Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions lib/Gestures/PropertyTarget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,24 @@ public class Gala.PropertyTarget : Object, GestureTarget {
// Don't take a reference since we are most of the time owned by the target
public weak Object? target { get; private set; }
public string property { get; construct; }

public bool allow_overshoot { get; construct; }
public Clutter.Interval interval { get; construct; }

public PropertyTarget (GestureAction action, Object target, string property, Type value_type, Value from_value, Value to_value) {
Object (action: action, property: property, interval: new Clutter.Interval.with_values (value_type, from_value, to_value));
public PropertyTarget (
GestureAction action,
Object target,
string property,
Type value_type,
Value from_value,
Value to_value,
bool allow_overshoot = false
) {
Object (
action: action,
property: property,
interval: new Clutter.Interval.with_values (value_type, from_value, to_value),
allow_overshoot: allow_overshoot
);

this.target = target;
this.target.weak_ref (on_target_disposed);
Expand All @@ -35,6 +48,10 @@ public class Gala.PropertyTarget : Object, GestureTarget {
return;
}

if (!allow_overshoot) {
progress = progress.clamp (0.0, 1.0);
}

target.set_property (property, interval.compute (progress));
}
}
5 changes: 4 additions & 1 deletion src/Widgets/MultitaskingView/MultitaskingView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
opened = false;
display = wm.get_display ();

multitasking_gesture_controller = new GestureController (MULTITASKING_VIEW, wm, MULTITASKING_VIEW);
multitasking_gesture_controller = new GestureController (MULTITASKING_VIEW, wm, MULTITASKING_VIEW) {
overshoot_upper_clamp = 1.1,
overshoot_lower_clamp = -0.1
};
multitasking_gesture_controller.enable_touchpad (wm.stage);
add_gesture_controller (multitasking_gesture_controller);

Expand Down
6 changes: 3 additions & 3 deletions src/Widgets/MultitaskingView/WorkspaceClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ public class Gala.WorkspaceClone : ActorTarget {
var initial_width = monitor.width;
var target_width = monitor.width * scale + WorkspaceRow.WORKSPACE_GAP * 2;

add_target (new PropertyTarget (MULTITASKING_VIEW, this, "width", typeof (float), (float) initial_width, (float) target_width));
add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-x", typeof (double), 1d, (double) scale));
add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-y", typeof (double), 1d, (double) scale));
add_target (new PropertyTarget (MULTITASKING_VIEW, this, "width", typeof (float), (float) initial_width, (float) target_width, true));
add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-x", typeof (double), 1d, (double) scale, true));
add_target (new PropertyTarget (MULTITASKING_VIEW, background, "scale-y", typeof (double), 1d, (double) scale, true));

window_container.padding_top = Utils.scale_to_int (TOP_OFFSET, monitor_scale);
window_container.padding_left = window_container.padding_right = (int) (monitor.width - monitor.width * scale) / 2;
Expand Down