Strange X11 Grabbing

A couple of days ago I upgraded my home server from Debian/Bullseye to Debian/Testing (soon to be Bookworm). Since then KDE sessions on that system have had problems of locking the input queue, the mouse can move and mouse-over events work but clicking the mouse or pressing the keyboard does nothing. Various web pages suggested that the xdotool program (in the xdotool package in Debian) can address this. The problem is apparently programs “grabbing” the input and not letting it go.

The command “xdotool key XF86LogGrabInfo” causes the xorg server to dump information on it’s “grabs”. After running that command I looked in /var/log/Xorg.0.log and found that active grabs were only held by /usr/bin/kwin_x11 and /usr/bin/kglobalaccel5. So it seems like a KDE issue. Other systems running X11 with Debian/Testing (such as the laptop I’m using to write this blog post) don’t have the problem, so it could be something related to the KDE configuration of the account used on that system.

The command “xdotool key XF86Ungrab” is supposed to break out of such a grab, but for me didn’t do so.

On the same system running KDE with Wayland works fine in this regard. Does Wayland do things differently and not allow this “grabbing” to block everything? Does KDE have an X11 specific bug? Is there a race condition that just gets triggered by the speed of Xorg on that system but not by the slightly different timings of Wayland? I might never find out.

I previously wrote about problems with Wayland/KDE on laptops [1]. Fortunately this bug happened to occur on a server so inability to reconfigure monitors isn’t necessarily a deal breaker, although being unable to use some of the high-DPI settings for the 4K monitor it has may be an issue. It will be really annoying if some of the laptop configurations I support get this grabbing problem. But since that time I have learned of the kscreen-doctor command which is included in Debian/Testing and can do some of the necessary things, it doesn’t have a man page so you have to run “kscreen-doctor -h” for documentation.

4 comments to Strange X11 Grabbing

  • I think XF86Ungrab requires an xorg.conf option to enable, because it’s a huge backdoor (you can break the grab of the screen locker and interact with the desktop session without knowing the user’s password).

    Grab issues are indeed an X11-specific problem, and one of the reasons I’m happy I switched to Wayland.

  • Marius: Thanks for that information, it makes sense.

  • isbug

    Hello, i think i have a related bug in GNOME in bookworm. Sometimes, in some applications, the cursor does not change when i move the mouse around.

    For example in Firefox hovering a link will not show the link. On the other hand, when a link is kept “hovered” when i hover around, the cursor will not go back to “text cursor”.

    xdotool key XF86Ungrab does indeed trigger the mouse cursor change. I have no idea where XF86LogGrabInfo places logs for wayland, but i don’t think the bug is specific to KDE/Xorg (or i’ve found another bug).

    Not sure if related, i see many entries per second for “gsd-media-keys[2043]: Unable to get default source” in journalctl. It’s a fresh install not an upgrade.

  • isbug

    EDIT: Actually, it seems pressing any key triggers the new mouse events.

    ^ to the moderator: you can add to my previous message