window: Avoid spurious focus-window changes when showing desktop

When using the show-desktop shortcut with no desktop window, unshowing
will focus the second-most-recently-used window. If we find a desktop
window, it will be focused explicitly and everything works as expected;
however without a desktop window, we end up hiding the focus window,
which will use focus_default_window() with the not_this_one parameter
to move focus away. We used to get away with this, as the not_this_one
parameter was ignored until commit e257580b94, now with bug 675982
fixed, we need to explicitly handle the show-desktop case.

https://bugzilla.gnome.org/show_bug.cgi?id=686928
This commit is contained in:
Florian Müllner 2012-10-26 14:39:21 +02:00
parent e2bf91cd61
commit 2cc0d31b17

View File

@ -3304,8 +3304,11 @@ meta_window_hide (MetaWindow *window)
* active workspace; when it is not, we need to pass in NULL, so as to * active workspace; when it is not, we need to pass in NULL, so as to
* focus the default window for the active workspace (this scenario * focus the default window for the active workspace (this scenario
* arises when we are switching workspaces). * arises when we are switching workspaces).
* We also pass in NULL if we are in the process of hiding all non-desktop
* windows to avoid unexpected changes to the stacking order.
*/ */
if (my_workspace == window->screen->active_workspace) if (my_workspace == window->screen->active_workspace &&
!my_workspace->showing_desktop)
not_this_one = window; not_this_one = window;
meta_workspace_focus_default_window (window->screen->active_workspace, meta_workspace_focus_default_window (window->screen->active_workspace,