eserte / perl-tk

the perl module Tk
https://metacpan.org/release/Tk
Other
44 stars 31 forks source link

scrolling improvements for aqua #35

Closed chrstphrchvz closed 5 years ago

chrstphrchvz commented 6 years ago

Here are two separate commits for supporting scrolling on macOS aqua (cf. #24). These were tested with Tcl::pTk, so I'm assuming they'll be applicable to Perl/Tk.

  1. Use the correct scaling factor for MouseWheel event units; see https://rt.cpan.org/Ticket/Display.html?id=125048. Adapted from http://wiki.tcl.tk/3893:

Kevin Walzer On OS X/Aqua the correct mousewheel binding would be:

bind .t.c <MouseWheel> {%W yview scroll [expr {- (%D)}] units}
  1. Mouse buttons 4 and 5 being used for scrolling is specific to X11, i.e. not all Unix windowingsystems do this (e.g. aqua does not). So instead of assuming X11 by checking $Tk::Platform, check windowingsystem eq 'x11' instead. This prevents the issue of someone's many-buttoned mouse from causing scroll events on aqua. This also matches the usage in https://core.tcl.tk/tips/doc/trunk/tip/171.md
chrstphrchvz commented 5 years ago

I am considering revising this to support horizontal scrolling as well, so for now I will close this and put any non-aqua changes I think are ready in another PR.