mirror of
https://github.com/elementary/gala.git
synced 2024-11-23 11:02:18 +03:00
multitasking: Enable bump animation for mouse scroll (#1270)
This commit is contained in:
parent
9207019d80
commit
a682b59ae6
@ -203,11 +203,40 @@ namespace Gala {
|
||||
|
||||
if (active_workspace != new_workspace) {
|
||||
new_workspace.activate (display.get_current_time ());
|
||||
} else {
|
||||
play_nudge_animation (direction);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void play_nudge_animation (Meta.MotionDirection direction) {
|
||||
if (!wm.enable_animations) {
|
||||
return;
|
||||
}
|
||||
|
||||
var nudge_gap = WindowManagerGala.NUDGE_GAP * InternalUtils.get_ui_scaling_factor ();
|
||||
|
||||
float dest = nudge_gap;
|
||||
if (direction == Meta.MotionDirection.RIGHT) {
|
||||
dest *= -1;
|
||||
}
|
||||
|
||||
double[] keyframes = { 0.5 };
|
||||
GLib.Value[] x = { dest };
|
||||
|
||||
var nudge = new Clutter.KeyframeTransition ("translation-x") {
|
||||
duration = AnimationDuration.NUDGE,
|
||||
remove_on_complete = true,
|
||||
progress_mode = Clutter.AnimationMode.EASE_IN_QUAD
|
||||
};
|
||||
nudge.set_from_value (0.0f);
|
||||
nudge.set_to_value (0.0f);
|
||||
nudge.set_key_frames (keyframes);
|
||||
nudge.set_values (x);
|
||||
workspaces.add_transition ("nudge", nudge);
|
||||
}
|
||||
|
||||
private void on_multitasking_gesture_detected (Gesture gesture) {
|
||||
if (gesture.type != Gdk.EventType.TOUCHPAD_SWIPE ||
|
||||
(gesture.fingers == 3 && GestureSettings.get_string ("three-finger-swipe-up") != "multitasking-view") ||
|
||||
|
Loading…
Reference in New Issue
Block a user