[tk9] Improve touchpad scrolling on Mac#1861
Conversation
|
Looks good - i.e. has no effect on Windows. |
|
For benefit of this thread, since I only said it in Slack: this isn't quite right yet. I'm going to mark it as a draft and keep tinkering with it. |
|
Mentioned in Slack, but not here - I updated this and now it is working well for me. Removing draft status. |
Use an accumulator and flush periodically rather than responding to every single event. This is performing better for me than previously. If this needs tuning, we can also use a divisor to modify things (by dividing the result of to_signed_16() before accumulating into pending_x, pending_y). Suggested values to try might be 2.0, 1.5, 1.25. But I find that it scrolls pretty well without a divisor at all.
b14f922 to
b43bc46
Compare
srjfoo
left a comment
There was a problem hiding this comment.
Some work still needed to get parity between Tk8 and Tk9.
Tk8: mouse and trackpad scrolling work just fine for me. No choppiness. If the main window is in the background, scrolling works fine over scrollbar and main text, but not over line numbers; with the main window in the foreground; scrolling works fine even over line numbers.
Tk9: The above is true for the mouse, but not for the trackpad. That is, everything is okay except scrolling when hovering over line numbers with the trackpad.
Opened #1866 for that. |
In Tk9, on Mac at least, scrolling with the touchpad only emits the
<TouchpadScroll>event, which we did not bind. This PR binds the event to correct the misbehaving scroll speed I observed previously.The
<MouseWheel>event handling was not touched, and should function exactly as before. I did limited testing of a mouse-wheel and it seemed to scroll fine.Testing notes: just try to scroll the text area with a mouse-wheel (if you have one) and with a Mac touchpad (if you have one). The mouse-wheel should behave exactly as before. The trackpad should scroll as most Mac apps do; if you scroll slowly, it does too, if you flick your finger it will go faster.
Test on python.org v3.14.5.