summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk/gdkdrawingcontext.c2
-rw-r--r--gdk/gdkinternals.h2
-rw-r--r--gdk/gdkwindow.c17
3 files changed, 10 insertions, 11 deletions
diff --git a/gdk/gdkdrawingcontext.c b/gdk/gdkdrawingcontext.c
index 89d9b500b1..c082a155cc 100644
--- a/gdk/gdkdrawingcontext.c
+++ b/gdk/gdkdrawingcontext.c
@@ -180,7 +180,7 @@ gdk_drawing_context_init (GdkDrawingContext *self)
static const cairo_user_data_key_t draw_context_key;
-static void
+void
gdk_cairo_set_drawing_context (cairo_t *cr,
GdkDrawingContext *context)
{
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 255557f53e..33aca335ce 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -451,6 +451,8 @@ void gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface,
GdkWindow *window);
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
+void gdk_cairo_set_drawing_context (cairo_t *cr,
+ GdkDrawingContext *context);
/*************************************
* Interfaces used by windowing code *
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 8abcddf12f..b9c58430e2 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -3553,20 +3553,17 @@ gdk_cairo_create (GdkWindow *window)
cr = cairo_create (surface);
- if (window->impl_window->current_paint.region != NULL)
- {
- region = cairo_region_copy (window->impl_window->current_paint.region);
- cairo_region_translate (region, -window->abs_x, -window->abs_y);
- }
- else
- {
- region = cairo_region_copy (window->clip_region);
- }
-
+ region = gdk_window_get_current_paint_region (window);
gdk_cairo_region (cr, region);
cairo_region_destroy (region);
cairo_clip (cr);
+ /* Assign a drawing context, if one is set; if gdk_cairo_create()
+ * is called outside of a frame drawing then this is going to be
+ * NULL.
+ */
+ gdk_cairo_set_drawing_context (cr, window->drawing_context);
+
cairo_surface_destroy (surface);
return cr;