Project Mouse Tailor
tomhorsley.com
tomhorsley.com
"Drag Lock" is a feature when you can "lock" onto a screen object (window, icon etc), so that it can be dragged without having to hold down a mouse button.
The op is doing this in hardware due to many Linux Distros changing from X11 to Wayland.
From the linked library, it looks like you could setup this logic, but it is pretty complex. But I think you could do it with a combination of the set and if_eq macros.
But it’s pretty cool to see how you could also accomplish this and fake out the computer using a bit of hardware hacking. (I know, it software running on a teensy, but still…)
If you go further and expand input remapping to also inclue macros you'll also soon find the need to send input directly to a window. There are also many cases where a simple remap won't do since there isn't a single "originating" input event (like remapping joystick movement to WASD or faking inputs from non-input device events). This makes any such API fairly complex and you'd have to be implementing something like it in the compositor/window manager/DE anyways, so why bother also doing it at the input layer?
Where Wayland went wrong is ignoring these use cases and putting the burden of making APIs for them on compositors, which of course couldn't agree on anything, so now we have nothing. Evdev works at a very low level, so many things aren't possible, libinput doesn't expose its APIs externally anyways and the only compositor with even rudimentary input mapping support is KWin and that barely works.