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 597763 - With >2 workspaces, Window menu "Move to Another Workspace" menu doesn't work
With >2 workspaces, Window menu "Move to Another Workspace" menu doesn't work
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
: 630799 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-10-08 01:55 UTC by Jason Clinton
Modified: 2010-09-28 13:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Full trace (10.63 KB, text/plain)
2009-10-08 01:58 UTC, Jason Clinton
  Details
Don't screw up the event mask when "managing" our own windows (2.82 KB, patch)
2010-07-14 20:17 UTC, Owen Taylor
committed Details | Review

Description Jason Clinton 2009-10-08 01:55:36 UTC
The menu pops up listing all three work spaces "Workspace 1", "Workspace 2", "Workspace 3", etc., but clicking does not result in any action taken. The console warnings from mutter and a full backtrace at the first warning is below.

Window manager warning: Log level 8: meta_window_set_user_time: assertion `!window->override_redirect' failed
Window manager warning: Log level 8: meta_window_raise: assertion `!window->override_redirect' failed
Window manager warning: Log level 8: meta_window_focus: assertion `!window->override_redirect' failed



Breakpoint 3, meta_window_set_user_time (window=0x316dd70, timestamp=7999249) at core/window.c:8514
8514	  g_return_if_fail (!window->override_redirect);
  • #0 meta_window_set_user_time
    at core/window.c line 8514
  • #1 event_callback
    at core/display.c line 1673
  • #2 filter_func
    at ui/ui.c line 84
  • #3 gdk_event_apply_filters
    at /tmp/buildd/gtk+2.0-2.18.2/gdk/x11/gdkevents-x11.c line 351
  • #4 gdk_event_translate
    at /tmp/buildd/gtk+2.0-2.18.2/gdk/x11/gdkevents-x11.c line 919
  • #5 _gdk_events_queue
    at /tmp/buildd/gtk+2.0-2.18.2/gdk/x11/gdkevents-x11.c line 2302
  • #6 gdk_event_dispatch
    at /tmp/buildd/gtk+2.0-2.18.2/gdk/x11/gdkevents-x11.c line 2363
  • #7 g_main_dispatch
    at /tmp/buildd/glib2.0-2.22.1/glib/gmain.c line 1960
  • #8 IA__g_main_context_dispatch
    at /tmp/buildd/glib2.0-2.22.1/glib/gmain.c line 2513
  • #9 g_main_context_iterate
    at /tmp/buildd/glib2.0-2.22.1/glib/gmain.c line 2591
  • #10 IA__g_main_loop_run
    at /tmp/buildd/glib2.0-2.22.1/glib/gmain.c line 2799
  • #11 main
    at core/main.c line 727
  • #0 meta_window_set_user_time
    at core/window.c line 8514
  • #1 event_callback
    at core/display.c line 1673
  • #2 filter_func
    at ui/ui.c line 84
  • #3 gdk_event_apply_filters
    at /tmp/buildd/gtk+2.0-2.18.2/gdk/x11/gdkevents-x11.c line 351
  • #4 gdk_event_translate
    at /tmp/buildd/gtk+2.0-2.18.2/gdk/x11/gdkevents-x11.c line 919
  • #5 _gdk_events_queue
    at /tmp/buildd/gtk+2.0-2.18.2/gdk/x11/gdkevents-x11.c line 2302
  • #6 gdk_event_dispatch
    at /tmp/buildd/gtk+2.0-2.18.2/gdk/x11/gdkevents-x11.c line 2363
  • #7 g_main_dispatch
    at /tmp/buildd/glib2.0-2.22.1/glib/gmain.c line 1960
  • #8 IA__g_main_context_dispatch
    at /tmp/buildd/glib2.0-2.22.1/glib/gmain.c line 2513
  • #9 g_main_context_iterate
    at /tmp/buildd/glib2.0-2.22.1/glib/gmain.c line 2591
  • #10 IA__g_main_loop_run
    at /tmp/buildd/glib2.0-2.22.1/glib/gmain.c line 2799
  • #11 main
    at core/main.c line 727

Comment 1 Jason Clinton 2009-10-08 01:58:29 UTC
Created attachment 145011 [details]
Full trace

Bugzilla ate my full trace. Uploaded as attachment. :(
Comment 2 Matti Viljanen 2009-11-24 18:17:36 UTC
It works for me now, Ubuntu 64-bit 9.10, 2.28.1~14-g988d-0~ricotz1
Comment 3 Nickolas Lloyd 2009-11-24 20:08:35 UTC
i've spent the last couple days looking into this, and all that i can figure out is that for some reason the workspaces submenu isn't receiving mouse events.  workspaces can be selected using the arrow keys, but the menu items don't even highlight when moused over.  the events are passed through the main event_callback() as per usual.  i've tried setting the event mask for the submenu and it's items with no change.  if anyone has a clue why this is happening, i'd be happy to write a patch
Comment 4 Nickolas Lloyd 2009-11-24 20:10:45 UTC
hmm, if it's working now, cancel that last post.  doesn't seem to be in the git tree however...
Comment 5 Neil Jagdish Patel 2010-07-02 15:07:14 UTC
I'm still seeing this bug with git master as of today. It happens with any GtkMenu that is popped-up inside the Mutter process (either Mutter itself or a plugin).

It seems Mutter does some checks so it doesn't end up managing it's own window, the menu end's up being caught into this, and is marked as override-redirect and therefore some funkiness seems to happen with the mouse grabs (keyboard nav works fine).

I'm going to play around with this to see if can be solved by not including menus in the checks, but if someone with more experience with Mutter internals could give some guidance, that would be great.
Comment 6 Neil Jagdish Patel 2010-07-02 15:22:50 UTC
That made less sense than I would like it to have :) Of course menu windows are override_redirect, however it does seem that something special is happening between what a GtkMenu would like to do and what Mutter wants to do. I'm going to play around with trying to diff the states between menus from mutter and those from external apps.
Comment 7 Colin Walters 2010-07-02 16:46:49 UTC
My random guess is we are getting the mouse event, but we need to be letting GDK handle it.

(Or even better, remove/reimplement the window menu in Clutter/St)
Comment 8 Nickolas Lloyd 2010-07-02 17:01:00 UTC
Based on the little bit of digging around I did back when I commented on this, IIRC mutter isn't even receiving the event, even though by all accounts it should.  I question though the need for the menu, or at least the current implementation.  As it is now, we have the choice to move to one of four workspaces, which was fine back in the days of gnome-session, but doesn't really make any sense now with gnome-shell given the variable number of workspaces.  Move to workspace left/right doesn't either, as the workspaces are arranged in two dimensions now instead of one.  If the menu is to stay, perhaps limit the options to Move to workspace Up/Down/Left/Right or something similar?
Comment 9 JasSmith 2010-07-02 17:06:31 UTC
On the input side of things, enabling input debug in clutter shows that clutter is not seeing event inputs either.
Comment 10 Neil Jagdish Patel 2010-07-13 13:26:25 UTC
Have been taking a deeper look into this, and comparing it to metacity too. It seems the issue only happens with Mutter, not with Metacity or Metacity-composited.

The xevent that Mutter receives has it's xevent->xany.window set to the initial GtkMenu that was popped-up, the submenu never receives mouse events "addressed" to it's window (whereas in Metacity the events clearly come with the correct xany.window attribute when the submenu is open).

Looking at the filter, both Mutter and Metacity are returning FALSE in event_callback and so the event is being sent to gdk it seems. There is no obvious fail of the grab, but I'm now inspecting that code path more thoroughly.
Comment 11 Owen Taylor 2010-07-14 20:17:31 UTC
A little tricky to debug. I'll admit that I was stepping through event delivery code in the X server before the light dawned.

Basic problem, as you saw, is that events were going to the grab window (the parent window) rather than the submenu. This was the case even though gdk_pointer_grab() was being done with owner_events=TRUE.

You can see what is going on by carefully reading from the 

   If owner_events is True and if a generated pointer event would
   normally be reported to this client, it is reported as usual. 
   Otherwise, the event is reported with respect to the grab_window and is 
   reported only if selected by event_mask.  For either value of
   owner_events, unreported events are discarded.

Note that it is "normally be reported to this client" not "is on a window owned by this client".

So, if we aren't selecting for pointer events on the window where the pointer is in, it's just like it is a window from a different process - the event will be reported with respect to the grab window.

And indeed, Mutter was messing up the event mask on windows created by GDK in the same process. It didn't matter for the menu, because the window was the same as the grab window, but caused problems for the submenu where the window and the grab window were different.

Will attach a fix. The second hunk isn't actually necessary to fix this particular problem since the menu is created fresh every time, but is good to fix now before it causes someone to waste a lot of time debugging later.
Comment 12 Owen Taylor 2010-07-14 20:17:44 UTC
Created attachment 165916 [details] [review]
Don't screw up the event mask when "managing" our own windows

When we do pseudo-management on an override-redirect window, we have to be
careful to augment the existing event mask, not replace it, or
delivery of pointer events will be disrupted.

When we unmanage a window, we shouldn't try to unselect events at all,
since that will interfere with event selection done by GDK.

http://bugzilla.gnome.org/show_bug.cgi?id=597763
Comment 13 Dan Winship 2010-07-14 20:34:12 UTC
Comment on attachment 165916 [details] [review]
Don't screw up the event mask when "managing" our own windows

looks good, and afaik, mutter won't freak out if it gets unexpected events for a window it doesn't care about any more
Comment 14 JasSmith 2010-07-14 20:50:22 UTC
Works wonderfully
Comment 15 Nickolas Lloyd 2010-07-28 02:14:32 UTC
I confirm that this works with the latest git
Comment 16 Nickolas Lloyd 2010-08-13 15:12:49 UTC
Unless there is some outstanding issue with the patch, can we get this pushed and the bug closed?  It'd be nice to have this issue fixed in the git tree.

Thanks
Comment 17 Owen Taylor 2010-08-13 18:43:09 UTC
Attachment 165916 [details] pushed as e590cd2 - Don't screw up the event mask when "managing" our own windows
Comment 18 Owen Taylor 2010-09-28 13:05:23 UTC
*** Bug 630799 has been marked as a duplicate of this bug. ***