pynput icon indicating copy to clipboard operation
pynput copied to clipboard

Change OSX on_scroll event for trackpad

Open ArtemKrin opened this issue 5 years ago • 2 comments

Hello! Want to purpose allow to get finest trackpad on_scroll event on Mac OSX (pointed in pixel) before event got (dx,dy)=(0,0) for small finger moving.

ArtemKrin avatar Dec 27 '19 20:12 ArtemKrin

Thank you for your contribution!

From the documentation:

Key to access an integer field that contains pixel-based scrolling data. The scrolling data represents the change in horizontal position since the last scrolling event from a Mighty Mouse scroller.

Does this mean that this is limited to work on a specific set of hardware, or is that just Apple speak for a generic mouse will scroll wheel?

I recently merged a PR that corrected scrolling for the controller by forcing deltas to be integers. That is because CGEventCreateScrollWheelEvent used to generate fake events works with discrete number of pixels, and thus cannot handle fractional values. Do you know of a way to work around this to enable your resolution improvements to be reusable by the controller?

moses-palmer avatar Feb 17 '20 15:02 moses-palmer

Confirmed working for me on standard built-in trackpad.

To clarify, the returned values for dy/dx remain integers, not fractions. The only difference with this PR is that slow scrolling produces non-zero values for dy/dx, whereas before there were lots of zero values, thus rendering those events useless.

Thank you @moses-palmer for the excellent library, and @ArtemKrin for the improvement!

abrichr avatar Nov 08 '22 17:11 abrichr