[gtk+] cssvalue: Pass property ID to transition function



commit e3fc081c5dbb5ab04c8b0d3bd9aa52fe16aba640
Author: Benjamin Otte <otte redhat com>
Date:   Thu Aug 30 15:51:29 2012 +0200

    cssvalue: Pass property ID to transition function
    
    This is to allow animating arrays properly. I'm not really thrilled
    about this solution (we leak propertys into the values again...), but
    it's the best I can come up with - I prefer it to having N different
    array types...

 gtk/gtkcssarrayvalue.c    |    1 +
 gtk/gtkcssbgsizevalue.c   |    5 +++--
 gtk/gtkcssbordervalue.c   |    1 +
 gtk/gtkcsscornervalue.c   |    9 +++++----
 gtk/gtkcsseasevalue.c     |    1 +
 gtk/gtkcssenginevalue.c   |    1 +
 gtk/gtkcssenumvalue.c     |    1 +
 gtk/gtkcssimagevalue.c    |    1 +
 gtk/gtkcssinheritvalue.c  |    1 +
 gtk/gtkcssinitialvalue.c  |    1 +
 gtk/gtkcssnumbervalue.c   |    1 +
 gtk/gtkcsspositionvalue.c |    5 +++--
 gtk/gtkcssrepeatvalue.c   |    1 +
 gtk/gtkcssrgbavalue.c     |    1 +
 gtk/gtkcssshadowsvalue.c  |    7 ++++---
 gtk/gtkcssshadowvalue.c   |   11 ++++++-----
 gtk/gtkcssstringvalue.c   |    1 +
 gtk/gtkcsstransition.c    |    1 +
 gtk/gtkcsstypedvalue.c    |    1 +
 gtk/gtkcssvalue.c         |    3 ++-
 gtk/gtkcssvalueprivate.h  |    2 ++
 gtk/gtksymboliccolor.c    |    1 +
 22 files changed, 40 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c
index fb22294..dab397e 100644
--- a/gtk/gtkcssarrayvalue.c
+++ b/gtk/gtkcssarrayvalue.c
@@ -95,6 +95,7 @@ gtk_css_value_array_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_array_transition (GtkCssValue *start,
                                 GtkCssValue *end,
+                                guint        property_id,
                                 double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c
index d7349dd..e545f61 100644
--- a/gtk/gtkcssbgsizevalue.c
+++ b/gtk/gtkcssbgsizevalue.c
@@ -84,6 +84,7 @@ gtk_css_value_bg_size_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_bg_size_transition (GtkCssValue *start,
                                   GtkCssValue *end,
+                                  guint        property_id,
                                   double       progress)
 {
   GtkCssValue *x, *y;
@@ -99,7 +100,7 @@ gtk_css_value_bg_size_transition (GtkCssValue *start,
 
   if (start->x)
     {
-      x = _gtk_css_value_transition (start->x, end->x, progress);
+      x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
       if (x == NULL)
         return NULL;
     }
@@ -108,7 +109,7 @@ gtk_css_value_bg_size_transition (GtkCssValue *start,
 
   if (start->y)
     {
-      y = _gtk_css_value_transition (start->y, end->y, progress);
+      y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
       if (y == NULL)
         {
           _gtk_css_value_unref (x);
diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c
index dab4631..953ab53 100644
--- a/gtk/gtkcssbordervalue.c
+++ b/gtk/gtkcssbordervalue.c
@@ -95,6 +95,7 @@ gtk_css_value_border_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_border_transition (GtkCssValue *start,
                                  GtkCssValue *end,
+                                 guint        property_id,
                                  double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcsscornervalue.c b/gtk/gtkcsscornervalue.c
index d26dffd..48586df 100644
--- a/gtk/gtkcsscornervalue.c
+++ b/gtk/gtkcsscornervalue.c
@@ -68,15 +68,16 @@ gtk_css_value_corner_equal (const GtkCssValue *corner1,
 
 static GtkCssValue *
 gtk_css_value_corner_transition (GtkCssValue *start,
-                                GtkCssValue *end,
-                                double       progress)
+                                 GtkCssValue *end,
+                                 guint        property_id,
+                                 double       progress)
 {
   GtkCssValue *x, *y;
 
-  x = _gtk_css_value_transition (start->x, end->x, progress);
+  x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
   if (x == NULL)
     return NULL;
-  y = _gtk_css_value_transition (start->y, end->y, progress);
+  y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
   if (y == NULL)
     {
       _gtk_css_value_unref (x);
diff --git a/gtk/gtkcsseasevalue.c b/gtk/gtkcsseasevalue.c
index 81c9bce..19f979b 100644
--- a/gtk/gtkcsseasevalue.c
+++ b/gtk/gtkcsseasevalue.c
@@ -84,6 +84,7 @@ gtk_css_value_ease_equal (const GtkCssValue *ease1,
 static GtkCssValue *
 gtk_css_value_ease_transition (GtkCssValue *start,
                                GtkCssValue *end,
+                               guint        property_id,
                                double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcssenginevalue.c b/gtk/gtkcssenginevalue.c
index a39ac6c..851c631 100644
--- a/gtk/gtkcssenginevalue.c
+++ b/gtk/gtkcssenginevalue.c
@@ -53,6 +53,7 @@ gtk_css_value_engine_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_engine_transition (GtkCssValue *start,
                                  GtkCssValue *end,
+                                 guint        property_id,
                                  double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index 9ea7ae8f..2d847f8 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -54,6 +54,7 @@ gtk_css_value_enum_equal (const GtkCssValue *enum1,
 static GtkCssValue *
 gtk_css_value_enum_transition (GtkCssValue *start,
                                GtkCssValue *end,
+                               guint        property_id,
                                double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcssimagevalue.c b/gtk/gtkcssimagevalue.c
index c40354f..b8baa50 100644
--- a/gtk/gtkcssimagevalue.c
+++ b/gtk/gtkcssimagevalue.c
@@ -67,6 +67,7 @@ gtk_css_value_image_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_image_transition (GtkCssValue *start,
                                 GtkCssValue *end,
+                                guint        property_id,
                                 double       progress)
 {
   GtkCssImage *fade;
diff --git a/gtk/gtkcssinheritvalue.c b/gtk/gtkcssinheritvalue.c
index d70200d..585a976 100644
--- a/gtk/gtkcssinheritvalue.c
+++ b/gtk/gtkcssinheritvalue.c
@@ -65,6 +65,7 @@ gtk_css_value_inherit_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_inherit_transition (GtkCssValue *start,
                                   GtkCssValue *end,
+                                  guint        property_id,
                                   double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcssinitialvalue.c b/gtk/gtkcssinitialvalue.c
index 45cadd7..d9d960f 100644
--- a/gtk/gtkcssinitialvalue.c
+++ b/gtk/gtkcssinitialvalue.c
@@ -54,6 +54,7 @@ gtk_css_value_initial_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_initial_transition (GtkCssValue *start,
                                   GtkCssValue *end,
+                                  guint        property_id,
                                   double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index db9e154..c84bce6 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -142,6 +142,7 @@ gtk_css_value_number_equal (const GtkCssValue *number1,
 static GtkCssValue *
 gtk_css_value_number_transition (GtkCssValue *start,
                                  GtkCssValue *end,
+                                 guint        property_id,
                                  double       progress)
 {
   /* FIXME: This needs to be supported at least for percentages,
diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c
index e69147a..077ab84 100644
--- a/gtk/gtkcsspositionvalue.c
+++ b/gtk/gtkcsspositionvalue.c
@@ -69,14 +69,15 @@ gtk_css_value_position_equal (const GtkCssValue *position1,
 static GtkCssValue *
 gtk_css_value_position_transition (GtkCssValue *start,
                                    GtkCssValue *end,
+                                   guint        property_id,
                                    double       progress)
 {
   GtkCssValue *x, *y;
 
-  x = _gtk_css_value_transition (start->x, end->x, progress);
+  x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
   if (x == NULL)
     return NULL;
-  y = _gtk_css_value_transition (start->y, end->y, progress);
+  y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
   if (y == NULL)
     {
       _gtk_css_value_unref (x);
diff --git a/gtk/gtkcssrepeatvalue.c b/gtk/gtkcssrepeatvalue.c
index 6f07072..b9387eb 100644
--- a/gtk/gtkcssrepeatvalue.c
+++ b/gtk/gtkcssrepeatvalue.c
@@ -53,6 +53,7 @@ gtk_css_value_repeat_equal (const GtkCssValue *repeat1,
 static GtkCssValue *
 gtk_css_value_repeat_transition (GtkCssValue *start,
                                  GtkCssValue *end,
+                                 guint        property_id,
                                  double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcssrgbavalue.c b/gtk/gtkcssrgbavalue.c
index 3bb6897..99bcfa2 100644
--- a/gtk/gtkcssrgbavalue.c
+++ b/gtk/gtkcssrgbavalue.c
@@ -53,6 +53,7 @@ gtk_css_value_rgba_equal (const GtkCssValue *rgba1,
 static GtkCssValue *
 gtk_css_value_rgba_transition (GtkCssValue *start,
                                GtkCssValue *end,
+                               guint        property_id,
                                double       progress)
 {
   GdkRGBA transition;
diff --git a/gtk/gtkcssshadowsvalue.c b/gtk/gtkcssshadowsvalue.c
index 78e092a..d565d89 100644
--- a/gtk/gtkcssshadowsvalue.c
+++ b/gtk/gtkcssshadowsvalue.c
@@ -93,6 +93,7 @@ gtk_css_value_shadows_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_shadows_transition (GtkCssValue *start,
                                   GtkCssValue *end,
+                                  guint        property_id,
                                   double       progress)
 {
   GtkCssValue *result;
@@ -109,14 +110,14 @@ gtk_css_value_shadows_transition (GtkCssValue *start,
 
   for (i = 0; i < MIN (start->len, end->len); i++)
     {
-      result->values[i] = _gtk_css_value_transition (start->values[i], end->values[i], progress);
+      result->values[i] = _gtk_css_value_transition (start->values[i], end->values[i], property_id, progress);
     }
   if (start->len > end->len)
     {
       for (; i < result->len; i++)
         {
           GtkCssValue *fill = _gtk_css_shadow_value_new_for_transition (start->values[i]);
-          result->values[i] = _gtk_css_value_transition (start->values[i], fill, progress);
+          result->values[i] = _gtk_css_value_transition (start->values[i], fill, property_id, progress);
           _gtk_css_value_unref (fill);
         }
     }
@@ -125,7 +126,7 @@ gtk_css_value_shadows_transition (GtkCssValue *start,
       for (; i < result->len; i++)
         {
           GtkCssValue *fill = _gtk_css_shadow_value_new_for_transition (end->values[i]);
-          result->values[i] = _gtk_css_value_transition (fill, end->values[i], progress);
+          result->values[i] = _gtk_css_value_transition (fill, end->values[i], property_id, progress);
           _gtk_css_value_unref (fill);
         }
     }
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index bdfa8d2..ed311a1 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -106,17 +106,18 @@ gtk_css_value_shadow_equal (const GtkCssValue *shadow1,
 static GtkCssValue *
 gtk_css_value_shadow_transition (GtkCssValue *start,
                                  GtkCssValue *end,
+                                 guint        property_id,
                                  double       progress)
 {
   if (start->inset != end->inset)
     return NULL;
 
-  return gtk_css_shadow_value_new (_gtk_css_value_transition (start->hoffset, end->hoffset, progress),
-                                   _gtk_css_value_transition (start->voffset, end->voffset, progress),
-                                   _gtk_css_value_transition (start->radius, end->radius, progress),
-                                   _gtk_css_value_transition (start->spread, end->spread, progress),
+  return gtk_css_shadow_value_new (_gtk_css_value_transition (start->hoffset, end->hoffset, property_id, progress),
+                                   _gtk_css_value_transition (start->voffset, end->voffset, property_id, progress),
+                                   _gtk_css_value_transition (start->radius, end->radius, property_id, progress),
+                                   _gtk_css_value_transition (start->spread, end->spread, property_id, progress),
                                    start->inset,
-                                   _gtk_css_value_transition (start->color, end->color, progress));
+                                   _gtk_css_value_transition (start->color, end->color, property_id, progress));
 }
 
 static void
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index 328fd21..78273d3 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -51,6 +51,7 @@ gtk_css_value_string_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_string_transition (GtkCssValue *start,
                                  GtkCssValue *end,
+                                 guint        property_id,
                                  double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcsstransition.c b/gtk/gtkcsstransition.c
index cbedc8b..ede18b3 100644
--- a/gtk/gtkcsstransition.c
+++ b/gtk/gtkcsstransition.c
@@ -46,6 +46,7 @@ gtk_css_transition_set_values (GtkStyleAnimation    *animation,
 
       value = _gtk_css_value_transition (transition->start,
                                          transition->end,
+                                         transition->property,
                                          progress);
       if (value == NULL)
         value = _gtk_css_value_ref (transition->end);
diff --git a/gtk/gtkcsstypedvalue.c b/gtk/gtkcsstypedvalue.c
index a939bac..5ce5eff 100644
--- a/gtk/gtkcsstypedvalue.c
+++ b/gtk/gtkcsstypedvalue.c
@@ -55,6 +55,7 @@ gtk_css_value_typed_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_typed_transition (GtkCssValue *start,
                                 GtkCssValue *end,
+                                guint        property_id,
                                 double       progress)
 {
   return NULL;
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index e057f90..b71eed1 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -125,6 +125,7 @@ _gtk_css_value_equal0 (const GtkCssValue *value1,
 GtkCssValue *
 _gtk_css_value_transition (GtkCssValue *start,
                            GtkCssValue *end,
+                           guint        property_id,
                            double       progress)
 {
   g_return_val_if_fail (start != NULL, FALSE);
@@ -133,7 +134,7 @@ _gtk_css_value_transition (GtkCssValue *start,
   if (start->class != end->class)
     return NULL;
 
-  return start->class->transition (start, end, progress);
+  return start->class->transition (start, end, property_id, progress);
 }
 
 char *
diff --git a/gtk/gtkcssvalueprivate.h b/gtk/gtkcssvalueprivate.h
index 629cc75..a7f9b96 100644
--- a/gtk/gtkcssvalueprivate.h
+++ b/gtk/gtkcssvalueprivate.h
@@ -50,6 +50,7 @@ struct _GtkCssValueClass {
                                                        const GtkCssValue          *value2);
   GtkCssValue * (* transition)                        (GtkCssValue                *start,
                                                        GtkCssValue                *end,
+                                                       guint                       property_id,
                                                        double                      progress);
   void          (* print)                             (const GtkCssValue          *value,
                                                        GString                    *string);
@@ -74,6 +75,7 @@ gboolean     _gtk_css_value_equal0                    (const GtkCssValue
                                                        const GtkCssValue          *value2);
 GtkCssValue *_gtk_css_value_transition                (GtkCssValue                *start,
                                                        GtkCssValue                *end,
+                                                       guint                       property_id,
                                                        double                      progress);
 
 char *       _gtk_css_value_to_string                 (const GtkCssValue          *value);
diff --git a/gtk/gtksymboliccolor.c b/gtk/gtksymboliccolor.c
index a96f9f5..1cca34c 100644
--- a/gtk/gtksymboliccolor.c
+++ b/gtk/gtksymboliccolor.c
@@ -238,6 +238,7 @@ gtk_css_value_symbolic_equal (const GtkCssValue *value1,
 static GtkCssValue *
 gtk_css_value_symbolic_transition (GtkCssValue *start,
                                    GtkCssValue *end,
+                                   guint        property_id,
                                    double       progress)
 {
   return NULL;



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