diff --git a/src/core/window-private.h b/src/core/window-private.h index 0d5d68c6f..c0cf4f1b1 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -204,7 +204,6 @@ struct _MetaWindow char *gtk_menubar_object_path; Window xtransient_for; - Window xgroup_leader; MetaWindow *transient_for; /* Initial workspace property */ diff --git a/src/x11/group.c b/src/x11/group.c index f08c75577..56e601bc0 100644 --- a/src/x11/group.c +++ b/src/x11/group.c @@ -36,6 +36,7 @@ #include "x11/group-props.h" #include "x11/meta-x11-display-private.h" #include "x11/window-x11.h" +#include "x11/window-x11-private.h" static MetaGroup* meta_group_new (MetaX11Display *x11_display, @@ -141,16 +142,15 @@ meta_window_get_group (MetaWindow *window) } void -meta_window_compute_group (MetaWindow* window) +meta_window_compute_group (MetaWindow *window) { - MetaGroup *group; + MetaGroup *group = NULL; MetaWindow *ancestor; MetaX11Display *x11_display = window->display->x11_display; + Window win_leader = meta_window_x11_get_xgroup_leader (window); /* 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. */ @@ -160,9 +160,9 @@ meta_window_compute_group (MetaWindow* window) { if (ancestor != window) group = ancestor->group; - else if (window->xgroup_leader != None) + else if (win_leader != None) group = g_hash_table_lookup (x11_display->groups_by_leader, - &window->xgroup_leader); + &win_leader); else { Window xwindow = meta_window_x11_get_xwindow (window); @@ -178,12 +178,14 @@ meta_window_compute_group (MetaWindow* window) } else { - if (ancestor != window && ancestor->xgroup_leader != None) + Window ancestor_leader = meta_window_x11_get_xgroup_leader (ancestor); + + if (ancestor != window && ancestor_leader != None) group = meta_group_new (x11_display, - ancestor->xgroup_leader); - else if (window->xgroup_leader != None) + ancestor_leader); + else if (win_leader != None) group = meta_group_new (x11_display, - window->xgroup_leader); + win_leader); else group = meta_group_new (x11_display, meta_window_x11_get_xwindow (window)); diff --git a/src/x11/window-props.c b/src/x11/window-props.c index 059f75a11..9ea0b51bf 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -1617,12 +1617,12 @@ reload_wm_hints (MetaWindow *window, Window old_group_leader; gboolean urgent; - old_group_leader = window->xgroup_leader; + old_group_leader = priv->xgroup_leader; /* Fill in defaults */ window->input = TRUE; window->initially_iconic = FALSE; - window->xgroup_leader = None; + priv->xgroup_leader = None; priv->wm_hints_pixmap = None; priv->wm_hints_mask = None; urgent = FALSE; @@ -1638,7 +1638,7 @@ reload_wm_hints (MetaWindow *window, window->initially_iconic = (hints->initial_state == IconicState); if (hints->flags & WindowGroupHint) - window->xgroup_leader = hints->window_group; + priv->xgroup_leader = hints->window_group; if (hints->flags & IconPixmapHint) priv->wm_hints_pixmap = hints->icon_pixmap; @@ -1651,15 +1651,15 @@ reload_wm_hints (MetaWindow *window, meta_verbose ("Read WM_HINTS input: %d iconic: %d group leader: 0x%lx pixmap: 0x%lx mask: 0x%lx", window->input, window->initially_iconic, - window->xgroup_leader, + priv->xgroup_leader, priv->wm_hints_pixmap, priv->wm_hints_mask); } - if (window->xgroup_leader != old_group_leader) + if (priv->xgroup_leader != old_group_leader) { meta_verbose ("Window %s changed its group leader to 0x%lx", - window->desc, window->xgroup_leader); + window->desc, priv->xgroup_leader); meta_window_group_leader_changed (window); } diff --git a/src/x11/window-x11-private.h b/src/x11/window-x11-private.h index fa685571c..b309586f2 100644 --- a/src/x11/window-x11-private.h +++ b/src/x11/window-x11-private.h @@ -79,6 +79,7 @@ struct _MetaWindowX11Private Window xwindow; Window xclient_leader; + Window xgroup_leader; /* Bypass compositor hints */ MetaBypassCompositorHint bypass_compositor; @@ -90,4 +91,6 @@ MetaWindowX11Private * meta_window_x11_get_private (MetaWindowX11 *window_x11); void meta_window_x11_initialize_state (MetaWindow *window); +Window meta_window_x11_get_xgroup_leader (MetaWindow *window); + G_END_DECLS diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 11e1f336c..f028c2f5c 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -558,7 +558,7 @@ meta_window_x11_manage (MetaWindow *window) /* assign the window to its group, or create a new group if needed */ window->group = NULL; - window->xgroup_leader = None; + priv->xgroup_leader = None; meta_window_compute_group (window); meta_window_load_initial_properties (window); @@ -2002,6 +2002,10 @@ static gboolean meta_window_x11_set_transient_for (MetaWindow *window, MetaWindow *parent) { + MetaWindowX11 *window_x11 = META_WINDOW_X11 (window); + MetaWindowX11Private *priv = + meta_window_x11_get_instance_private (window_x11); + meta_window_x11_recalc_window_type (window); if (!window->constructing) { @@ -2027,8 +2031,8 @@ meta_window_x11_set_transient_for (MetaWindow *window, * in programs such as xmms-- see #328211. */ if (window->xtransient_for != None && - window->xgroup_leader != None && - window->xtransient_for != window->xgroup_leader) + priv->xgroup_leader != None && + window->xtransient_for != priv->xgroup_leader) meta_window_group_leader_changed (window); return TRUE; @@ -4412,3 +4416,17 @@ meta_window_x11_get_xwindow (MetaWindow *window) return priv->xwindow; } + +Window +meta_window_x11_get_xgroup_leader (MetaWindow *window) +{ + MetaWindowX11 *window_x11; + MetaWindowX11Private *priv; + + g_return_val_if_fail (META_IS_WINDOW (window), None); + + window_x11 = META_WINDOW_X11 (window); + priv = meta_window_x11_get_instance_private (window_x11); + + return priv->xgroup_leader; +}