window: Move group to WindowX11
Which means meta_window_get_group now requires a x11 client type, so ensure we don't call it on a wayland client Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3555>
This commit is contained in:
parent
e17d20191e
commit
43351b483f
@ -1988,14 +1988,20 @@ in_tab_chain (MetaWindow *window,
|
||||
gboolean in_dock_tab_chain;
|
||||
gboolean in_group_tab_chain;
|
||||
MetaGroup *focus_group = NULL;
|
||||
MetaGroup *window_group = NULL;
|
||||
|
||||
in_normal_tab_chain_type = window->type != META_WINDOW_DOCK && window->type != META_WINDOW_DESKTOP;
|
||||
in_normal_tab_chain = meta_window_is_focusable (window) && in_normal_tab_chain_type && !window->skip_taskbar;
|
||||
in_dock_tab_chain = meta_window_is_focusable (window) && (!in_normal_tab_chain_type || window->skip_taskbar);
|
||||
|
||||
if (window->display->focus_window)
|
||||
focus_group = window->display->focus_window->group;
|
||||
in_group_tab_chain = meta_window_is_focusable (window) && (!focus_group || meta_window_get_group (window) == focus_group);
|
||||
if (window->display->focus_window &&
|
||||
window->display->focus_window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
focus_group = meta_window_get_group (window->display->focus_window);
|
||||
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
window_group = meta_window_get_group (window);
|
||||
|
||||
in_group_tab_chain = meta_window_is_focusable (window) && (!focus_group || window_group == focus_group);
|
||||
|
||||
return (type == META_TAB_LIST_NORMAL && in_normal_tab_chain)
|
||||
|| (type == META_TAB_LIST_DOCKS && in_dock_tab_chain)
|
||||
|
@ -321,9 +321,6 @@ struct _MetaWindow
|
||||
/* Managed by delete.c */
|
||||
MetaCloseDialog *close_dialog;
|
||||
|
||||
/* maintained by group.c */
|
||||
MetaGroup *group;
|
||||
|
||||
GObject *compositor_private;
|
||||
|
||||
/* Focused window that is (directly or indirectly) attached to this one */
|
||||
|
@ -1453,9 +1453,13 @@ meta_window_unmanage (MetaWindow *window,
|
||||
*/
|
||||
|
||||
meta_stack_freeze (window->display->stack);
|
||||
group = meta_window_get_group (window);
|
||||
if (group)
|
||||
meta_group_update_layers (group);
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
group = meta_window_get_group (window);
|
||||
if (group)
|
||||
meta_group_update_layers (group);
|
||||
}
|
||||
|
||||
meta_stack_thaw (window->display->stack);
|
||||
}
|
||||
|
||||
@ -1463,7 +1467,8 @@ meta_window_unmanage (MetaWindow *window,
|
||||
|
||||
/* safe to do this early as group.c won't re-add to the
|
||||
* group if window->unmanaging */
|
||||
meta_window_shutdown_group (window);
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
meta_window_shutdown_group (window);
|
||||
|
||||
/* If we have the focus, focus some other window.
|
||||
* This is done first, so that if the unmap causes
|
||||
@ -4458,7 +4463,7 @@ meta_window_get_titlebar_rect (MetaWindow *window,
|
||||
const char*
|
||||
meta_window_get_startup_id (MetaWindow *window)
|
||||
{
|
||||
if (window->startup_id == NULL)
|
||||
if (window->startup_id == NULL && window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
{
|
||||
MetaGroup *group;
|
||||
|
||||
@ -6114,10 +6119,13 @@ meta_window_get_default_layer (MetaWindow *window)
|
||||
void
|
||||
meta_window_update_layer (MetaWindow *window)
|
||||
{
|
||||
MetaGroup *group;
|
||||
MetaGroup *group = NULL;
|
||||
|
||||
meta_stack_freeze (window->display->stack);
|
||||
group = meta_window_get_group (window);
|
||||
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||
group = meta_window_get_group (window);
|
||||
|
||||
if (group)
|
||||
meta_group_update_layers (group);
|
||||
else
|
||||
|
@ -135,10 +135,16 @@ meta_group_unref (MetaGroup *group)
|
||||
MetaGroup*
|
||||
meta_window_get_group (MetaWindow *window)
|
||||
{
|
||||
MetaWindowX11 *window_x11;
|
||||
MetaWindowX11Private *priv;
|
||||
|
||||
if (window->unmanaging)
|
||||
return NULL;
|
||||
|
||||
return window->group;
|
||||
window_x11 = META_WINDOW_X11 (window);
|
||||
priv = meta_window_x11_get_private (window_x11);
|
||||
|
||||
return priv->group;
|
||||
}
|
||||
|
||||
void
|
||||
@ -148,6 +154,8 @@ meta_window_compute_group (MetaWindow *window)
|
||||
MetaWindow *ancestor;
|
||||
MetaX11Display *x11_display = window->display->x11_display;
|
||||
Window win_leader = meta_window_x11_get_xgroup_leader (window);
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
|
||||
/* use window->xwindow if no window->xgroup_leader */
|
||||
|
||||
@ -159,7 +167,7 @@ meta_window_compute_group (MetaWindow *window)
|
||||
if (x11_display->groups_by_leader)
|
||||
{
|
||||
if (ancestor != window)
|
||||
group = ancestor->group;
|
||||
group = meta_window_get_group (ancestor);
|
||||
else if (win_leader != None)
|
||||
group = g_hash_table_lookup (x11_display->groups_by_leader,
|
||||
&win_leader);
|
||||
@ -173,7 +181,7 @@ meta_window_compute_group (MetaWindow *window)
|
||||
|
||||
if (group != NULL)
|
||||
{
|
||||
window->group = group;
|
||||
priv->group = group;
|
||||
group->refcount += 1;
|
||||
}
|
||||
else
|
||||
@ -190,13 +198,13 @@ meta_window_compute_group (MetaWindow *window)
|
||||
group = meta_group_new (x11_display,
|
||||
meta_window_x11_get_xwindow (window));
|
||||
|
||||
window->group = group;
|
||||
priv->group = group;
|
||||
}
|
||||
|
||||
if (!window->group)
|
||||
if (!priv->group)
|
||||
return;
|
||||
|
||||
window->group->windows = g_slist_prepend (window->group->windows, window);
|
||||
priv->group->windows = g_slist_prepend (priv->group->windows, window);
|
||||
|
||||
meta_topic (META_DEBUG_GROUPS,
|
||||
"Adding %s to group with leader 0x%lx",
|
||||
@ -206,17 +214,20 @@ meta_window_compute_group (MetaWindow *window)
|
||||
static void
|
||||
remove_window_from_group (MetaWindow *window)
|
||||
{
|
||||
if (window->group != NULL)
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
|
||||
if (priv->group != NULL)
|
||||
{
|
||||
meta_topic (META_DEBUG_GROUPS,
|
||||
"Removing %s from group with leader 0x%lx",
|
||||
window->desc, window->group->group_leader);
|
||||
window->desc, priv->group->group_leader);
|
||||
|
||||
window->group->windows =
|
||||
g_slist_remove (window->group->windows,
|
||||
priv->group->windows =
|
||||
g_slist_remove (priv->group->windows,
|
||||
window);
|
||||
meta_group_unref (window->group);
|
||||
window->group = NULL;
|
||||
meta_group_unref (priv->group);
|
||||
priv->group = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,9 @@ struct _MetaWindowX11Private
|
||||
/* Bypass compositor hints */
|
||||
MetaBypassCompositorHint bypass_compositor;
|
||||
|
||||
/* maintained by group.c */
|
||||
MetaGroup *group;
|
||||
|
||||
MetaSyncCounter sync_counter;
|
||||
};
|
||||
|
||||
|
@ -557,7 +557,7 @@ meta_window_x11_manage (MetaWindow *window)
|
||||
window);
|
||||
|
||||
/* assign the window to its group, or create a new group if needed */
|
||||
window->group = NULL;
|
||||
priv->group = NULL;
|
||||
priv->xgroup_leader = None;
|
||||
meta_window_compute_group (window);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user