diff --git a/ChangeLog b/ChangeLog index 3497325f4..961a140e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2006-03-29 Elijah Newren + + Fix grouping in the presence of ancestors; caught by Björn. + #336184 + + * src/group.c (meta_window_compute_group): Use new + meta_window_find_root_ancestor() function to get ancestor; for the + computed group, use the ancestor's group instead of the ancestor + itself + + * src/window.[ch] (meta_window_find_root_ancestor, + meta_window_raise): split meta_window_find_root_ancestor() + functionality of meta_window_raise() and make it available + elsewhere + 2006-03-29 Elijah Newren * rationales.txt: Add bugs about pointer warping; update diff --git a/src/group.c b/src/group.c index 8f79ad5ff..a2f798196 100644 --- a/src/group.c +++ b/src/group.c @@ -116,16 +116,21 @@ void meta_window_compute_group (MetaWindow* window) { MetaGroup *group; + MetaWindow *ancestor; /* use window->xwindow if no window->xgroup_leader */ group = NULL; + /* Determine the ancestor of the window; its group setting will override the + * normal grouping rules; see bug 328211. + */ + ancestor = meta_window_find_root_ancestor (window); + if (window->display->groups_by_leader) { - if (window->xtransient_for != None) - group = g_hash_table_lookup (window->display->groups_by_leader, - &window->xtransient_for); + if (ancestor != window) + group = ancestor->group; else if (window->xgroup_leader != None) group = g_hash_table_lookup (window->display->groups_by_leader, &window->xgroup_leader); @@ -141,9 +146,9 @@ meta_window_compute_group (MetaWindow* window) } else { - if (window->xtransient_for != None) + if (ancestor != window && ancestor->xgroup_leader != None) group = meta_group_new (window->display, - window->xtransient_for); + ancestor->xgroup_leader); else if (window->xgroup_leader != None) group = meta_group_new (window->display, window->xgroup_leader); @@ -154,8 +159,7 @@ meta_window_compute_group (MetaWindow* window) window->group = group; } - window->group->windows = g_slist_prepend (window->group->windows, - window); + window->group->windows = g_slist_prepend (window->group->windows, window); meta_topic (META_DEBUG_GROUPS, "Adding %s to group with leader 0x%lx\n", diff --git a/src/window.c b/src/window.c index 4f384de9a..33f280223 100644 --- a/src/window.c +++ b/src/window.c @@ -3993,12 +3993,20 @@ find_root_ancestor (MetaWindow *window, return TRUE; } -void -meta_window_raise (MetaWindow *window) +MetaWindow * +meta_window_find_root_ancestor (MetaWindow *window) { MetaWindow *ancestor; ancestor = window; meta_window_foreach_ancestor (window, find_root_ancestor, &ancestor); + return ancestor; +} + +void +meta_window_raise (MetaWindow *window) +{ + MetaWindow *ancestor; + ancestor = meta_window_find_root_ancestor (window); meta_topic (META_DEBUG_WINDOW_OPS, "Raising window %s, ancestor of %s\n", diff --git a/src/window.h b/src/window.h index 7b9a9eb83..49ac0293d 100644 --- a/src/window.h +++ b/src/window.h @@ -555,6 +555,8 @@ gboolean meta_window_is_ancestor_of_transient (MetaWindow *window, void meta_window_foreach_ancestor (MetaWindow *window, MetaWindowForeachFunc func, void *data); +MetaWindow* meta_window_find_root_ancestor (MetaWindow *window); + void meta_window_begin_grab_op (MetaWindow *window, MetaGrabOp op,