From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Steven Tamm Newsgroups: gmane.emacs.devel Subject: Mac emacs scroll bars Date: Thu, 8 Jul 2004 09:05:31 -0700 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <7627C10A-CF84-11D8-8F92-00050260B859@duke.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1089302779 26522 80.91.224.253 (8 Jul 2004 16:06:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 8 Jul 2004 16:06:19 +0000 (UTC) Cc: emacs-devel Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Jul 08 18:06:12 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BibPY-0003TD-00 for ; Thu, 08 Jul 2004 18:06:12 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BibPX-00045c-00 for ; Thu, 08 Jul 2004 18:06:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BibRf-000854-GW for emacs-devel@quimby.gnus.org; Thu, 08 Jul 2004 12:08:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BibRP-000838-JI for emacs-devel@gnu.org; Thu, 08 Jul 2004 12:08:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BibRN-00082k-Q0 for emacs-devel@gnu.org; Thu, 08 Jul 2004 12:08:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BibRN-00082Z-M3 for emacs-devel@gnu.org; Thu, 08 Jul 2004 12:08:05 -0400 Original-Received: from [17.250.248.88] (helo=smtpout.mac.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BibP0-0005ur-8L for emacs-devel@gnu.org; Thu, 08 Jul 2004 12:05:38 -0400 Original-Received: from mac.com (smtpin02-en2 [10.13.10.147]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id i68G5Y9L026493; Thu, 8 Jul 2004 09:05:35 -0700 (PDT) Original-Received: from [10.0.1.201] (c-24-5-11-73.client.comcast.net [24.5.11.73]) (authenticated bits=0) by mac.com (Xserve/smtpin02/MantshX 4.0) with ESMTP id i68G5YZt011594; Thu, 8 Jul 2004 09:05:34 -0700 (PDT) In-Reply-To: Original-To: Martin Otte , YAMAMOTO Mitsuharu X-Mailer: Apple Mail (2.618) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25542 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25542 >> I have been trying to get the scrollbar to continuously scroll if >> for example I hold down the mouse button on the up or down arrows, >> but so far I have failed since I am a novice with the emacs source >> code. > My guess is that it can be done in Lisp-level using track-mouse and > sit-for. But it would not be so easy, judging from complicated codes > in mouse.el. I'm not sure one can do it at the lisp level. The particular problem is that holding down the mouse button doesn't generate the same kind of events on the mac that holding down a key would (i.e. autorepeat events). Because of the event model, read-event hangs until you move the mouse. So the following code: (defun mac-scroll-down-line () (track-mouse (let* ((done nil)) (while (not done) (scroll-down 1) (setq done (memq (car-safe (read-event)) '(mouse-1 double-mouse-1 triple-mouse-1 drag-mouse-1))) )))) does what you'd want if you move the mouse around... But read-event wouldn't do the right thing. So it appears that there would have to be a new C function added that would call the new Carbon function GetCurrentEventButtonState (or Button on MAC_OS) so that "mouse-down" could be "tested" from the lisp code. Then the code would look something like this (defun mac-scroll-down-line () (track-mouse (let* ((done nil)) (while (not done) (scroll-down 1) (sit-for mouse-delay) ;; possibily have initial and subsequent delays (setq done (mac-is-button-down))) (mac-scroll-ignore-events)))) I added mac-scroll-ignore-events today to CVS. This would be more Mac like, but have the annoying problem of having a 1/4 second delay after you let go of the mouse. Perhaps the better solution would be to make a version of (read-event) that would produce null events? >> I have included a very small patch to keyboard.c to disable emacs >> from interpreting double and triple clicking in the scrollbar. This >> makes it much easier for me to use the scrollbar. I am sending you >> the patch because I see that you have been contributing heavily to >> the development of emacs, and I'm not sure where else to send the >> patch. Please examine and/or try the patch and if you feel that it >> is useful, feel free to submit the patch. > > Maybe similar thing can alternatively be done with > > (defun mac-scroll-down () > (track-mouse > (while (not (meeq (car-safe (read-event)) > '(mouse-1 double-mouse-1 triple-mouse-1))) nil) > (scroll-down))) > > (Likewise for mac-scroll-down-line, mac-scroll-up, and > mac-scroll-up-line in term/mac-win.el.) > > Although both of them are not complete (e.g., drag within non-handle > scrollbar area), they are better than before. I checked in a change similar to this. I forgot to add drag-mouse-1 to the list of ignorable events, though. -Steven