summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-05-31 22:03:25 +0200
committerraveit65 <[email protected]>2016-07-02 10:50:56 +0200
commit36050c2e84626e52c11790cdc706079f6861c4a5 (patch)
tree9738c5a756863fc36102e9c424bb0bead0de1c2e /eel
parent6eb433420c347de2384dcfe3dbbd7b5fc97117da (diff)
downloadcaja-36050c2e84626e52c11790cdc706079f6861c4a5.tar.bz2
caja-36050c2e84626e52c11790cdc706079f6861c4a5.tar.xz
GTK+-3 eel-background: prepare code for GtkStyleContext port
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-background.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/eel/eel-background.c b/eel/eel-background.c
index 9fdb333d..c107ed7c 100644
--- a/eel/eel-background.c
+++ b/eel/eel-background.c
@@ -373,18 +373,42 @@ void
eel_background_draw (GtkWidget *widget,
# if GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr)
+{
+ int width, height;
+ GdkWindow *window = gtk_widget_get_window (widget);
+ GdkColor color;
+
+ EelBackground *self = eel_get_widget_background (widget);
+
+ drawable_get_adjusted_size (self, &width, &height);
+
+ eel_background_ensure_realized (self);
+ color = self->details->default_color;
+ make_color_inactive (self, &color);
+
+ cairo_save (cr);
+
+ if (self->details->bg_surface != NULL) {
+ cairo_set_source_surface (cr, self->details->bg_surface, 0, 0);
+ cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+ } else {
+ gdk_cairo_set_source_color (cr, &color);
+ }
+
+ cairo_rectangle (cr, 0, 0, width, height);
+ cairo_fill (cr);
+
+ cairo_restore (cr);
+}
# else
GdkEventExpose *event)
-# endif
{
int width, height;
GdkWindow *window = gtk_widget_get_window (widget);
GdkColor color;
-# if !GTK_CHECK_VERSION (3, 0, 0)
if (event->window != window)
return;
-# endif
EelBackground *self = eel_get_widget_background (widget);
@@ -394,11 +418,7 @@ eel_background_draw (GtkWidget *widget,
color = self->details->default_color;
make_color_inactive (self, &color);
-# if GTK_CHECK_VERSION(3,0,0)
- cairo_save (cr);
-# else
cairo_t *cr = gdk_cairo_create (window);
-# endif
if (self->details->bg_surface != NULL) {
cairo_set_source_surface (cr, self->details->bg_surface, 0, 0);
@@ -407,20 +427,15 @@ eel_background_draw (GtkWidget *widget,
gdk_cairo_set_source_color (cr, &color);
}
-# if !GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_rectangle (cr, &event->area);
cairo_clip (cr);
-# endif
cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);
-# if GTK_CHECK_VERSION(3,0,0)
- cairo_restore (cr);
-# else
cairo_destroy (cr);
-# endif
}
+# endif
static void
set_root_surface (EelBackground *self,