From 84bc2804401818c0b4a23f75979966b0bd1610f8 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 4 Jan 2012 04:00:58 +0100 Subject: [PATCH] borderimage: Add _gtk_border_image_new_for_context() and use it. --- gtk/gtkborderimage.c | 16 ++++++++++++++++ gtk/gtkborderimageprivate.h | 1 + gtk/gtkthemingengine.c | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gtk/gtkborderimage.c b/gtk/gtkborderimage.c index 4f1d0c1e57..f13b0a83db 100644 --- a/gtk/gtkborderimage.c +++ b/gtk/gtkborderimage.c @@ -28,6 +28,7 @@ #include "gtkborderimageprivate.h" #include "gtkstylepropertiesprivate.h" +#include "gtkthemingengineprivate.h" /* this is in case round() is not provided by the compiler, * such as in the case of C89 compilers, like MSVC @@ -72,6 +73,21 @@ _gtk_border_image_new (GtkCssImage *source, return image; } +GtkBorderImage * +_gtk_border_image_new_for_engine (GtkThemingEngine *engine) +{ + GtkCssImage *source; + + source = g_value_get_object (_gtk_theming_engine_peek_property (engine, "border-image-source")); + if (source == NULL) + return NULL; + + return _gtk_border_image_new (source, + g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-slice")), + g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-width")), + g_value_get_boxed (_gtk_theming_engine_peek_property (engine, "border-image-repeat"))); +} + GtkBorderImage * _gtk_border_image_ref (GtkBorderImage *image) { diff --git a/gtk/gtkborderimageprivate.h b/gtk/gtkborderimageprivate.h index 39b3eb0714..f9654daba2 100644 --- a/gtk/gtkborderimageprivate.h +++ b/gtk/gtkborderimageprivate.h @@ -43,6 +43,7 @@ GtkBorderImage * _gtk_border_image_new (GtkCssImage *sour GtkBorder *slice, GtkBorder *width, GtkCssBorderImageRepeat *repeat); +GtkBorderImage * _gtk_border_image_new_for_engine (GtkThemingEngine *engine); GtkBorderImage * _gtk_border_image_ref (GtkBorderImage *image); void _gtk_border_image_unref (GtkBorderImage *image); diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c index 57e16e50bc..edcd5c426d 100644 --- a/gtk/gtkthemingengine.c +++ b/gtk/gtkthemingengine.c @@ -1552,8 +1552,8 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine, junction = gtk_theming_engine_get_junction_sides (engine); gtk_theming_engine_get_border (engine, flags, &border); + border_image = _gtk_border_image_new_for_engine (engine); gtk_theming_engine_get (engine, flags, - "border-image", &border_image, "border-style", &border_style, NULL); @@ -1920,8 +1920,8 @@ gtk_theming_engine_render_frame_gap (GtkThemingEngine *engine, junction = gtk_theming_engine_get_junction_sides (engine); gtk_theming_engine_get_border (engine, state, &border); + border_image = _gtk_border_image_new_for_engine (engine); gtk_theming_engine_get (engine, state, - "border-image", &border_image, "border-top-left-radius", &top_left_radius, "border-top-right-radius", &top_right_radius, "border-bottom-right-radius", &bottom_right_radius,