mirror of
https://github.com/elementary/gala.git
synced 2024-09-11 15:15:39 +03:00
Multitasking view: Respect animations key (#1656)
This commit is contained in:
parent
10e70a8a49
commit
5b4acc7bec
@ -231,12 +231,8 @@ namespace Gala {
|
||||
* the group.
|
||||
*/
|
||||
public void add_window (Meta.Window window, bool no_redraw = false, bool temporary = false) {
|
||||
var new_window = new WindowIconActor (window);
|
||||
|
||||
new_window.save_easing_state ();
|
||||
new_window.set_easing_duration (0);
|
||||
var new_window = new WindowIconActor (wm, window);
|
||||
new_window.set_position (32, 32);
|
||||
new_window.restore_easing_state ();
|
||||
new_window.temporary = temporary;
|
||||
|
||||
icon_container.add_child (new_window);
|
||||
@ -251,25 +247,28 @@ namespace Gala {
|
||||
* @param animate Whether to fade the icon out before removing it
|
||||
*/
|
||||
public void remove_window (Meta.Window window, bool animate = true) {
|
||||
foreach (var child in icon_container.get_children ()) {
|
||||
unowned WindowIconActor w = (WindowIconActor) child;
|
||||
if (w.window == window) {
|
||||
foreach (unowned var child in icon_container.get_children ()) {
|
||||
unowned var icon = (WindowIconActor) child;
|
||||
if (icon.window == window) {
|
||||
if (animate) {
|
||||
w.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
w.set_easing_duration (200);
|
||||
w.opacity = 0;
|
||||
icon.save_easing_state ();
|
||||
icon.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
icon.set_easing_duration (wm.enable_animations ? 200 : 0);
|
||||
icon.opacity = 0;
|
||||
icon.restore_easing_state ();
|
||||
|
||||
var transition = w.get_transition ("opacity");
|
||||
var transition = icon.get_transition ("opacity");
|
||||
if (transition != null) {
|
||||
transition.completed.connect (() => {
|
||||
w.destroy ();
|
||||
icon.destroy ();
|
||||
});
|
||||
} else {
|
||||
w.destroy ();
|
||||
icon.destroy ();
|
||||
}
|
||||
|
||||
} else
|
||||
w.destroy ();
|
||||
} else {
|
||||
icon.destroy ();
|
||||
}
|
||||
|
||||
// don't break here! If people spam hover events and we animate
|
||||
// removal, we can actually multiple instances of the same window icon
|
||||
|
@ -25,6 +25,8 @@ namespace Gala {
|
||||
public const int SPACING = 48;
|
||||
public const int GROUP_WIDTH = 64;
|
||||
|
||||
public WindowManager wm { get; construct; }
|
||||
|
||||
public signal void request_reposition (bool animate);
|
||||
|
||||
private float _scale_factor = 1.0f;
|
||||
@ -40,8 +42,8 @@ namespace Gala {
|
||||
}
|
||||
}
|
||||
|
||||
public IconGroupContainer (float scale) {
|
||||
Object (scale_factor: scale);
|
||||
public IconGroupContainer (WindowManager wm, float scale) {
|
||||
Object (wm: wm, scale_factor: scale);
|
||||
|
||||
layout_manager = new Clutter.BoxLayout ();
|
||||
}
|
||||
@ -60,7 +62,7 @@ namespace Gala {
|
||||
|
||||
insert_child_at_index (group, index * 2);
|
||||
|
||||
var thumb = new WorkspaceInsertThumb (index, scale_factor);
|
||||
var thumb = new WorkspaceInsertThumb (wm, index, scale_factor);
|
||||
thumb.notify["expanded"].connect_after (expanded_changed);
|
||||
insert_child_at_index (thumb, index * 2);
|
||||
|
||||
|
@ -42,7 +42,6 @@ namespace Gala {
|
||||
reactive = true;
|
||||
|
||||
background = new BackgroundManager (display, monitor, false);
|
||||
background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
|
||||
window_container = new WindowCloneContainer (wm, gesture_tracker);
|
||||
window_container.window_selected.connect ((w) => { window_selected (w); });
|
||||
|
@ -72,7 +72,7 @@ namespace Gala {
|
||||
workspaces = new Clutter.Actor ();
|
||||
workspaces.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
|
||||
icon_groups = new IconGroupContainer (display.get_monitor_scale (display.get_primary_monitor ()));
|
||||
icon_groups = new IconGroupContainer (wm, display.get_monitor_scale (display.get_primary_monitor ()));
|
||||
|
||||
dock_clones = new Clutter.Actor ();
|
||||
|
||||
@ -355,39 +355,54 @@ namespace Gala {
|
||||
workspaces.restore_easing_state ();
|
||||
|
||||
if (!is_nudge_animation) {
|
||||
var active_transition = new Clutter.PropertyTransition ("backdrop-opacity") {
|
||||
duration = calculated_duration,
|
||||
remove_on_complete = true
|
||||
};
|
||||
active_transition.set_from_value (active_icon_group.backdrop_opacity);
|
||||
active_transition.set_to_value (cancel_action ? 1.0f : 0.0f);
|
||||
active_icon_group.add_transition ("backdrop-opacity", active_transition);
|
||||
if (wm.enable_animations) {
|
||||
var active_transition = new Clutter.PropertyTransition ("backdrop-opacity") {
|
||||
duration = duration,
|
||||
remove_on_complete = true
|
||||
};
|
||||
active_transition.set_from_value (active_icon_group.backdrop_opacity);
|
||||
active_transition.set_to_value (cancel_action ? 1.0f : 0.0f);
|
||||
active_icon_group.add_transition ("backdrop-opacity", active_transition);
|
||||
|
||||
var target_transition = new Clutter.PropertyTransition ("backdrop-opacity") {
|
||||
duration = calculated_duration,
|
||||
remove_on_complete = true
|
||||
};
|
||||
target_transition.set_from_value (target_icon_group.backdrop_opacity);
|
||||
target_transition.set_to_value (cancel_action ? 0.0f : 1.0f);
|
||||
target_icon_group.add_transition ("backdrop-opacity", target_transition);
|
||||
var target_transition = new Clutter.PropertyTransition ("backdrop-opacity") {
|
||||
duration = duration,
|
||||
remove_on_complete = true
|
||||
};
|
||||
target_transition.set_from_value (target_icon_group.backdrop_opacity);
|
||||
target_transition.set_to_value (cancel_action ? 0.0f : 1.0f);
|
||||
target_icon_group.add_transition ("backdrop-opacity", target_transition);
|
||||
} else {
|
||||
active_icon_group.backdrop_opacity = cancel_action ? 1.0f : 0.0f;
|
||||
target_icon_group.backdrop_opacity = cancel_action ? 0.0f : 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
workspaces.get_transition ("x").completed.connect (() => {
|
||||
var transition = workspaces.get_transition ("x");
|
||||
if (transition != null) {
|
||||
transition.completed.connect (() => {
|
||||
workspace_gesture_tracker.enabled = true;
|
||||
|
||||
if (!is_nudge_animation && !cancel_action) {
|
||||
manager.get_workspace_by_index (target_workspace_index).activate (display.get_current_time ());
|
||||
update_positions (false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
workspace_gesture_tracker.enabled = true;
|
||||
|
||||
if (!is_nudge_animation && !cancel_action) {
|
||||
manager.get_workspace_by_index (target_workspace_index).activate (display.get_current_time ());
|
||||
update_positions (false);
|
||||
} else {
|
||||
// Reset easing parameters either way.
|
||||
// This stops the animation from causing touch events to "lag" behind.
|
||||
workspaces.set_easing_duration (0);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
workspace_gesture_tracker.connect_handlers (null, (owned) on_animation_update, (owned) on_animation_end);
|
||||
if (!wm.enable_animations) {
|
||||
on_animation_end (1, false, 0);
|
||||
} else {
|
||||
workspace_gesture_tracker.connect_handlers (null, (owned) on_animation_update, (owned) on_animation_end);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -415,13 +430,13 @@ namespace Gala {
|
||||
}
|
||||
|
||||
workspace_clone.save_easing_state ();
|
||||
workspace_clone.set_easing_duration (animate ? 200 : 0);
|
||||
workspace_clone.set_easing_duration ((animate && wm.enable_animations) ? 200 : 0);
|
||||
workspace_clone.x = dest_x;
|
||||
workspace_clone.restore_easing_state ();
|
||||
}
|
||||
|
||||
workspaces.save_easing_state ();
|
||||
workspaces.set_easing_duration (animate ? AnimationDuration.WORKSPACE_SWITCH_MIN : 0);
|
||||
workspaces.set_easing_duration ((animate && wm.enable_animations) ? AnimationDuration.WORKSPACE_SWITCH_MIN : 0);
|
||||
workspaces.x = -active_x;
|
||||
workspaces.restore_easing_state ();
|
||||
|
||||
@ -629,6 +644,11 @@ namespace Gala {
|
||||
return;
|
||||
}
|
||||
|
||||
// we don't want to handle cancel animation when animation are off
|
||||
if (is_cancel_animation && !wm.enable_animations) {
|
||||
return;
|
||||
}
|
||||
|
||||
animating = true;
|
||||
|
||||
opened = !opened;
|
||||
@ -769,9 +789,7 @@ namespace Gala {
|
||||
var clone = new SafeWindowClone (window, true);
|
||||
dock_clones.add_child (clone);
|
||||
|
||||
GestureTracker.OnBegin on_animation_begin = () => {
|
||||
clone.set_position (initial_x, initial_y);
|
||||
};
|
||||
clone.set_position (initial_x, initial_y);
|
||||
|
||||
GestureTracker.OnUpdate on_animation_update = (percentage) => {
|
||||
var y = GestureTracker.animation_value (initial_y, target_y, percentage);
|
||||
@ -785,16 +803,15 @@ namespace Gala {
|
||||
|
||||
clone.save_easing_state ();
|
||||
clone.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
clone.set_easing_duration (is_cancel_animation ? 0 : ANIMATION_DURATION);
|
||||
clone.set_easing_duration ((!is_cancel_animation && wm.enable_animations) ? ANIMATION_DURATION : 0);
|
||||
clone.y = target_y;
|
||||
clone.restore_easing_state ();
|
||||
};
|
||||
|
||||
if (!with_gesture) {
|
||||
on_animation_begin (0);
|
||||
if (!with_gesture || !wm.enable_animations) {
|
||||
on_animation_end (1, false, 0);
|
||||
} else {
|
||||
multitasking_gesture_tracker.connect_handlers ((owned) on_animation_begin, (owned) on_animation_update, (owned) on_animation_end);
|
||||
multitasking_gesture_tracker.connect_handlers (null, (owned) on_animation_update, (owned) on_animation_end);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -805,10 +822,6 @@ namespace Gala {
|
||||
var initial_y = dock.y;
|
||||
var target_y = dock.source.y;
|
||||
|
||||
GestureTracker.OnBegin on_animation_begin = () => {
|
||||
dock.set_easing_duration (0);
|
||||
};
|
||||
|
||||
GestureTracker.OnUpdate on_animation_update = (percentage) => {
|
||||
var y = GestureTracker.animation_value (initial_y, target_y, percentage);
|
||||
dock.y = y;
|
||||
@ -820,16 +833,16 @@ namespace Gala {
|
||||
}
|
||||
|
||||
dock.save_easing_state ();
|
||||
dock.set_easing_duration (ANIMATION_DURATION);
|
||||
dock.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
dock.set_easing_duration (wm.enable_animations ? ANIMATION_DURATION : 0);
|
||||
dock.y = target_y;
|
||||
dock.restore_easing_state ();
|
||||
};
|
||||
|
||||
if (!with_gesture) {
|
||||
if (!with_gesture || !wm.enable_animations) {
|
||||
on_animation_end (1, false, 0);
|
||||
} else {
|
||||
multitasking_gesture_tracker.connect_handlers ((owned) on_animation_begin, (owned) on_animation_update, (owned) on_animation_end);
|
||||
multitasking_gesture_tracker.connect_handlers (null, (owned) on_animation_update, (owned) on_animation_end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
public bool active {
|
||||
set {
|
||||
active_shape.save_easing_state ();
|
||||
active_shape.set_easing_duration (FADE_ANIMATION_DURATION);
|
||||
active_shape.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
active_shape.opacity = value ? 255 : 0;
|
||||
active_shape.restore_easing_state ();
|
||||
|
||||
@ -286,9 +286,11 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
return;
|
||||
}
|
||||
|
||||
var duration = (animate && wm.enable_animations) ? MultitaskingView.ANIMATION_DURATION : 0;
|
||||
|
||||
save_easing_state ();
|
||||
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
set_easing_duration (animate ? MultitaskingView.ANIMATION_DURATION : 0);
|
||||
set_easing_duration (duration);
|
||||
|
||||
set_position (target_x, target_y);
|
||||
set_size (outer_rect.width, outer_rect.height);
|
||||
@ -305,7 +307,7 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
|
||||
window_icon.save_easing_state ();
|
||||
window_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
window_icon.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
window_icon.set_easing_duration (duration);
|
||||
window_icon.opacity = 0;
|
||||
set_window_icon_position (outer_rect.width, outer_rect.height);
|
||||
window_icon.restore_easing_state ();
|
||||
@ -322,7 +324,7 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
}
|
||||
};
|
||||
|
||||
if (!animate || gesture_tracker == null || !with_gesture) {
|
||||
if (!animate || gesture_tracker == null || !with_gesture || !wm.enable_animations) {
|
||||
on_animation_end (1, false, 0);
|
||||
} else {
|
||||
gesture_tracker.connect_handlers (null, (owned) on_animation_update, (owned) on_animation_end);
|
||||
@ -364,39 +366,39 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
return;
|
||||
}
|
||||
|
||||
var duration = wm.enable_animations ? MultitaskingView.ANIMATION_DURATION : 0;
|
||||
|
||||
save_easing_state ();
|
||||
set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
set_easing_duration (duration);
|
||||
|
||||
set_size (rect.width, rect.height);
|
||||
set_position (rect.x, rect.y);
|
||||
opacity = 255;
|
||||
restore_easing_state ();
|
||||
|
||||
window_icon.save_easing_state ();
|
||||
window_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
window_icon.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
window_icon.set_easing_duration (duration);
|
||||
window_icon.opacity = 255;
|
||||
set_window_icon_position (rect.width, rect.height);
|
||||
window_icon.restore_easing_state ();
|
||||
|
||||
toggle_shadow (true);
|
||||
|
||||
if (opacity < 255) {
|
||||
save_easing_state ();
|
||||
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
set_easing_duration (300);
|
||||
|
||||
opacity = 255;
|
||||
restore_easing_state ();
|
||||
}
|
||||
|
||||
window_icon.get_transition ("opacity").completed.connect (() => {
|
||||
var transition = window_icon.get_transition ("opacity");
|
||||
if (transition != null) {
|
||||
transition.completed.connect (() => {
|
||||
in_slot_animation = false;
|
||||
place_widgets (rect.width, rect.height);
|
||||
});
|
||||
} else {
|
||||
in_slot_animation = false;
|
||||
place_widgets (rect.width, rect.height);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (gesture_tracker == null || !with_gesture) {
|
||||
if (gesture_tracker == null || !with_gesture || !wm.enable_animations) {
|
||||
on_animation_end (1, false, 0);
|
||||
} else {
|
||||
gesture_tracker.connect_handlers (null, (owned) on_animation_update, (owned) on_animation_end);
|
||||
@ -441,15 +443,17 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
var duration = wm.enable_animations ? FADE_ANIMATION_DURATION : 0;
|
||||
|
||||
close_button.save_easing_state ();
|
||||
close_button.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
close_button.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
close_button.set_easing_duration (duration);
|
||||
close_button.opacity = in_slot_animation ? 0 : 255;
|
||||
close_button.restore_easing_state ();
|
||||
|
||||
window_title.save_easing_state ();
|
||||
window_title.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
window_title.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
window_title.set_easing_duration (duration);
|
||||
window_title.opacity = in_slot_animation ? 0 : 255;
|
||||
window_title.restore_easing_state ();
|
||||
|
||||
@ -457,15 +461,17 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
}
|
||||
|
||||
public override bool leave_event (Clutter.CrossingEvent event) {
|
||||
var duration = wm.enable_animations ? FADE_ANIMATION_DURATION : 0;
|
||||
|
||||
close_button.save_easing_state ();
|
||||
close_button.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
close_button.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
close_button.set_easing_duration (duration);
|
||||
close_button.opacity = 0;
|
||||
close_button.restore_easing_state ();
|
||||
|
||||
window_title.save_easing_state ();
|
||||
window_title.set_easing_mode (Clutter.AnimationMode.LINEAR);
|
||||
window_title.set_easing_duration (wm.enable_animations ? FADE_ANIMATION_DURATION : 0);
|
||||
window_title.set_easing_duration (duration);
|
||||
window_title.opacity = 0;
|
||||
window_title.restore_easing_state ();
|
||||
|
||||
@ -501,14 +507,18 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
remove_transition ("shadow-opacity");
|
||||
}
|
||||
|
||||
var shadow_transition = new Clutter.PropertyTransition ("shadow-opacity") {
|
||||
duration = MultitaskingView.ANIMATION_DURATION,
|
||||
remove_on_complete = true,
|
||||
progress_mode = Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
interval = new Clutter.Interval (typeof (uint8), shadow_opacity, show ? 255 : 0)
|
||||
};
|
||||
if (wm.enable_animations) {
|
||||
var shadow_transition = new Clutter.PropertyTransition ("shadow-opacity") {
|
||||
duration = MultitaskingView.ANIMATION_DURATION,
|
||||
remove_on_complete = true,
|
||||
progress_mode = Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
interval = new Clutter.Interval (typeof (uint8), shadow_opacity, show ? 255 : 0)
|
||||
};
|
||||
|
||||
add_transition ("shadow-opacity", shadow_transition);
|
||||
add_transition ("shadow-opacity", shadow_transition);
|
||||
} else {
|
||||
shadow_opacity = show ? 255 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -589,26 +599,25 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
active_shape.hide ();
|
||||
|
||||
var scale = window_icon.width / clone.width;
|
||||
var duration = wm.enable_animations ? FADE_ANIMATION_DURATION : 0;
|
||||
|
||||
clone.get_transformed_position (out abs_x, out abs_y);
|
||||
clone.save_easing_state ();
|
||||
clone.set_easing_duration (FADE_ANIMATION_DURATION);
|
||||
clone.set_easing_duration (duration);
|
||||
clone.set_easing_mode (Clutter.AnimationMode.EASE_IN_CUBIC);
|
||||
clone.set_pivot_point ((click_x - abs_x) / clone.width, (click_y - abs_y) / clone.height);
|
||||
clone.set_scale (scale, scale);
|
||||
clone.opacity = 0;
|
||||
clone.set_pivot_point ((click_x - abs_x) / clone.width, (click_y - abs_y) / clone.height);
|
||||
clone.restore_easing_state ();
|
||||
|
||||
request_reposition ();
|
||||
|
||||
get_transformed_position (out abs_x, out abs_y);
|
||||
|
||||
save_easing_state ();
|
||||
set_easing_duration (0);
|
||||
set_position (abs_x + prev_parent_x, abs_y + prev_parent_y);
|
||||
|
||||
window_icon.save_easing_state ();
|
||||
window_icon.set_easing_duration (FADE_ANIMATION_DURATION);
|
||||
window_icon.set_easing_duration (duration);
|
||||
window_icon.set_easing_mode (Clutter.AnimationMode.EASE_IN_OUT_CUBIC);
|
||||
window_icon.set_position (click_x - (abs_x + prev_parent_x) - window_icon.width / 2,
|
||||
click_y - (abs_y + prev_parent_y) - window_icon.height / 2);
|
||||
@ -645,6 +654,7 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
var scale = hovered ? 0.4 : 1.0;
|
||||
var opacity = hovered ? 0 : 255;
|
||||
var duration = hovered && insert_thumb != null ? insert_thumb.delay : 100;
|
||||
duration = wm.enable_animations ? duration : 0;
|
||||
|
||||
window_icon.save_easing_state ();
|
||||
|
||||
@ -748,9 +758,11 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
get_parent ().remove_child (this);
|
||||
prev_parent.insert_child_at_index (this, prev_index);
|
||||
|
||||
clone.save_easing_state ();
|
||||
var duration = wm.enable_animations ? MultitaskingView.ANIMATION_DURATION : 0;
|
||||
|
||||
clone.set_pivot_point (0.0f, 0.0f);
|
||||
clone.set_easing_duration (250);
|
||||
clone.save_easing_state ();
|
||||
clone.set_easing_duration (duration);
|
||||
clone.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
clone.set_scale (1, 1);
|
||||
clone.opacity = 255;
|
||||
@ -758,11 +770,8 @@ public class Gala.WindowClone : Clutter.Actor {
|
||||
|
||||
request_reposition ();
|
||||
|
||||
// pop 0 animation duration from drag_begin()
|
||||
restore_easing_state ();
|
||||
|
||||
window_icon.save_easing_state ();
|
||||
window_icon.set_easing_duration (250);
|
||||
window_icon.set_easing_duration (duration);
|
||||
window_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
set_window_icon_position (slot.width, slot.height);
|
||||
window_icon.restore_easing_state ();
|
||||
|
@ -190,7 +190,6 @@ namespace Gala {
|
||||
foreach (var tilable in window_positions) {
|
||||
unowned var clone = (WindowClone) tilable.id;
|
||||
clone.take_slot (tilable.rect, with_gesture, is_cancel_animation);
|
||||
clone.place_widgets (tilable.rect.width, tilable.rect.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ namespace Gala {
|
||||
*/
|
||||
public class WindowIconActor : Clutter.Actor {
|
||||
public Meta.Window window { get; construct; }
|
||||
public WindowManager wm { get; construct; }
|
||||
|
||||
private float cur_icon_scale = 1.0f;
|
||||
private float desired_icon_scale = 1.0f;
|
||||
@ -64,7 +65,7 @@ namespace Gala {
|
||||
set {
|
||||
if (_temporary && !value) {
|
||||
remove_transition ("pulse");
|
||||
} else if (!_temporary && value) {
|
||||
} else if (!_temporary && value && wm.enable_animations) {
|
||||
var transition = new Clutter.TransitionGroup () {
|
||||
duration = 800,
|
||||
auto_reverse = true,
|
||||
@ -98,19 +99,15 @@ namespace Gala {
|
||||
}
|
||||
}
|
||||
|
||||
private bool initial = true;
|
||||
|
||||
private WindowIcon? icon = null;
|
||||
private WindowIcon? old_icon = null;
|
||||
|
||||
public WindowIconActor (Meta.Window window) {
|
||||
Object (window: window);
|
||||
public WindowIconActor (WindowManager wm, Meta.Window window) {
|
||||
Object (wm: wm, window: window);
|
||||
}
|
||||
|
||||
construct {
|
||||
set_pivot_point (0.5f, 0.5f);
|
||||
set_easing_mode (Clutter.AnimationMode.EASE_OUT_ELASTIC);
|
||||
set_easing_duration (800);
|
||||
|
||||
window.notify["on-all-workspaces"].connect (on_all_workspaces_changed);
|
||||
}
|
||||
@ -133,19 +130,9 @@ namespace Gala {
|
||||
* @param size The size to which to animate to and display the icon in
|
||||
*/
|
||||
public void place (float x, float y, int size, float scale) {
|
||||
if (initial) {
|
||||
save_easing_state ();
|
||||
set_easing_duration (10);
|
||||
}
|
||||
|
||||
desired_icon_scale = scale;
|
||||
set_position (x, y);
|
||||
icon_size = size;
|
||||
|
||||
if (initial) {
|
||||
restore_easing_state ();
|
||||
initial = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,8 +145,10 @@ namespace Gala {
|
||||
|
||||
add_child (new_icon);
|
||||
|
||||
new_icon.save_easing_state ();
|
||||
new_icon.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
new_icon.set_easing_duration (500);
|
||||
new_icon.set_easing_duration (wm.enable_animations ? 500 : 0);
|
||||
new_icon.restore_easing_state ();
|
||||
|
||||
if (icon == null) {
|
||||
icon = new_icon;
|
||||
|
@ -340,7 +340,7 @@ namespace Gala {
|
||||
|
||||
window_container.restack_windows ();
|
||||
|
||||
var display = workspace.get_display ();
|
||||
unowned var display = workspace.get_display ();
|
||||
|
||||
var monitor = display.get_monitor_geometry (display.get_primary_monitor ());
|
||||
var initial_x = is_cancel_animation ? x : x + current_x_overlap ();
|
||||
@ -360,7 +360,7 @@ namespace Gala {
|
||||
var x = GestureTracker.animation_value (initial_x, target_x, percentage);
|
||||
set_x (x);
|
||||
|
||||
double update_scale = (double) GestureTracker.animation_value (1.0f, (float)scale, percentage);
|
||||
var update_scale = (double) GestureTracker.animation_value (1.0f, (float)scale, percentage);
|
||||
background.set_scale (update_scale, update_scale);
|
||||
};
|
||||
|
||||
@ -370,19 +370,19 @@ namespace Gala {
|
||||
}
|
||||
|
||||
save_easing_state ();
|
||||
set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
set_easing_duration (wm.enable_animations ? MultitaskingView.ANIMATION_DURATION : 0);
|
||||
set_x (target_x);
|
||||
restore_easing_state ();
|
||||
|
||||
background.save_easing_state ();
|
||||
background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
background.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
background.set_easing_duration (wm.enable_animations ? MultitaskingView.ANIMATION_DURATION : 0);
|
||||
background.set_scale (scale, scale);
|
||||
background.restore_easing_state ();
|
||||
};
|
||||
|
||||
if (!with_gesture) {
|
||||
if (!with_gesture || !wm.enable_animations) {
|
||||
on_animation_begin (0);
|
||||
on_animation_end (1, false, 0);
|
||||
} else {
|
||||
@ -442,19 +442,19 @@ namespace Gala {
|
||||
}
|
||||
|
||||
save_easing_state ();
|
||||
set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
set_easing_duration (wm.enable_animations ? MultitaskingView.ANIMATION_DURATION : 0);
|
||||
set_x (target_x);
|
||||
restore_easing_state ();
|
||||
|
||||
background.save_easing_state ();
|
||||
background.set_easing_duration (MultitaskingView.ANIMATION_DURATION);
|
||||
background.set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
background.set_easing_duration (wm.enable_animations ? MultitaskingView.ANIMATION_DURATION : 0);
|
||||
background.set_scale (1, 1);
|
||||
background.restore_easing_state ();
|
||||
};
|
||||
|
||||
if (!with_gesture) {
|
||||
if (!with_gesture || !wm.enable_animations) {
|
||||
on_animation_end (1, false, 0);
|
||||
} else {
|
||||
gesture_tracker.connect_handlers (null, (owned) on_animation_update, (owned) on_animation_end);
|
||||
|
@ -7,6 +7,8 @@
|
||||
public class Gala.WorkspaceInsertThumb : Clutter.Actor {
|
||||
public const int EXPAND_DELAY = 300;
|
||||
|
||||
public WindowManager wm { get; construct; }
|
||||
|
||||
public int workspace_index { get; construct set; }
|
||||
public bool expanded { get; set; default = false; }
|
||||
public int delay { get; set; default = EXPAND_DELAY; }
|
||||
@ -25,8 +27,8 @@ public class Gala.WorkspaceInsertThumb : Clutter.Actor {
|
||||
|
||||
private uint expand_timeout = 0;
|
||||
|
||||
public WorkspaceInsertThumb (int workspace_index, float scale) {
|
||||
Object (workspace_index: workspace_index, scale_factor: scale);
|
||||
public WorkspaceInsertThumb (WindowManager wm, int workspace_index, float scale) {
|
||||
Object (wm: wm, workspace_index: workspace_index, scale_factor: scale);
|
||||
|
||||
reallocate ();
|
||||
opacity = 0;
|
||||
@ -82,7 +84,7 @@ public class Gala.WorkspaceInsertThumb : Clutter.Actor {
|
||||
private new void transform (bool expand) {
|
||||
save_easing_state ();
|
||||
set_easing_mode (Clutter.AnimationMode.EASE_OUT_QUAD);
|
||||
set_easing_duration (200);
|
||||
set_easing_duration (wm.enable_animations ? 200 : 0);
|
||||
|
||||
if (!expand) {
|
||||
remove_transition ("pulse");
|
||||
@ -100,6 +102,10 @@ public class Gala.WorkspaceInsertThumb : Clutter.Actor {
|
||||
}
|
||||
|
||||
private void add_pulse_animation () {
|
||||
if (!wm.enable_animations) {
|
||||
return;
|
||||
}
|
||||
|
||||
var transition = new Clutter.TransitionGroup () {
|
||||
duration = 800,
|
||||
auto_reverse = true,
|
||||
|
Loading…
Reference in New Issue
Block a user