When the following happens:
- I start a drag-and-drop operation, starting from application ABC.
- Application ABC locks up (temporarily)
- I release the mouse button
then, until application ABC finishes processing, I have the following problems:
- Other programs cannot "grab" the mouse pointer
- The drag-and-drop cursor remains active
- I cannot click anything
- I cannot open the gnome-panel or GNOME menu
- I cannot press certain keys (including space, enter, arrow keys)
Obviously, I then cannot do other work while waiting for the application to finish.
A situation when this occurs is when I have ~500 firefox tabs open, when dragging tabs it sometimes freezes for half an hour or so.
A workaround is to use a terminal by pressing Ctrl-Alt-F1, log in, run killall ABC
to kill the offending application, and press Ctrl-Alt-F7 to get back to the graphical environment. But I would rather not have to kill ABC, instead letting it finish processing, while getting my mouse back.
So, is it possible to forcibly abort a drag-and-drop / un-grab the mouse pointer from a busy program, without killing the process?
Best Answer
In fact, it is possible to do this (at least with recent versions of X).
You can do this by pressing the XF86Ungrab key, introduced in this commit.
By default, this keysym is not bound to any physical key or key combination (it was disabled in 2012 after it was reported as a security hole, since it allows anyone to bypass lock screens by breaking their grabs). On some other setups it is bound to a shortcut that uses the number pad. Obviously, that won't work on laptops that lack a keypad.
But you can still activate the keysym using
xdotool
:This works with X.org version 2:1.11.4-0ubuntu10.8 on Ubuntu Precise.