From 0488efc8c1347d25be5bd5adcf9f8d3687ccecb4 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sat, 12 Feb 2005 07:34:30 +0000 Subject: [PATCH] Raise the ancestor of a window instead of the window itself. Fixes 2005-02-12 Elijah Newren Raise the ancestor of a window instead of the window itself. Fixes #166894. * src/window.c: (find_root_ancestor): new function, (meta_window_raise): get the ancestor of the given window and raise it if possible instead of the window --- ChangeLog | 9 +++++++++ src/window.c | 37 ++++++++++++++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ab2ba138..37368ffbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-02-12 Elijah Newren + + Raise the ancestor of a window instead of the window itself. + Fixes #166894. + + * src/window.c: (find_root_ancestor): new function, + (meta_window_raise): get the ancestor of the given window and + raise it if possible instead of the window + 2005-02-12 Elijah Newren Don't unconditionally place splashscreens (and other diff --git a/src/window.c b/src/window.c index 34830c313..8470e259d 100644 --- a/src/window.c +++ b/src/window.c @@ -3654,13 +3654,44 @@ meta_window_set_current_workspace_hint (MetaWindow *window) meta_error_trap_pop (window->display, FALSE); } +static gboolean +find_root_ancestor (MetaWindow *window, + void *data) +{ + MetaWindow **ancestor = data; + + /* Overwrite the previously "most-root" ancestor with the new one found */ + *ancestor = window; + + /* We want this to continue until meta_window_foreach_ancestor quits because + * there are no more valid ancestors. + */ + return TRUE; +} + void meta_window_raise (MetaWindow *window) { - meta_topic (META_DEBUG_WINDOW_OPS, - "Raising window %s\n", window->desc); + MetaWindow *ancestor; + ancestor = window; + meta_window_foreach_ancestor (window, find_root_ancestor, &ancestor); - meta_stack_raise (window->screen->stack, window); + meta_topic (META_DEBUG_WINDOW_OPS, + "Raising window %s, ancestor of %s\n", + ancestor->desc, window->desc); + + if (window->screen->stack != ancestor->screen->stack) + { + meta_warning ( + "Either stacks aren't per screen or some window has a weird " + "transient_for hint; window->screen->stack != " + "ancestor->screen->stack. window = %s, ancestor = %s.\n", + window->desc, ancestor->desc); + /* Just punt and raise the window itself */ + meta_stack_raise (window->screen->stack, window); + } + else + meta_stack_raise (window->screen->stack, ancestor); } void