plugins/default: Fix broken switch_workspace()
Swap which windows are switched with which in the workspace switching animation of the default plugin since this was backwards (resulting in failures), but animate only those which are on either the current workspace or the one to switch to. Have the animation span the entire screen as intended. Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2038 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2076>
This commit is contained in:
parent
f04f5d70e6
commit
888e69d3a4
@ -503,11 +503,16 @@ switch_workspace (MetaPlugin *plugin,
|
|||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
|
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
|
||||||
GList *l;
|
GList *l;
|
||||||
ClutterActor *workspace0 = clutter_actor_new ();
|
|
||||||
ClutterActor *workspace1 = clutter_actor_new ();
|
|
||||||
ClutterActor *stage;
|
ClutterActor *stage;
|
||||||
|
ClutterActor *workspace1, *workspace2;
|
||||||
int screen_width, screen_height;
|
int screen_width, screen_height;
|
||||||
|
|
||||||
|
if (from == to)
|
||||||
|
{
|
||||||
|
meta_plugin_switch_workspace_completed (plugin);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
display = meta_plugin_get_display (plugin);
|
display = meta_plugin_get_display (plugin);
|
||||||
stage = meta_get_stage_for_display (display);
|
stage = meta_get_stage_for_display (display);
|
||||||
|
|
||||||
@ -515,66 +520,70 @@ switch_workspace (MetaPlugin *plugin,
|
|||||||
&screen_width,
|
&screen_width,
|
||||||
&screen_height);
|
&screen_height);
|
||||||
|
|
||||||
|
workspace1 = clutter_actor_new ();
|
||||||
|
workspace2 = clutter_actor_new ();
|
||||||
|
|
||||||
clutter_actor_set_pivot_point (workspace1, 1.0, 1.0);
|
clutter_actor_set_pivot_point (workspace1, 1.0, 1.0);
|
||||||
clutter_actor_set_position (workspace1,
|
clutter_actor_set_size (workspace1,
|
||||||
screen_width,
|
screen_width,
|
||||||
screen_height);
|
screen_height);
|
||||||
|
clutter_actor_set_size (workspace2,
|
||||||
|
screen_width,
|
||||||
|
screen_height);
|
||||||
|
|
||||||
clutter_actor_set_scale (workspace1, 0.0, 0.0);
|
clutter_actor_set_scale (workspace1, 0.0, 0.0);
|
||||||
|
|
||||||
clutter_actor_add_child (stage, workspace1);
|
clutter_actor_add_child (stage, workspace1);
|
||||||
clutter_actor_add_child (stage, workspace0);
|
clutter_actor_add_child (stage, workspace2);
|
||||||
|
|
||||||
if (from == to)
|
for (l = g_list_last (meta_get_window_actors (display)); l; l = l->prev)
|
||||||
{
|
|
||||||
meta_plugin_switch_workspace_completed (plugin);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
l = g_list_last (meta_get_window_actors (display));
|
|
||||||
|
|
||||||
while (l)
|
|
||||||
{
|
{
|
||||||
MetaWindowActor *window_actor = l->data;
|
MetaWindowActor *window_actor = l->data;
|
||||||
ActorPrivate *apriv = get_actor_private (window_actor);
|
ActorPrivate *apriv = get_actor_private (window_actor);
|
||||||
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
|
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
|
||||||
MetaWorkspace *workspace;
|
MetaWindow *window;
|
||||||
gint win_workspace;
|
|
||||||
|
|
||||||
workspace = meta_window_get_workspace (meta_window_actor_get_meta_window (window_actor));
|
window = meta_window_actor_get_meta_window (window_actor);
|
||||||
win_workspace = meta_workspace_index (workspace);
|
|
||||||
|
|
||||||
if (win_workspace == to || win_workspace == from)
|
if (meta_window_is_on_all_workspaces (window))
|
||||||
{
|
|
||||||
ClutterActor *parent = win_workspace == to ? workspace1 : workspace0;
|
|
||||||
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_show (actor);
|
|
||||||
clutter_actor_set_child_below_sibling (parent, actor, NULL);
|
|
||||||
g_object_unref (actor);
|
|
||||||
}
|
|
||||||
else if (win_workspace < 0)
|
|
||||||
{
|
{
|
||||||
/* Sticky window */
|
/* Sticky window */
|
||||||
apriv->orig_parent = NULL;
|
apriv->orig_parent = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Window on some other desktop */
|
MetaWorkspace *workspace;
|
||||||
clutter_actor_hide (actor);
|
gint win_workspace;
|
||||||
apriv->orig_parent = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
l = l->prev;
|
workspace = meta_window_get_workspace (window);
|
||||||
|
win_workspace = 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);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->desktop1 = workspace0;
|
priv->desktop1 = workspace1;
|
||||||
priv->desktop2 = workspace1;
|
priv->desktop2 = workspace2;
|
||||||
|
|
||||||
priv->tml_switch_workspace1 = actor_animate (workspace0, CLUTTER_EASE_IN_SINE,
|
priv->tml_switch_workspace1 = actor_animate (workspace1, CLUTTER_EASE_IN_SINE,
|
||||||
ANIMATION_SWITCH,
|
ANIMATION_SWITCH,
|
||||||
"scale-x", 1.0,
|
"scale-x", 1.0,
|
||||||
"scale-y", 1.0,
|
"scale-y", 1.0,
|
||||||
@ -584,7 +593,7 @@ switch_workspace (MetaPlugin *plugin,
|
|||||||
G_CALLBACK (on_switch_workspace_effect_complete),
|
G_CALLBACK (on_switch_workspace_effect_complete),
|
||||||
plugin);
|
plugin);
|
||||||
|
|
||||||
priv->tml_switch_workspace2 = actor_animate (workspace1, CLUTTER_EASE_IN_SINE,
|
priv->tml_switch_workspace2 = actor_animate (workspace2, CLUTTER_EASE_IN_SINE,
|
||||||
ANIMATION_SWITCH,
|
ANIMATION_SWITCH,
|
||||||
"scale-x", 0.0,
|
"scale-x", 0.0,
|
||||||
"scale-y", 0.0,
|
"scale-y", 0.0,
|
||||||
|
Loading…
Reference in New Issue
Block a user