mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 10:50:08 +00:00
css: Add gtk_css_style_get_static_style
This lets us avoid poking directly at the GtkCssAnimatedStyle struct in gtkcssnode.c.
This commit is contained in:
parent
5ac24db049
commit
b2b89f6c57
@ -79,6 +79,15 @@ gtk_css_animated_style_is_static (GtkCssStyle *style)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkCssStyle *
|
||||||
|
gtk_css_animated_style_get_static_style (GtkCssStyle *style)
|
||||||
|
{
|
||||||
|
/* This is called a lot, so we avoid a dynamic type check here */
|
||||||
|
GtkCssAnimatedStyle *animated = (GtkCssAnimatedStyle *) style;
|
||||||
|
|
||||||
|
return animated->style;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_css_animated_style_dispose (GObject *object)
|
gtk_css_animated_style_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
@ -123,6 +132,7 @@ gtk_css_animated_style_class_init (GtkCssAnimatedStyleClass *klass)
|
|||||||
style_class->get_value = gtk_css_animated_style_get_value;
|
style_class->get_value = gtk_css_animated_style_get_value;
|
||||||
style_class->get_section = gtk_css_animated_style_get_section;
|
style_class->get_section = gtk_css_animated_style_get_section;
|
||||||
style_class->is_static = gtk_css_animated_style_is_static;
|
style_class->is_static = gtk_css_animated_style_is_static;
|
||||||
|
style_class->get_static_style = gtk_css_animated_style_get_static_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -407,14 +407,7 @@ gtk_css_node_real_update_style (GtkCssNode *cssnode,
|
|||||||
{
|
{
|
||||||
GtkCssStyle *static_style, *new_static_style, *new_style;
|
GtkCssStyle *static_style, *new_static_style, *new_style;
|
||||||
|
|
||||||
if (GTK_IS_CSS_ANIMATED_STYLE (style))
|
static_style = gtk_css_style_get_static_style (style);
|
||||||
{
|
|
||||||
static_style = GTK_CSS_ANIMATED_STYLE (style)->style;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
static_style = style;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gtk_css_style_needs_recreation (static_style, change))
|
if (gtk_css_style_needs_recreation (static_style, change))
|
||||||
new_static_style = gtk_css_node_create_style (cssnode);
|
new_static_style = gtk_css_node_create_style (cssnode);
|
||||||
@ -436,7 +429,7 @@ gtk_css_node_real_update_style (GtkCssNode *cssnode,
|
|||||||
}
|
}
|
||||||
else if (static_style != style && (change & GTK_CSS_CHANGE_TIMESTAMP))
|
else if (static_style != style && (change & GTK_CSS_CHANGE_TIMESTAMP))
|
||||||
{
|
{
|
||||||
new_style = gtk_css_animated_style_new_advance (GTK_CSS_ANIMATED_STYLE (style),
|
new_style = gtk_css_animated_style_new_advance ((GtkCssAnimatedStyle *)style,
|
||||||
static_style,
|
static_style,
|
||||||
timestamp);
|
timestamp);
|
||||||
}
|
}
|
||||||
|
@ -53,11 +53,18 @@ gtk_css_style_real_is_static (GtkCssStyle *style)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkCssStyle *
|
||||||
|
gtk_css_style_real_get_static_style (GtkCssStyle *style)
|
||||||
|
{
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_css_style_class_init (GtkCssStyleClass *klass)
|
gtk_css_style_class_init (GtkCssStyleClass *klass)
|
||||||
{
|
{
|
||||||
klass->get_section = gtk_css_style_real_get_section;
|
klass->get_section = gtk_css_style_real_get_section;
|
||||||
klass->is_static = gtk_css_style_real_is_static;
|
klass->is_static = gtk_css_style_real_is_static;
|
||||||
|
klass->get_static_style = gtk_css_style_real_get_static_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -89,6 +96,14 @@ gtk_css_style_is_static (GtkCssStyle *style)
|
|||||||
return GTK_CSS_STYLE_GET_CLASS (style)->is_static (style);
|
return GTK_CSS_STYLE_GET_CLASS (style)->is_static (style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkCssStyle *
|
||||||
|
gtk_css_style_get_static_style (GtkCssStyle *style)
|
||||||
|
{
|
||||||
|
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
|
||||||
|
|
||||||
|
return GTK_CSS_STYLE_GET_CLASS (style)->get_static_style (style);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gtk_css_style_print:
|
* gtk_css_style_print:
|
||||||
* @style: a #GtkCssStyle
|
* @style: a #GtkCssStyle
|
||||||
|
@ -56,6 +56,8 @@ struct _GtkCssStyleClass
|
|||||||
guint id);
|
guint id);
|
||||||
/* TRUE if this style will require changes based on timestamp */
|
/* TRUE if this style will require changes based on timestamp */
|
||||||
gboolean (* is_static) (GtkCssStyle *style);
|
gboolean (* is_static) (GtkCssStyle *style);
|
||||||
|
|
||||||
|
GtkCssStyle * (* get_static_style) (GtkCssStyle *style);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gtk_css_style_get_type (void) G_GNUC_CONST;
|
GType gtk_css_style_get_type (void) G_GNUC_CONST;
|
||||||
@ -74,6 +76,7 @@ gboolean gtk_css_style_print (GtkCssStyle
|
|||||||
PangoAttrList * gtk_css_style_get_pango_attributes (GtkCssStyle *style);
|
PangoAttrList * gtk_css_style_get_pango_attributes (GtkCssStyle *style);
|
||||||
|
|
||||||
PangoFontDescription * gtk_css_style_get_pango_font (GtkCssStyle *style);
|
PangoFontDescription * gtk_css_style_get_pango_font (GtkCssStyle *style);
|
||||||
|
GtkCssStyle * gtk_css_style_get_static_style (GtkCssStyle *style);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user