[gtk+] css: Implement animations for font-weight property
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: Implement animations for font-weight property
- Date: Mon, 16 Feb 2015 22:57:28 +0000 (UTC)
commit 295b8aab0c1be8bf4437637f9b69ed1c368df489
Author: Benjamin Otte <otte redhat com>
Date: Sun Feb 15 05:37:19 2015 +0100
css: Implement animations for font-weight property
gtk/gtkcssenumvalue.c | 18 +++++++++++++++++-
gtk/gtkcssstylepropertyimpl.c | 2 +-
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index 502df3e..e9ee788 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -419,11 +419,27 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
return _gtk_css_font_weight_value_new (new_weight);
}
+static GtkCssValue *
+gtk_css_value_font_weight_transition (GtkCssValue *start,
+ GtkCssValue *end,
+ guint property_id,
+ double progress)
+{
+ PangoWeight new_weight;
+
+ if (start->value < 0 || end->value < 0)
+ return NULL;
+
+ new_weight = (start->value + end->value + 50) / 200 * 100;
+
+ return _gtk_css_font_weight_value_new (new_weight);
+}
+
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
gtk_css_value_enum_free,
gtk_css_value_font_weight_compute,
gtk_css_value_enum_equal,
- gtk_css_value_enum_transition,
+ gtk_css_value_font_weight_transition,
gtk_css_value_enum_print
};
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 056c54f..45fa695 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -1049,7 +1049,7 @@ _gtk_css_style_property_init_properties (void)
gtk_css_style_property_register ("font-weight",
GTK_CSS_PROPERTY_FONT_WEIGHT,
PANGO_TYPE_WEIGHT,
- GTK_STYLE_PROPERTY_INHERIT,
+ GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
parse_pango_weight,
query_pango_weight,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]