Skip to content

[tk9] Improve touchpad scrolling on Mac#1861

Merged
windymilla merged 2 commits into
DistributedProofreaders:masterfrom
tangledhelix:tk9-scrolling
May 26, 2026
Merged

[tk9] Improve touchpad scrolling on Mac#1861
windymilla merged 2 commits into
DistributedProofreaders:masterfrom
tangledhelix:tk9-scrolling

Conversation

@tangledhelix
Copy link
Copy Markdown
Member

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.

@tangledhelix tangledhelix requested review from srjfoo and windymilla May 24, 2026 02:21
@tangledhelix tangledhelix added the bug Something isn't working label May 24, 2026
@windymilla
Copy link
Copy Markdown
Collaborator

Looks good - i.e. has no effect on Windows.

@tangledhelix
Copy link
Copy Markdown
Member Author

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.

@tangledhelix tangledhelix marked this pull request as draft May 24, 2026 17:10
@tangledhelix
Copy link
Copy Markdown
Member Author

Mentioned in Slack, but not here - I updated this and now it is working well for me. Removing draft status.

@tangledhelix tangledhelix marked this pull request as ready for review May 25, 2026 16:50
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.
Copy link
Copy Markdown
Member

@srjfoo srjfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tangledhelix
Copy link
Copy Markdown
Member Author

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.

@tangledhelix tangledhelix removed the tk9 label May 26, 2026
@tangledhelix tangledhelix changed the title Improve touchpad scrolling on Mac for Tk 9 [tk9] Improve touchpad scrolling on Mac May 26, 2026
@windymilla windymilla merged commit 39d253b into DistributedProofreaders:master May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants