Sunday, February 18, 2024

Disable Windows double-finger-click

My new work laptop did not have dedicated buttons, and by default Windows set it up so that a two-finger tap or click on the touchpad would trigger a right-button click. I turned on the non-default setting that lets me click in the lower-right part of the touchpad to get a right button click, and turned off the two-finger tap options. There is no way to turn off the option for generating a right-button click with a two-finger click. 

This might seem quite innocent, but I kept on getting fake right-button clicks instead of left-button clicks when clicking the touchpad. I changed the registry settings to make the right-click area really small. It didn't solve the problem. Finally, I figured out what was going on: I click the touchpad with the side of my right thumb. This seems to result in the touchpad occasionally registering the tip and joint of my right thumb as separate contacts. The bad right-clicks were driving me crazy. I searched through registry and Windows .sys and .dll files for some hidden option to turn off the two-finger click for right-button clicks, finding nothing. Nothing. I tried to install some older proprietary touchpad driver, but none of them worked.

Finally, it was time to write some code to disable the bad right clicks. After a bunch of hiccups (I almost never write code that interacts with the Windows API), and a Python-based prototype, I wrote a little C program. Just set disable-two-finger-right-click.exe to run as Administrator in Task Scheduler on login, and it takes care of it. The code uses rawinput to get the touchpad HID report, uses the HidP-* functions to parse it, and registers a low level mouse hook to remap the bad right clicks to left clicks based on some heuristics (mainly based around how long ago there was a two-finger click before the right click, while ignoring the official right-click area of the touchpad). 

So many hours that would have been saved if Microsoft just added an extra option.

No comments:

Post a Comment