Background
I have the following AHK script (obtained from https://medium.com/@dakshin.k1/enable-3-finger-gesture-for-click-and-drag-on-windows-and-linux-cd7165b66851):
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
; Enable three-finger drag
drag_enabled := 0
+^#F22::
if (drag_enabled) {
Click up
drag_enabled := 0
} else {
drag_enabled := 1
Click down
}
return
LButton::
if (drag_enabled) {
Click up
drag_enabled := 0
} else {
click
}
return
This is supposed to enable Mac-style three-finger dragging on any Windows 10 laptop's touchpad, but with the following three steps required:
- Perform a three-finger tap.
- Move the mouse pointer to wherever you'd like. If dragging a window, the window should (and does) follow the cursor as you move it. If selecting text, you should see the text being highlighted like you'd expect and even two-finger scrolling should work (and does)!
- Perform a single-finger tap to complete the simulated gesture.
The problem
I am absolutely gobsmacked that AHK is capable of all of this, so it doesn't come as a surprise that it doesn't quite work as well as I'd hoped. After an indeterminable amount of time, I can no longer click/tap with my touchpad normally.
My questions
- What does
+^#F22
actually do? The docs and my limited knowledge of AHK seem to imply that it would set upShift+Ctrl+Win+Whatever F22 means
as a hotkey that enables step 1. above. But does it also enable step 2? If not... - How is AHK able to track the mouse pointer, keeping the drag action going while any amount of finger removals from, and re-contacts with, the touchpad are possible? What Win32 API functions are being called by which lines of the script?
- How can I fix the touchpad clicking problem (I have a feeling that the answer is "you can't", but please prove me wrong)?
I have spent about 2 hours on this already, reading the docs and trying to refamiliarise myself with AHK in general, because it's been an age since I last used it (and even then, I never did anything half as advanced as this)!