GNOME Bugzilla – Bug 151500
[PATCH] make alttab work when the pointer is grabbed
Last modified: 2006-06-06 19:58:16 UTC
When you press alttab and an application has got the pointer grabbed, nothing happens instead of switching to the next window. This might be related to display.c line 3054: /* FIXME: * If we have no MetaWindow we do our best * and try to do the grab on the RootWindow. * This will fail if anyone else has any * key grab on the RootWindow. */ if (window) grab_xwindow = window->frame ? window->frame->xwindow : window->xwindow; else grab_xwindow = screen->xroot; What happens is that do_change_window() in keybindings.c calls meta_display_begin_grab_op() which fails because the pointer is already grabbed. The attached patch fixes this by just switching to the next window in the tablist when meta_display_begin_grab_op() fails, so this doesn't fix the problem completly (keeping alt pressed still won't work), but it is better then doing nothing at all. A real life example of this problem is xmame, which when requested by the user will grab the mouse, this is actually kinda handy when playing games. xmame wiil release the grab when ot looses focus, this works fine with other wm's but fails with metacity because of the above reasons.
Created attachment 31131 [details] [review] patch
I'm skeptical, normally an app will take a grab in order to force modal behavior, and there should not be a hidden escape hatch. An escape hatch like this isn't something most users will find, so any UI design based on its existence (such as the xmame one it sounds like) just doesn't seem that useful. Much more common uses of pointer grab for example are for menus, drag and drop, clicking a button, or whatever. In those cases alt+tab probably causes confusion and weirdness. I'd expect something like xmame to instead go fullscreen, and then there's no way for focus to be lost since you can't click on windows.
Well, all other window managers I know of work fine with alt-tab or similar keybindings when the mouse is grabbed. I agree that for a modal dialog box alt-tab shouldn't work but that descission should taken on base of wmhints. The current situation is IMHO a bug, because an XLib call fails alt-tab doesn't work as advertised as someone has acknowledged by putting a FIXME comment above the troublesome code. Now if the descisson would really be this is a modal dialog box, so we won't do alt tab then it would be a feature. xmame btw also has a fullscreen mode, but has been programmed in such a way that you can alttab from the fullscreen mode to any other app. I concider this to be a feature :) Xmame also has a key combo to grab/ungrab the mouse (xmame has to many hotkeys and way to many cmdline options) Also I'm used to modals stealing the focus from their window group, so if mozilla throws a modal dialog, no other mozilla window can get focus, but other apps should be able to get focus just fine, but thats a bit offtopic I believe.
p.s. Please take a look at the patch, this is a case where the code says more then a 1000 words.
*** This bug has been marked as a duplicate of 344059 ***