[gtk+] gdk: Move ref_cairo_surface from GdkDrawable to GdkWindowImpl



commit d1700d6e3cf5d31b41abf78be5609cd886daf579
Author: Benjamin Otte <otte redhat com>
Date:   Tue Nov 23 01:46:03 2010 +0100

    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.

 gdk/gdkdrawable.h        |    2 --
 gdk/gdkoffscreenwindow.c |    8 +++-----
 gdk/gdkwindow.c          |    2 +-
 gdk/gdkwindowimpl.h      |    3 +++
 gdk/x11/gdkwindow-x11.c  |   22 +++++++++-------------
 5 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h
index 9e75d15..c8d8146 100644
--- a/gdk/gdkdrawable.h
+++ b/gdk/gdkdrawable.h
@@ -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);
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index 04770e5..018af47 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -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;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 15c864f..c746764 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -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 *
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index 3df0095..ece83a2 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -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);
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 82fa879..d7eed9e 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]