mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-06 02:40:07 +00:00
GtkThemingEngine: Use border-image to render borders if an image is available.
This commit is contained in:
parent
7ee564c7cd
commit
96e5a02148
@ -26,6 +26,7 @@
|
|||||||
#include <gtk/gtkstylecontext.h>
|
#include <gtk/gtkstylecontext.h>
|
||||||
#include <gtk/gtkintl.h>
|
#include <gtk/gtkintl.h>
|
||||||
|
|
||||||
|
#include "gtk9slice.h"
|
||||||
#include "gtkpango.h"
|
#include "gtkpango.h"
|
||||||
|
|
||||||
typedef struct GtkThemingEnginePrivate GtkThemingEnginePrivate;
|
typedef struct GtkThemingEnginePrivate GtkThemingEnginePrivate;
|
||||||
@ -961,15 +962,26 @@ gtk_theming_engine_render_frame (GtkThemingEngine *engine,
|
|||||||
GtkStateFlags flags;
|
GtkStateFlags flags;
|
||||||
GdkColor lighter, darker;
|
GdkColor lighter, darker;
|
||||||
GdkColor *bg_color;
|
GdkColor *bg_color;
|
||||||
|
Gtk9Slice *slice;
|
||||||
|
|
||||||
cairo_save (cr);
|
|
||||||
flags = gtk_theming_engine_get_state (engine);
|
flags = gtk_theming_engine_get_state (engine);
|
||||||
|
|
||||||
cairo_set_line_width (cr, 1);
|
|
||||||
|
|
||||||
gtk_theming_engine_get (engine, flags,
|
gtk_theming_engine_get (engine, flags,
|
||||||
|
"border-image", &slice,
|
||||||
"background-color", &bg_color,
|
"background-color", &bg_color,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
if (slice)
|
||||||
|
{
|
||||||
|
gtk_9slice_render (slice, cr, x, y, width, height);
|
||||||
|
gtk_9slice_unref (slice);
|
||||||
|
gdk_color_free (bg_color);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_save (cr);
|
||||||
|
cairo_set_line_width (cr, 1);
|
||||||
|
|
||||||
color_shade (bg_color, 0.7, &darker);
|
color_shade (bg_color, 0.7, &darker);
|
||||||
color_shade (bg_color, 1.3, &lighter);
|
color_shade (bg_color, 1.3, &lighter);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user