styleproperty: Add an affects-size property
This property will be used to avoid gtk_widget_queue_resize() calls in favor of gtk_widget_queue_draw().
This commit is contained in:
@ -38,6 +38,7 @@
|
|||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_ANIMATED,
|
PROP_ANIMATED,
|
||||||
|
PROP_AFFECTS_SIZE,
|
||||||
PROP_ID,
|
PROP_ID,
|
||||||
PROP_INHERIT,
|
PROP_INHERIT,
|
||||||
PROP_INITIAL
|
PROP_INITIAL
|
||||||
@ -70,6 +71,9 @@ gtk_css_style_property_set_property (GObject *object,
|
|||||||
case PROP_ANIMATED:
|
case PROP_ANIMATED:
|
||||||
property->animated = g_value_get_boolean (value);
|
property->animated = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_AFFECTS_SIZE:
|
||||||
|
property->affects_size = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
case PROP_INHERIT:
|
case PROP_INHERIT:
|
||||||
property->inherit = g_value_get_boolean (value);
|
property->inherit = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
@ -96,6 +100,9 @@ gtk_css_style_property_get_property (GObject *object,
|
|||||||
case PROP_ANIMATED:
|
case PROP_ANIMATED:
|
||||||
g_value_set_boolean (value, property->animated);
|
g_value_set_boolean (value, property->animated);
|
||||||
break;
|
break;
|
||||||
|
case PROP_AFFECTS_SIZE:
|
||||||
|
g_value_set_boolean (value, property->affects_size);
|
||||||
|
break;
|
||||||
case PROP_ID:
|
case PROP_ID:
|
||||||
g_value_set_boolean (value, property->id);
|
g_value_set_boolean (value, property->id);
|
||||||
break;
|
break;
|
||||||
@ -251,6 +258,13 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
|
|||||||
P_("Set if the value can be animated"),
|
P_("Set if the value can be animated"),
|
||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_AFFECTS_SIZE,
|
||||||
|
g_param_spec_boolean ("affects-size",
|
||||||
|
P_("Affects size"),
|
||||||
|
P_("Set if the value affects the sizing of elements"),
|
||||||
|
TRUE,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
g_object_class_install_property (object_class,
|
g_object_class_install_property (object_class,
|
||||||
PROP_ID,
|
PROP_ID,
|
||||||
g_param_spec_uint ("id",
|
g_param_spec_uint ("id",
|
||||||
@ -381,6 +395,23 @@ _gtk_css_style_property_is_animated (GtkCssStyleProperty *property)
|
|||||||
return property->animated;
|
return property->animated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _gtk_css_style_property_affects_size:
|
||||||
|
* @property: the property
|
||||||
|
*
|
||||||
|
* Queries if the given @property affects the size of elements. This is
|
||||||
|
* used for optimizations inside GTK, where a gtk_widget_queue_resize()
|
||||||
|
* can be avoided if the property does not affect size.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the property affects sizing of elements.
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
_gtk_css_style_property_affects_size (GtkCssStyleProperty *property)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), FALSE);
|
||||||
|
|
||||||
|
return property->affects_size;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* _gtk_css_style_property_get_id:
|
* _gtk_css_style_property_get_id:
|
||||||
* @property: the property
|
* @property: the property
|
||||||
|
|||||||
@ -49,6 +49,7 @@ struct _GtkCssStyleProperty
|
|||||||
guint id;
|
guint id;
|
||||||
guint inherit :1;
|
guint inherit :1;
|
||||||
guint animated :1;
|
guint animated :1;
|
||||||
|
guint affects_size :1;
|
||||||
|
|
||||||
GtkCssStylePropertyParseFunc parse_value;
|
GtkCssStylePropertyParseFunc parse_value;
|
||||||
GtkCssStylePropertyQueryFunc query_value;
|
GtkCssStylePropertyQueryFunc query_value;
|
||||||
@ -71,6 +72,7 @@ GtkCssStyleProperty * _gtk_css_style_property_lookup_by_id (guint
|
|||||||
|
|
||||||
gboolean _gtk_css_style_property_is_inherit (GtkCssStyleProperty *property);
|
gboolean _gtk_css_style_property_is_inherit (GtkCssStyleProperty *property);
|
||||||
gboolean _gtk_css_style_property_is_animated (GtkCssStyleProperty *property);
|
gboolean _gtk_css_style_property_is_animated (GtkCssStyleProperty *property);
|
||||||
|
gboolean _gtk_css_style_property_affects_size (GtkCssStyleProperty *property);
|
||||||
guint _gtk_css_style_property_get_id (GtkCssStyleProperty *property);
|
guint _gtk_css_style_property_get_id (GtkCssStyleProperty *property);
|
||||||
GtkCssValue * _gtk_css_style_property_get_initial_value
|
GtkCssValue * _gtk_css_style_property_get_initial_value
|
||||||
(GtkCssStyleProperty *property);
|
(GtkCssStyleProperty *property);
|
||||||
|
|||||||
Reference in New Issue
Block a user