fix jumping when exiting too early

This commit is contained in:
Tom Beckmann 2015-03-03 20:07:17 +00:00
parent 2294965136
commit 1aa57baa72
3 changed files with 24 additions and 20 deletions

View File

@ -27,7 +27,7 @@ namespace Gala
*/ */
public class MultitaskingView : Actor, ActivatableComponent public class MultitaskingView : Actor, ActivatableComponent
{ {
const int HIDING_DURATION = 300; public const int ANIMATION_DURATION = 250;
const int SMOOTH_SCROLL_DELAY = 500; const int SMOOTH_SCROLL_DELAY = 500;
public WindowManager wm { get; construct; } public WindowManager wm { get; construct; }
@ -226,11 +226,14 @@ namespace Gala
workspace_clone.active = false; workspace_clone.active = false;
} }
workspace_clone.save_easing_state ();
workspace_clone.set_easing_duration (animate ? 200 : 0); workspace_clone.set_easing_duration (animate ? 200 : 0);
workspace_clone.x = dest_x; workspace_clone.x = dest_x;
workspace_clone.restore_easing_state ();
} }
workspaces.set_easing_duration (animate ? 300 : 0); workspaces.set_easing_duration (animate ?
AnimationSettings.get_default ().workspace_switch_duration : 0);
workspaces.x = -active_x; workspaces.x = -active_x;
reposition_icon_groups (animate); reposition_icon_groups (animate);
@ -473,6 +476,11 @@ namespace Gala
if (active_workspace != null) if (active_workspace != null)
workspaces.set_child_above_sibling (active_workspace, null); workspaces.set_child_above_sibling (active_workspace, null);
workspaces.remove_all_transitions ();
foreach (var child in workspaces.get_children ()) {
child.remove_all_transitions ();
}
update_positions (false); update_positions (false);
foreach (var child in workspaces.get_children ()) { foreach (var child in workspaces.get_children ()) {
@ -484,7 +492,8 @@ namespace Gala
} }
if (!opening) { if (!opening) {
Timeout.add (290, () => {
Timeout.add (ANIMATION_DURATION, () => {
foreach (var container in window_containers_monitors) { foreach (var container in window_containers_monitors) {
container.visible = false; container.visible = false;
} }
@ -502,7 +511,7 @@ namespace Gala
return false; return false;
}); });
} else { } else {
Timeout.add (200, () => { Timeout.add (ANIMATION_DURATION, () => {
animating = false; animating = false;
return false; return false;
}); });

View File

@ -276,24 +276,17 @@ namespace Gala
var outer_rect = window.get_outer_rect (); var outer_rect = window.get_outer_rect ();
#endif #endif
float offset_x = 0, offset_y = 0; var monitor_geom = window.get_screen ().get_monitor_geometry (window.get_monitor ());
var offset_x = monitor_geom.x;
var parent = get_parent (); var offset_y = monitor_geom.y;
if (parent != null) {
// in overview_mode the parent has just been added to the stage, so the
// transforme position is not set yet. However, the set position is correct
// for overview anyway, so we can just use that.
if (overview_mode)
parent.get_position (out offset_x, out offset_y);
else
parent.get_transformed_position (out offset_x, out offset_y);
}
save_easing_state ();
set_easing_mode (AnimationMode.EASE_IN_OUT_CUBIC); set_easing_mode (AnimationMode.EASE_IN_OUT_CUBIC);
set_easing_duration (animate ? 300 : 0); set_easing_duration (animate ? MultitaskingView.ANIMATION_DURATION : 0);
set_position (outer_rect.x - offset_x, outer_rect.y - offset_y); set_position (outer_rect.x - offset_x, outer_rect.y - offset_y);
set_size (outer_rect.width, outer_rect.height); set_size (outer_rect.width, outer_rect.height);
restore_easing_state ();
window_icon.opacity = 0; window_icon.opacity = 0;
@ -308,13 +301,15 @@ namespace Gala
{ {
slot = rect; slot = rect;
set_easing_duration (250); save_easing_state ();
set_easing_duration (MultitaskingView.ANIMATION_DURATION);
set_easing_mode (AnimationMode.EASE_OUT_QUAD); set_easing_mode (AnimationMode.EASE_OUT_QUAD);
set_size (rect.width, rect.height); set_size (rect.width, rect.height);
set_position (rect.x, rect.y); set_position (rect.x, rect.y);
window_icon.opacity = 255; window_icon.opacity = 255;
restore_easing_state ();
// for overview mode, windows may be faded out initially. Make sure // for overview mode, windows may be faded out initially. Make sure
// to fade those in. // to fade those in.

View File

@ -298,7 +298,7 @@ namespace Gala
background.set_pivot_point (0.5f, pivotY); background.set_pivot_point (0.5f, pivotY);
background.save_easing_state (); background.save_easing_state ();
background.set_easing_duration (250); background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
background.set_easing_mode (AnimationMode.EASE_OUT_QUAD); background.set_easing_mode (AnimationMode.EASE_OUT_QUAD);
background.set_scale (scale, scale); background.set_scale (scale, scale);
background.restore_easing_state (); background.restore_easing_state ();
@ -333,7 +333,7 @@ namespace Gala
opened = false; opened = false;
background.save_easing_state (); background.save_easing_state ();
background.set_easing_duration (300); background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
background.set_easing_mode (AnimationMode.EASE_IN_OUT_CUBIC); background.set_easing_mode (AnimationMode.EASE_IN_OUT_CUBIC);
background.set_scale (1, 1); background.set_scale (1, 1);
background.restore_easing_state (); background.restore_easing_state ();