GNOME Bugzilla – Bug 705200
raise-or-lower works eratically
Last modified: 2017-02-07 13:46:01 UTC
The "Raise window if covered, otherwise lower it" functionality works some of the time. Other times, when windows are apparently at the top of the window stack on the desktop, pressing the raise_or_lower keybinding does nothing (i.e. leaves the active window on top). There's some diagnosis of this issue in the Red Hat bugzilla at https://bugzilla.redhat.com/show_bug.cgi?id=827099 -- I haven't investigated to see whether the diagnosis is accurate, but the symptoms described are the same (and I couldn't find that report as having been sent upstream to here).
The diagnosis in https://bugzilla.redhat.com/show_bug.cgi?id=827099 appears accurate to me. The presence of a window in a "secondary" workspace definitely appears to trigger the issue. This is still a problem for me on Fedora 20 and my version of gnome-shell is: $ rpm -q gnome-shell gnome-shell-3.10.4-9.fc20.x86_64
I've been running into this issue repeatedly (on cinnamon/muffin) and it is very annoying. I decided to dig into the code and I have discovered the cause. Function "handle_raise_or_lower (src/core/keybindings.c)" is called when running 'raise-or-lower' on a window. This function iterates through all the windows in the stack to determine if our window is already on top or obscured. The problem is that the window stack includes windows in another workspaces and also windows that are minimized. I have identified 2 distinct erratic behaviors: - 1st one is the one described originally in this bug report: our window is already on top. We run 'raise-or-lower' on it, repeatedly, and nothing happens. This is caused by the code finding another window in a different workspace that is on top of our window, causing the code to raise our window. Since our window was already on top in our workspace, nothing happens. - 2nd behavior: our window is on top, we run 'raise-or-lower' and nothing happens. However, we run it again and now the window is lowered. This happens because a minimized window is identified as being on top. The first 'raise-or-lower' raises our window, but it was already on top so nothing happens. The second 'raise-or-lower' actually lowers it. Both behaviors are fixed by the following patch: diff --git a/src/core/keybindings.c b/src/core/keybindings.c index b7853e2..48aab75 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -3198,7 +3198,7 @@ handle_raise_or_lower (MetaDisplay *display, { MetaRectangle tmp, win_rect, above_rect; - if (above->mapped) + if (above->mapped && meta_window_should_be_showing(above)) { meta_window_get_frame_rect (window, &win_rect); meta_window_get_frame_rect (above, &above_rect);
Thanks for looking into this, can you provide a git formatted patch? (In reply to Jose Marino from comment #2) > diff --git a/src/core/keybindings.c b/src/core/keybindings.c > index b7853e2..48aab75 100644 > --- a/src/core/keybindings.c > +++ b/src/core/keybindings.c > @@ -3198,7 +3198,7 @@ handle_raise_or_lower (MetaDisplay *display, > { > MetaRectangle tmp, win_rect, above_rect; > > - if (above->mapped) > + if (above->mapped && meta_window_should_be_showing(above)) please leave a space to follow mutter's style: _showing (above) Otherwise this looks good to me.
Created attachment 345040 [details] [review] Fix erratic raise_or_lower behavior patch Patch on top of git master from today (57f80f091f2e0). Created with "git format-patch".
Created attachment 345043 [details] [review] Fix erratic raise_or_lower behavior patch Something went wrong with my first patch, here it goes again: Patch on top of git master from today (57f80f091f2e0). Created with "git format-patch".
Created attachment 345116 [details] [review] keybindings: fix erratic raise_or_lower behavior Function "handle_raise_or_lower (src/core/keybindings.c)" is called when running 'raise-or-lower' on a window. This function iterates through all the windows in the stack to determine if our window is already on top or obscured. The problem is that the window stack includes windows in another workspaces and also windows that are minimized.
Review of attachment 345116 [details] [review]: I just added your explanation from comment #2 to commit message. Code looks good, thanks
Attachment 345116 [details] pushed as 58669e7 - keybindings: fix erratic raise_or_lower behavior