Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 130109
Status: open
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: pc+dev [...] asdf.org
Cc: CAC [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: scrollwheel doesn't work for horizontal scrollbars
Date: Fri, 19 Jul 2019 19:51:42 +0300
To: bug-Tk [...] rt.cpan.org
From: Phil Carmody <pc+dev [...] asdf.org>
https://metacpan.org/source/SREZIC/Tk-804.034/Scrollbar/Scrollbar.pm In ClassInit, this bit of code: # X11 mousewheel - honour for horizontal too. $mw->bind($class, '<4>', ['ScrlByUnits','hv',-5]); $mw->bind($class, '<5>', ['ScrlByUnits','hv', 5]); Is followed shortly by this bit of code: $mw->bind($class, '<4>', ['ScrlByUnits','v',-3]); $mw->bind($class, '<5>', ['ScrlByUnits','v', 3]); The comment implies that the intention was to support wheel actions on horizontal scrollbars, but the second set of lines disable that. I've not checked the git history for the order of arrival of those lines, or the reasons behind them, but one of them must be wrong. Personal preference is that the guy who wrote the comment was right, and therefore that the latter lines should be nuked. Cheers, Phil -- We are no longer hunters and nomads. No longer awed and frightened, as we have gained some understanding of the world in which we live. As such, we can cast aside childish remnants from the dawn of our civilization. -- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/
I've also noticed instances of bindings being created and then overwritten. However, given how long any behaviors have been present, I wonder if the preference has been to keep existing/de-facto behaviors unless they are exceptionally buggy.

Looking at
 https://github.com/eserte/perl-tk/blame/37be920519a128afddd49d473654174e497fbcc1/Scrollbar/Scrollbar.pm#L68 , the first pair of bindings were added in Tk 804.0_24, and the second pair were "added" by Tk 800.025 (it looks as if an older version of Perl/Tk might have been committed on top of a newer one).

Removing the second pair of bindings does allow the scrollbars to be operated with the mousewheel (<4> and <5> in X11). However, the upstream Tcl/Tk behavior (as of 8.5.15, see scrlbar.tcl) is that horizontal scrollbars are scrolled in X11 using <Shift-4> and <Shift-5>, not <4> or <5>. (For windowing systems aqua and win32, which use <MouseWheel>, horizontal scrollbars only respond to horizontal scrolling or shift+vertical scrolling, not vertical scrolling alone.) So maybe Perl/Tk should follow that instead, by removing the second set of bindings, and replacing the first set of bindings with:


 $mw->bind($class, '<Shift-4>',       ['ScrlByUnits','hv',-5]);
 $mw->bind($class, '<Shift-5>',       ['ScrlByUnits','hv', 5]);
 $mw->bind($class, '<Button-6>',      ['ScrlByUnits','hv',-5]);
 $mw->bind($class, '<Button-7>',      ['ScrlByUnits','hv', 5]);
 

Subject: Re: [rt.cpan.org #130109] scrollwheel doesn't work for horizontal scrollbars
Date: Sun, 21 Jul 2019 12:53:32 +0300
To: Christopher Alexander Chavez via RT <bug-Tk [...] rt.cpan.org>
From: Phil Carmody <pc+dev [...] asdf.org>
Thanks for your quick reply! Yeah, I found the git blame page, and was a little perturbed by the signal-to-noise ratio in the two linked-to megapatches, little can be really learnt from them except which came first. Show quoted text
> So maybe Perl/Tk should follow that instead, by removing the second set > of bindings, and replacing the first set of bindings with:
The principle of least surprise is probably the strongest argument. So on the presumption that these are the approprate event names: + $mw->bind($class, '<Shift-4>', ['ScrlByUnits','hv',-5]); + $mw->bind($class, '<Shift-5>', ['ScrlByUnits','hv', 5]); + $mw->bind($class, '<Button-6>', ['ScrlByUnits','hv',-5]); + $mw->bind($class, '<Button-7>', ['ScrlByUnits','hv', 5]); Acked-by: Phil Carmody <pc+dev@asdf.org> (In particular the use of 5 rather than 3, it was the slowness of scrolling that made me look at the source in the first place, I wanted to know if it was changeable!) Cheers, Phil -- We are no longer hunters and nomads. No longer awed and frightened, as we have gained some understanding of the world in which we live. As such, we can cast aside childish remnants from the dawn of our civilization. -- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/
On Sun Jul 21 04:53:50 2019, pc+dev@asdf.org wrote:
Show quoted text
> The principle of least surprise is probably the strongest argument.
> So on the presumption that these are the approprate event names:
>
> + $mw->bind($class, '<Shift-4>', ['ScrlByUnits','hv',-5]);
Show quoted text
> + $mw->bind($class, '<Shift-5>', ['ScrlByUnits','hv', 5]);
> + $mw->bind($class, '<Button-6>', ['ScrlByUnits','hv',-5]);
> + $mw->bind($class, '<Button-7>', ['ScrlByUnits','hv', 5]);

>
Show quoted text
> Acked-by: Phil Carmody <pc+dev@asdf.org>

I have opened a pull request with this change: https://github.com/eserte/perl-tk/pull/59


> (In particular the use of 5 rather than 3, it was the slowness of
Show quoted text
> scrolling that made me look at the source in the first place, I wanted
> to know if it was changeable!)

I actually hadn't noticed the amounts were different, but 5 also happens to be the amount used by upstream Tcl/Tk, which I guess is a plus.