From bb1ab0afd9ee19259d4d10fbe40cd3361f447d46 Mon Sep 17 00:00:00 2001 From: Maxim Ermilov Date: Sat, 11 Sep 2010 05:00:15 +0400 Subject: [PATCH] Lower a window and all its transients as a unit It's strange to leave transients windows around, after ancestor window was lowered and unfocused. https://bugzilla.gnome.org/show_bug.cgi?id=612726 --- src/core/core.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/core/core.c b/src/core/core.c index 6fd2edd75..9464b0d78 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -260,15 +260,14 @@ meta_core_user_raise (Display *xdisplay, meta_window_raise (window); } -void -meta_core_user_lower_and_unfocus (Display *xdisplay, - Window frame_xwindow, - guint32 timestamp) +static gboolean +lower_window_and_transients (MetaWindow *window, + gpointer data) { - MetaWindow *window = get_window (xdisplay, frame_xwindow); - meta_window_lower (window); + meta_window_foreach_transient (window, lower_window_and_transients, NULL); + if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK && meta_prefs_get_raise_on_click ()) { @@ -296,11 +295,25 @@ meta_core_user_lower_and_unfocus (Display *xdisplay, } } - /* focus the default window, if needed */ - if (window->has_focus) - meta_workspace_focus_default_window (window->screen->active_workspace, - NULL, - timestamp); + return FALSE; +} + +void +meta_core_user_lower_and_unfocus (Display *xdisplay, + Window frame_xwindow, + guint32 timestamp) +{ + MetaWindow *window = get_window (xdisplay, frame_xwindow); + + lower_window_and_transients (window, NULL); + + /* Rather than try to figure that out whether we just lowered + * the focus window, assume that's always the case. (Typically, + * this will be invoked via keyboard action or by a mouse action; + * in either case the window or a modal child will have been focused.) */ + meta_workspace_focus_default_window (window->screen->active_workspace, + NULL, + timestamp); } void