Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Dec 19, 2024
1 parent 72bc8b9 commit 2ba0b1d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/Gestures/GesturePropertyTransition.vala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* with easing without a gesture. Respects the enable animation setting.
*/
public class Gala.GesturePropertyTransition : Object {
public delegate void DoneCallback (bool cancel_action);
public delegate void DoneCallback (int completions);

/**
* The actor whose property will be animated.
Expand Down Expand Up @@ -100,13 +100,13 @@ public class Gala.GesturePropertyTransition : Object {

if (actual_from_value.type () != current_value.type ()) {
warning ("from_value of type %s is not of the same type as the property %s which is %s. Can't animate.", from_value.type_name (), property, current_value.type_name ());
finish (true);
finish (0);
return;
}

if (current_value.type () != to_value.type ()) {
warning ("to_value of type %s is not of the same type as the property %s which is %s. Can't animate.", to_value.type_name (), property, current_value.type_name ());
finish (true);
finish (0);
return;
}

Expand Down Expand Up @@ -152,9 +152,9 @@ public class Gala.GesturePropertyTransition : Object {

unowned var transition = actor.get_transition (property);
if (transition == null) {
finish (cancel_action);
finish (completions);
} else {
transition.stopped.connect ((is_finished) => finish (cancel_action, is_finished));
transition.stopped.connect ((is_finished) => finish (completions, is_finished));
}
};

Expand All @@ -181,9 +181,9 @@ public class Gala.GesturePropertyTransition : Object {
}
}

private void finish (bool cancel_action, bool callback = true) {
private void finish (int completions, bool callback = true) {
if (callback && done_callback != null) {
done_callback (cancel_action);
done_callback (completions);
}

unref ();
Expand Down
4 changes: 2 additions & 2 deletions src/ShellClients/PanelClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public class Gala.PanelClone : Object {
Utils.x11_unset_window_pass_through (panel.window);
}

new GesturePropertyTransition (clone, gesture_tracker, "y", null, calculate_clone_y (false)).start (with_gesture, (cancel_action) => {
if (!cancel_action) {
new GesturePropertyTransition (clone, gesture_tracker, "y", null, calculate_clone_y (false)).start (with_gesture, (completions) => {
if (completions > 0) {
clone.visible = false;
panel_hidden = false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Widgets/MultitaskingView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ namespace Gala {

// The callback needs to run at the same frame as the others (e.g. PanelClone) so we can't do a simple Timeout here
// The actual transition does nothing here, since the opacity just stays at 255
new GesturePropertyTransition (this, multitasking_gesture_tracker, "opacity", null, 255u).start (with_gesture, (cancel_action) => {
new GesturePropertyTransition (this, multitasking_gesture_tracker, "opacity", null, 255u).start (with_gesture, (completions) => {
if (!opening) {
foreach (var container in window_containers_monitors) {
container.visible = false;
Expand All @@ -695,7 +695,7 @@ namespace Gala {

animating = false;

if (cancel_action) {
if (completions == 0) {
toggle (false, true);
}
});
Expand Down

0 comments on commit 2ba0b1d

Please sign in to comment.