JitouchApp / Jitouch

A multi-touch extension for MacBook, Magic Mouse, and Magic Trackpad
GNU General Public License v3.0
390 stars 28 forks source link

Left click on the magic mouse occasionally stops working #56

Open katzelad opened 1 year ago

katzelad commented 1 year ago

About once every couple of hours the left click of the magic mouse stops working until I perform a left click on the trackpad.

2023-01-11 10:59:42.853 Jitouch[13225:4794400] Suppressed MouseDown with 2 fingers d=0.285989 t=0.020944

After clicking the trackpad, MouseDown is no longer suppressed and left clicking is enabled.

Thanks

aaronkollasch commented 1 year ago

The t=0.020944 suggests that the trackpadCallback has been called very shortly before your click. The d=0.285989 suggests that the trackpadCallback was called with two fingers present at that distance. This is the only place that lastTwoFingerDate is set. https://github.com/JitouchApp/Jitouch/blob/f8e8d6713f6c71c0af037feb6406bb990c47d5c7/jitouch/Jitouch/Gesture.m#L2005-L2022

Then lastTwoFingerDate is checked in the CGEventCallback: https://github.com/JitouchApp/Jitouch/blob/f8e8d6713f6c71c0af037feb6406bb990c47d5c7/jitouch/Jitouch/Gesture.m#L2934-L2939

When you see this issue, did you have a hand on or near the trackpad at the time? (It may be hovering as the trackpad can detect fingers close to but not touching the surface)

katzelad commented 1 year ago

@aaronkollasch Yes, this was the problem - my palm was resting close to the trackpad :) But when disabling Jitouch my palm doesn't interfere with the mouse left click (it also never happened when CGEventTap didn't work). Is it possible something about the detector which enables the click gestures interferes with palm detection?

aaronkollasch commented 1 year ago

Some gestures like "One-Fix One-Tap" usually result in an unexpected click being sent, so Jitouch has to intercept those clicks and suppress them. The way Jitouch does this is it disables left clicks if it detects more than one finger on the touchpad within a certain distance. However, I should try moving that logic after Jitouch's built-in palm rejection. There's also potential for improving Jitouch's palm rejection, tracked in issue #44.

katzelad commented 1 year ago

@aaronkollasch Is it possible to suppress only trackpad clicks? It should be possible to tell them apart from mouse clicks by checking if there is a finger on the mouse during the click. Palm rejection also sounds great :)

aaronkollasch commented 1 year ago

It's tricky because I don't think CGEventCallback knows which device sent the click, and if it does I don't think it would use the same IDs as the Multitouch API. What you suggest, allowing clicks if a magic mouse has a finger down at the time, is possible, but it would mean additional complexity so I'm not sure it's the right route.

When you see the issue, what part of the touchpad are you touching?

katzelad commented 1 year ago

The top-left part (fingers on the keyboard, thumb on or above the trackpad).