jordansissel / xdotool

fake keyboard/mouse input, window management, and more
Other
3.27k stars 321 forks source link

Use XTEST instead of XWarpPointer with a single screen #435

Closed ofourdan closed 1 month ago

ofourdan commented 1 year ago

xdotool uses the XTEST extension for pretty much all input events emulation except for mousemove.

For mousemove, it uses XWarpPointer() instead, to work around an old bug from 2009 that would ignore the screen number in Zaphod mode.

Unfortunately, that prevents mousemove to work in Xwayland with libEI because Xwayland wires XTEST to libEI, whereas xdotool uses the core protocol for that command alone.

Zaphod mode is nowadays somehow deprecated, GNOME and GTK have dropped support for it and Xwayland supports only one X11 screen (not to be confused with multi-monitors), so this workaround in xdotool actually causes more harm that good in most current cases nowadays.

So, to preserve compatibility with Zaphod mode while being compatible with modern windowing systems, this fix limits the workaround that uses XWarpPointer() for when there is more than one screen, and uses the XTEST extension otherwise.

jordansissel commented 1 month ago

@ofourdan I like the way you solved this while keeping compatibility for the ancient bug workaround. Nice work. :)

jordansissel commented 1 month ago

This was an easy PR to review thanks to the great detail you provided. 👍