Fix grouping in the presence of ancestors; caught by Björn. #336184

2006-03-29  Elijah Newren  <newren gmail com>

	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
This commit is contained in:
Elijah Newren 2006-03-30 19:22:38 +00:00 committed by Elijah Newren
parent 82a6c99485
commit 127a89886b
4 changed files with 38 additions and 9 deletions

View File

@ -1,3 +1,18 @@
2006-03-29 Elijah Newren <newren gmail com>
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 <newren gmail com> 2006-03-29 Elijah Newren <newren gmail com>
* rationales.txt: Add bugs about pointer warping; update * rationales.txt: Add bugs about pointer warping; update

View File

@ -116,16 +116,21 @@ void
meta_window_compute_group (MetaWindow* window) meta_window_compute_group (MetaWindow* window)
{ {
MetaGroup *group; MetaGroup *group;
MetaWindow *ancestor;
/* use window->xwindow if no window->xgroup_leader */ /* use window->xwindow if no window->xgroup_leader */
group = NULL; 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->display->groups_by_leader)
{ {
if (window->xtransient_for != None) if (ancestor != window)
group = g_hash_table_lookup (window->display->groups_by_leader, group = ancestor->group;
&window->xtransient_for);
else if (window->xgroup_leader != None) else if (window->xgroup_leader != None)
group = g_hash_table_lookup (window->display->groups_by_leader, group = g_hash_table_lookup (window->display->groups_by_leader,
&window->xgroup_leader); &window->xgroup_leader);
@ -141,9 +146,9 @@ meta_window_compute_group (MetaWindow* window)
} }
else else
{ {
if (window->xtransient_for != None) if (ancestor != window && ancestor->xgroup_leader != None)
group = meta_group_new (window->display, group = meta_group_new (window->display,
window->xtransient_for); ancestor->xgroup_leader);
else if (window->xgroup_leader != None) else if (window->xgroup_leader != None)
group = meta_group_new (window->display, group = meta_group_new (window->display,
window->xgroup_leader); window->xgroup_leader);
@ -154,8 +159,7 @@ meta_window_compute_group (MetaWindow* window)
window->group = group; window->group = group;
} }
window->group->windows = g_slist_prepend (window->group->windows, window->group->windows = g_slist_prepend (window->group->windows, window);
window);
meta_topic (META_DEBUG_GROUPS, meta_topic (META_DEBUG_GROUPS,
"Adding %s to group with leader 0x%lx\n", "Adding %s to group with leader 0x%lx\n",

View File

@ -3993,12 +3993,20 @@ find_root_ancestor (MetaWindow *window,
return TRUE; return TRUE;
} }
void MetaWindow *
meta_window_raise (MetaWindow *window) meta_window_find_root_ancestor (MetaWindow *window)
{ {
MetaWindow *ancestor; MetaWindow *ancestor;
ancestor = window; ancestor = window;
meta_window_foreach_ancestor (window, find_root_ancestor, &ancestor); 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, meta_topic (META_DEBUG_WINDOW_OPS,
"Raising window %s, ancestor of %s\n", "Raising window %s, ancestor of %s\n",

View File

@ -555,6 +555,8 @@ gboolean meta_window_is_ancestor_of_transient (MetaWindow *window,
void meta_window_foreach_ancestor (MetaWindow *window, void meta_window_foreach_ancestor (MetaWindow *window,
MetaWindowForeachFunc func, MetaWindowForeachFunc func,
void *data); void *data);
MetaWindow* meta_window_find_root_ancestor (MetaWindow *window);
void meta_window_begin_grab_op (MetaWindow *window, void meta_window_begin_grab_op (MetaWindow *window,
MetaGrabOp op, MetaGrabOp op,