diff options
author | Michael Natterer <mitch@gimp.org> | 2010-10-14 13:25:23 +0200 |
---|---|---|
committer | Michael Natterer <mitch@gimp.org> | 2010-10-14 13:25:23 +0200 |
commit | 9d9742f1e56a331f71c6a46b11ccc765621d46c7 (patch) | |
tree | 2a8736e41f6ea1f8ab254bcda86a41c711cd3240 /gdk/gdkoffscreenwindow.c | |
parent | 10c76c1c956c9dee46a6d9e28b9456967d508889 (diff) | |
download | gtk+-9d9742f1e56a331f71c6a46b11ccc765621d46c7.tar.gz |
Bug 631599 - Allow to use arbitrary surfaces for offscreen windows
Add signal GdkWindow::create-surface which allows to use any
surface type as storage for offscreen windows.
Test the new signal in tests/gdkoffscreenbox.c
Diffstat (limited to 'gdk/gdkoffscreenwindow.c')
-rw-r--r-- | gdk/gdkoffscreenwindow.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c index 0cea577379..55d1fad827 100644 --- a/gdk/gdkoffscreenwindow.c +++ b/gdk/gdkoffscreenwindow.c @@ -113,17 +113,11 @@ get_surface (GdkOffscreenWindow *offscreen) if (! offscreen->surface) { GdkWindowObject *private = (GdkWindowObject *) offscreen->wrapper; - cairo_surface_t *similar; - similar = _gdk_drawable_ref_cairo_surface ((GdkWindow *)private->parent); - - offscreen->surface = cairo_surface_create_similar (similar, - /* FIXME: use visual */ - CAIRO_CONTENT_COLOR, - private->width, - private->height); - - cairo_surface_destroy (similar); + g_signal_emit_by_name (private, "create-surface", + private->width, + private->height, + &offscreen->surface); } return offscreen->surface; @@ -155,6 +149,30 @@ gdk_offscreen_window_ref_cairo_surface (GdkDrawable *drawable) return cairo_surface_reference (get_surface (offscreen)); } +cairo_surface_t * +_gdk_offscreen_window_create_surface (GdkWindow *offscreen, + gint width, + gint height) +{ + GdkWindowObject *private = (GdkWindowObject *) offscreen; + cairo_surface_t *similar; + cairo_surface_t *surface; + + g_return_val_if_fail (GDK_IS_OFFSCREEN_WINDOW (private->impl), NULL); + + similar = _gdk_drawable_ref_cairo_surface ((GdkWindow *)private->parent); + + surface = cairo_surface_create_similar (similar, + /* FIXME: use visual */ + CAIRO_CONTENT_COLOR, + width, + height); + + cairo_surface_destroy (similar); + + return surface; +} + void _gdk_offscreen_window_new (GdkWindow *window, GdkWindowAttr *attributes, |