[libadwaita/bilelmoussaoui/animation-target-fn] AnimationTarget: take the user_data on the last param




commit f4d197f39acd0b77ec99bdaa77b5ccdb0565c8ca
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Sat Nov 27 20:29:45 2021 +0100

    AnimationTarget: take the user_data on the last param
    
    Otherwise bindings confuses the value for the user_data
    In general, it's supposed to be the last param

 src/adw-animation-target.c   | 2 +-
 src/adw-animation-target.h   | 6 +++---
 tests/test-animation.c       | 4 ++--
 tests/test-timed-animation.c | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/adw-animation-target.c b/src/adw-animation-target.c
index 379487d7..337359c5 100644
--- a/src/adw-animation-target.c
+++ b/src/adw-animation-target.c
@@ -85,7 +85,7 @@ adw_callback_animation_target_set_value (AdwAnimationTarget *target,
 {
   AdwCallbackAnimationTarget *self = ADW_CALLBACK_ANIMATION_TARGET (target);
 
-  self->callback (self->user_data, value);
+  self->callback (value, self->user_data);
 }
 
 static void
diff --git a/src/adw-animation-target.h b/src/adw-animation-target.h
index 42483d04..6f9c4383 100644
--- a/src/adw-animation-target.h
+++ b/src/adw-animation-target.h
@@ -24,15 +24,15 @@ GDK_DECLARE_INTERNAL_TYPE (AdwAnimationTarget, adw_animation_target, ADW, ANIMAT
 
 /**
  * AdwAnimationTargetFunc:
- * @user_data: (nullable): The user data provided when creating the target
  * @value: The animation value
+ * @user_data: (nullable): The user data provided when creating the target
  *
  * Prototype for animation targets based on user callbacks.
  *
  * Since: 1.0
  */
-typedef void (*AdwAnimationTargetFunc) (gpointer user_data,
-                                        double   value);
+typedef void (*AdwAnimationTargetFunc) (double   value,
+                                        gpointer user_data);
 
 #define ADW_TYPE_CALLBACK_ANIMATION_TARGET (adw_callback_animation_target_get_type())
 
diff --git a/tests/test-animation.c b/tests/test-animation.c
index 2701f028..252f2930 100644
--- a/tests/test-animation.c
+++ b/tests/test-animation.c
@@ -12,8 +12,8 @@ static double last_value;
 static int done_count;
 
 static void
-value_cb (gpointer user_data,
-          double   value)
+value_cb (double   value,
+          gpointer user_data)
 {
   last_value = value;
 }
diff --git a/tests/test-timed-animation.c b/tests/test-timed-animation.c
index 679b1f3a..78e7db69 100644
--- a/tests/test-timed-animation.c
+++ b/tests/test-timed-animation.c
@@ -11,8 +11,8 @@
 int notified;
 
 static void
-value_cb (gpointer user_data,
-          double   value)
+value_cb (double   value,
+          gpointer user_data)
 {
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]