default-plugin: Handle unmanaging windows in switch_workspace

Also add a regression metatest.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2559
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2782>
This commit is contained in:
Sebastian Wick 2023-01-04 03:46:33 +01:00
parent fbe7a8df3a
commit 17c52854b7
3 changed files with 42 additions and 25 deletions

View File

@ -555,42 +555,47 @@ switch_workspace (MetaPlugin *plugin,
ActorPrivate *apriv = get_actor_private (window_actor);
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
MetaWindow *window;
MetaWorkspace *workspace;
gint workspace_idx;
window = meta_window_actor_get_meta_window (window_actor);
workspace = meta_window_get_workspace (window);
if (!workspace)
{
/* unmanaging window */
clutter_actor_hide (actor);
apriv->orig_parent = NULL;
continue;
}
if (meta_window_is_on_all_workspaces (window))
{
/* Sticky window */
apriv->orig_parent = NULL;
continue;
}
else
{
MetaWorkspace *workspace;
gint win_workspace;
workspace = meta_window_get_workspace (window);
win_workspace = meta_workspace_index (workspace);
workspace_idx = meta_workspace_index (workspace);
if (win_workspace == to || win_workspace == from)
{
ClutterActor *parent = win_workspace == to ? workspace1
: workspace2;
apriv->orig_parent = clutter_actor_get_parent (actor);
if (workspace_idx == to || workspace_idx == from)
{
ClutterActor *parent = workspace_idx == to ? workspace1
: workspace2;
apriv->orig_parent = clutter_actor_get_parent (actor);
g_object_ref (actor);
clutter_actor_remove_child (clutter_actor_get_parent (actor),
actor);
clutter_actor_add_child (parent, actor);
clutter_actor_set_child_below_sibling (parent, actor, NULL);
g_object_unref (actor);
}
else
{
/* Window on some other desktop */
clutter_actor_hide (actor);
apriv->orig_parent = NULL;
}
}
g_object_ref (actor);
clutter_actor_remove_child (clutter_actor_get_parent (actor),
actor);
clutter_actor_add_child (parent, actor);
clutter_actor_set_child_below_sibling (parent, actor, NULL);
g_object_unref (actor);
continue;
}
/* Window on some other desktop */
clutter_actor_hide (actor);
apriv->orig_parent = NULL;
}
priv->desktop1 = workspace1;

View File

@ -446,6 +446,7 @@ stacking_tests = [
'workspace-test',
'always-on-top',
'focus-default-window-globally-active-input',
'workspace-unmanaging-window',
]
foreach stacking_test: stacking_tests

View File

@ -0,0 +1,11 @@
num_workspaces 2
activate_workspace 0
new_client 1 wayland
create 1/1
show 1/1
wait
quit_client 1
activate_workspace 1
wait