#10202·deskflow

X11 client leaves synthetic mouse buttons latched when the connection drops mid-click (suspend/lid close)

Author: Ken24TCreated Sep 27, 2026Updated Sep 27, 2026
Labelsx11

Sanity checks

  • I have done the sanity checks, and my issue persists.

I searched existing issues; the closest matches are #10146 (Wayland held-button tracking, fixed) and #8263 (sleep disconnects). I am running the Flathub stable 1.26.0; master still only releases keys on screen leave/disconnect and has no held-button tracking on X11 (analysis below), so I do not expect the continuous build to differ, but I am happy to test it.

Deskflow version info

Server (ARAGORN):

Deskflow: 1.26.0
Qt: 6.11.2
System: Linux Mint 22.3 (Zena)
Session: X11 (Cinnamon)

Client (PIPIN):

Deskflow: 1.26.0
Qt: 6.11.2
System: Linux Mint 22.3 (Zena)
Session: X11 (Cinnamon)

Build types

  • Community package (Flathub Flatpak, org.deskflow.deskflow, stable branch)

Deskflow configuration

  • Linux Mint 22.3 / Cinnamon / X11 desktop "ARAGORN" is the server and holds the physical Logitech mouse and keyboard.
  • Linux Mint 22.3 / Cinnamon / X11 laptop "PIPIN" is the client, connected over Wi-Fi, positioned to the right of the server, single monitor each.
  • protocol = barrier, relativeMouseMoves = false, clipboard sharing on, no corner switching.

What steps will reproduce the problem?

  1. Start the server and connect the client.
  2. Move the shared pointer onto the client's screen.
  3. Press and hold the left mouse button. The pointer stays on the client, so the server injects a synthetic ButtonPress into the client via XTEST.
  4. While still holding the button, close the laptop lid so the client suspends and the Wi-Fi/Deskflow link drops. Release the mouse button only after the client is asleep.
  5. Open the lid and let the client resume and Deskflow reconnect.
  6. The client's X server still has button 1 down: xinput --query-state "Virtual core XTEST pointer" reports button[1]=down, and no physical device on the client holds it. In Cinnamon the pointer becomes the 4-way "move" cursor and every click is treated as a window-move drag, so nothing responds.
  7. Restarting the Deskflow client alone does not clear it (the state lives in the X server); only restarting X or rebooting the client does.

Expected: when the link to the server drops, the client should release any buttons it synthesised, leaving the pointer in a neutral state.

Log output

Show log

Sample from a watchdog on the client (timestamps AEST). "Virtual core XTEST pointer" is the client's synthetic input device; all physical devices are up throughout:

2026-09-28T07:58:18+1000 button 1 (left) PRESSED; Virtual core XTEST pointer=[1]; ...
2026-09-28T07:58:23+1000 WARNING button 1 held >5s; Virtual core XTEST pointer=[1]; ...
2026-09-28T07:59:34+1000 RESUME after ~60s sleep gap
2026-09-28T07:59:35+1000 state after resume: Virtual core XTEST pointer=[1]; ...
2026-09-28T07:59:35+1000 LATCH DETECTED button 1 (left): still held 0s after resume; Virtual core XTEST pointer=[1]; ...
2026-09-28T07:59:35+1000 injected ButtonRelease 1
2026-09-28T07:59:35+1000 button 1 (left) released after 77.14s

Full lines (with per-device state) from the actual run:

2026-09-28T07:58:18+1000 button 1 (left) PRESSED; Virtual core XTEST pointer=[1]; 2.4G Mouse=[]; 2.4G Mouse Consumer Control=[]; ELAN1200:00 04F3:30BA Mouse=[]; ELAN1200:00 04F3:30BA Touchpad=[]
2026-09-28T07:58:23+1000 WARNING button 1 held >5s; Virtual core XTEST pointer=[1]; 2.4G Mouse=[]; 2.4G Mouse Consumer Control=[]; ELAN1200:00 04F3:30BA Mouse=[]; ELAN1200:00 04F3:30BA Touchpad=[]
2026-09-28T07:59:34+1000 RESUME after ~60s sleep gap
2026-09-28T07:59:35+1000 state after resume: Virtual core XTEST pointer=[1]; 2.4G Mouse=[]; 2.4G Mouse Consumer Control=[]; ELAN1200:00 04F3:30BA Mouse=[]; ELAN1200:00 04F3:30BA Touchpad=[]
2026-09-28T07:59:35+1000 LATCH DETECTED button 1 (left): still held 0s after resume; Virtual core XTEST pointer=[1]; 2.4G Mouse=[]; 2.4G Mouse Consumer Control=[]; ELAN1200:00 04F3:30BA Mouse=[]; ELAN1200:00 04F3:30BA Touchpad=[]
2026-09-28T07:59:35+1000 injected ButtonRelease 1
2026-09-28T07:59:35+1000 button 1 (left) released after 77.14s

The watchdog's per-device state comes from xinput --query-state; at 07:59:35 that showed button[1]=down for the XTEST device and button[1]=up for every physical device.

Additional information

Likely cause. Fake input on the X11 client goes through XTEST: XWindowsScreen::fakeMouseButton() calls XTestFakeButtonEvent(). Nothing tracks or releases held buttons afterwards:

  • Screen::leaveSecondary() only calls m_screen->fakeAllKeysUp() (src/lib/deskflow/Screen.cpp:459 on master).
  • Client::cleanupScreen() only calls m_screen->disable() (src/lib/client/Client.cpp:540 on master), which unmaps the hider window and does not touch button state.
  • There is no fakeAllButtonsUp() or equivalent anywhere in the tree; only fakeAllKeysUp() exists, for keys.

Because XTestFakeButtonEvent() changes the X server's core pointer state, which is not tied to the injecting process, a press whose release is never delivered stays down even after the client reconnects or Deskflow restarts. That matches the symptom - the window manager is in a move grab, hence the 4-way cursor and unclickable UI - and explains why only a reboot (X restart) cleared it.

This is not the cross-barrier drag case: on X11 the server already refuses to switch screens while a physical button is down (Screen::isLockedToScreen() via XQueryPointer, used by Server::isSwitchOkay()), so the latch specifically comes from the link dropping between press and release (suspend/lid close, Wi-Fi drop, client restart).

Related: #10146 ("fix(wayland): track held mouse buttons in EiScreen", merged 2026-09-11) added held-button tracking for an analogous desync on the Wayland server path. The X11 client path has no equivalent.

Possible fix: track buttons pressed by fakeMouseButton(..., true) and release those still down from Screen::leaveSecondary() and from the disconnect path (Client::cleanupScreen() / XWindowsScreen::disable()), ideally via a fakeAllButtonsUp() alongside fakeAllKeysUp() so platforms behave consistently. Happy to test a patch.

Workaround: a small user service on the client watches the XTEST pointer and injects the missing ButtonRelease after resume/Wi-Fi drops; in the run above it cleared the latch 1 second after resume. That is what produced this log.

Real-world impact: the "Authorise" button in Update Manager became unclickable (cursor became the 4-way move arrow) and an unlock screen was stuck the same way after opening the laptop lid. Restarting the computer was the only recovery.