Alt+Tab and other WM shortcuts not working while pointer is grabbed

Lasse Kärkkäinen ljkarkk2 at cc.hut.fi
Sun May 9 12:58:38 PDT 2010


I'm sure everyone here is already familiar with this problem, as it has 
been around for a decade at least. I am talking about not being to 
switch to another window from a full screen game (even though the issue 
itself has nothing to do with full screen windows).

Once XGrabPointer() is called, the WM loses control not only of the 
mouse but also of the keyboard. Although there are situations where 
applications may require extended keyboard control as well (e.g. virtual 
machines and remote desktops), XGrabPointer is extensively used by games 
and other applications that simply require extended mouse control.

Keys that are currently annoyingly broken when the input is grabbed:
- Alt+Tab, Alt+Left/Right, Alt+F4 or other such combinations used in WM 
for window control
- Volume controls, power button and other such keys

The usual response to this problem is that it is a bug in the game and 
that it should be fixed there. I think this solution is invalid because 
there is no other way to get the required functionality (being able to 
track relative mouse movement without worrying about the pointer 
escaping from the application). Even though such functionality could be 
added, all the existing games would stay broken and it would take a long 
time until game programming libraries and other software adopted the new 
way, not to mention that there are plenty of existing closed source 
games that are no longer maintained by their vendors. Maybe some 
consider that the game should handle the event by itself, but there 
nothing sensible the game could do in case of e.g. Alt+Tab.

While I cannot fully understand how X11 events behave, I would think 
that there should be a way for WM to specify key combinations that it 
will receive no matter what any application started later does. With 
such a system the WM could define its most important access keys with 
that interface. If nothing else, Ctrl+Alt+Delete might be such an escape 
sequence, but this alone would not provide optimal user experience 
because Alt+Tab would still be broken.

On the other hand, always keeping Alt+Tab to the WM might disturb remote 
desktop usage and other things. One option to consider is adopting the 
Super key as a general WM accelerator key as an alternative to Alt. 
Since it is generally not used by any application software, keeping it 
to the WM would work rather well. One could still use Alt instead to 
control a virtual machine.

Another thing to consider is that most WM shortcuts should indeed be 
disabled for games. For example, Alt+drag is commonly used in RTS games 
for giving orders but currently that doesn't work without grabbing 
because the WM thinks that one is trying to move the window.

Kiosk applications would also be affected, as they may currently think 
that they can securely grab all input (except Ctrl+Alt+BS, SysRq and VT 
switching which need to be disabled elsewhere), so care must be taken 
with any change to the grabbing behavior.

So, can this problem finally be fixed, so that maybe 2011 would be the 
year of the Linux Desktop :-)



More information about the xdg mailing list