Fix switching workspaces and maximizing a window distorts it (#58)

Use the previously unused maximized and unmaximized lists to keep track
of which windows are being animated. Remove animations in
end_switch_workspace to prevent window breakage.

https://bugs.launchpad.net/gala/+bug/1602722
This commit is contained in:
Felipe Escoto 2018-05-16 00:58:01 -05:00 committed by Rico Tzschichholz
parent f02b776d95
commit 60478f3281

View File

@ -119,7 +119,7 @@ namespace Gala
logind_proxy.prepare_for_sleep.connect (prepare_for_sleep);
} catch (Error e) {
warning ("Failed to get LoginD proxy: %s", e.message);
}
}
}
}
@ -857,7 +857,7 @@ namespace Gala
{
unowned AnimationSettings animation_settings = AnimationSettings.get_default ();
var duration = animation_settings.minimize_duration;
if (!animation_settings.enable_animations
|| duration == 0
|| actor.get_meta_window ().window_type != WindowType.NORMAL) {
@ -929,6 +929,8 @@ namespace Gala
return;
}
kill_window_effects (actor);
var window = actor.get_meta_window ();
if (window.window_type == WindowType.NORMAL) {
@ -942,6 +944,7 @@ namespace Gala
return;
}
maximizing.add (actor);
old_actor.set_position (old_inner_rect.x, old_inner_rect.y);
ui_group.add_child (old_actor);
@ -997,6 +1000,12 @@ namespace Gala
actor.set_scale (1.0f, 1.0f);
actor.set_translation (0.0f, 0.0f, 0.0f);
actor.restore_easing_state ();
ulong handler_id = 0UL;
handler_id = actor.transitions_completed.connect (() => {
actor.disconnect (handler_id);
maximizing.remove (actor);
});
}
}
@ -1079,7 +1088,7 @@ namespace Gala
var outer_rect = window.get_frame_rect ();
actor.set_position (outer_rect.x, outer_rect.y);
}
actor.set_pivot_point (0.5f, 1.0f);
actor.set_scale (0.01f, 0.1f);
actor.opacity = 0;
@ -1272,6 +1281,7 @@ namespace Gala
return;
}
kill_window_effects (actor);
var window = actor.get_meta_window ();
if (window.window_type == WindowType.NORMAL) {
@ -1297,6 +1307,8 @@ namespace Gala
return;
}
unmaximizing.add (actor);
old_actor.set_position (old_rect.x, old_rect.y);
ui_group.add_child (old_actor);
@ -1331,6 +1343,12 @@ namespace Gala
actor.set_scale (1.0f, 1.0f);
actor.set_translation (0.0f, 0.0f, 0.0f);
actor.restore_easing_state ();
ulong handler_id = 0UL;
handler_id = actor.transitions_completed.connect (() => {
actor.disconnect (handler_id);
unmaximizing.remove (actor);
});
}
}
@ -1363,12 +1381,11 @@ namespace Gala
unminimize_completed (actor);
if (end_animation (ref minimizing, actor))
minimize_completed (actor);
if (end_animation (ref maximizing, actor))
size_change_completed (actor);
if (end_animation (ref unmaximizing, actor))
size_change_completed (actor);
if (end_animation (ref destroying, actor))
destroy_completed (actor);
end_animation (ref unmaximizing, actor);
end_animation (ref maximizing, actor);
}
/*workspace switcher*/
@ -1611,6 +1628,8 @@ namespace Gala
if (window == null || window.is_destroyed ())
continue;
kill_window_effects (window);
var meta_window = window.get_meta_window ();
if (meta_window.get_workspace () != active_workspace
&& !meta_window.is_on_all_workspaces ())