]> Pileus Git - ~andy/gtk/commitdiff
gdk: Move ref_cairo_surface from GdkDrawable to GdkWindowImpl
authorBenjamin Otte <otte@redhat.com>
Tue, 23 Nov 2010 00:46:03 +0000 (01:46 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 2 Dec 2010 19:21:03 +0000 (20:21 +0100)
Also make it take the actual GdkWindow, not the implementation, like all
the other vfuncs do.

gdk/gdkdrawable.h
gdk/gdkoffscreenwindow.c
gdk/gdkwindow.c
gdk/gdkwindowimpl.h
gdk/x11/gdkwindow-x11.c

index 9e75d158064098337cb3e9291f1fc6c448d795a9..c8d81469689ddb95a488bfb391099dc2dec23106 100644 (file)
@@ -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);
index 04770e57da5be9039a1f908e09bf9443ed438814..018af4702381d841f22920e79fbddf8e10d0b82e 100644 (file)
@@ -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;
index 15c864fdccd60820cc942573e4da9de67edb7669..c746764756f611c937f14a97dde622902e94ea81 100644 (file)
@@ -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 *
index 3df0095956c34bbd1d12b3e439317d520566924e..ece83a226ed5f5bc3707f0445e63b346735eb845 100644 (file)
@@ -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);
index 82fa879552ffd6659d9cbdf114bae2d9cecb21a5..d7eed9e75f67b81b5339d89bf832d20e29851cad 100644 (file)
@@ -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;