diff options
author | Benjamin Otte <otte@redhat.com> | 2015-01-19 04:40:24 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2015-01-20 06:30:19 +0100 |
commit | 118c8876561f9379f169106a684bc23ec8c605b1 (patch) | |
tree | 6a74640e23b0a09a6cb18f98e1c9d51f944559be /gtk/gtkrender.c | |
parent | e6b228f12a30cda36a84b550b49f84555e08fcc7 (diff) | |
download | gtk+-118c8876561f9379f169106a684bc23ec8c605b1.tar.gz |
render: Don't pass junction sides to builtin image
Instead, split the grip into 8 different builtin images (one for each
side and corner).
Diffstat (limited to 'gtk/gtkrender.c')
-rw-r--r-- | gtk/gtkrender.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/gtk/gtkrender.c b/gtk/gtkrender.c index 8549632f02..542c4670e2 100644 --- a/gtk/gtkrender.c +++ b/gtk/gtkrender.c @@ -134,7 +134,6 @@ gtk_do_render_check (GtkStyleContext *context, cr, width, height, image_type, - gtk_style_context_get_junction_sides (context), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)), @@ -232,7 +231,6 @@ gtk_do_render_option (GtkStyleContext *context, cr, width, height, image_type, - gtk_style_context_get_junction_sides (context), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)), @@ -320,7 +318,6 @@ gtk_do_render_arrow (GtkStyleContext *context, cr, size, size, GTK_CSS_IMAGE_BUILTIN_ARROW, - gtk_style_context_get_junction_sides (context), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)), @@ -521,7 +518,6 @@ gtk_do_render_expander (GtkStyleContext *context, cr, width, height, image_type, - gtk_style_context_get_junction_sides (context), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)), @@ -1105,17 +1101,42 @@ gtk_do_render_handle (GtkStyleContext *context, cairo_translate (cr, x, y); if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_GRIP)) - type = GTK_CSS_IMAGE_BUILTIN_GRIP; + { + GtkJunctionSides sides = gtk_style_context_get_junction_sides (context); + + /* order is important here for when too many (or too few) sides are set */ + if ((sides & GTK_JUNCTION_CORNER_BOTTOMRIGHT) == GTK_JUNCTION_CORNER_BOTTOMRIGHT) + type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT; + else if ((sides & GTK_JUNCTION_CORNER_TOPRIGHT) == GTK_JUNCTION_CORNER_TOPRIGHT) + type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOPRIGHT; + else if ((sides & GTK_JUNCTION_CORNER_BOTTOMLEFT) == GTK_JUNCTION_CORNER_BOTTOMLEFT) + type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMLEFT; + else if ((sides & GTK_JUNCTION_CORNER_TOPLEFT) == GTK_JUNCTION_CORNER_TOPLEFT) + type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOPLEFT; + else if (sides & GTK_JUNCTION_RIGHT) + type = GTK_CSS_IMAGE_BUILTIN_GRIP_RIGHT; + else if (sides & GTK_JUNCTION_BOTTOM) + type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOM; + else if (sides & GTK_JUNCTION_TOP) + type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOP; + else if (sides & GTK_JUNCTION_LEFT) + type = GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT; + else + type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT; + } else if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_PANE_SEPARATOR)) - type = GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR; + { + type = GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR; + } else - type = GTK_CSS_IMAGE_BUILTIN_HANDLE; + { + type = GTK_CSS_IMAGE_BUILTIN_HANDLE; + } gtk_css_image_builtin_draw (_gtk_css_image_value_get_image (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_SOURCE)), cr, width, height, type, - gtk_style_context_get_junction_sides (context), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)), @@ -1251,7 +1272,6 @@ gtk_do_render_activity (GtkStyleContext *context, cr, width, height, GTK_CSS_IMAGE_BUILTIN_SPINNER, - gtk_style_context_get_junction_sides (context), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR)), _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR)), |