summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdkinternals.h4
-rw-r--r--gdk/gdkoffscreenwindow.c13
-rw-r--r--gdk/gdkwindow.c15
-rw-r--r--gdk/gdkwindowimpl.h5
-rw-r--r--gdk/quartz/gdkdrawable-quartz.c9
-rw-r--r--gdk/quartz/gdkwindow-quartz.c13
-rw-r--r--gdk/win32/gdkdrawable-win32.c9
-rw-r--r--gdk/win32/gdkwindow-win32.c13
-rw-r--r--gdk/x11/gdkdrawable-x11.c9
-rw-r--r--gdk/x11/gdkwindow-x11.c12
10 files changed, 65 insertions, 37 deletions
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 9f2c4ca183..e2f45d5cf5 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -495,10 +495,6 @@ void _gdk_display_pointer_info_foreach (GdkDisplay *display,
void _gdk_window_invalidate_for_expose (GdkWindow *window,
cairo_region_t *region);
-gboolean _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
- int width,
- int height);
-
GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
int x, int y);
GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index ebbdcc7737..dbacf952a3 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -597,6 +597,18 @@ gdk_offscreen_window_translate (GdkWindow *window,
_gdk_window_add_damage (window, area);
}
+static cairo_surface_t *
+gdk_offscreen_window_resize_cairo_surface (GdkWindow *window,
+ cairo_surface_t *surface,
+ gint width,
+ gint height)
+{
+ /* No-op. The surface gets resized in
+ * gdk_offscreen_window_move_resize_internal().
+ */
+ return surface;
+}
+
/**
* gdk_offscreen_window_set_embedder:
* @window: a #GdkWindow
@@ -700,4 +712,5 @@ gdk_offscreen_window_impl_iface_init (GdkWindowImplIface *iface)
iface->get_root_coords = gdk_offscreen_window_get_root_coords;
iface->get_device_state = gdk_offscreen_window_get_device_state;
iface->destroy = gdk_offscreen_window_destroy;
+ iface->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
}
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index e0ef633f37..6801900f8a 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -1018,14 +1018,17 @@ recompute_visible_regions_internal (GdkWindowObject *private,
recompute_visible_regions_internal (private->parent, TRUE, FALSE, FALSE);
}
- if (private->cairo_surface &&
- (!gdk_window_has_impl (private) ||
- !_gdk_windowing_set_cairo_surface_size (private->cairo_surface,
- private->width,
- private->height)))
+ if (private->cairo_surface && gdk_window_has_impl (private))
{
- gdk_window_drop_cairo_surface (private);
+ GdkWindowImplIface *iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
+
+ private->cairo_surface = iface->resize_cairo_surface (private->impl,
+ private->cairo_surface,
+ private->width,
+ private->height);
}
+ else if (private->cairo_surface)
+ gdk_window_drop_cairo_surface (private);
}
/* Call this when private has changed in one or more of these ways:
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index a39ed3793d..1c9d81980b 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -141,6 +141,11 @@ struct _GdkWindowImplIface
void (* destroy) (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy);
+
+ cairo_surface_t * (* resize_cairo_surface) (GdkWindow *window,
+ cairo_surface_t *surface,
+ gint width,
+ gint height);
};
/* Interface Functions */
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index b19913675b..632f0cd009 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -32,15 +32,6 @@ typedef struct {
CGContextRef cg_context;
} GdkQuartzCairoSurfaceData;
-gboolean
-_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
- int width,
- int height)
-{
- /* This is not supported with quartz surfaces. */
- return FALSE;
-}
-
static void
gdk_quartz_cairo_surface_destroy (void *data)
{
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 6a58347667..11d140fd91 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -1086,6 +1086,18 @@ _gdk_quartz_window_destroy (GdkWindow *window,
}
}
+static cairo_surface_t *
+gdk_window_quartz_resize_cairo_surface (GdkWindow *window,
+ cairo_surface_t *surface,
+ gint width,
+ gint height)
+{
+ /* Quartz surfaces cannot be resized */
+ cairo_surface_destroy (surface);
+
+ return NULL;
+}
+
void
_gdk_windowing_window_destroy_foreign (GdkWindow *window)
{
@@ -2986,6 +2998,7 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->queue_antiexpose = _gdk_quartz_window_queue_antiexpose;
iface->translate = _gdk_quartz_window_translate;
iface->destroy = _gdk_quartz_window_destroy;
+ iface->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;
}
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index beafd7b227..d2e0348adb 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -228,15 +228,6 @@ gdk_win32_ref_cairo_surface (GdkDrawable *drawable)
return impl->cairo_surface;
}
-gboolean
-_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
- gint width,
- gint height)
-{
- // Do nothing. The surface size is determined by the DC
- return FALSE;
-}
-
HGDIOBJ
gdk_win32_drawable_get_handle (GdkDrawable *drawable)
{
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 9869a8e19a..398be8dcb1 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -744,6 +744,18 @@ _gdk_win32_window_destroy (GdkWindow *window,
gdk_win32_handle_table_remove (GDK_WINDOW_HWND (window));
}
+static cairo_surface_t *
+gdk_win32_window_resize_cairo_surface (GdkWindow *window,
+ cairo_surface_t *surface,
+ gint width,
+ gint height)
+{
+ /* XXX: Make Cairo surface use DC clip */
+ cairo_surface_destroy (surface);
+
+ return NULL;
+}
+
void
_gdk_windowing_window_destroy_foreign (GdkWindow *window)
{
@@ -3299,6 +3311,7 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->queue_antiexpose = _gdk_win32_window_queue_antiexpose;
iface->translate = _gdk_win32_window_translate;
iface->destroy = _gdk_win32_window_destroy;
+ iface->resize_cairo_surface = gdk_win32_window_resize_cairo_surface;
}
gboolean
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index 9214364caa..21107166ea 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -194,15 +194,6 @@ gdk_x11_cairo_surface_destroy (void *data)
impl->cairo_surface = NULL;
}
-gboolean
-_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
- int width,
- int height)
-{
- cairo_xlib_surface_set_size (surface, width, height);
- return TRUE;
-}
-
static cairo_surface_t *
gdk_x11_create_cairo_surface (GdkDrawable *drawable,
int width,
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index df634b6b65..66494d6152 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -1028,6 +1028,17 @@ _gdk_x11_window_destroy (GdkWindow *window,
}
}
+static cairo_surface_t *
+gdk_window_x11_resize_cairo_surface (GdkWindow *window,
+ cairo_surface_t *surface,
+ gint width,
+ gint height)
+{
+ cairo_xlib_surface_set_size (surface, width, height);
+
+ return surface;
+}
+
void
_gdk_windowing_window_destroy_foreign (GdkWindow *window)
{
@@ -5514,6 +5525,7 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->queue_antiexpose = _gdk_x11_window_queue_antiexpose;
iface->translate = _gdk_x11_window_translate;
iface->destroy = _gdk_x11_window_destroy;
+ iface->resize_cairo_surface = gdk_window_x11_resize_cairo_surface;
}
static Bool