Commit d1700d6e authored by Benjamin Otte's avatar Benjamin Otte

gdk: Move ref_cairo_surface from GdkDrawable to GdkWindowImpl

Also make it take the actual GdkWindow, not the implementation, like all
the other vfuncs do.
parent 62d004cf
......@@ -59,8 +59,6 @@ struct _GdkDrawableClass
{
GObjectClass parent_class;
cairo_surface_t *(*ref_cairo_surface) (GdkDrawable *drawable);
/* Padding for future expansion */
void (*_gdk_reserved7) (void);
void (*_gdk_reserved9) (void);
......
......@@ -135,9 +135,9 @@ is_parent_of (GdkWindow *parent,
}
static cairo_surface_t *
gdk_offscreen_window_ref_cairo_surface (GdkDrawable *drawable)
gdk_offscreen_window_ref_cairo_surface (GdkWindow *window)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
return cairo_surface_reference (get_surface (offscreen));
}
......@@ -694,13 +694,11 @@ static void
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
{
GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_offscreen_window_finalize;
drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
impl_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
impl_class->show = gdk_offscreen_window_show;
impl_class->hide = gdk_offscreen_window_hide;
impl_class->withdraw = gdk_offscreen_window_withdraw;
......
......@@ -2736,7 +2736,7 @@ gdk_window_begin_implicit_paint (GdkWindow *window, GdkRectangle *rect)
static cairo_surface_t *
gdk_window_ref_impl_surface (GdkWindow *window)
{
return GDK_DRAWABLE_GET_CLASS (window->impl)->ref_cairo_surface (window->impl);
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->ref_cairo_surface (window);
}
static cairo_t *
......
......@@ -50,6 +50,9 @@ struct _GdkWindowImplClass
{
GdkDrawableClass parent_class;
cairo_surface_t *
(* ref_cairo_surface) (GdkWindow *window);
void (* show) (GdkWindow *window,
gboolean already_mapped);
void (* hide) (GdkWindow *window);
......
......@@ -188,11 +188,10 @@ gdk_x11_cairo_surface_destroy (void *data)
}
static cairo_surface_t *
gdk_x11_create_cairo_surface (GdkDrawable *drawable,
gdk_x11_create_cairo_surface (GdkWindowImplX11 *impl,
int width,
int height)
{
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (drawable);
GdkVisual *visual;
visual = gdk_window_get_visual (impl->wrapper);
......@@ -203,23 +202,22 @@ gdk_x11_create_cairo_surface (GdkDrawable *drawable,
}
static cairo_surface_t *
gdk_x11_ref_cairo_surface (GdkDrawable *drawable)
gdk_x11_ref_cairo_surface (GdkWindow *window)
{
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (drawable);
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (window->impl);
if (GDK_IS_WINDOW_IMPL_X11 (drawable) &&
GDK_WINDOW_DESTROYED (impl->wrapper))
if (GDK_WINDOW_DESTROYED (window))
return NULL;
if (!impl->cairo_surface)
{
impl->cairo_surface = gdk_x11_create_cairo_surface (drawable,
gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
impl->cairo_surface = gdk_x11_create_cairo_surface (impl,
gdk_window_get_width (window),
gdk_window_get_height (window));
if (impl->cairo_surface)
cairo_surface_set_user_data (impl->cairo_surface, &gdk_x11_cairo_key,
drawable, gdk_x11_cairo_surface_destroy);
impl, gdk_x11_cairo_surface_destroy);
}
else
cairo_surface_reference (impl->cairo_surface);
......@@ -5567,13 +5565,11 @@ static void
gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
object_class->finalize = gdk_window_impl_x11_finalize;
drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
impl_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
impl_class->show = gdk_window_x11_show;
impl_class->hide = gdk_window_x11_hide;
impl_class->withdraw = gdk_window_x11_withdraw;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment