unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Toolkit scroll bar emulation in Carbon Emacs
@ 2005-05-05  6:56 YAMAMOTO Mitsuharu
  2005-05-06  8:34 ` YAMAMOTO Mitsuharu
  2005-05-07  5:18 ` YAMAMOTO Mitsuharu
  0 siblings, 2 replies; 4+ messages in thread
From: YAMAMOTO Mitsuharu @ 2005-05-05  6:56 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1582 bytes --]

I guess many users feel frustration about scroll bar behavior on
Carbon Emacs.  I'm not familiar with scroll bar issues in general so
much, or the attached patch is not perfect, but I hope that it would
become a first step to solve such issues.

With the attached patch, Carbon Emacs generates Lisp-level events as
it were using X toolkit scroll bars.  So the scroll bar handlers at
the Lisp level can be used as they are.  Now auto-repeat works, and
changing the pressed part (e.g., pressing the up arrow and then moving
to the down arrow without releasing the mouse button) also works.

Why "emulation"?  Because the standard way of scroll bar event
handling on Mac is not compatible with that in Emacs: The former
requires us to block until a mouse button is released (one can do some
work such as redisplay through a callback, but it can't be used for
Lisp evaluation).  Multi-threading may be useful for some of the
problems, but that requires major changes.

As I said, the patch is still not perfect.  For example, you'll see
only a part of screen is updated when scrolling on slower machines if
redisplay-dont-pause is nil.  This problem is related to the following
issue, which was about mouse movement events, but scroll bar click
events this time.

  http://lists.gnu.org/archive/html/emacs-devel/2005-01/msg00240.html

Despite such a problem, I think this patch is a good point to
(re)start.

The patch includes a change to configure.in, so please make sure to
regenerate the configure script and rerun it.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

[-- Attachment #2: diff-scrollbar.gz --]
[-- Type: application/octet-stream, Size: 6644 bytes --]

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Toolkit scroll bar emulation in Carbon Emacs
  2005-05-05  6:56 Toolkit scroll bar emulation in Carbon Emacs YAMAMOTO Mitsuharu
@ 2005-05-06  8:34 ` YAMAMOTO Mitsuharu
  2005-05-07  5:18 ` YAMAMOTO Mitsuharu
  1 sibling, 0 replies; 4+ messages in thread
From: YAMAMOTO Mitsuharu @ 2005-05-06  8:34 UTC (permalink / raw)


>>>>> On Thu, 05 May 2005 15:56:58 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:

> With the attached patch, Carbon Emacs generates Lisp-level events as
> it were using X toolkit scroll bars.  So the scroll bar handlers at
> the Lisp level can be used as they are.  Now auto-repeat works, and
> changing the pressed part (e.g., pressing the up arrow and then
> moving to the down arrow without releasing the mouse button) also
> works.

I've installed the patch (with some modifications) except the change
to configure.in.  So the default configuration does not change the
scroll bar behavior.  One can test the new toolkit scroll bar
emulation by specifying -DUSE_TOOLKIT_SCROLL_BARS manually.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Toolkit scroll bar emulation in Carbon Emacs
@ 2005-05-06 20:41 David Reitter
  0 siblings, 0 replies; 4+ messages in thread
From: David Reitter @ 2005-05-06 20:41 UTC (permalink / raw)


YAMAMOTO Mitsuharu writes:

 > With the attached patch, Carbon Emacs generates Lisp-level events as
 > it were using X toolkit scroll bars.  So the scroll bar handlers at
 > the Lisp level can be used as they are.  Now auto-repeat works, and
 > changing the pressed part (e.g., pressing the up arrow and then moving
 > to the down arrow without releasing the mouse button) also works.

Thank you very very much for working on this.

So I've tried out your patch and I have to say, I'm impressed. The new 
behavior is pretty much perfect.
I even find the overscrolling behavior and the resizing of the 
scrollbar at the end of a buffer very
tolerable - it's not resizing erratically, and most importantly, it 
doesn't jump when you grab the
scrollbar.

I can confirm, the screen updates lag behind a bit on my 2002 Powerbook.

There is no method to not display the point in the visible area? I'd 
like to scroll somewhere else in the
buffer (and I do that quite often) and then jump back, and I know a lot 
of other people are used to that,
too. Such a setting would, of course, preserve the region when 
scrolling.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Toolkit scroll bar emulation in Carbon Emacs
  2005-05-05  6:56 Toolkit scroll bar emulation in Carbon Emacs YAMAMOTO Mitsuharu
  2005-05-06  8:34 ` YAMAMOTO Mitsuharu
@ 2005-05-07  5:18 ` YAMAMOTO Mitsuharu
  1 sibling, 0 replies; 4+ messages in thread
From: YAMAMOTO Mitsuharu @ 2005-05-07  5:18 UTC (permalink / raw)


>>>>> On Thu, 05 May 2005 15:56:58 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:

> For example, you'll see only a part of screen is updated when
> scrolling on slower machines if redisplay-dont-pause is nil.  This
> problem is related to the following issue, which was about mouse
> movement events, but scroll bar click events this time.

>   http://lists.gnu.org/archive/html/emacs-devel/2005-01/msg00240.html

How about the following patch?  It regards toolkit scroll bar thumb
drags as "squeezable" as well as mouse movements, and prevent
redisplay from being paused by these kinds of events.  Currently, only
thumb drags are delayed, but auto-repeats on other scroll bar parts do
pause redisplay as in the usual auto-repeats on keys.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

Index: src/keyboard.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v
retrieving revision 1.822
diff -c -r1.822 keyboard.c
*** src/keyboard.c	2 May 2005 10:32:40 -0000	1.822
--- src/keyboard.c	7 May 2005 04:54:16 -0000
***************
*** 3531,3539 ****
       READABLE_EVENTS_FILTER_EVENTS is set, report it as empty.  */
    if (kbd_fetch_ptr != kbd_store_ptr)
      {
!       int have_live_event = 1;
! 
!       if (flags & READABLE_EVENTS_FILTER_EVENTS)
          {
            struct input_event *event;
  
--- 3531,3541 ----
       READABLE_EVENTS_FILTER_EVENTS is set, report it as empty.  */
    if (kbd_fetch_ptr != kbd_store_ptr)
      {
!       if (flags & (READABLE_EVENTS_FILTER_EVENTS
! #ifdef USE_TOOLKIT_SCROLL_BARS
! 		   | READABLE_EVENTS_IGNORE_SQUEEZABLES
! #endif
! 		   ))
          {
            struct input_event *event;
  
***************
*** 3541,3556 ****
                     ? kbd_fetch_ptr
                     : kbd_buffer);
  
!           while (have_live_event && event->kind == FOCUS_IN_EVENT)
!             {
!               event++;
                if (event == kbd_buffer + KBD_BUFFER_SIZE)
                  event = kbd_buffer;
!               if (event == kbd_store_ptr)
!                 have_live_event = 0;
!             }
          }
!       if (have_live_event) return 1;
      }
  
  #ifdef HAVE_MOUSE
--- 3543,3570 ----
                     ? kbd_fetch_ptr
                     : kbd_buffer);
  
! 	  do
! 	    {
! #ifdef USE_TOOLKIT_SCROLL_BARS
! 	      if (flags & READABLE_EVENTS_FILTER_EVENTS)
! #endif
! 		if (event->kind != FOCUS_IN_EVENT)
! 		  return 1;
! #ifdef USE_TOOLKIT_SCROLL_BARS
! 	      if (flags & READABLE_EVENTS_IGNORE_SQUEEZABLES)
! 		if (! (event->kind == SCROLL_BAR_CLICK_EVENT
! 		       && event->part == scroll_bar_handle
! 		       && event->modifiers == 0))
! 		  return 1;
! #endif
! 	      event++;
                if (event == kbd_buffer + KBD_BUFFER_SIZE)
                  event = kbd_buffer;
! 	    }
! 	  while (event != kbd_store_ptr);
          }
!       else
! 	return 1;
      }
  
  #ifdef HAVE_MOUSE
***************
*** 6545,6551 ****
     If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal
     events (FOCUS_IN_EVENT).
     If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
!    movements. */
  
  static void
  get_input_pending (addr, flags)
--- 6559,6565 ----
     If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal
     events (FOCUS_IN_EVENT).
     If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
!    movements and toolkit scroll bar thumb drags. */
  
  static void
  get_input_pending (addr, flags)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-07  5:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-05  6:56 Toolkit scroll bar emulation in Carbon Emacs YAMAMOTO Mitsuharu
2005-05-06  8:34 ` YAMAMOTO Mitsuharu
2005-05-07  5:18 ` YAMAMOTO Mitsuharu
  -- strict thread matches above, loose matches on Subject: below --
2005-05-06 20:41 David Reitter

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).