diff options
author | Benjamin Otte <otte@redhat.com> | 2016-12-31 02:36:00 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-12-31 02:49:47 +0100 |
commit | 45fbc25e5e86a44dff1c40e2592c8c69e26f23fb (patch) | |
tree | e3a5f4d1b26ce6e798959e2b0ff69b2e57d2e65f | |
parent | 5b33127692f50aa56c184d2f203f32294e6d61f4 (diff) | |
download | gtk+-45fbc25e5e86a44dff1c40e2592c8c69e26f23fb.tar.gz |
css: Remove -gtk-icon-effect
-gtk-icon-filter replaces this now.
-rw-r--r-- | gtk/gtkcssenumvalue.c | 87 | ||||
-rw-r--r-- | gtk/gtkcssenumvalueprivate.h | 6 | ||||
-rw-r--r-- | gtk/gtkcssstylepropertyimpl.c | 21 | ||||
-rw-r--r-- | gtk/gtkcsstypesprivate.h | 8 | ||||
-rw-r--r-- | gtk/gtkiconhelper.c | 12 |
5 files changed, 2 insertions, 132 deletions
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c index 3120a817a9..35447ff830 100644 --- a/gtk/gtkcssenumvalue.c +++ b/gtk/gtkcssenumvalue.c @@ -930,93 +930,6 @@ _gtk_css_fill_mode_value_get (const GtkCssValue *value) return value->value; } -/* GtkCssIconEffect */ - -static const GtkCssValueClass GTK_CSS_VALUE_ICON_EFFECT = { - gtk_css_value_enum_free, - gtk_css_value_enum_compute, - gtk_css_value_enum_equal, - gtk_css_value_enum_transition, - gtk_css_value_enum_print -}; - -static GtkCssValue image_effect_values[] = { - { >K_CSS_VALUE_ICON_EFFECT, 1, GTK_CSS_ICON_EFFECT_NONE, "none" }, - { >K_CSS_VALUE_ICON_EFFECT, 1, GTK_CSS_ICON_EFFECT_HIGHLIGHT, "highlight" }, - { >K_CSS_VALUE_ICON_EFFECT, 1, GTK_CSS_ICON_EFFECT_DIM, "dim" } -}; - -GtkCssValue * -_gtk_css_icon_effect_value_new (GtkCssIconEffect image_effect) -{ - guint i; - - for (i = 0; i < G_N_ELEMENTS (image_effect_values); i++) - { - if (image_effect_values[i].value == image_effect) - return _gtk_css_value_ref (&image_effect_values[i]); - } - - g_return_val_if_reached (NULL); -} - -GtkCssValue * -_gtk_css_icon_effect_value_try_parse (GtkCssParser *parser) -{ - guint i; - - g_return_val_if_fail (parser != NULL, NULL); - - for (i = 0; i < G_N_ELEMENTS (image_effect_values); i++) - { - if (_gtk_css_parser_try (parser, image_effect_values[i].name, TRUE)) - return _gtk_css_value_ref (&image_effect_values[i]); - } - - return NULL; -} - -GtkCssIconEffect -_gtk_css_icon_effect_value_get (const GtkCssValue *value) -{ - g_return_val_if_fail (value->class == >K_CSS_VALUE_ICON_EFFECT, GTK_CSS_ICON_EFFECT_NONE); - - return value->value; -} - -void -gtk_css_icon_effect_apply (GtkCssIconEffect icon_effect, - cairo_surface_t *surface) -{ - cairo_t *cr; - - switch (icon_effect) - { - case GTK_CSS_ICON_EFFECT_DIM: - cr = cairo_create (surface); - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); - cairo_set_source_rgba (cr, 0, 0, 0, 0); /* transparent */ - cairo_paint_with_alpha (cr, 0.5); - cairo_destroy (cr); - break; - - case GTK_CSS_ICON_EFFECT_HIGHLIGHT: - cr = cairo_create (surface); - cairo_set_source_rgb (cr, 0.1, 0.1, 0.1); - cairo_set_operator (cr, CAIRO_OPERATOR_COLOR_DODGE); - /* DANGER: We mask with ourself - that works for images, but... */ - cairo_mask_surface (cr, surface, 0, 0); - cairo_destroy (cr); - break; - - default: - g_warn_if_reached (); - /* fall through */ - case GTK_CSS_ICON_EFFECT_NONE: - break; - } -} - /* GtkCssIconStyle */ static const GtkCssValueClass GTK_CSS_VALUE_ICON_STYLE = { diff --git a/gtk/gtkcssenumvalueprivate.h b/gtk/gtkcssenumvalueprivate.h index b1be91ddf2..5b6c6f393c 100644 --- a/gtk/gtkcssenumvalueprivate.h +++ b/gtk/gtkcssenumvalueprivate.h @@ -81,12 +81,6 @@ GtkCssValue * _gtk_css_fill_mode_value_new (GtkCssFillMode fill_m GtkCssValue * _gtk_css_fill_mode_value_try_parse (GtkCssParser *parser); GtkCssFillMode _gtk_css_fill_mode_value_get (const GtkCssValue *value); -GtkCssValue * _gtk_css_icon_effect_value_new (GtkCssIconEffect image_effect); -GtkCssValue * _gtk_css_icon_effect_value_try_parse (GtkCssParser *parser); -GtkCssIconEffect _gtk_css_icon_effect_value_get (const GtkCssValue *value); -void gtk_css_icon_effect_apply (GtkCssIconEffect icon_effect, - cairo_surface_t *surface); - GtkCssValue * _gtk_css_icon_style_value_new (GtkCssIconStyle icon_style); GtkCssValue * _gtk_css_icon_style_value_try_parse (GtkCssParser *parser); GtkCssIconStyle _gtk_css_icon_style_value_get (const GtkCssValue *value); diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index 6229d2d5ef..15ea1cac46 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -412,18 +412,6 @@ parse_css_fill_mode (GtkCssStyleProperty *property, } static GtkCssValue * -image_effect_parse (GtkCssStyleProperty *property, - GtkCssParser *parser) -{ - GtkCssValue *value = _gtk_css_icon_effect_value_try_parse (parser); - - if (value == NULL) - _gtk_css_parser_error (parser, "unknown value for property"); - - return value; -} - -static GtkCssValue * icon_palette_parse (GtkCssStyleProperty *property, GtkCssParser *parser) { @@ -1606,15 +1594,6 @@ _gtk_css_style_property_init_properties (void) opacity_parse, opacity_query, _gtk_css_number_value_new (1, GTK_CSS_NUMBER)); - gtk_css_style_property_register ("-gtk-icon-effect", - GTK_CSS_PROPERTY_ICON_EFFECT, - G_TYPE_NONE, - GTK_STYLE_PROPERTY_INHERIT, - GTK_CSS_AFFECTS_ICON, - image_effect_parse, - NULL, - _gtk_css_icon_effect_value_new (GTK_CSS_ICON_EFFECT_NONE)); - _gtk_style_property_add_alias ("-gtk-icon-effect", "-gtk-image-effect"); /* Private property holding the binding sets */ gtk_css_style_property_register ("-gtk-key-bindings", diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h index 885d9d472b..9e080871a4 100644 --- a/gtk/gtkcsstypesprivate.h +++ b/gtk/gtkcsstypesprivate.h @@ -225,7 +225,7 @@ enum { /*< skip >*/ GTK_CSS_PROPERTY_ANIMATION_DELAY, GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, GTK_CSS_PROPERTY_OPACITY, - GTK_CSS_PROPERTY_ICON_EFFECT, + GTK_CSS_PROPERTY_FILTER, GTK_CSS_PROPERTY_GTK_KEY_BINDINGS, GTK_CSS_PROPERTY_CARET_COLOR, GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR, @@ -282,12 +282,6 @@ typedef enum /*< skip >*/ { } GtkCssFillMode; typedef enum /*< skip >*/ { - GTK_CSS_ICON_EFFECT_NONE, - GTK_CSS_ICON_EFFECT_HIGHLIGHT, - GTK_CSS_ICON_EFFECT_DIM -} GtkCssIconEffect; - -typedef enum /*< skip >*/ { GTK_CSS_ICON_STYLE_REQUESTED, GTK_CSS_ICON_STYLE_REGULAR, GTK_CSS_ICON_STYLE_SYMBOLIC diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index 9f3cdb1fd6..d47c514ee5 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -379,7 +379,6 @@ ensure_surface_from_pixbuf (GtkIconHelper *self, gint width, height; cairo_surface_t *surface; GdkPixbuf *pixbuf; - GtkCssIconEffect icon_effect; if (get_pixbuf_size (self, scale, @@ -393,8 +392,6 @@ ensure_surface_from_pixbuf (GtkIconHelper *self, pixbuf = g_object_ref (orig_pixbuf); surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, gtk_widget_get_window (gtk_css_gadget_get_owner (GTK_CSS_GADGET (self)))); - icon_effect = _gtk_css_icon_effect_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_EFFECT)); - gtk_css_icon_effect_apply (icon_effect, surface); g_object_unref (pixbuf); return surface; @@ -469,14 +466,7 @@ ensure_surface_for_gicon (GtkIconHelper *self, surface = gdk_cairo_surface_create_from_pixbuf (destination, scale, gtk_widget_get_window (gtk_css_gadget_get_owner (GTK_CSS_GADGET (self)))); - if (!symbolic) - { - GtkCssIconEffect icon_effect; - - icon_effect = _gtk_css_icon_effect_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_EFFECT)); - gtk_css_icon_effect_apply (icon_effect, surface); - } - else + if (symbolic) { priv->rendered_surface_is_symbolic = TRUE; } |