css: Redo GtkCssAffects

We now have GTK_CSS_AFFECTS_CONTENT for properties that have an effect
on content rendering.

Using GTK_CSS_AFFECTS_ICON is wrong for icon-transform and icon-filter
as they don't change the icon, just how the icon is rendered, so we use
GTK_CSS_AFFECTS_CONTENT for those.

We also introduce GTK_CSS_AFFECTS_POSTEFFECT for opacity and filter -
properties that affect the whole drawing of the widget by applying an
effect after everything is said and done.
This commit is contained in:
Benjamin Otte 2017-01-01 19:50:25 +01:00
parent 2571036c07
commit aa917ce3b7
2 changed files with 14 additions and 10 deletions

View File

@ -897,7 +897,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_PROPERTY_COLOR,
GDK_TYPE_RGBA,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_FOREGROUND | GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
GTK_CSS_AFFECTS_CONTENT | GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
color_parse,
color_query,
_gtk_css_color_value_new_rgba (1, 1, 1, 1));
@ -1446,7 +1446,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_PROPERTY_ICON_TRANSFORM,
G_TYPE_NONE,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON | GTK_CSS_AFFECTS_CLIP,
GTK_CSS_AFFECTS_CONTENT | GTK_CSS_AFFECTS_CLIP,
transform_value_parse,
NULL,
_gtk_css_transform_value_new_none ());
@ -1454,7 +1454,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_PROPERTY_ICON_FILTER,
G_TYPE_NONE,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_ICON | GTK_CSS_AFFECTS_SYMBOLIC_ICON | GTK_CSS_AFFECTS_CLIP,
GTK_CSS_AFFECTS_CONTENT,
filter_value_parse,
NULL,
gtk_css_filter_value_new_none ());
@ -1590,7 +1590,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_PROPERTY_OPACITY,
G_TYPE_DOUBLE,
GTK_STYLE_PROPERTY_ANIMATED,
0,
GTK_CSS_AFFECTS_POSTEFFECT,
opacity_parse,
opacity_query,
_gtk_css_number_value_new (1, GTK_CSS_NUMBER));
@ -1598,7 +1598,7 @@ _gtk_css_style_property_init_properties (void)
GTK_CSS_PROPERTY_FILTER,
G_TYPE_NONE,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_REDRAW,
GTK_CSS_AFFECTS_POSTEFFECT,
filter_value_parse,
NULL,
gtk_css_filter_value_new_none ());

View File

@ -96,7 +96,7 @@ typedef guint64 GtkCssChange;
/*
* GtkCssAffects:
* @GTK_CSS_AFFECTS_FOREGROUND: The foreground rendering is affected.
* @GTK_CSS_AFFECTS_CONTENT: The content rendering is affected.
* This does not include things that affect the font. For those,
* see @GTK_CSS_AFFECTS_FONT.
* @GTK_CSS_AFFECTS_BACKGROUND: The background rendering is affected.
@ -116,6 +116,8 @@ typedef guint64 GtkCssChange;
* @GTK_CSS_AFFECTS_SIZE: Changes in this property may have an effect
* on the allocated size of the element. Changes in these properties
* should cause a recomputation of the element's allocated size.
* @GTK_CSS_AFFECTS_POSTEFFECT: An effect is applied after drawing that changes
* the drawing.
*
* The generic effects that a CSS property can have. If a value is
* set, then the property will have an influence on that feature.
@ -123,7 +125,7 @@ typedef guint64 GtkCssChange;
* Note that multiple values can be set.
*/
typedef enum {
GTK_CSS_AFFECTS_FOREGROUND = (1 << 0),
GTK_CSS_AFFECTS_CONTENT = (1 << 0),
GTK_CSS_AFFECTS_BACKGROUND = (1 << 1),
GTK_CSS_AFFECTS_BORDER = (1 << 2),
GTK_CSS_AFFECTS_FONT = (1 << 3),
@ -133,15 +135,17 @@ typedef enum {
GTK_CSS_AFFECTS_SYMBOLIC_ICON = (1 << 7),
GTK_CSS_AFFECTS_OUTLINE = (1 << 8),
GTK_CSS_AFFECTS_CLIP = (1 << 9),
GTK_CSS_AFFECTS_SIZE = (1 << 10)
GTK_CSS_AFFECTS_SIZE = (1 << 10),
GTK_CSS_AFFECTS_POSTEFFECT = (1 << 11)
} GtkCssAffects;
#define GTK_CSS_AFFECTS_REDRAW (GTK_CSS_AFFECTS_FOREGROUND | \
#define GTK_CSS_AFFECTS_REDRAW (GTK_CSS_AFFECTS_CONTENT | \
GTK_CSS_AFFECTS_BACKGROUND | \
GTK_CSS_AFFECTS_BORDER | \
GTK_CSS_AFFECTS_ICON | \
GTK_CSS_AFFECTS_SYMBOLIC_ICON | \
GTK_CSS_AFFECTS_OUTLINE)
GTK_CSS_AFFECTS_OUTLINE | \
GTK_CSS_AFFECTS_POSTEFFECT)
enum { /*< skip >*/
GTK_CSS_PROPERTY_COLOR,