Repository navigation
Fix mouse-wheel scroll-up on Tk 9 - #76
Merged
Merged
Conversation
Tk 9 delivers <MouseWheel> on X11 with a +/-120 delta and reports the unused button substitution as the string "??", which is truthy. The old handler took the button branch for any truthy num, then treated "??" as Button-5, so every notch scrolled down and scrolling up was impossible in the packaged (Tk 9) builds. Decode the delta first and only honour num when it is truly 4 or 5, and use a finer wheel step for smoother scrolling. Add regression tests covering the Tk 9 "??" num for scroll up, scroll down, prev-page navigation, and the ignored event case.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Drive a genuine <MouseWheel> event through Tk (num resolves to the string "??" under Tk 9) so the scroll direction is exercised the way the packaged app really receives it, not just via a mocked num=0.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Mouse-wheel scroll up did nothing and every notch scrolled/advanced down, in the packaged builds. Logs from a real run show it:
Tk 9 delivers
<MouseWheel>on X11 with a+/-120deltaand reports the unused button substitution as the string"??". The old handler was:So every notch decoded as scroll-down; scroll-up was unreachable. Tk 8.6 delivered
<Button-4>/<Button-5>with a real intnum, which is why source builds worked and packaged (Tk 9) builds did not.Fix
_wheel_direction()readsdeltafirst and only treatsnumas a button when it is actually4or5._wheel_step()uses a finer step (1/10 of the canvas height, min 40px) so the wheel is smoother than the arrow-key step.Testing
num="??"for scroll-up, scroll-down, prev-page navigation, plus the ignored-event case.bash scripts/lint.shclean;xvfb-run pytest: 562 passed, coverage 96.38%.