GNOME Bugzilla – Bug 79036
Strange behaviour of floating context menus
Last modified: 2011-02-04 16:11:52 UTC
Open an image, then right-click on it, next cut off the context menu. Now right-click on the image again, and look at the floating menu...
Created attachment 7771 [details] Image showing the strange context menu
This very much looks like a bug in your window manager or GTK+. The latter is unlikely, I suspect your WM causing the problem. Anyway, consider reassigning the bug to GTK+.
This also happens with the DIA drawing program (http://hans.breuer.org/dia/). Would this suggest a GTK problem?
If this does not seem to be a GIMP-specific problem, then maybe it is better to reassign this report to GTK+. This looks like a Windows-specific bug, because I could not reproduce it on other platforms.
Somehow the window manager seems to be giving the tearoff menu a bigger size allocation than it expects. What window manager? (The effect you see there is because when the menu is popped up again GTK+ puts an image of the widgets into the torn-off window as the background image, since widgets can't be two places at once, and you are seeing that image being tiled since the window is bigger than GTK+ expects.)
The reporter is using Windows, as indicated in the OS field (and confirmed by looking at the other bug reports from the same reporter). So the choice of window managers is rather limited in this case... I think that I understand the problem now: the normal menus do not have a title bar, so they are displayed correctly. But when the menu is torn off, a title bar is added to it. And in this case Windows enforces a minimal size for the title bar, causing the menu window to be larger than GTK+ expects.
I forgot to reassign this bug to the default component owner...
Hmmm, GtkMenu sets the GDK_WINDOW_TYPE_HINT_MENU on the torn off menu, so the Win32 backend just needs to use that to set whatever win32 magic is needed to get a window where the title bar doesn't increase the minimum size I hope this doens't require creating the window in a different class, since that sounds like it might be harder to do after the window is created when gdk_window_set_type_hint() is called. [ The gdk_window_set_type_hint() is new in GTK+-2.0, this bug is probably about the win32-production branch, but it probably is best just fixed in 2.x. ]
The problem is in the gdk_window_set_decorations() implementation. I hadn't known the strange semantics of GDK_DECOR_ALL, but now I read the documentation (in GTK+ 2.0)... Will fix.
Hmm. Now that I implemented gdk_window_set_decorations() correctly, torn-off menus have no title bar or border at all, making it impossible to move them, they "stick" to the place where popped up. That doesn't seem very useful? But it seems to work the same on X11, at least on one Red Hat box I tried (hmm, didn't check what window manager).
Sorry, ignore previous comment. There were still bugs...
Fix applied to gtk-1-3-win32-production. Same fix needed for HEAD and gtk-2-0, leaving open.
Fix applied to HEAD and gtk-2-0.