Menu

#125 Map <Button-4/5> to <MouseWheel> on UNIX

open-remind
5
2004-12-13
2003-02-06
Neil Madden
No

Currently on UNIX, mousewheel events are mapped to
mouse buttons 4 and 5. On Windows, there is a separate
<MouseWheel> event. I understand that historically,
buttons 4 and 5 are used on UNIX, but in the interests
of hiding platform-specific details, it would useful to
be able to portably register interest in mousewheel
events, without having to work out how those are
conveyed on a particular platform.
To this end, I propose adding a simple mapping to Tks
script library so that button 4/5 events also generate
an appropriate <MouseWheel> event. This can be done
easily in two lines of code:

bind all <Button-4> {event generate %W <MouseWheel>
-delta 1}
bind all <Button-5> {event generate %W <MouseWheel>
-delta -1}

This seems to get things working on my Linux box. I
haven't looked at the delta values on Windows, so they
may need some tweaking (finding a suitable default
value, and working out whether up is negative or positive).
I think this is a small change, but one which does
quite a lot in hiding platform specific details, in a
backwards-compatible way.

Discussion

  • Chris Waters

    Chris Waters - 2003-03-09

    Logged In: YES
    user_id=25775

    According to a fellow Debian developer, there's a way to ask
    X which buttons control ZAxisMapping. (He also informs me
    that it's not always 4/5; some people use 6/7.) I'll try to
    get more details, maybe even see if I can whip up a proper
    patch.

     
  • Donal K. Fellows

    • status: open --> open-remind
     
  • Tom Goddard

    Tom Goddard - 2010-01-13

    The MouseWheel binding doing nothing on X11 platforms has caused us headaches in our Windows/Mac/Linux molecular visualization program UCSF Chimera. It is one of too many cases where we have to special-case the Tk code depending on operating system. We'd love to see this fixed.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.