Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GesturePropertyTransition: Only call done_callback if the transition finished #2201

Merged
merged 2 commits into from
Jan 4, 2025
Merged
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
9 changes: 6 additions & 3 deletions src/Gestures/GesturePropertyTransition.vala
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ public class Gala.GesturePropertyTransition : Object {
* to the final position. If with_gesture is false it will just ease to the {@link to_value}.
* #this will keep itself alive until the animation finishes so it is safe to immediatly unref it after creation and calling start.
*
* @param done_callback a callback for when the transition finishes. It is guaranteed to be called exactly once.
* @param done_callback a callback for when the transition finishes. This shouldn't be used for setting state, instead state should
* be set immediately on {@link GestureTracker.OnEnd} not only once the animation ends to allow for interrupting the animation by starting a new gesture.
* done_callback will only be called if the animation finishes, not if it is interrupted e.g. by starting a new animation for the same property,
* destroying the actor or removing the transition.
*/
public void start (bool with_gesture, owned DoneCallback? done_callback = null) {
ref ();
Expand Down Expand Up @@ -179,8 +182,8 @@ public class Gala.GesturePropertyTransition : Object {
}
}

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

Expand Down
Loading