bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mouse wheel support in Emacs 21.3.50


From: Jason Rumney
Subject: Re: mouse wheel support in Emacs 21.3.50
Date: Sun, 24 Oct 2004 23:02:26 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt)

"Drew Adams" <drew.adams@oracle.com> writes:

> 1. Bug?: Searching Elisp Info for "wheel" shows nothing that is current. It
> shows the same stuff as for Emacs 20 ("mouse-wheel"...). Yet, looking at
> real mouse wheel events, I see stuff like wheel-up that is not in Info, and
> I don't see "mouse-wheel" in real events.

I have updated the elisp manual to reflect the current implementation.

The rationale behind it was to separate out the wheel-up and
wheel-down events to make it easier for end users to rebind them (the
single mouse-wheel event was unusual in that you had to look at the
DELTA parameter to see if it was positive or negative, most mouse and
keyboard events are simpler). It also allowed us to reuse the mwheel
implementation, which had some extra features that the previous
Windows-only support did not have.

> 3. I'd like to know how to interpret the components of the various mouse
> events. In Emacs 20 this was simple; there was just the POSITION and the
> DELTA. Now I see lots of components (with no Elisp Info)

There is only POSITION (which like in the old mouse-wheel event is a list).

> In particular, if I call read-event and get mouse wheel events, where
> can I get the DELTA info that used to be there?

That is where the double- and triple- modifiers come in, for
compatibility with the mouse-4 and mouse-5 way of handling the mouse
wheel.

> Actually, I can pretty much see what's going on in mwheel-scroll, in terms
> of getting the DELTA info (amount), but before I base new code on what
> happens in (this 2002) mwheel-scroll code, I wonder if this is a good model;
> that is, if this deals with the latest event structure and is the
> recommended (i.e. current) way to go about things.

I can't see this changing unless X gets proper mouse wheel support
instead of emulating mouse-4 and -5. Unfortunately I think too many
X applications now have mouse-4 and -5 hardcoded for that to change.
One thing that could change is that mouse-4 and mouse-5 could be
translated to wheel-up and wheel-down internally by Emacs, but because
they come to Emacs as mouse button events, wheel-up and wheel-down
will not be able to change I think (eg reintroducing DELTA).

> And the whole treatment of the wheel as buttons 4 & 5 is not clear
> to me.

That is specific to X. On Windows and Mac, wheel-up and wheel-down are
used. If you want to write portable code, use mouse-wheel-up-event and
mouse-wheel-down-event to determine what events you should be dealing
with.

> And what if (as I do) I have 5 mouse buttons and a wheel?

If you are on Windows or Mac, no problem, since the wheel has its own
events. If you're on X, you'll have to map them to mouse-6 and mouse-7
or other applications will become confused (Emacs can be made to
handle them as -4 and -5, with the wheel as -6 and -7, but other
applications are not so flexible).

> 5. Finally, although I have little real hope for this, are there any
> guidelines for trying to make code that deals with making the mouse wheel
> work in both Emacs 20 and 21?

Since Emacs 20 had different mouse wheel handling for different
platforms, such guidelines would be quite complex, as would your code
for handling the differences.

I've never heard of anyone using the mouse wheel in Emacs for anything
other than its default scrolling behaviour, so I'm not sure there is
any demand for such a guide.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]