Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ea75432
ActorTarget: Remember current commits
leolost2605 Mar 3, 2025
6df6495
Animate desktop workspace switch using the multitaskingview
leolost2605 Mar 3, 2025
c0f2a17
Add gap between workspaces when switching
leolost2605 Mar 3, 2025
46b5a6e
Works pretty reliable now
leolost2605 Mar 4, 2025
f62f811
Fix some inconsitencies
leolost2605 Mar 4, 2025
5e81272
WorkspaceManager/cleanup: Fix crash
leolost2605 Mar 4, 2025
66b745c
WorkspaceManager/cleanup: Fix crash
leolost2605 Mar 4, 2025
54f9ef8
Cleanup
leolost2605 Mar 4, 2025
f177864
Fix shellclients as static
leolost2605 Mar 4, 2025
c0bf547
Merge branch 'main' into leolost/multitasking-view-desktop-ws-switch
leolost2605 Mar 4, 2025
7e62412
We dont need a non black background anymore
leolost2605 Mar 4, 2025
f08d193
Simplify switch to next workspace
leolost2605 Mar 4, 2025
26dc04a
GestureController: Introduce separate gesture progress
leolost2605 Mar 4, 2025
3aa5e2f
Finish nudge, fix abrupt end
leolost2605 Mar 4, 2025
c7da35c
Cleanup
leolost2605 Mar 4, 2025
3dc7346
Use animating from actortarget
leolost2605 Mar 5, 2025
e02d5d9
Fix last ws not removed
leolost2605 Mar 5, 2025
87ed31e
Merge branch 'leolost/fix-ws-cleanup' into leolost/multitasking-view-…
leolost2605 Mar 5, 2025
2254726
Fix order of events
leolost2605 Mar 5, 2025
05f8c1e
Make only MultitaskingView responsible for state change
leolost2605 Mar 5, 2025
a6c7bec
Hide icon groups
leolost2605 Mar 5, 2025
cd3e647
Merge branch 'main' into leolost/multitasking-view-desktop-ws-switch
leolost2605 Mar 5, 2025
dbf29e9
Cleanup on all workspaces changed
leolost2605 Mar 5, 2025
460c473
Merge branch 'main' into leolost/multitasking-view-desktop-ws-switch
lenemter Mar 5, 2025
a700125
Fix hover widgets
leolost2605 Mar 5, 2025
7fa005e
Fix beeps
leolost2605 Mar 5, 2025
0cfcd60
Move files to own folder, add comment
leolost2605 Mar 5, 2025
fcf438c
Fix flicker and layer
leolost2605 Mar 5, 2025
13df367
More cleanup
leolost2605 Mar 5, 2025
b8704b8
Fix moving to last if second last would be empty
leolost2605 Mar 6, 2025
87e64da
Merge branch 'main' into leolost/multitasking-view-desktop-ws-switch
leolost2605 Mar 8, 2025
b2134a4
Fix merge
leolost2605 Mar 8, 2025
60d1f67
Merge branch 'main' into leolost/multitasking-view-desktop-ws-switch
leolost2605 Mar 8, 2025
acf6a3e
Fix crash
leolost2605 Mar 8, 2025
b1941d9
Adjust values to fix zoom
leolost2605 Mar 9, 2025
73287a9
Merge branch 'main' into leolost/multitasking-view-desktop-ws-switch
leolost2605 Mar 9, 2025
67b8dd9
Fix overshoot stacking
leolost2605 Mar 9, 2025
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
15 changes: 6 additions & 9 deletions src/Background/BackgroundContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ public class Gala.BackgroundContainer : Meta.BackgroundGroup {
}
});

set_black_background (true);
#if HAS_MUTTER47
background_color = Cogl.Color.from_string ("Black");
#else
background_color = Clutter.Color.from_string ("Black");
#endif

update ();
}

Expand All @@ -37,14 +42,6 @@ public class Gala.BackgroundContainer : Meta.BackgroundGroup {
monitor_manager.monitors_changed.disconnect (update);
}

public void set_black_background (bool black) {
#if HAS_MUTTER47
set_background_color (black ? Cogl.Color.from_string ("Black") : null);
#else
set_background_color (black ? Clutter.Color.from_string ("Black") : null);
#endif
}

private void update () {
var reference_child = (get_child_at_index (0) as BackgroundManager);
if (reference_child != null)
Expand Down
40 changes: 28 additions & 12 deletions src/Gestures/ActorTarget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,25 @@ public class Gala.ActorTarget : Clutter.Actor, GestureTarget {
}
}

public bool animating { get { return ongoing_animations > 0; } }

private double[] current_progress;
private double[] current_commit;
private Gee.List<GestureTarget> targets;

private int ongoing_animations = 0;

construct {
current_progress = new double[GestureAction.N_ACTIONS];
current_commit = new double[GestureAction.N_ACTIONS];
targets = new Gee.ArrayList<GestureTarget> ();

child_added.connect (on_child_added);
}

private void sync_target (GestureTarget target) {
for (int action = 0; action < current_progress.length; action++) {
target.propagate (COMMIT, action, current_progress[action]);
target.propagate (COMMIT, action, current_commit[action]);
target.propagate (UPDATE, action, current_progress[action]);
}
}
Expand All @@ -51,16 +57,35 @@ public class Gala.ActorTarget : Clutter.Actor, GestureTarget {
return current_progress[action];
}

public double get_current_commit (GestureAction action) {
return current_commit[action];
}

public virtual void start_progress (GestureAction action) {}
public virtual void update_progress (GestureAction action, double progress) {}
public virtual void commit_progress (GestureAction action, double to) {}
public virtual void end_progress (GestureAction action) {}

public override void propagate (UpdateType update_type, GestureAction action, double progress) {
current_progress[action] = progress;
if (update_type == COMMIT) {
current_commit[action] = progress;
} else {
current_progress[action] = progress;
}

foreach (var target in targets) {
target.propagate (update_type, action, progress);
}

for (var child = get_first_child (); child != null; child = child.get_next_sibling ()) {
if (child is ActorTarget) {
child.propagate (update_type, action, progress);
}
}

switch (update_type) {
case START:
ongoing_animations++;
start_progress (action);
break;
case UPDATE:
Expand All @@ -70,19 +95,10 @@ public class Gala.ActorTarget : Clutter.Actor, GestureTarget {
commit_progress (action, progress);
break;
case END:
ongoing_animations--;
end_progress (action);
break;
}

foreach (var target in targets) {
target.propagate (update_type, action, progress);
}

for (var child = get_first_child (); child != null; child = child.get_next_sibling ()) {
if (child is ActorTarget) {
child.propagate (update_type, action, progress);
}
}
}

private void on_child_added (Clutter.Actor child) {
Expand Down
1 change: 0 additions & 1 deletion src/Gestures/Gesture.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ namespace Gala {
public enum GestureAction {
NONE,
SWITCH_WORKSPACE,
MOVE_TO_WORKSPACE,
SWITCH_WINDOWS,
MULTITASKING_VIEW,
DOCK,
Expand Down
74 changes: 42 additions & 32 deletions src/Gestures/GestureController.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ public class Gala.GestureController : Object {
get { return _target; }
set {
_target = value;
target.propagate (UPDATE, action, calculate_bounded_progress ());
target.propagate (UPDATE, action, progress);
}
}

private Variant? _action_info;
public Variant? action_info { get { return _action_info; } }

public double distance { get; construct set; }
public double overshoot_lower_clamp { get; construct set; default = 0d; }
public double overshoot_upper_clamp { get; construct set; default = 1d; }
Expand All @@ -52,7 +55,7 @@ public class Gala.GestureController : Object {
get { return _progress; }
set {
_progress = value;
target.propagate (UPDATE, action, calculate_bounded_progress ());
target.propagate (UPDATE, action, value);
}
}

Expand All @@ -71,6 +74,7 @@ public class Gala.GestureController : Object {
private ScrollBackend? scroll_backend;

private GestureBackend? recognizing_backend;
private double gesture_progress;
private double previous_percentage;
private uint64 previous_time;
private double previous_delta;
Expand All @@ -83,22 +87,6 @@ public class Gala.GestureController : Object {
Object (action: action, target: target);
}

private double calculate_bounded_progress () {
var lower_clamp_int = (int) overshoot_lower_clamp;
var upper_clamp_int = (int) overshoot_upper_clamp;

double stretched_percentage = 0;
if (_progress < lower_clamp_int) {
stretched_percentage = (_progress - lower_clamp_int) * - (overshoot_lower_clamp - lower_clamp_int);
} else if (_progress > upper_clamp_int) {
stretched_percentage = (_progress - upper_clamp_int) * (overshoot_upper_clamp - upper_clamp_int);
}

var clamped = _progress.clamp (lower_clamp_int, upper_clamp_int);

return clamped + stretched_percentage;
}

public void enable_touchpad () {
touchpad_backend = ToucheggBackend.get_default ();
touchpad_backend.on_gesture_detected.connect (gesture_detected);
Expand All @@ -121,11 +109,11 @@ public class Gala.GestureController : Object {
timeline = null;
}

target.propagate (START, action, calculate_bounded_progress ());
target.propagate (START, action, progress);
}

private bool gesture_detected (GestureBackend backend, Gesture gesture, uint32 timestamp) {
recognizing = enabled && (GestureSettings.get_action (gesture) == action
recognizing = enabled && (GestureSettings.get_action (gesture, out _action_info) == action
|| backend == scroll_backend && GestureSettings.get_action (gesture) == NONE);

if (recognizing) {
Expand Down Expand Up @@ -154,6 +142,7 @@ public class Gala.GestureController : Object {

prepare ();

gesture_progress = progress;
previous_percentage = percentage;
previous_time = elapsed_time;
}
Expand All @@ -176,7 +165,7 @@ public class Gala.GestureController : Object {
}
}

progress += calculate_applied_delta (percentage, updated_delta);
update_gesture_progress (percentage, updated_delta);

previous_percentage = percentage;
previous_time = elapsed_time;
Expand All @@ -188,7 +177,7 @@ public class Gala.GestureController : Object {
return;
}

progress += calculate_applied_delta (percentage, previous_delta);
update_gesture_progress (percentage, previous_delta);

var to = progress;

Expand All @@ -198,17 +187,32 @@ public class Gala.GestureController : Object {

recognizing = false;

finish (velocity, Math.round (to));
finish (velocity * direction_multiplier, Math.round (to));

gesture_progress = 0;
previous_percentage = 0;
previous_time = 0;
previous_delta = 0;
velocity = 0;
direction_multiplier = 0;
}

private inline double calculate_applied_delta (double percentage, double percentage_delta) {
return ((percentage - percentage_delta) - (previous_percentage - previous_delta)) * direction_multiplier;
private void update_gesture_progress (double percentage, double percentage_delta) {
gesture_progress += ((percentage - percentage_delta) - (previous_percentage - previous_delta)) * direction_multiplier;

var lower_clamp_int = (int) overshoot_lower_clamp;
var upper_clamp_int = (int) overshoot_upper_clamp;

double stretched_percentage = 0;
if (gesture_progress < lower_clamp_int) {
stretched_percentage = (gesture_progress - lower_clamp_int) * - (overshoot_lower_clamp - lower_clamp_int);
} else if (gesture_progress > upper_clamp_int) {
stretched_percentage = (gesture_progress - upper_clamp_int) * (overshoot_upper_clamp - upper_clamp_int);
}

var clamped = gesture_progress.clamp (lower_clamp_int, upper_clamp_int);

progress = clamped + stretched_percentage;
}

private void finish (double velocity, double to) {
Expand All @@ -217,26 +221,32 @@ public class Gala.GestureController : Object {
target.propagate (COMMIT, action, clamped_to);

if (progress == to) {
target.propagate (END, action, calculate_bounded_progress ());
finished ();
return;
}

if (!AnimationsSettings.get_enable_animations ()) {
progress = clamped_to;
target.propagate (END, action, calculate_bounded_progress ());
finished ();
return;
}

var spring = new SpringTimeline (target.actor, progress, clamped_to, velocity, 1, 1, 1000);
spring.progress.connect ((value) => progress = value);
spring.stopped.connect (() => {
target.propagate (END, action, calculate_bounded_progress ());
timeline = null;
});
spring.stopped.connect_after (finished);

timeline = spring;
}

private void finished (bool is_finished = true) {
target.propagate (END, action, progress);
timeline = null;

if (is_finished) {
_action_info = null;
}
}

/**
* Animates to the given progress value.
* If the gesture is currently recognizing, it will do nothing.
Expand All @@ -249,7 +259,7 @@ public class Gala.GestureController : Object {
}

prepare ();
finish (0.005, to);
finish ((to > progress ? 1 : -1) * 5, to);
}

public void cancel_gesture () {
Expand Down
7 changes: 5 additions & 2 deletions src/Gestures/GestureSettings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ public class Gala.GestureSettings : Object {
return gala_settings.get_string (setting_id);
}

public static GestureAction get_action (Gesture gesture) {
public static GestureAction get_action (Gesture gesture, out Variant? action_info = null) {
action_info = null;

if (gesture.type == TOUCHPAD_SWIPE) {
var fingers = gesture.fingers;

Expand All @@ -85,7 +87,8 @@ public class Gala.GestureSettings : Object {

if (fingers == 3 && three_finger_swipe_horizontal == "move-to-workspace" ||
fingers == 4 && four_finger_swipe_horizontal == "move-to-workspace") {
return MOVE_TO_WORKSPACE;
action_info = true;
return SWITCH_WORKSPACE;
}


Expand Down
Loading