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 145416 - Error dialogs and menus
Error dialogs and menus
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 143485 156009 156773 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-07-04 22:19 UTC by Euan MacGregor
Modified: 2011-02-04 16:18 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
menu-on-top-of-dialog.tar.gz (1.49 KB, application/octet-stream)
2004-07-08 14:16 UTC, Bastien Nocera
  Details
add grab-notify to GtkMenu (1.50 KB, patch)
2005-06-27 15:36 UTC, Matthias Clasen
none Details | Review

Description Euan MacGregor 2004-07-04 22:19:22 UTC
If you have the menus open when an error dialog appears, the error dialog
appears /behind/ the menus.
This is particularly fun because the menus don't let anything else on the X
server receive events and the error dialog doesn't let anything except itself
from receive events.  Therefore, if the Ok button is obscured it looks like an X
deadlock (although if you know that space will dismiss the dialog it's not as bad).

One way to reproduce is to have totem have a bogus file in its initial playlist
that it then tries to load on startup and open one of the menus when the window
appears.
Comment 1 Bastien Nocera 2004-07-08 14:15:54 UTC
I could reproduce that problem, but it's not Totem related, it could happen with
any GTK+ application.

I attached a test case for it below, simply compile the .c file with:
gcc -o foo foo.c `pkg-config --libs --cflags libglade-2.0`
and run it in the current dir:
./foo

Simply click on the menu, before the dialog pops up.
Comment 2 Bastien Nocera 2004-07-08 14:16:48 UTC
Created attachment 29350 [details]
menu-on-top-of-dialog.tar.gz
Comment 3 Owen Taylor 2004-07-08 17:17:02 UTC
The stacking is not fixable. The fact that the error dialog grabs
the grab away from the menus may be fixable, though it's going to make
the grab mess in GTK+ messier.

Probably what you really want is to unpost any active menus when
the dialog comes up, though that also is pretty tricky in the GTK+;
maybe just special case and have gtk_dialog_map() call

 gtk_menu_deactive_all (screen)

(screen? display? grab group?) 
Comment 4 Matthias Clasen 2004-10-06 05:37:30 UTC
Should probably be looked at in connection with the tentative grab-broken signal
Comment 5 Bastien Nocera 2004-10-30 15:25:14 UTC
*** Bug 156773 has been marked as a duplicate of this bug. ***
Comment 6 Christian Persch 2004-10-31 22:40:00 UTC
*** Bug 143485 has been marked as a duplicate of this bug. ***
Comment 7 Matthias Clasen 2005-06-09 16:33:19 UTC
*** Bug 156009 has been marked as a duplicate of this bug. ***
Comment 8 Matthias Clasen 2005-06-27 15:36:25 UTC
Created attachment 48419 [details] [review]
add grab-notify to GtkMenu

Here is a proposal to handle this by canceling the menu if it gets
grab-shadowed by something that is not a menu. This exception is necessary
since submenus do grab-shadow their parents regularly. While it is
theoretically possible that a
menu gets grab-shadowed by an unrelated menu that is not a descendent in the
menu hierarchy, this seems a pretty unlikely scenario, and b) since both menus
are override-redirect, the shadowing one will end up above the shadowed one in
the stacking order, so the deadlock described above will not occur.

The patch seems to be a little less than perfect for torn off menus, where the
selection is not removed in the torn-off menu when a submenu is grab-shadowed. 

I don#t know why that is, canceling the submenu with Escape has the right
effect of removing the selection...
Comment 9 Matthias Clasen 2005-06-27 17:39:46 UTC
2005-06-27  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkmenu.c (gtk_menu_grab_notify): Cancel menus when
        they are grab-shadowed by something thats not a
        submenu.  (#145416, Euan MacGregor)