After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 151500 - [PATCH] make alttab work when the pointer is grabbed
[PATCH] make alttab work when the pointer is grabbed
Status: RESOLVED DUPLICATE of bug 344059
Product: metacity
Classification: Other
Component: general
2.8.x
Other Linux
: Normal normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2004-08-31 10:38 UTC by Hans de Goede
Modified: 2006-06-06 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.44 KB, patch)
2004-08-31 10:40 UTC, Hans de Goede
none Details | Review

Description Hans de Goede 2004-08-31 10:38:54 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.
Comment 1 Hans de Goede 2004-08-31 10:40:18 UTC
Created attachment 31131 [details] [review]
patch
Comment 2 Havoc Pennington 2004-08-31 16:04:39 UTC
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.
Comment 3 Hans de Goede 2004-08-31 17:45:24 UTC
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.
Comment 4 Hans de Goede 2004-08-31 17:59:47 UTC
p.s.

Please take a look at the patch, this is a case where the code says more then a
1000 words.
Comment 5 Elijah Newren 2006-06-06 19:58:16 UTC

*** This bug has been marked as a duplicate of 344059 ***