GdkDrawable -> GObject



Hi,

I started over on the GObject thing and this time did the hard part
first; it works for me now, at least with testgtk.

Summary:
 - GdkDrawable is a fully virtual object, that is, it has no 
   data members, and all its methods are virtual pretty much
 - GdkWindow is a subclass
 - the instance/class structs are called GdkWindowObject[Class], for 
   legacy reasons
 - GdkPixmap is a subclass, its instance/class is GdkPixmapObject
 - All functions take GdkWindow/GdkPixmap which are typedefs for 
   GdkWindow; thus GDK_WINDOW() and GDK_PIXMAP() return the 
   typedef. This means GDK_WINDOW(window)->struct_field 
   doesn't work, but all the fields are private anyway.
 - platform-specific code provides the GdkDrawable subclasses
   GdkWindowImpl and GdkPixmapImpl; only the _get_type() 
   functions of these are exported to cross-platform GDK
 - GdkWindow and GdkPixmap are implemented by delegating 
   much of their functionality to the Impl variants
 - the X port shares code between GdkWindowImpl and  
   GdkPixmapImpl using a GdkDrawableImpl, but other ports
   do not need to do this

Now I'm going to move to the easy types. The basic strategy is to
declare the GObject in the cross-platform headers, with a "gpointer
windowing_data" so that platform-specific code can implement the type
without changing its size. Thus derived classes will be permitted.
I believe this works for GdkColormap, GdkDragContext, GdkImage.
So I'm going to go ahead and do those, they should be trivial.

GdkGC is a bit different; it's a purely virtual type like GdkDrawable,
and the "constructor" is virtualized via GdkDrawable::create_gc.  This
is somewhat pesky, because g_type_create_instance (gdk_gc_get_type())
will give you a totally useless no-op object that segfaults ("pure
virtual method called") if you invoke any methods (we could make it
not segfault I suppose, but it would still do nothing).

The basic problem is that GdkGC is both a virtual interface and a
concrete class.  However I don't see a way around that that doesn't
make a big mess or break backward compatibility.

The concrete impact is that you can't make a subclass of the concrete
GdkGC for the platform, you can only derive from the abstract
interface. This is going to be life unless someone gives me
suggestions. ;-)

Also as I mentioned before, the clip region/mask stuff for GdkGC
currently can't be virtually overridden in practice. I'm not going to
solve this problem in the immediate future I don't think.

GdkFont as I said before is going to remain untouched until the plan
for Pango integration is complete, but it should be trivial to
GObject-ify using the same strategy used for the other types.
(However, I think GdkFont is more or less deprecated anyway in favor
of PangoFontDescription.)

Havoc

Index: gdk/Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/Makefile.am,v
retrieving revision 1.41
retrieving revision 1.41.4.1
diff -u -r1.41 -r1.41.4.1
--- gdk/Makefile.am	2000/04/05 04:11:10	1.41
+++ gdk/Makefile.am	2000/05/17 19:48:26	1.41.4.1
@@ -85,6 +85,7 @@
 	gdkglobals.c	\
 	gdkimage.c	\
 	gdkinternals.h  \
+	gdkpixmap.c	\
 	gdkrgb.c	\
 	gdkrectangle.c	\
 	gdkwindow.c	\
Index: gdk/gdk.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdk.c,v
retrieving revision 1.118
retrieving revision 1.118.2.2
diff -u -r1.118 -r1.118.2.2
--- gdk/gdk.c	2000/05/02 21:36:07	1.118
+++ gdk/gdk.c	2000/05/17 18:34:13	1.118.2.2
@@ -313,6 +313,8 @@
   }
 #endif	/* G_ENABLE_DEBUG */
 
+  g_type_init ();
+  
   arg_context = gdk_arg_context_new (NULL);
   gdk_arg_context_add_table (arg_context, gdk_args);
   gdk_arg_context_add_table (arg_context, _gdk_windowing_args);
@@ -334,8 +336,8 @@
   
   gdk_events_init ();
   gdk_visual_init ();
-  gdk_window_init ();
-  gdk_image_init ();
+  gdk_windowing_window_init ();
+  gdk_windowing_image_init ();
   gdk_input_init ();
   gdk_dnd_init ();
 
Index: gdk/gdkcompat.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkcompat.h,v
retrieving revision 1.3
retrieving revision 1.3.6.2
diff -u -r1.3 -r1.3.6.2
--- gdk/gdkcompat.h	2000/01/29 22:26:40	1.3
+++ gdk/gdkcompat.h	2000/05/17 19:48:26	1.3.6.2
@@ -11,13 +11,12 @@
  */
 #ifndef	GDK_DISABLE_COMPAT_H
 
-#define GdkWindowType                  GdkDrawableType
-
 #define gdk_draw_pixmap                gdk_draw_drawable
 #define gdk_draw_bitmap                gdk_draw_drawable
 
 #define gdk_window_get_size            gdk_drawable_get_size
-#define gdk_window_get_type            gdk_drawable_get_type
+/* We can't really be compatible here, due to GObject */
+/* #define gdk_window_get_type            gdk_drawable_get_type */
 #define gdk_window_get_colormap        gdk_drawable_get_colormap
 #define gdk_window_set_colormap        gdk_drawable_set_colormap
 #define gdk_window_get_visual          gdk_drawable_get_visual
Index: gdk/gdkdraw.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkdraw.c,v
retrieving revision 1.15
retrieving revision 1.15.2.3
diff -u -r1.15 -r1.15.2.3
--- gdk/gdkdraw.c	2000/04/15 16:22:52	1.15
+++ gdk/gdkdraw.c	2000/05/17 18:34:14	1.15.2.3
@@ -28,54 +28,91 @@
 #include "gdkinternals.h"
 #include "gdkwindow.h"
 
-/* Manipulation of drawables
- */
-GdkDrawable *
-gdk_drawable_alloc (void)
+static void gdk_drawable_init       (GdkDrawable      *drawable);
+static void gdk_drawable_class_init (GdkDrawableClass *klass);
+static void gdk_drawable_finalize   (GObject          *object);
+
+static gpointer parent_class = NULL;
+
+GType
+gdk_drawable_get_type (void)
 {
-  GdkDrawablePrivate *private = g_new (GdkDrawablePrivate, 1);
-  GdkDrawable *drawable = (GdkDrawable*) private;
+  static GType object_type = 0;
+
+  if (!object_type)
+    {
+      static const GTypeInfo object_info =
+      {
+        sizeof (GdkDrawableClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gdk_drawable_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (GdkDrawable),
+        0,              /* n_preallocs */
+        (GInstanceInitFunc) gdk_drawable_init,
+      };
+      
+      object_type = g_type_register_static (G_TYPE_OBJECT,
+                                            "GdkDrawable",
+                                            &object_info);
+    }
   
-  drawable->user_data = NULL;
+  return object_type;
+}
+
+static void
+gdk_drawable_init (GdkDrawable *drawable)
+{
 
-  private->ref_count = 1;
-  private->destroyed = FALSE;
-  private->klass = NULL;
-  private->klass_data = NULL;
-  private->window_type = GDK_WINDOW_CHILD;
 
-  private->width = 1;
-  private->height = 1;
+}
 
-  private->depth = 0;
+static void
+gdk_drawable_class_init (GdkDrawableClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  private->colormap = NULL;
+  parent_class = g_type_class_peek (G_TYPE_OBJECT);
 
-  return drawable;
+  object_class->finalize = gdk_drawable_finalize;
+}
+
+static void
+gdk_drawable_finalize (GObject *object)
+{
+  GdkDrawable *drawable = GDK_DRAWABLE (object);
+
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+/* Manipulation of drawables
+ */
+
 void          
 gdk_drawable_set_data (GdkDrawable   *drawable,
 		       const gchar   *key,
 		       gpointer	      data,
 		       GDestroyNotify destroy_func)
 {
-  g_dataset_set_data_full (drawable, key, data, destroy_func);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+  
+  g_object_set_qdata_full (G_OBJECT (drawable),
+                           g_quark_from_string (key),
+                           data,
+                           destroy_func);
 }
 
 gpointer
 gdk_drawable_get_data (GdkDrawable   *drawable,
 		       const gchar   *key)
-{
-  return g_dataset_get_data (drawable, key);
-}
-
-GdkDrawableType
-gdk_drawable_get_type (GdkDrawable *drawable)
 {
-  g_return_val_if_fail (drawable != NULL, (GdkDrawableType) -1);
+  g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
   
-  return GDK_DRAWABLE_TYPE (drawable);
+  return g_object_get_qdata (G_OBJECT (drawable),
+                             g_quark_from_string (key));
 }
 
 void
@@ -83,63 +120,60 @@
 		       gint        *width,
 		       gint        *height)
 {
-  GdkDrawablePrivate *drawable_private;
-  
-  g_return_if_fail (drawable != NULL);
-  
-  drawable_private = (GdkDrawablePrivate*) drawable;
-  
-  if (width)
-    *width = drawable_private->width;
-  if (height)
-    *height = drawable_private->height;
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+
+  GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);  
 }
 
 GdkVisual*
 gdk_drawable_get_visual (GdkDrawable *drawable)
 {
-  GdkColormap *colormap;
-
-  g_return_val_if_fail (drawable != NULL, NULL);
-
-  colormap = gdk_drawable_get_colormap (drawable);
-  return colormap ? gdk_colormap_get_visual (colormap) : NULL;
+  g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+  
+  return GDK_DRAWABLE_GET_CLASS (drawable)->get_visual (drawable);
 }
 
 gint
 gdk_drawable_get_depth (GdkDrawable *drawable)
+{
+  g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), 0);
+
+  return GDK_DRAWABLE_GET_CLASS (drawable)->get_depth (drawable);
+}
+
+void
+gdk_drawable_set_colormap (GdkDrawable *drawable,
+                           GdkColormap *cmap)
 {
-  GdkDrawablePrivate *private = (GdkDrawablePrivate *)drawable;
-  g_return_val_if_fail (drawable != NULL, 0);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
 
-  return private->depth;
+  GDK_DRAWABLE_GET_CLASS (drawable)->set_colormap (drawable, cmap);
 }
 
+GdkColormap*
+gdk_drawable_get_colormap (GdkDrawable *drawable)
+{
+  g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+
+  return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (drawable);
+}
+
 GdkDrawable*
 gdk_drawable_ref (GdkDrawable *drawable)
 {
-  GdkDrawablePrivate *private = (GdkDrawablePrivate *)drawable;
-  g_return_val_if_fail (drawable != NULL, NULL);
-  
-  private->ref_count += 1;
+  g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
+
+  g_object_ref (G_OBJECT (drawable));
+
   return drawable;
 }
 
 void
 gdk_drawable_unref (GdkDrawable *drawable)
 {
-  GdkDrawablePrivate *private = (GdkDrawablePrivate *)drawable;
-  
-  g_return_if_fail (drawable != NULL);
-  g_return_if_fail (private->ref_count > 0);
-  
-  private->ref_count -= 1;
-  if (private->ref_count == 0)
-    {
-      private->klass->destroy (drawable);
-      g_dataset_destroy (drawable);
-      g_free (drawable);
-    }
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+
+  g_object_unref (G_OBJECT (drawable));
 }
 
 /* Drawing
@@ -153,17 +187,15 @@
   GdkGCPrivate *gc_private;
   GdkPoint point;
 
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (gc != NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable))
-    return;
   gc_private = (GdkGCPrivate*) gc;
 
   point.x = x;
   point.y = y;
   
-  ((GdkDrawablePrivate *)drawable)->klass->draw_points (drawable, gc, &point, 1);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc, &point, 1);
 }
 
 void
@@ -177,18 +209,16 @@
   GdkGCPrivate *gc_private;
   GdkSegment segment;
 
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (gc != NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable))
-    return;
   gc_private = (GdkGCPrivate*) gc;
 
   segment.x1 = x1;
   segment.y1 = y1;
   segment.x2 = x2;
   segment.y2 = y2;
-  ((GdkDrawablePrivate *)drawable)->klass->draw_segments (drawable, gc, &segment, 1);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, &segment, 1);
 }
 
 void
@@ -199,23 +229,25 @@
 		    gint         y,
 		    gint         width,
 		    gint         height)
-{
-  GdkDrawablePrivate *drawable_private;
-
-  g_return_if_fail (drawable != NULL);
+{  
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (gc != NULL);
-
-  drawable_private = (GdkDrawablePrivate*) drawable;
-  if (GDK_DRAWABLE_DESTROYED (drawable))
-    return;
 
-  if (width < 0)
-    width = drawable_private->width;
-  if (height < 0)
-    height = drawable_private->height;
+  if (width < 0 || height < 0)
+    {
+      gint real_width;
+      gint real_height;
+      
+      gdk_drawable_get_size (drawable, &real_width, &real_height);
+
+      if (width < 0)
+        width = real_width;
+      if (height < 0)
+        height = real_height;
+    }
 
-  ((GdkDrawablePrivate *)drawable)->klass->draw_rectangle (drawable, gc, filled, x, y,
-							   width, height);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_rectangle (drawable, gc, filled, x, y,
+                                                     width, height);
 }
 
 void
@@ -228,25 +260,25 @@
 	      gint         height,
 	      gint         angle1,
 	      gint         angle2)
-{
-  GdkDrawablePrivate *drawable_private;
-  GdkGCPrivate *gc_private;
-
-  g_return_if_fail (drawable != NULL);
+{  
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (gc != NULL);
 
-  drawable_private = (GdkDrawablePrivate*) drawable;
-  if (GDK_DRAWABLE_DESTROYED (drawable))
-    return;
-  gc_private = (GdkGCPrivate*) gc;
-
-  if (width < 0)
-    width = drawable_private->width;
-  if (height < 0)
-    height = drawable_private->height;
+  if (width < 0 || height < 0)
+    {
+      gint real_width;
+      gint real_height;
+      
+      gdk_drawable_get_size (drawable, &real_width, &real_height);
+
+      if (width < 0)
+        width = real_width;
+      if (height < 0)
+        height = real_height;
+    }
 
-  ((GdkDrawablePrivate *)drawable)->klass->draw_arc (drawable, gc, filled,
-						     x, y, width, height, angle1, angle2);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_arc (drawable, gc, filled,
+                                               x, y, width, height, angle1, angle2);
 }
 
 void
@@ -256,13 +288,10 @@
 		  GdkPoint    *points,
 		  gint         npoints)
 {
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (gc != NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable))
-    return;
-
-  ((GdkDrawablePrivate *)drawable)->klass->draw_polygon (drawable, gc, filled,
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_polygon (drawable, gc, filled,
 							 points, npoints);
 }
 
@@ -298,12 +327,12 @@
 	       const gchar *text,
 	       gint         text_length)
 {
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (font != NULL);
   g_return_if_fail (gc != NULL);
   g_return_if_fail (text != NULL);
 
-  ((GdkDrawablePrivate *)drawable)->klass->draw_text (drawable, font, gc, x, y, text, text_length);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_text (drawable, font, gc, x, y, text, text_length);
 }
 
 void
@@ -315,12 +344,12 @@
 		  const GdkWChar *text,
 		  gint		  text_length)
 {
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (font != NULL);
   g_return_if_fail (gc != NULL);
   g_return_if_fail (text != NULL);
 
-  ((GdkDrawablePrivate *)drawable)->klass->draw_text_wc (drawable, font, gc, x, y, text, text_length);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_text_wc (drawable, font, gc, x, y, text, text_length);
 }
 
 void
@@ -334,21 +363,26 @@
 		   gint         width,
 		   gint         height)
 {
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (src != NULL);
   g_return_if_fail (gc != NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable) || GDK_DRAWABLE_DESTROYED (src))
-    return;
-
-  if (width == -1)
-    width = ((GdkDrawablePrivate *)src)->width;
-  if (height == -1)
-    height = ((GdkDrawablePrivate *)src)->height;
+  if (width < 0 || height < 0)
+    {
+      gint real_width;
+      gint real_height;
+      
+      gdk_drawable_get_size (drawable, &real_width, &real_height);
+
+      if (width < 0)
+        width = real_width;
+      if (height < 0)
+        height = real_height;
+    }
 
-  ((GdkDrawablePrivate *)drawable)->klass->draw_drawable (drawable, gc, src,
-							  xsrc, ysrc, xdest, ydest,
-							  width, height);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_drawable (drawable, gc, src,
+                                                    xsrc, ysrc, xdest, ydest,
+                                                    width, height);
 }
 
 void
@@ -364,7 +398,7 @@
 {
   GdkImagePrivate *image_private;
 
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (image != NULL);
   g_return_if_fail (gc != NULL);
 
@@ -390,18 +424,15 @@
 		 GdkPoint    *points,
 		 gint         npoints)
 {
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail ((points != NULL) && (npoints > 0));
   g_return_if_fail (gc != NULL);
   g_return_if_fail (npoints >= 0);
 
   if (npoints == 0)
     return;
-
-  if (GDK_DRAWABLE_DESTROYED (drawable))
-    return;
 
-  ((GdkDrawablePrivate *)drawable)->klass->draw_points (drawable, gc, points, npoints);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_points (drawable, gc, points, npoints);
 }
 
 void
@@ -410,7 +441,7 @@
 		   GdkSegment  *segs,
 		   gint         nsegs)
 {
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
 
   if (nsegs == 0)
     return;
@@ -419,10 +450,7 @@
   g_return_if_fail (gc != NULL);
   g_return_if_fail (nsegs >= 0);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable))
-    return;
-
-  ((GdkDrawablePrivate *)drawable)->klass->draw_segments (drawable, gc, segs, nsegs);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_segments (drawable, gc, segs, nsegs);
 }
 
 void
@@ -432,16 +460,13 @@
 		gint         npoints)
 {
 
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
   g_return_if_fail (points != NULL);
   g_return_if_fail (gc != NULL);
   g_return_if_fail (npoints >= 0);
 
   if (npoints == 0)
     return;
-
-  if (GDK_DRAWABLE_DESTROYED (drawable))
-    return;
 
-  ((GdkDrawablePrivate *)drawable)->klass->draw_lines (drawable, gc, points, npoints);
+  GDK_DRAWABLE_GET_CLASS (drawable)->draw_lines (drawable, gc, points, npoints);
 }
Index: gdk/gdkdrawable.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkdrawable.h,v
retrieving revision 1.6
retrieving revision 1.6.2.2
diff -u -r1.6 -r1.6.2.2
--- gdk/gdkdrawable.h	2000/04/15 16:22:52	1.6
+++ gdk/gdkdrawable.h	2000/05/17 03:50:39	1.6.2.2
@@ -10,45 +10,22 @@
 
 typedef struct _GdkDrawableClass GdkDrawableClass;
 
-/* Types of windows.
- *   Root: There is only 1 root window and it is initialized
- *	   at startup. Creating a window of type GDK_WINDOW_ROOT
- *	   is an error.
- *   Toplevel: Windows which interact with the window manager.
- *   Child: Windows which are children of some other type of window.
- *	    (Any other type of window). Most windows are child windows.
- *   Dialog: A special kind of toplevel window which interacts with
- *	     the window manager slightly differently than a regular
- *	     toplevel window. Dialog windows should be used for any
- *	     transient window.
- *   Pixmap: Pixmaps are really just another kind of window which
- *	     doesn't actually appear on the screen. It can't have
- *	     children, either and is really just a convenience so
- *	     that the drawing functions can work on both windows
- *	     and pixmaps transparently. (ie. You shouldn't pass a
- *	     pixmap to any procedure which accepts a window with the
- *	     exception of the drawing functions).
- *   Foreign: A window that actually belongs to another application
- */
-typedef enum
-{
-  GDK_WINDOW_ROOT,
-  GDK_WINDOW_TOPLEVEL,
-  GDK_WINDOW_CHILD,
-  GDK_WINDOW_DIALOG,
-  GDK_WINDOW_TEMP,
-  GDK_DRAWABLE_PIXMAP,
-  GDK_WINDOW_FOREIGN
-} GdkDrawableType;
+#define GDK_TYPE_DRAWABLE              (gdk_drawable_get_type ())
+#define GDK_DRAWABLE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE, GdkDrawable))
+#define GDK_DRAWABLE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE, GdkDrawableClass))
+#define GDK_IS_DRAWABLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE))
+#define GDK_IS_DRAWABLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE))
+#define GDK_DRAWABLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE, GdkDrawableClass))
 
 struct _GdkDrawable
 {
-  gpointer user_data;
+  GObject parent_instance;
 };
  
 struct _GdkDrawableClass 
 {
-  void  (*destroy)       (GdkDrawable    *drawable);
+  GObjectClass parent_class;
+  
   GdkGC *(*create_gc)    (GdkDrawable    *drawable,
 		          GdkGCValues    *values,
 		          GdkGCValuesMask mask);
@@ -108,13 +85,23 @@
 			  GdkGC        *gc,
 			  GdkPoint     *points,
 			  gint          npoints);
+
+  gint (*get_depth)      (GdkDrawable  *drawable);
+  void (*get_size)       (GdkDrawable  *drawable,
+                          gint         *width,
+                          gint         *height);
+
+  void (*set_colormap)   (GdkDrawable  *drawable,
+                          GdkColormap  *cmap);
+
+  GdkColormap* (*get_colormap) (GdkDrawable *drawable);
+  GdkVisual*   (*get_visual) (GdkDrawable  *drawable);
 };
 
+GType           gdk_drawable_get_type     (void);
+
 /* Manipulation of drawables
  */
-GdkDrawable *   gdk_drawable_alloc        (void);
-
-GdkDrawableType gdk_drawable_get_type     (GdkDrawable	  *window);
 
 void            gdk_drawable_set_data     (GdkDrawable    *drawable,
 					   const gchar    *key,
@@ -123,7 +110,7 @@
 gpointer        gdk_drawable_get_data     (GdkDrawable    *drawable,
 					   const gchar    *key);
 
-void            gdk_drawable_get_size     (GdkWindow	  *drawable,
+void            gdk_drawable_get_size     (GdkDrawable	  *drawable,
 					   gint	          *width,
 					   gint  	  *height);
 void	        gdk_drawable_set_colormap (GdkDrawable	  *drawable,
Index: gdk/gdkgc.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkgc.c,v
retrieving revision 1.25
retrieving revision 1.25.6.1
diff -u -r1.25 -r1.25.6.1
--- gdk/gdkgc.c	2000/03/28 01:24:42	1.25
+++ gdk/gdkgc.c	2000/05/17 19:48:26	1.25.6.1
@@ -51,7 +51,7 @@
 {
   g_return_val_if_fail (drawable != NULL, NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable))
+  if (GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable))
     return NULL;
 
   return gdk_gc_new_with_values (drawable, NULL, 0);
@@ -67,12 +67,12 @@
 
   g_return_val_if_fail (drawable != NULL, NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable))
+  if (GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable))
     return NULL;
 
-  gc = ((GdkDrawablePrivate *)drawable)->klass->create_gc (drawable,
-							   values,
-							   values_mask);
+  gc = GDK_DRAWABLE_GET_CLASS (drawable)->create_gc (drawable,
+                                                     values,
+                                                     values_mask);
   private = (GdkGCPrivate *)gc;
   
   if (values_mask & GDK_GC_CLIP_X_ORIGIN)
Index: gdk/gdkinternals.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkinternals.h,v
retrieving revision 1.3
retrieving revision 1.3.2.3
diff -u -r1.3 -r1.3.2.3
--- gdk/gdkinternals.h	2000/05/15 16:09:47	1.3
+++ gdk/gdkinternals.h	2000/05/17 19:48:26	1.3.2.3
@@ -156,15 +156,6 @@
 
 void _gdk_cursor_destroy (GdkCursor *cursor);
 
-/* Class supplied by windowing-system-dependent code for GdkWindow.
- */
-extern GdkDrawableClass _gdk_windowing_window_class;
-
-/* Class for covering over windowing-system-dependent and backing-store
- * code for GdkWindow
- */
-extern GdkDrawableClass _gdk_window_class;
-
 extern GdkArgDesc _gdk_windowing_args[];
 gboolean _gdk_windowing_init_check              (int         argc,
 						 char      **argv);
@@ -208,15 +199,19 @@
 				    gboolean   recursing,
 				    gboolean   foreign_destroy);
 
+/* Implementation types */
+GType gdk_window_impl_get_type (void);
+GType gdk_pixmap_impl_get_type (void);
+
 /************************************
  * Initialization and exit routines *
  ************************************/
 
-void gdk_window_init (void);
+void gdk_windowing_window_init (void);
 void gdk_visual_init (void);
 void gdk_dnd_init    (void);
 
-void gdk_image_init  (void);
+void gdk_windowing_image_init  (void);
 void gdk_image_exit  (void);
 
 void gdk_input_init  (void);
Index: gdk/gdkpixmap.c
===================================================================
RCS file: gdkpixmap.c
diff -N gdkpixmap.c
--- /dev/null	Tue May  5 16:32:27 1998
+++ /tmp/cvsD3mrPs	Wed May 17 23:03:16 2000
@@ -0,0 +1,366 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#include "gdkpixmap.h"
+#include "gdkinternals.h"
+
+static GdkGC *gdk_pixmap_create_gc      (GdkDrawable     *drawable,
+                                         GdkGCValues     *values,
+                                         GdkGCValuesMask  mask);
+static void   gdk_pixmap_draw_rectangle (GdkDrawable     *drawable,
+					 GdkGC           *gc,
+					 gint             filled,
+					 gint             x,
+					 gint             y,
+					 gint             width,
+					 gint             height);
+static void   gdk_pixmap_draw_arc       (GdkDrawable     *drawable,
+					 GdkGC           *gc,
+					 gint             filled,
+					 gint             x,
+					 gint             y,
+					 gint             width,
+					 gint             height,
+					 gint             angle1,
+					 gint             angle2);
+static void   gdk_pixmap_draw_polygon   (GdkDrawable     *drawable,
+					 GdkGC           *gc,
+					 gint             filled,
+					 GdkPoint        *points,
+					 gint             npoints);
+static void   gdk_pixmap_draw_text      (GdkDrawable     *drawable,
+					 GdkFont         *font,
+					 GdkGC           *gc,
+					 gint             x,
+					 gint             y,
+					 const gchar     *text,
+					 gint             text_length);
+static void   gdk_pixmap_draw_text_wc   (GdkDrawable     *drawable,
+					 GdkFont         *font,
+					 GdkGC           *gc,
+					 gint             x,
+					 gint             y,
+					 const GdkWChar  *text,
+					 gint             text_length);
+static void   gdk_pixmap_draw_drawable  (GdkDrawable     *drawable,
+					 GdkGC           *gc,
+					 GdkPixmap       *src,
+					 gint             xsrc,
+					 gint             ysrc,
+					 gint             xdest,
+					 gint             ydest,
+					 gint             width,
+					 gint             height);
+static void   gdk_pixmap_draw_points    (GdkDrawable     *drawable,
+					 GdkGC           *gc,
+					 GdkPoint        *points,
+					 gint             npoints);
+static void   gdk_pixmap_draw_segments  (GdkDrawable     *drawable,
+					 GdkGC           *gc,
+					 GdkSegment      *segs,
+					 gint             nsegs);
+static void   gdk_pixmap_draw_lines     (GdkDrawable     *drawable,
+					 GdkGC           *gc,
+					 GdkPoint        *points,
+					 gint             npoints);
+static void   gdk_pixmap_real_get_size  (GdkDrawable     *drawable,
+                                         gint            *width,
+                                         gint            *height);
+
+static GdkVisual*   gdk_pixmap_real_get_visual   (GdkDrawable *drawable);
+static gint         gdk_pixmap_real_get_depth    (GdkDrawable *drawable);
+static void         gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
+                                                  GdkColormap *cmap);
+static GdkColormap* gdk_pixmap_real_get_colormap (GdkDrawable *drawable);
+
+static void gdk_pixmap_init       (GdkPixmapObject      *pixmap);
+static void gdk_pixmap_class_init (GdkPixmapObjectClass *klass);
+static void gdk_pixmap_finalize   (GObject              *object);
+
+static gpointer parent_class = NULL;
+
+GType
+gdk_pixmap_get_type (void)
+{
+  static GType object_type = 0;
+
+  if (!object_type)
+    {
+      static const GTypeInfo object_info =
+      {
+        sizeof (GdkPixmapObjectClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gdk_pixmap_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (GdkPixmapObject),
+        0,              /* n_preallocs */
+        (GInstanceInitFunc) gdk_pixmap_init,
+      };
+      
+      object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
+                                            "GdkPixmap",
+                                            &object_info);
+    }
+  
+  return object_type;
+}
+
+static void
+gdk_pixmap_init (GdkPixmapObject *pixmap)
+{
+  /* 0-initialization is good for all other fields. */
+  pixmap->impl =
+    GDK_DRAWABLE (g_type_create_instance (gdk_pixmap_impl_get_type ()));
+}
+
+static void
+gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
+  
+  parent_class = g_type_class_peek (GDK_TYPE_DRAWABLE);
+
+  object_class->finalize = gdk_pixmap_finalize;
+
+  drawable_class->create_gc = gdk_pixmap_create_gc;
+  drawable_class->draw_rectangle = gdk_pixmap_draw_rectangle;
+  drawable_class->draw_arc = gdk_pixmap_draw_arc;
+  drawable_class->draw_polygon = gdk_pixmap_draw_polygon;
+  drawable_class->draw_text = gdk_pixmap_draw_text;
+  drawable_class->draw_text_wc = gdk_pixmap_draw_text_wc;
+  drawable_class->draw_drawable = gdk_pixmap_draw_drawable;
+  drawable_class->draw_points = gdk_pixmap_draw_points;
+  drawable_class->draw_segments = gdk_pixmap_draw_segments;
+  drawable_class->draw_lines = gdk_pixmap_draw_lines;
+  drawable_class->get_depth = gdk_pixmap_real_get_depth;
+  drawable_class->get_size = gdk_pixmap_real_get_size;
+  drawable_class->set_colormap = gdk_pixmap_real_set_colormap;
+  drawable_class->get_colormap = gdk_pixmap_real_get_colormap;
+  drawable_class->get_visual = gdk_pixmap_real_get_visual;
+}
+
+static void
+gdk_pixmap_finalize (GObject *object)
+{
+  GdkPixmapObject *obj = (GdkPixmapObject *) object;
+
+  g_object_unref (G_OBJECT (obj->impl));
+  obj->impl = NULL;
+  
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static GdkGC *
+gdk_pixmap_create_gc (GdkDrawable     *drawable,
+                      GdkGCValues     *values,
+                      GdkGCValuesMask  mask)
+{
+  return gdk_gc_new_with_values (((GdkPixmapObject *) drawable)->impl,
+                                 values, mask);
+}
+
+static void
+gdk_pixmap_draw_rectangle (GdkDrawable *drawable,
+			   GdkGC       *gc,
+			   gint         filled,
+			   gint         x,
+			   gint         y,
+			   gint         width,
+			   gint         height)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_rectangle (private->impl, gc, filled,
+                      x, y, width, height);
+}
+
+static void
+gdk_pixmap_draw_arc (GdkDrawable *drawable,
+		     GdkGC       *gc,
+		     gint         filled,
+		     gint         x,
+		     gint         y,
+		     gint         width,
+		     gint         height,
+		     gint         angle1,
+		     gint         angle2)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_arc (private->impl, gc, filled,
+                x, y,
+                width, height, angle1, angle2);
+}
+
+static void
+gdk_pixmap_draw_polygon (GdkDrawable *drawable,
+			 GdkGC       *gc,
+			 gint         filled,
+			 GdkPoint    *points,
+			 gint         npoints)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_polygon (private->impl, gc, filled, points, npoints);
+}
+
+static void
+gdk_pixmap_draw_text (GdkDrawable *drawable,
+		      GdkFont     *font,
+		      GdkGC       *gc,
+		      gint         x,
+		      gint         y,
+		      const gchar *text,
+		      gint         text_length)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_text (private->impl, font, gc,
+                 x, y, text, text_length);
+}
+
+static void
+gdk_pixmap_draw_text_wc (GdkDrawable    *drawable,
+			 GdkFont        *font,
+			 GdkGC          *gc,
+			 gint            x,
+			 gint            y,
+			 const GdkWChar *text,
+			 gint            text_length)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_text_wc (private->impl, font, gc,
+                    x, y, text, text_length);
+}
+
+static void
+gdk_pixmap_draw_drawable (GdkDrawable *drawable,
+			  GdkGC       *gc,
+			  GdkPixmap   *src,
+			  gint         xsrc,
+			  gint         ysrc,
+			  gint         xdest,
+			  gint         ydest,
+			  gint         width,
+			  gint         height)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc,
+                     xdest, ydest,
+                     width, height);
+}
+
+static void
+gdk_pixmap_draw_points (GdkDrawable *drawable,
+			GdkGC       *gc,
+			GdkPoint    *points,
+			gint         npoints)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_points (private->impl, gc, points, npoints);
+}
+
+static void
+gdk_pixmap_draw_segments (GdkDrawable *drawable,
+			  GdkGC       *gc,
+			  GdkSegment  *segs,
+			  gint         nsegs)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_segments (private->impl, gc, segs, nsegs);
+}
+
+static void
+gdk_pixmap_draw_lines (GdkDrawable *drawable,
+		       GdkGC       *gc,
+		       GdkPoint    *points,
+		       gint         npoints)
+{
+  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
+
+  gdk_draw_lines (private->impl, gc, points, npoints);
+}
+
+static void
+gdk_pixmap_real_get_size (GdkDrawable *drawable,
+                          gint *width,
+                          gint *height)
+{
+  g_return_if_fail (GDK_IS_PIXMAP (drawable));
+
+  gdk_drawable_get_size (GDK_DRAWABLE (((GdkPixmapObject*)drawable)->impl),
+                         width, height);
+}
+
+static GdkVisual*
+gdk_pixmap_real_get_visual (GdkDrawable *drawable)
+{
+  GdkColormap *colormap;
+
+  g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
+
+  colormap = gdk_drawable_get_colormap (drawable);
+  return colormap ? gdk_colormap_get_visual (colormap) : NULL;
+}
+
+static gint
+gdk_pixmap_real_get_depth (GdkDrawable *drawable)
+{
+  gint depth;
+  
+  g_return_val_if_fail (GDK_IS_PIXMAP (drawable), 0);
+
+  depth = ((GdkPixmapObject *)GDK_PIXMAP (drawable))->depth;
+
+  if (depth == 0)
+    g_print ("0 depth for type %s\n", g_type_name (G_OBJECT_TYPE (drawable)));
+
+  return depth;
+}
+
+static void
+gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
+                              GdkColormap *cmap)
+{
+  g_return_if_fail (GDK_IS_PIXMAP (drawable));  
+  
+  gdk_drawable_set_colormap (((GdkPixmapObject*)drawable)->impl, cmap);
+}
+
+static GdkColormap*
+gdk_pixmap_real_get_colormap (GdkDrawable *drawable)
+{
+  g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
+  
+  return gdk_drawable_get_colormap (((GdkPixmapObject*)drawable)->impl);
+}
Index: gdk/gdkpixmap.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkpixmap.h,v
retrieving revision 1.3
retrieving revision 1.3.6.2
diff -u -r1.3 -r1.3.6.2
--- gdk/gdkpixmap.h	2000/01/28 12:16:26	1.3
+++ gdk/gdkpixmap.h	2000/05/17 19:48:26	1.3.6.2
@@ -2,10 +2,38 @@
 #define __GDK_PIXMAP_H__
 
 #include <gdk/gdktypes.h>
+#include <gdk/gdkdrawable.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
+
+typedef struct _GdkPixmapObject GdkPixmapObject;
+typedef struct _GdkPixmapObjectClass GdkPixmapObjectClass;
+
+#define GDK_TYPE_PIXMAP              (gdk_pixmap_get_type ())
+#define GDK_PIXMAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP, GdkPixmap))
+#define GDK_PIXMAP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP, GdkPixmapObjectClass))
+#define GDK_IS_PIXMAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP))
+#define GDK_IS_PIXMAP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP))
+#define GDK_PIXMAP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP, GdkPixmapClass))
+
+struct _GdkPixmapObject
+{
+  GdkDrawable parent_instance;
+  
+  GdkDrawable *impl;  /* window-system-specific delegate object */
+
+  gint depth;
+};
+
+struct _GdkPixmapObjectClass
+{
+  GdkDrawableClass parent_class;
+
+};
+
+GType      gdk_pixmap_get_type          (void);
 
 /* Pixmaps
  */
Index: gdk/gdkprivate.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkprivate.h,v
retrieving revision 1.44
retrieving revision 1.44.6.3
diff -u -r1.44 -r1.44.6.3
--- gdk/gdkprivate.h	2000/03/28 01:24:42	1.44
+++ gdk/gdkprivate.h	2000/05/17 19:48:26	1.44.6.3
@@ -44,18 +44,13 @@
 #define GDK_PARENT_RELATIVE_BG ((GdkPixmap *)1L)
 #define GDK_NO_BG ((GdkPixmap *)2L)
 
-#define GDK_DRAWABLE_TYPE(d) (((GdkDrawablePrivate *)d)->window_type)
-#define GDK_IS_WINDOW(d) (GDK_DRAWABLE_TYPE(d) <= GDK_WINDOW_TEMP || \
-                          GDK_DRAWABLE_TYPE(d) == GDK_WINDOW_FOREIGN)
-#define GDK_IS_PIXMAP(d) (GDK_DRAWABLE_TYPE(d) == GDK_DRAWABLE_PIXMAP)
-#define GDK_DRAWABLE_DESTROYED(d) (((GdkDrawablePrivate *)d)->destroyed)
+#define GDK_WINDOW_TYPE(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->window_type)
+#define GDK_WINDOW_DESTROYED(d) (((GdkWindowObject*)(GDK_WINDOW (d)))->destroyed)
 
 #define gdk_window_lookup(xid)	   ((GdkWindow*) gdk_xid_table_lookup (xid))
 #define gdk_pixmap_lookup(xid)	   ((GdkPixmap*) gdk_xid_table_lookup (xid))
 #define gdk_font_lookup(xid)	   ((GdkFont*) gdk_xid_table_lookup (xid))
 
-typedef struct _GdkDrawablePrivate     GdkDrawablePrivate;
-typedef struct _GdkWindowPrivate       GdkWindowPrivate;
 typedef struct _GdkImageClass	       GdkImageClass;
 typedef struct _GdkImagePrivate	       GdkImagePrivate;
 typedef struct _GdkGCPrivate	       GdkGCPrivate;
@@ -64,51 +59,6 @@
 typedef struct _GdkFontPrivate	       GdkFontPrivate;
 typedef struct _GdkEventFilter	       GdkEventFilter;
 typedef struct _GdkClientFilter	       GdkClientFilter;
-
-struct _GdkDrawablePrivate
-{
-  GdkDrawable drawable;
-  GdkDrawableClass *klass;
-  gpointer klass_data;
-
-  guint ref_count;
-
-  gint width;
-  gint height;
-
-  GdkColormap *colormap;
-
-  guint8 window_type;
-  guint8 depth;
-  
-  guint destroyed : 2;
-};
-
-struct _GdkWindowPrivate
-{
-  GdkDrawablePrivate drawable;
-  
-  GdkWindow *parent;
-  gint x;
-  gint y;
-  guint8 resize_count;
-  guint mapped : 1;
-  guint guffaw_gravity : 1;
-  guint input_only : 1;
-
-  gint extension_events;
-
-  GList *filters;
-  GList *children;
-
-  GdkColor bg_color;
-  GdkPixmap *bg_pixmap;
-  
-  GSList *paint_stack;
-  
-  GdkRegion *update_area;
-  guint update_freeze_count;
-};
 
 struct _GdkImageClass 
 {
Index: gdk/gdktypes.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdktypes.h,v
retrieving revision 1.50
retrieving revision 1.50.6.1
diff -u -r1.50 -r1.50.6.1
--- gdk/gdktypes.h	2000/03/28 01:58:04	1.50
+++ gdk/gdktypes.h	2000/05/17 03:21:50	1.50.6.1
@@ -30,6 +30,7 @@
 /* GDK uses "glib". (And so does GTK).
  */
 #include <glib.h>
+#include <glib-object.h>
 
 #ifdef G_OS_WIN32
 #  ifdef GDK_COMPILATION
Index: gdk/gdkwindow.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkwindow.c,v
retrieving revision 1.89
retrieving revision 1.89.2.5
diff -u -r1.89 -r1.89.2.5
--- gdk/gdkwindow.c	2000/05/15 16:09:47	1.89
+++ gdk/gdkwindow.c	2000/05/18 02:56:08	1.89.2.5
@@ -45,10 +45,9 @@
   gint y_offset;
 };
 
-static void   gdk_window_draw_destroy   (GdkDrawable     *drawable);
-static GdkGC *gdk_window_draw_create_gc (GdkDrawable     *drawable,
-					 GdkGCValues     *values,
-					 GdkGCValuesMask  mask);
+static GdkGC *gdk_window_create_gc      (GdkDrawable     *drawable,
+                                         GdkGCValues     *values,
+                                         GdkGCValuesMask  mask);
 static void   gdk_window_draw_rectangle (GdkDrawable     *drawable,
 					 GdkGC           *gc,
 					 gint             filled,
@@ -105,74 +104,119 @@
 					 GdkGC           *gc,
 					 GdkPoint        *points,
 					 gint             npoints);
+static void   gdk_window_real_get_size  (GdkDrawable     *drawable,
+                                         gint            *width,
+                                         gint            *height);
+
+static GdkVisual*   gdk_window_real_get_visual   (GdkDrawable *drawable);
+static gint         gdk_window_real_get_depth    (GdkDrawable *drawable);
+static void         gdk_window_real_set_colormap (GdkDrawable *drawable,
+                                             GdkColormap *cmap);
+static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable);
 
+     
 static void gdk_window_free_paint_stack (GdkWindow *window);
 
-/* All drawing operations on windows are forwarded through the following
- * class to enable the automatic-backing-store feature.
- */
-GdkDrawableClass _gdk_window_class = {
-  gdk_window_draw_destroy,
-  gdk_window_draw_create_gc,
-  gdk_window_draw_rectangle,
-  gdk_window_draw_arc,
-  gdk_window_draw_polygon,
-  gdk_window_draw_text,
-  gdk_window_draw_text_wc,
-  gdk_window_draw_drawable,
-  gdk_window_draw_points,
-  gdk_window_draw_segments,
-  gdk_window_draw_lines
-};
-
-GdkWindow *
-_gdk_window_alloc (void)
-{
-  GdkWindowPrivate *private = g_new (GdkWindowPrivate, 1);
-  GdkWindow *window = (GdkWindow*) private;
-  
-  window->user_data = NULL;
-
-  private->drawable.ref_count = 1;
-  private->drawable.destroyed = FALSE;
-  private->drawable.klass = NULL;
-  private->drawable.klass_data = NULL;
-  private->drawable.window_type = GDK_WINDOW_CHILD;
-
-  private->drawable.width = 1;
-  private->drawable.height = 1;
-
-  private->drawable.colormap = NULL;
-
-  private->parent = NULL;
-  private->x = 0;
-  private->y = 0;
-  private->resize_count = 0;
-
-  private->mapped = FALSE;
-  private->guffaw_gravity = FALSE;
-  private->extension_events = FALSE;
-  
-  private->filters = NULL;
-  private->children = NULL;
-
-  private->bg_color.pixel = 0;
-  private->bg_color.red = 0;
-  private->bg_color.green = 0;
-  private->bg_color.blue = 0;
+static void gdk_window_init       (GdkWindowObject      *window);
+static void gdk_window_class_init (GdkWindowObjectClass *klass);
+static void gdk_window_finalize   (GObject              *object);
+
+static gpointer parent_class = NULL;
+
+GType
+gdk_window_get_type (void)
+{
+  static GType object_type = 0;
+
+  if (!object_type)
+    {
+      static const GTypeInfo object_info =
+      {
+        sizeof (GdkWindowObjectClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gdk_window_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (GdkWindowObject),
+        0,              /* n_preallocs */
+        (GInstanceInitFunc) gdk_window_init,
+      };
+      
+      object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
+                                            "GdkWindow",
+                                            &object_info);
+    }
+  
+  return object_type;
+}
 
-  private->bg_pixmap = NULL;
+static void
+gdk_window_init (GdkWindowObject *window)
+{
+  /* 0-initialization is good for all other fields. */
 
-  private->paint_stack = NULL;
+  window->window_type = GDK_WINDOW_CHILD;
 
-  private->update_area = NULL;
-  private->update_freeze_count = 0;
+  window->impl =
+    GDK_DRAWABLE (g_type_create_instance (gdk_window_impl_get_type ()));
+}
+
+static void
+gdk_window_class_init (GdkWindowObjectClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
   
-  return window;
+  parent_class = g_type_class_peek (GDK_TYPE_DRAWABLE);
+
+  object_class->finalize = gdk_window_finalize;
+
+  drawable_class->create_gc = gdk_window_create_gc;
+  drawable_class->draw_rectangle = gdk_window_draw_rectangle;
+  drawable_class->draw_arc = gdk_window_draw_arc;
+  drawable_class->draw_polygon = gdk_window_draw_polygon;
+  drawable_class->draw_text = gdk_window_draw_text;
+  drawable_class->draw_text_wc = gdk_window_draw_text_wc;
+  drawable_class->draw_drawable = gdk_window_draw_drawable;
+  drawable_class->draw_points = gdk_window_draw_points;
+  drawable_class->draw_segments = gdk_window_draw_segments;
+  drawable_class->draw_lines = gdk_window_draw_lines;
+  drawable_class->get_depth = gdk_window_real_get_depth;
+  drawable_class->get_size = gdk_window_real_get_size;
+  drawable_class->set_colormap = gdk_window_real_set_colormap;
+  drawable_class->get_colormap = gdk_window_real_get_colormap;
+  drawable_class->get_visual = gdk_window_real_get_visual;
 }
 
+static void
+gdk_window_finalize (GObject *object)
+{
+  GdkWindow *window = GDK_WINDOW (object);
+  GdkWindowObject *obj = (GdkWindowObject *) object;
+  
+  if (!GDK_WINDOW_DESTROYED (window))
+    {
+      if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
+	{
+	  g_warning ("losing last reference to undestroyed window\n");
+	  _gdk_window_destroy (window, FALSE);
+	}
+      else
+	/* We use TRUE here, to keep us from actually calling
+	 * XDestroyWindow() on the window
+	 */
+	_gdk_window_destroy (window, TRUE);
+    }
+
+  g_object_unref (G_OBJECT (obj->impl));
+  obj->impl = NULL;
+  
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
 /**
- * _gdk_window_destroy_heirarchy:
+ * _gdk_window_destroy_hierarchy:
  * @window: a #GdkWindow
  * @recursing: If TRUE, then this is being called because a parent
  *            was destroyed. This generally means that the call to the windowing system
@@ -188,37 +232,37 @@
  * drop the reference count created by gdk_window_new().
  **/
 static void
-_gdk_window_destroy_heirarchy (GdkWindow *window,
+_gdk_window_destroy_hierarchy (GdkWindow *window,
 			       gboolean   recursing,
 			       gboolean   foreign_destroy)
 {
-  GdkWindowPrivate *private;
-  GdkWindowPrivate *temp_private;
+  GdkWindowObject *private;
+  GdkWindowObject *temp_private;
   GdkWindow *temp_window;
   GList *children;
   GList *tmp;
   
   g_return_if_fail (window != NULL);
   
-  private = (GdkWindowPrivate*) window;
+  private = (GdkWindowObject*) window;
   
-  switch (private->drawable.window_type)
+  switch (GDK_WINDOW_TYPE (window))
     {
     case GDK_WINDOW_TOPLEVEL:
     case GDK_WINDOW_CHILD:
     case GDK_WINDOW_DIALOG:
     case GDK_WINDOW_TEMP:
     case GDK_WINDOW_FOREIGN:
-      if (!GDK_DRAWABLE_DESTROYED (window))
+      if (!GDK_WINDOW_DESTROYED (window))
 	{
 	  private->mapped = FALSE;
-	  private->drawable.destroyed = TRUE;
+	  private->destroyed = TRUE;
 	  
 	  _gdk_windowing_window_destroy (window, recursing, foreign_destroy);
 
 	  if (private->parent)
 	    {
-	      GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent;
+	      GdkWindowObject *parent_private = (GdkWindowObject *)private->parent;
 	      if (parent_private->children)
 		parent_private->children = g_list_remove (parent_private->children, window);
 	    }
@@ -232,7 +276,7 @@
 	      private->bg_pixmap = NULL;
 	    }
 	  
-	  if (GDK_DRAWABLE_TYPE (window) != GDK_WINDOW_FOREIGN)
+	  if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
 	    {
 	      children = tmp = private->children;
 	      private->children = NULL;
@@ -242,9 +286,9 @@
 		  temp_window = tmp->data;
 		  tmp = tmp->next;
 		  
-		  temp_private = (GdkWindowPrivate*) temp_window;
+		  temp_private = (GdkWindowObject*) temp_window;
 		  if (temp_private)
-		    _gdk_window_destroy_heirarchy (temp_window, TRUE, foreign_destroy);
+		    _gdk_window_destroy_hierarchy (temp_window, TRUE, foreign_destroy);
 		}
 	      
 	      g_list_free (children);
@@ -263,22 +307,14 @@
 	      g_list_free (private->filters);
 	      private->filters = NULL;
 	    }
-	  
-	  if (private->drawable.colormap)
-	    {
-	      gdk_colormap_unref (private->drawable.colormap);
-	      private->drawable.colormap = NULL;
-	    }
+
+          gdk_drawable_set_colormap (GDK_DRAWABLE (window), NULL);
 	}
       break;
       
     case GDK_WINDOW_ROOT:
       g_error ("attempted to destroy root window");
       break;
-      
-    case GDK_WINDOW_PIXMAP:
-      g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
-      break;
     }
 }
 
@@ -297,13 +333,13 @@
 _gdk_window_destroy (GdkWindow *window,
 		     gboolean   foreign_destroy)
 {
-  _gdk_window_destroy_heirarchy (window, FALSE, foreign_destroy);
+  _gdk_window_destroy_hierarchy (window, FALSE, foreign_destroy);
 }
 
 void
 gdk_window_destroy (GdkWindow *window)
 {
-  _gdk_window_destroy_heirarchy (window, FALSE, FALSE);
+  _gdk_window_destroy_hierarchy (window, FALSE, FALSE);
   gdk_drawable_unref (window);
 }
 
@@ -313,7 +349,7 @@
 {
   g_return_if_fail (window != NULL);
   
-  window->user_data = user_data;
+  ((GdkWindowObject*)window)->user_data = user_data;
 }
 
 void
@@ -322,49 +358,54 @@
 {
   g_return_if_fail (window != NULL);
   
-  *data = window->user_data;
+  *data = ((GdkWindowObject*)window)->user_data;
 }
 
+GdkWindowType
+gdk_window_get_window_type (GdkWindow *window)
+{
+  g_return_val_if_fail (GDK_IS_WINDOW (window), (GdkWindowType) -1);
+  
+  return GDK_WINDOW_TYPE (window);
+}
+
 void
 gdk_window_get_position (GdkWindow *window,
 			 gint      *x,
 			 gint      *y)
 {
-  GdkWindowPrivate *window_private;
+  GdkWindowObject *obj;
   
-  g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  window_private = (GdkWindowPrivate*) window;
+  obj = (GdkWindowObject*) window;
   
   if (x)
-    *x = window_private->x;
+    *x = obj->x;
   if (y)
-    *y = window_private->y;
+    *y = obj->y;
 }
 
 GdkWindow*
 gdk_window_get_parent (GdkWindow *window)
 {
-  g_return_val_if_fail (window != NULL, NULL);
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
   
-  return ((GdkWindowPrivate*) window)->parent;
+  return (GdkWindow*) ((GdkWindowObject*) window)->parent;
 }
 
 GdkWindow*
 gdk_window_get_toplevel (GdkWindow *window)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *obj;
   
-  g_return_val_if_fail (window != NULL, NULL);
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
 
-  private = (GdkWindowPrivate *)window;
-  while (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
-    private = (GdkWindowPrivate *)private->parent;
+  obj = (GdkWindowObject *)window;
+  while (GDK_WINDOW_TYPE (obj) == GDK_WINDOW_CHILD)
+    obj = (GdkWindowObject *)obj->parent;
   
-  return (GdkWindow *)window;
+  return GDK_WINDOW (obj);
 }
 
 void          
@@ -372,15 +413,15 @@
 		       GdkFilterFunc  function,
 		       gpointer       data)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   GList *tmp_list;
   GdkEventFilter *filter;
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  private = (GdkWindowPrivate*) window;
-  if (private && GDK_DRAWABLE_DESTROYED (window))
+  private = (GdkWindowObject*) window;
+  if (private && GDK_WINDOW_DESTROYED (window))
     return;
   
   if (private)
@@ -411,14 +452,14 @@
 			  GdkFilterFunc  function,
 			  gpointer       data)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   GList *tmp_list, *node;
   GdkEventFilter *filter;
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  private = (GdkWindowPrivate*) window;
+  private = (GdkWindowObject*) window;
   
   if (private)
     tmp_list = private->filters;
@@ -451,7 +492,7 @@
   GList *new_list = NULL;
   GList *tmp_list;
   
-  tmp_list = ((GdkWindowPrivate *)gdk_parent_root)->children;
+  tmp_list = ((GdkWindowObject *)gdk_parent_root)->children;
   while (tmp_list)
     {
       new_list = g_list_prepend (new_list, tmp_list->data);
@@ -473,7 +514,7 @@
 gboolean 
 gdk_window_is_visible (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   
   g_return_val_if_fail (window != NULL, FALSE);
   g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
@@ -496,19 +537,19 @@
 gboolean 
 gdk_window_is_viewable (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   
   g_return_val_if_fail (window != NULL, FALSE);
   g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
   
   while (private && 
-	 (private != (GdkWindowPrivate *)gdk_parent_root) &&
-	 (private->drawable.window_type != GDK_WINDOW_FOREIGN))
+	 (private != (GdkWindowObject *)gdk_parent_root) &&
+	 (GDK_WINDOW_TYPE (private) != GDK_WINDOW_FOREIGN))
     {
       if (!private->mapped)
 	return FALSE;
       
-      private = (GdkWindowPrivate *)private->parent;
+      private = (GdkWindowObject *)private->parent;
     }
   
   return TRUE;
@@ -531,7 +572,7 @@
 static GdkGC *
 gdk_window_get_bg_gc (GdkWindow *window, GdkWindowPaint *paint)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   guint gc_mask = 0;
   GdkGCValues gc_values;
@@ -542,7 +583,7 @@
       tmp_paint.x_offset += private->x;
       tmp_paint.y_offset += private->y;
       
-      return gdk_window_get_bg_gc (private->parent, &tmp_paint);
+      return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
     }
   else if (private->bg_pixmap && private->bg_pixmap != GDK_PARENT_RELATIVE_BG && private->bg_pixmap != GDK_NO_BG)
     {
@@ -579,7 +620,7 @@
 			       GdkRegion *region)
 {
 #ifdef USE_BACKING_STORE
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   GdkRectangle clip_box;
   GdkWindowPaint *paint;
   GdkRegion *init_region;
@@ -588,7 +629,7 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
   paint = g_new (GdkWindowPaint, 1);
@@ -674,7 +715,7 @@
 gdk_window_end_paint (GdkWindow *window)
 {
 #ifdef USE_BACKING_STORE
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   GdkWindowPaint *paint;
   GdkGC *tmp_gc;
   GdkRectangle clip_box;
@@ -683,7 +724,7 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
   g_return_if_fail (private->paint_stack != NULL);
@@ -700,11 +741,11 @@
   gdk_gc_set_clip_region (tmp_gc, paint->region);
   gdk_gc_set_clip_origin (tmp_gc, -x_offset, -y_offset);
 
-  _gdk_windowing_window_class.draw_drawable (window, tmp_gc, paint->pixmap,
-					     clip_box.x - paint->x_offset,
-					     clip_box.y - paint->y_offset,
-					     clip_box.x - x_offset, clip_box.y - y_offset,
-					     clip_box.width, clip_box.height);
+  gdk_draw_drawable (private->impl, tmp_gc, paint->pixmap,
+                     clip_box.x - paint->x_offset,
+                     clip_box.y - paint->y_offset,
+                     clip_box.x - x_offset, clip_box.y - y_offset,
+                     clip_box.width, clip_box.height);
   gdk_gc_unref (tmp_gc);
 
   if (private->paint_stack)
@@ -729,7 +770,7 @@
 static void
 gdk_window_free_paint_stack (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   
   if (private->paint_stack)
     {
@@ -757,7 +798,7 @@
 			gint      *x_offset,
 			gint      *y_offset)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   
   if (private->paint_stack)
     {
@@ -791,18 +832,18 @@
        gdk_gc_set_ts_origin (gc, old_ts_x, old_ts_y);       \
      }
 
-static void
-gdk_window_draw_destroy (GdkDrawable *drawable)
-{
-  _gdk_windowing_window_class.destroy (drawable);
-}
-
 static GdkGC *
-gdk_window_draw_create_gc (GdkDrawable     *drawable,
-			   GdkGCValues     *values,
-			   GdkGCValuesMask  mask)
+gdk_window_create_gc (GdkDrawable     *drawable,
+                      GdkGCValues     *values,
+                      GdkGCValuesMask  mask)
 {
-  return _gdk_windowing_window_class.create_gc (drawable, values, mask);
+  g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+  
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return NULL;
+
+  return gdk_gc_new_with_values (((GdkWindowObject *) drawable)->impl,
+                                 values, mask);
 }
 
 static void
@@ -814,8 +855,11 @@
 			   gint         width,
 			   gint         height)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   OFFSET_GC (gc);
+
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
   
   if (private->paint_stack)
     {
@@ -824,8 +868,8 @@
 			  x - x_offset, y - y_offset, width, height);
     }
   else
-    _gdk_windowing_window_class.draw_rectangle (drawable, gc, filled,
-						x - x_offset, y - y_offset, width, height);
+    gdk_draw_rectangle (private->impl, gc, filled,
+                        x - x_offset, y - y_offset, width, height);
 
   RESTORE_GC (gc);
 }
@@ -841,9 +885,12 @@
 		     gint         angle1,
 		     gint         angle2)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   OFFSET_GC (gc);
 
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
   if (private->paint_stack)
     {
       GdkWindowPaint *paint = private->paint_stack->data;
@@ -852,9 +899,9 @@
 		    width, height, angle1, angle2);
     }
   else
-    _gdk_windowing_window_class.draw_arc (drawable, gc, filled,
-					  x - x_offset, y - y_offset,
-					  width, height, angle1, angle2);
+    gdk_draw_arc (private->impl, gc, filled,
+                  x - x_offset, y - y_offset,
+                  width, height, angle1, angle2);
   RESTORE_GC (gc);
 }
 
@@ -865,11 +912,14 @@
 			 GdkPoint    *points,
 			 gint         npoints)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   GdkPoint *new_points;
   
   OFFSET_GC (gc);
 
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
   if (x_offset != 0 || y_offset != 0)
     {
       int i;
@@ -891,8 +941,8 @@
 
     }
   else
-    _gdk_windowing_window_class.draw_polygon (drawable, gc, filled, new_points, npoints);
-
+    gdk_draw_polygon (private->impl, gc, filled, new_points, npoints);
+  
   if (new_points != points)
     g_free (new_points);
 
@@ -908,9 +958,12 @@
 		      const gchar *text,
 		      gint         text_length)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   OFFSET_GC (gc);
 
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
   if (private->paint_stack)
     {
       GdkWindowPaint *paint = private->paint_stack->data;
@@ -919,8 +972,8 @@
 
     }
   else
-    _gdk_windowing_window_class.draw_text (drawable, font, gc,
-					   x - x_offset, y - y_offset, text, text_length);
+    gdk_draw_text (private->impl, font, gc,
+                   x - x_offset, y - y_offset, text, text_length);
 
   RESTORE_GC (gc);
 }
@@ -934,9 +987,12 @@
 			 const GdkWChar *text,
 			 gint            text_length)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   OFFSET_GC (gc);
 
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
   if (private->paint_stack)
     {
       GdkWindowPaint *paint = private->paint_stack->data;
@@ -944,9 +1000,9 @@
 			x - x_offset, y - y_offset, text, text_length);
     }
   else
-    _gdk_windowing_window_class.draw_text_wc (drawable, font, gc,
-					      x - x_offset, y - y_offset, text, text_length);
-
+    gdk_draw_text_wc (private->impl, font, gc,
+                      x - x_offset, y - y_offset, text, text_length);
+  
   RESTORE_GC (gc);
 }
 
@@ -961,9 +1017,12 @@
 			  gint         width,
 			  gint         height)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   OFFSET_GC (gc);
 
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
   if (private->paint_stack)
     {
       GdkWindowPaint *paint = private->paint_stack->data;
@@ -972,9 +1031,9 @@
 
     }
   else
-    _gdk_windowing_window_class.draw_drawable (drawable, gc, src, xsrc, ysrc,
-					       xdest - x_offset, ydest - y_offset,
-					       width, height);
+    gdk_draw_drawable (private->impl, gc, src, xsrc, ysrc,
+                       xdest - x_offset, ydest - y_offset,
+                       width, height);
   RESTORE_GC (gc);
 }
 
@@ -984,11 +1043,14 @@
 			GdkPoint    *points,
 			gint         npoints)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   GdkPoint *new_points;
   
   OFFSET_GC (gc);
 
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
   if (x_offset != 0 || y_offset != 0)
     {
       gint i;
@@ -1009,7 +1071,7 @@
       gdk_draw_points (paint->pixmap, gc, new_points, npoints);
     }
   else
-    _gdk_windowing_window_class.draw_points (drawable, gc, points, npoints);
+    gdk_draw_points (private->impl, gc, points, npoints);
 
   if (new_points != points)
     g_free (new_points);
@@ -1023,11 +1085,14 @@
 			  GdkSegment  *segs,
 			  gint         nsegs)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   GdkSegment *new_segs;
 
   OFFSET_GC (gc);
 
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
   if (x_offset != 0 || y_offset != 0)
     {
       gint i;
@@ -1050,8 +1115,8 @@
       gdk_draw_segments (paint->pixmap, gc, new_segs, nsegs);
     }
   else
-    _gdk_windowing_window_class.draw_segments (drawable, gc, new_segs, nsegs);
-
+    gdk_draw_segments (private->impl, gc, new_segs, nsegs);
+  
   if (new_segs != segs)
     g_free (new_segs);
 
@@ -1064,11 +1129,14 @@
 		       GdkPoint    *points,
 		       gint         npoints)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
   GdkPoint *new_points;
 
   OFFSET_GC (gc);
 
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
   if (x_offset != 0 || y_offset != 0)
     {
       gint i;
@@ -1089,7 +1157,7 @@
       gdk_draw_lines (paint->pixmap, gc, new_points, npoints);
     }
   else
-    _gdk_windowing_window_class.draw_lines (drawable, gc, new_points, npoints);
+    gdk_draw_lines (private->impl, gc, new_points, npoints);
 
   if (new_points != points)
     g_free (new_points);
@@ -1105,10 +1173,13 @@
 			       gint       width,
 			       gint       height)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   GdkWindowPaint *paint = private->paint_stack->data;
   GdkGC *tmp_gc;
 
+  if (GDK_WINDOW_DESTROYED (window))
+    return;
+  
   tmp_gc = gdk_window_get_bg_gc (window, paint);
   gdk_draw_rectangle (paint->pixmap, tmp_gc, TRUE,
 		      x - paint->x_offset, y - paint->y_offset, width, height);
@@ -1118,13 +1189,15 @@
 void
 gdk_window_clear (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+  gint width, height;
+  
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
+  gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+  
   gdk_window_clear_area (window, 0, 0,
-			 private->drawable.width, private->drawable.height);
+                         width, height);
 }
 
 void
@@ -1134,7 +1207,7 @@
 		       gint       width,
 		       gint       height)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1152,7 +1225,7 @@
 		         gint       width,
 		         gint       height)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1175,9 +1248,12 @@
 			gint         height)
 {
   GdkImagePrivate *image_private = (GdkImagePrivate*) image;
-  GdkWindowPrivate *private = (GdkWindowPrivate *)drawable;
+  GdkWindowObject *private = (GdkWindowObject *)drawable;
 
   OFFSET_GC (gc);
+
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
   
   if (private->paint_stack)
     {
@@ -1188,13 +1264,77 @@
 
     }
   else
-    image_private->klass->image_put (image, drawable, gc, xsrc, ysrc,
+    image_private->klass->image_put (image, private->impl, gc, xsrc, ysrc,
 				     xdest - x_offset, ydest - y_offset,
 				     width, height);
 
   RESTORE_GC (gc);
 }
 
+
+static void
+gdk_window_real_get_size (GdkDrawable *drawable,
+                          gint *width,
+                          gint *height)
+{
+  g_return_if_fail (GDK_IS_WINDOW (drawable));
+
+  gdk_drawable_get_size (GDK_DRAWABLE (((GdkWindowObject*)drawable)->impl),
+                         width, height);
+}
+
+static GdkVisual*
+gdk_window_real_get_visual (GdkDrawable *drawable)
+{
+  GdkColormap *colormap;
+
+  g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+  colormap = gdk_drawable_get_colormap (drawable);
+  return colormap ? gdk_colormap_get_visual (colormap) : NULL;
+}
+
+static gint
+gdk_window_real_get_depth (GdkDrawable *drawable)
+{
+  gint depth;
+  
+  g_return_val_if_fail (GDK_IS_WINDOW (drawable), 0);
+
+  depth = ((GdkWindowObject *)GDK_WINDOW (drawable))->depth;
+
+  if (depth == 0)
+    {
+      g_print ("0 depth for type %s\n", g_type_name (G_OBJECT_TYPE (drawable)));
+      G_BREAKPOINT ();
+    }
+
+  return depth;
+}
+
+static void
+gdk_window_real_set_colormap (GdkDrawable *drawable,
+                              GdkColormap *cmap)
+{
+  g_return_if_fail (GDK_IS_WINDOW (drawable));  
+
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return;
+  
+  gdk_drawable_set_colormap (((GdkWindowObject*)drawable)->impl, cmap);
+}
+
+static GdkColormap*
+gdk_window_real_get_colormap (GdkDrawable *drawable)
+{
+  g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
+
+  if (GDK_WINDOW_DESTROYED (drawable))
+    return NULL;
+  
+  return gdk_drawable_get_colormap (((GdkWindowObject*)drawable)->impl);
+}
+
 /* Code for dirty-region queueing
  */
 
@@ -1206,7 +1346,7 @@
 static void
 gdk_window_process_updates_internal (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   gboolean save_region = FALSE;
 
   /* If an update got queued during update processing, we can get a
@@ -1222,11 +1362,14 @@
 	{
 	  GdkEvent event;
 	  GdkRectangle window_rect;
-	  
+          gint width, height;
+
+          gdk_drawable_get_size (GDK_DRAWABLE (private), &width, &height);
+          
 	  window_rect.x = 0;
 	  window_rect.y = 0;
-	  window_rect.width = private->drawable.width;
-	  window_rect.height = private->drawable.height;
+	  window_rect.width = width;
+	  window_rect.height = height;
 
 	  save_region = _gdk_windowing_window_queue_antiexpose (window, update_area);
       
@@ -1283,7 +1426,7 @@
 gdk_window_process_updates (GdkWindow *window,
 			    gboolean   update_children)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1310,12 +1453,12 @@
 			      GdkRectangle *rect,
 			      gboolean      invalidate_children)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
   if (private->update_area)
@@ -1341,18 +1484,20 @@
       tmp_list = private->children;
       while (tmp_list)
 	{
-	  GdkWindowPrivate *child = tmp_list->data;
+	  GdkWindowObject *child = tmp_list->data;
 	  tmp_list = tmp_list->next;
 
-	  /* FIXME: this is a HACK to figure out if the child is
-	   *        input-only.
-	   */
-	  if (child->drawable.colormap)
+	  if (!((GdkWindowObject *)GDK_WINDOW (child))->input_only)
 	    {
+              gint width, height;
+
+              gdk_drawable_get_size (GDK_DRAWABLE (child),
+                                     &width, &height);
+              
 	      child_rect.x = child->x;
 	      child_rect.y = child->y;
-	      child_rect.width = child->drawable.width;
-	      child_rect.height = child->drawable.height;
+	      child_rect.width = width;
+	      child_rect.height = height;
 	      
 	      if (gdk_rectangle_intersect (rect, &child_rect, &new_rect))
 		{
@@ -1371,12 +1516,12 @@
 			      GdkRegion *region,
 			      gboolean   invalidate_children)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
   if (private->input_only)
@@ -1405,15 +1550,20 @@
       tmp_list = private->children;
       while (tmp_list)
 	{
-	  GdkWindowPrivate *child = tmp_list->data;
+	  GdkWindowObject *child = tmp_list->data;
 	  tmp_list = tmp_list->next;
 
 	  if (child->input_only)
 	    {
+              gint width, height;
+
+              gdk_drawable_get_size (GDK_DRAWABLE (child),
+                                     &width, &height);
+              
 	      child_rect.x = child->x;
 	      child_rect.y = child->y;
-	      child_rect.width = child->drawable.width;
-	      child_rect.height = child->drawable.height;
+	      child_rect.width = width;
+	      child_rect.height = height;
 	      
 	      child_region = gdk_region_rectangle (&child_rect);
 	      gdk_region_intersect (child_region, region);
@@ -1433,7 +1583,7 @@
 GdkRegion *
 gdk_window_get_update_area (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   GdkRegion *tmp_region;
 
   g_return_val_if_fail (window != NULL, NULL);
@@ -1462,7 +1612,7 @@
 void
 _gdk_window_clear_update_area (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1479,7 +1629,7 @@
 void
 gdk_window_freeze_updates (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1490,7 +1640,7 @@
 void
 gdk_window_thaw_updates (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
Index: gdk/gdkwindow.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/gdkwindow.h,v
retrieving revision 1.7
retrieving revision 1.7.6.4
diff -u -r1.7 -r1.7.6.4
--- gdk/gdkwindow.h	2000/03/28 01:24:42	1.7
+++ gdk/gdkwindow.h	2000/05/17 18:34:14	1.7.6.4
@@ -28,6 +28,35 @@
   GDK_INPUT_ONLY
 } GdkWindowClass;
 
+/* Types of windows.
+ *   Root: There is only 1 root window and it is initialized
+ *	   at startup. Creating a window of type GDK_WINDOW_ROOT
+ *	   is an error.
+ *   Toplevel: Windows which interact with the window manager.
+ *   Child: Windows which are children of some other type of window.
+ *	    (Any other type of window). Most windows are child windows.
+ *   Dialog: A special kind of toplevel window which interacts with
+ *	     the window manager slightly differently than a regular
+ *	     toplevel window. Dialog windows should be used for any
+ *	     transient window.
+ *   Pixmap: Pixmaps are really just another kind of window which
+ *	     doesn't actually appear on the screen. It can't have
+ *	     children, either and is really just a convenience so
+ *	     that the drawing functions can work on both windows
+ *	     and pixmaps transparently. (ie. You shouldn't pass a
+ *	     pixmap to any procedure which accepts a window with the
+ *	     exception of the drawing functions).
+ *   Foreign: A window that actually belongs to another application
+ */
+typedef enum
+{
+  GDK_WINDOW_ROOT,
+  GDK_WINDOW_TOPLEVEL,
+  GDK_WINDOW_CHILD,
+  GDK_WINDOW_DIALOG,
+  GDK_WINDOW_TEMP,
+  GDK_WINDOW_FOREIGN
+} GdkWindowType;
 
 /* Window attribute mask values.
  *   GDK_WA_TITLE: The "title" field is valid.
@@ -97,7 +126,7 @@
   GdkWindowClass wclass;
   GdkVisual *visual;
   GdkColormap *colormap;
-  GdkDrawableType window_type;
+  GdkWindowType window_type;
   GdkCursor *cursor;
   gchar *wmclass_name;
   gchar *wmclass_class;
@@ -118,13 +147,69 @@
   /* GdkGravity gravity; */
 };
 
+typedef struct _GdkWindowObject GdkWindowObject;
+typedef struct _GdkWindowObjectClass GdkWindowObjectClass;
+
+#define GDK_TYPE_WINDOW              (gdk_window_get_type ())
+#define GDK_WINDOW(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW, GdkWindow))
+#define GDK_WINDOW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW, GdkWindowObjectClass))
+#define GDK_IS_WINDOW(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW))
+#define GDK_IS_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW))
+#define GDK_WINDOW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW, GdkWindowObjectClass))
+
+struct _GdkWindowObject
+{
+  GdkDrawable parent_instance;
+
+  gpointer user_data;
+
+  GdkDrawable *impl; /* window-system-specific delegate object */  
+  
+  GdkWindowObject *parent;
+
+  gint x;
+  gint y;
+  
+  gint extension_events;
+
+  GList *filters;
+  GList *children;
+
+  GdkColor bg_color;
+  GdkPixmap *bg_pixmap;
+  
+  GSList *paint_stack;
+  
+  GdkRegion *update_area;
+  guint update_freeze_count;
+  
+  guint8 window_type;
+  guint8 depth;
+  guint8 resize_count;
+  guint mapped : 1;
+  guint guffaw_gravity : 1;
+  guint input_only : 1;
+  
+  guint destroyed : 2;
+};
+
+struct _GdkWindowObjectClass
+{
+  GdkDrawableClass parent_class;
+
+
+};
+
 /* Windows
  */
+GType         gdk_window_get_type    (void);
 GdkWindow*    gdk_window_new	     (GdkWindow	    *parent,
 				      GdkWindowAttr *attributes,
 				      gint	     attributes_mask);
 
 void	      gdk_window_destroy     (GdkWindow	    *window);
+
+GdkWindowType gdk_window_get_window_type (GdkWindow *window);
 
 GdkWindow*    gdk_window_at_pointer  (gint	   *win_x,
 				      gint	   *win_y);
Index: gdk/x11/gdkcursor-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkcursor-x11.c,v
retrieving revision 1.11
retrieving revision 1.11.6.1
diff -u -r1.11 -r1.11.6.1
--- gdk/x11/gdkcursor-x11.c	2000/02/13 20:22:20	1.11
+++ gdk/x11/gdkcursor-x11.c	2000/05/17 18:34:14	1.11.6.1
@@ -29,6 +29,8 @@
 
 #include "gdkx.h"
 #include "gdkcursor.h"
+#include "gdkpixmap-x11.h"
+#include <gdk/gdkpixmap.h>
 
 GdkCursor*
 gdk_cursor_new (GdkCursorType cursor_type)
@@ -62,12 +64,12 @@
   Cursor xcursor;
   XColor xfg, xbg;
 
-  g_return_val_if_fail (source != NULL, NULL);
+  g_return_val_if_fail (GDK_IS_PIXMAP (source), NULL);
   g_return_val_if_fail (fg != NULL, NULL);
   g_return_val_if_fail (bg != NULL, NULL);
 
-  source_pixmap = GDK_DRAWABLE_XID (source);
-  mask_pixmap   = GDK_DRAWABLE_XID (mask);
+  source_pixmap = GDK_PIXMAP_XID (source);
+  mask_pixmap   = GDK_PIXMAP_XID (mask);
 
   xfg.pixel = fg->pixel;
   xfg.red = fg->red;
Index: gdk/x11/gdkdnd-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkdnd-x11.c,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -u -r1.32 -r1.32.2.1
--- gdk/x11/gdkdnd-x11.c	2000/05/15 16:09:49	1.32
+++ gdk/x11/gdkdnd-x11.c	2000/05/17 19:48:27	1.32.2.1
@@ -2423,16 +2423,10 @@
 			   gboolean        add_filter)
 {
   gint old_warnings = 0;	/* quiet gcc */
-			       
-  gboolean is_foreign = GDK_DRAWABLE_TYPE (window);
 
-  if (is_foreign)
-    {
-      old_warnings = gdk_error_warnings;
-      gdk_error_warnings = 0;
-    }
+  gdk_error_trap_push ();
 
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
       if (add_filter)
 	{
@@ -2454,11 +2448,8 @@
 	}
     }
 
-  if (is_foreign)
-    {
-      gdk_flush();
-      gdk_error_warnings = old_warnings;
-    }
+  gdk_flush ();
+  gdk_error_trap_pop ();  
 }
 
 static GdkFilterReturn 
Index: gdk/x11/gdkdrawable-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkdrawable-x11.c,v
retrieving revision 1.2
retrieving revision 1.2.6.4
diff -u -r1.2 -r1.2.6.4
--- gdk/x11/gdkdrawable-x11.c	2000/03/28 01:24:43	1.2
+++ gdk/x11/gdkdrawable-x11.c	2000/05/17 23:29:04	1.2.6.4
@@ -25,9 +25,9 @@
  */
 
 #include "gdkprivate-x11.h"
+#include "gdkdrawable-x11.h"
+#include "gdkpixmap-x11.h"
 
-static void    gdk_x11_drawable_destroy   (GdkDrawable     *drawable);
-
 static void gdk_x11_draw_rectangle (GdkDrawable    *drawable,
 				    GdkGC          *gc,
 				    gint            filled,
@@ -85,94 +85,129 @@
 				    GdkPoint       *points,
 				    gint            npoints);
 
+static void gdk_x11_set_colormap   (GdkDrawable    *drawable,
+                                    GdkColormap    *colormap);
+
+static GdkColormap* gdk_x11_get_colormap   (GdkDrawable    *drawable);
+
+static gint         gdk_x11_get_depth      (GdkDrawable    *drawable);
+
+static void gdk_drawable_impl_init       (GdkDrawableImpl      *drawable);
+static void gdk_drawable_impl_class_init (GdkDrawableImplClass *klass);
+static void gdk_drawable_impl_finalize   (GObject              *object);
+
+static gpointer parent_class = NULL;
+
+GType
+gdk_drawable_impl_get_type (void)
+{
+  static GType object_type = 0;
+
+  if (!object_type)
+    {
+      static const GTypeInfo object_info =
+      {
+        sizeof (GdkDrawableImplClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gdk_drawable_impl_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (GdkDrawableImpl),
+        0,              /* n_preallocs */
+        (GInstanceInitFunc) gdk_drawable_impl_init,
+      };
+      
+      object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
+                                            "GdkDrawableImpl",
+                                            &object_info);
+    }
+  
+  return object_type;
+}
+
+static void
+gdk_drawable_impl_init (GdkDrawableImpl *impl)
+{
 
-GdkDrawableClass _gdk_x11_drawable_class = {
-  gdk_x11_drawable_destroy,
-  _gdk_x11_gc_new,
-  gdk_x11_draw_rectangle,
-  gdk_x11_draw_arc,
-  gdk_x11_draw_polygon,
-  gdk_x11_draw_text,
-  gdk_x11_draw_text_wc,
-  gdk_x11_draw_drawable,
-  gdk_x11_draw_points,
-  gdk_x11_draw_segments,
-  gdk_x11_draw_lines
-};
 
+}
+
+static void
+gdk_drawable_impl_class_init (GdkDrawableImplClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
+
+  parent_class = g_type_class_peek (GDK_TYPE_DRAWABLE);
+
+  object_class->finalize = gdk_drawable_impl_finalize;
+
+  drawable_class->create_gc = _gdk_x11_gc_new;
+  drawable_class->draw_rectangle = gdk_x11_draw_rectangle;
+  drawable_class->draw_arc = gdk_x11_draw_arc;
+  drawable_class->draw_polygon = gdk_x11_draw_polygon;
+  drawable_class->draw_text = gdk_x11_draw_text;
+  drawable_class->draw_text_wc = gdk_x11_draw_text_wc;
+  drawable_class->draw_drawable = gdk_x11_draw_drawable;
+  drawable_class->draw_points = gdk_x11_draw_points;
+  drawable_class->draw_segments = gdk_x11_draw_segments;
+  drawable_class->draw_lines = gdk_x11_draw_lines;
+
+  drawable_class->set_colormap = gdk_x11_set_colormap;
+  drawable_class->get_colormap = gdk_x11_get_colormap;
+
+  drawable_class->get_depth = gdk_x11_get_depth;
+}
+
+static void
+gdk_drawable_impl_finalize (GObject *object)
+{
+  GdkDrawableImpl *impl = GDK_DRAWABLE_IMPL (object);
+
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
 /*****************************************************
  * X11 specific implementations of generic functions *
  *****************************************************/
 
-GdkColormap*
-gdk_drawable_get_colormap (GdkDrawable *drawable)
+static GdkColormap*
+gdk_x11_get_colormap (GdkDrawable *drawable)
 {
-  GdkDrawablePrivate *drawable_private;
-  XWindowAttributes window_attributes;
-  
-  g_return_val_if_fail (drawable != NULL, NULL);
-  drawable_private = (GdkDrawablePrivate*) drawable;
-  
-  if (!GDK_DRAWABLE_DESTROYED (drawable))
-    {
-      if (drawable_private->colormap == NULL &&
-	  GDK_IS_WINDOW (drawable))
-	{
-	  XGetWindowAttributes (GDK_DRAWABLE_XDISPLAY (drawable),
-				GDK_DRAWABLE_XID (drawable),
-				&window_attributes);
-	  drawable_private->colormap =  gdk_colormap_lookup (window_attributes.colormap);
-	}
+  GdkDrawableImpl *impl;
 
-      return drawable_private->colormap;
-    }
-  
-  return NULL;
+  g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL (drawable), NULL);
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
+
+  return impl->colormap;
 }
 
-void
-gdk_drawable_set_colormap (GdkDrawable *drawable,
-			   GdkColormap *colormap)
+static void
+gdk_x11_set_colormap (GdkDrawable *drawable,
+                      GdkColormap *colormap)
 {
-  GdkDrawablePrivate *drawable_private;
-  GdkColormapPrivateX *colormap_private;
+  GdkDrawableImpl *impl;
   
-  g_return_if_fail (drawable != NULL);
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
   g_return_if_fail (colormap != NULL);
-  
-  drawable_private = (GdkDrawablePrivate *)drawable;
-  colormap_private = (GdkColormapPrivateX *)colormap;
   
-  if (!GDK_DRAWABLE_DESTROYED (drawable))
-    {
-      if (GDK_IS_WINDOW (drawable))
-	{
-	  g_return_if_fail (colormap_private->base.visual !=
-			    ((GdkColormapPrivate *)(drawable_private->colormap))->visual);
+  impl = GDK_DRAWABLE_IMPL (drawable);
 
-	  XSetWindowColormap (GDK_DRAWABLE_XDISPLAY (drawable),
-			      GDK_DRAWABLE_XID (drawable),
-			      colormap_private->xcolormap);
-	}
-
-      if (drawable_private->colormap)
-	gdk_colormap_unref (drawable_private->colormap);
-      drawable_private->colormap = colormap;
-      gdk_colormap_ref (drawable_private->colormap);
-
-      if (GDK_IS_WINDOW (drawable) &&
-	  drawable_private->window_type != GDK_WINDOW_TOPLEVEL)
-	gdk_window_add_colormap_windows (drawable);
-    }
+  if (impl->colormap == colormap)
+    return;
+  
+  if (impl->colormap)
+    gdk_colormap_unref (impl->colormap);
+  impl->colormap = colormap;
+  if (impl->colormap)
+    gdk_colormap_ref (impl->colormap);
 }
 
 /* Drawing
  */
-static void 
-gdk_x11_drawable_destroy (GdkDrawable *drawable)
-{
-  
-}
 
 static void
 gdk_x11_draw_rectangle (GdkDrawable *drawable,
@@ -183,11 +218,17 @@
 			gint         width,
 			gint         height)
 {
+  GdkDrawableImpl *impl;
+
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
+  
   if (filled)
-    XFillRectangle (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+    XFillRectangle (impl->xdisplay, impl->xid,
 		    GDK_GC_GET_XGC (gc), x, y, width, height);
   else
-    XDrawRectangle (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+    XDrawRectangle (impl->xdisplay, impl->xid,
 		    GDK_GC_GET_XGC (gc), x, y, width, height);
 }
 
@@ -202,11 +243,18 @@
 		  gint         angle1,
 		  gint         angle2)
 {
+  GdkDrawableImpl *impl;
+
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
+
+  
   if (filled)
-    XFillArc (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+    XFillArc (impl->xdisplay, impl->xid,
 	      GDK_GC_GET_XGC (gc), x, y, width, height, angle1, angle2);
   else
-    XDrawArc (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+    XDrawArc (impl->xdisplay, impl->xid,
 	      GDK_GC_GET_XGC (gc), x, y, width, height, angle1, angle2);
 }
 
@@ -219,7 +267,13 @@
 {
   XPoint *tmp_points;
   gint tmp_npoints, i;
+  GdkDrawableImpl *impl;
+
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
 
+  impl = GDK_DRAWABLE_IMPL (drawable);
+
+  
   if (!filled &&
       (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y))
     {
@@ -241,10 +295,10 @@
     }
   
   if (filled)
-    XFillPolygon (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+    XFillPolygon (impl->xdisplay, impl->xid,
 		  GDK_GC_GET_XGC (gc), tmp_points, tmp_npoints, Complex, CoordModeOrigin);
   else
-    XDrawLines (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+    XDrawLines (impl->xdisplay, impl->xid,
 		GDK_GC_GET_XGC (gc), tmp_points, tmp_npoints, CoordModeOrigin);
 
   g_free (tmp_points);
@@ -265,25 +319,31 @@
 		   const gchar *text,
 		   gint         text_length)
 {
+  GdkDrawableImpl *impl;
+
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
+  
   if (font->type == GDK_FONT_FONT)
     {
       XFontStruct *xfont = (XFontStruct *) GDK_FONT_XFONT (font);
-      XSetFont(GDK_DRAWABLE_XDISPLAY (drawable), GDK_GC_GET_XGC (gc), xfont->fid);
+      XSetFont(impl->xdisplay, GDK_GC_GET_XGC (gc), xfont->fid);
       if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
 	{
-	  XDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+	  XDrawString (impl->xdisplay, impl->xid,
 		       GDK_GC_GET_XGC (gc), x, y, text, text_length);
 	}
       else
 	{
-	  XDrawString16 (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+	  XDrawString16 (impl->xdisplay, impl->xid,
 			 GDK_GC_GET_XGC (gc), x, y, (XChar2b *) text, text_length / 2);
 	}
     }
   else if (font->type == GDK_FONT_FONTSET)
     {
       XFontSet fontset = (XFontSet) GDK_FONT_XFONT (font);
-      XmbDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+      XmbDrawString (impl->xdisplay, impl->xid,
 		     fontset, GDK_GC_GET_XGC (gc), x, y, text, text_length);
     }
   else
@@ -299,15 +359,21 @@
 		      const GdkWChar *text,
 		      gint	      text_length)
 {
+  GdkDrawableImpl *impl;
+
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
+  
   if (font->type == GDK_FONT_FONT)
     {
       XFontStruct *xfont = (XFontStruct *) GDK_FONT_XFONT (font);
       gchar *text_8bit;
       gint i;
-      XSetFont(GDK_DRAWABLE_XDISPLAY (drawable), GDK_GC_GET_XGC (gc), xfont->fid);
+      XSetFont(impl->xdisplay, GDK_GC_GET_XGC (gc), xfont->fid);
       text_8bit = g_new (gchar, text_length);
       for (i=0; i<text_length; i++) text_8bit[i] = text[i];
-      XDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+      XDrawString (impl->xdisplay, impl->xid,
                    GDK_GC_GET_XGC (gc), x, y, text_8bit, text_length);
       g_free (text_8bit);
     }
@@ -315,7 +381,7 @@
     {
       if (sizeof(GdkWChar) == sizeof(wchar_t))
 	{
-	  XwcDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+	  XwcDrawString (impl->xdisplay, impl->xid,
 			 (XFontSet) GDK_FONT_XFONT (font),
 			 GDK_GC_GET_XGC (gc), x, y, (wchar_t *)text, text_length);
 	}
@@ -325,7 +391,7 @@
 	  gint i;
 	  text_wchar = g_new (wchar_t, text_length);
 	  for (i=0; i<text_length; i++) text_wchar[i] = text[i];
-	  XwcDrawString (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+	  XwcDrawString (impl->xdisplay, impl->xid,
 			 (XFontSet) GDK_FONT_XFONT (font),
 			 GDK_GC_GET_XGC (gc), x, y, text_wchar, text_length);
 	  g_free (text_wchar);
@@ -348,12 +414,17 @@
 {
   int src_depth = gdk_drawable_get_depth (src);
   int dest_depth = gdk_drawable_get_depth (drawable);
+  GdkDrawableImpl *impl;
 
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
+  
   if (src_depth == 1)
     {
-      XCopyArea (GDK_DRAWABLE_XDISPLAY (drawable),
+      XCopyArea (impl->xdisplay,
 		 GDK_DRAWABLE_XID (src),
-		 GDK_DRAWABLE_XID (drawable),
+		 impl->xid,
 		 GDK_GC_GET_XGC (gc),
 		 xsrc, ysrc,
 		 width, height,
@@ -361,9 +432,9 @@
     }
   else if (dest_depth != 0 && src_depth == dest_depth)
     {
-      XCopyArea (GDK_DRAWABLE_XDISPLAY (drawable),
+      XCopyArea (impl->xdisplay,
 		 GDK_DRAWABLE_XID (src),
-		 GDK_DRAWABLE_XID (drawable),
+		 impl->xid,
 		 GDK_GC_GET_XGC (gc),
 		 xsrc, ysrc,
 		 width, height,
@@ -379,13 +450,20 @@
 		     GdkPoint    *points,
 		     gint         npoints)
 {
+  GdkDrawableImpl *impl;
+
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
+
+  
   /* We special-case npoints == 1, because X will merge multiple
    * consecutive XDrawPoint requests into a PolyPoint request
    */
   if (npoints == 1)
     {
-      XDrawPoint (GDK_DRAWABLE_XDISPLAY (drawable),
-		  GDK_DRAWABLE_XID (drawable),
+      XDrawPoint (impl->xdisplay,
+		  impl->xid,
 		  GDK_GC_GET_XGC (gc),
 		  points[0].x, points[0].y);
     }
@@ -400,8 +478,8 @@
 	  tmp_points[i].y = points[i].y;
 	}
       
-      XDrawPoints (GDK_DRAWABLE_XDISPLAY (drawable),
-		   GDK_DRAWABLE_XID (drawable),
+      XDrawPoints (impl->xdisplay,
+		   impl->xid,
 		   GDK_GC_GET_XGC (gc),
 		   tmp_points,
 		   npoints,
@@ -417,12 +495,19 @@
 		       GdkSegment  *segs,
 		       gint         nsegs)
 {
+  GdkDrawableImpl *impl;
+
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
+
+  
   /* We special-case nsegs == 1, because X will merge multiple
    * consecutive XDrawLine requests into a PolySegment request
    */
   if (nsegs == 1)
     {
-      XDrawLine (GDK_DRAWABLE_XDISPLAY (drawable), GDK_DRAWABLE_XID (drawable),
+      XDrawLine (impl->xdisplay, impl->xid,
 		 GDK_GC_GET_XGC (gc), segs[0].x1, segs[0].y1,
 		 segs[0].x2, segs[0].y2);
     }
@@ -439,8 +524,8 @@
 	  tmp_segs[i].y2 = segs[i].y2;
 	}
       
-      XDrawSegments (GDK_DRAWABLE_XDISPLAY (drawable),
-		     GDK_DRAWABLE_XID (drawable),
+      XDrawSegments (impl->xdisplay,
+		     impl->xid,
 		     GDK_GC_GET_XGC (gc),
 		     tmp_segs, nsegs);
 
@@ -456,18 +541,32 @@
 {
   gint i;
   XPoint *tmp_points = g_new (XPoint, npoints);
+  GdkDrawableImpl *impl;
+
+  g_return_if_fail (GDK_IS_DRAWABLE_IMPL (drawable));
+
+  impl = GDK_DRAWABLE_IMPL (drawable);
 
+  
   for (i=0; i<npoints; i++)
     {
       tmp_points[i].x = points[i].x;
       tmp_points[i].y = points[i].y;
     }
       
-  XDrawLines (GDK_DRAWABLE_XDISPLAY (drawable),
-	      GDK_DRAWABLE_XID (drawable),
+  XDrawLines (impl->xdisplay,
+	      impl->xid,
 	      GDK_GC_GET_XGC (gc),
 	      tmp_points, npoints,
 	      CoordModeOrigin);
 
   g_free (tmp_points);
+}
+
+static gint
+gdk_x11_get_depth (GdkDrawable *drawable)
+{
+  /* This is a bit bogus but I'm not sure the other way is better */
+
+  return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL (drawable)->wrapper);
 }
Index: gdk/x11/gdkdrawable-x11.h
===================================================================
RCS file: gdkdrawable-x11.h
diff -N gdkdrawable-x11.h
--- /dev/null	Tue May  5 16:32:27 1998
+++ /tmp/cvskl9FH7	Wed May 17 23:03:16 2000
@@ -0,0 +1,73 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#ifndef __GDK_DRAWABLE_X11_H__
+#define __GDK_DRAWABLE_X11_H__
+
+#include <gdk/gdkdrawable.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Drawable implementation for X11
+ */
+
+typedef struct _GdkDrawableImpl GdkDrawableImpl;
+typedef struct _GdkDrawableImplClass GdkDrawableImplClass;
+
+#define GDK_TYPE_DRAWABLE_IMPL              (gdk_drawable_impl_get_type ())
+#define GDK_DRAWABLE_IMPL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE_IMPL, GdkDrawableImpl))
+#define GDK_DRAWABLE_IMPL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE_IMPL, GdkDrawableImplClass))
+#define GDK_IS_DRAWABLE_IMPL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE_IMPL))
+#define GDK_IS_DRAWABLE_IMPL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE_IMPL))
+#define GDK_DRAWABLE_IMPL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE_IMPL, GdkDrawableImplClass))
+
+struct _GdkDrawableImpl
+{
+  GdkDrawable parent_instance;
+
+  GdkDrawable *wrapper;
+  
+  GdkColormap *colormap;
+  
+  Window xid;
+  Display *xdisplay;
+};
+ 
+struct _GdkDrawableImplClass 
+{
+  GdkDrawableClass parent_class;
+
+};
+
+GType gdk_drawable_impl_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GDK_DRAWABLE_X11_H__ */
Index: gdk/x11/gdkevents-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkevents-x11.c,v
retrieving revision 1.27
retrieving revision 1.27.2.2
diff -u -r1.27 -r1.27.2.2
--- gdk/x11/gdkevents-x11.c	2000/05/15 16:09:49	1.27
+++ gdk/x11/gdkevents-x11.c	2000/05/17 19:48:27	1.27.2.2
@@ -259,7 +259,7 @@
 {
   
   GdkWindow *window;
-  GdkWindowPrivate *window_private;
+  GdkWindowObject *window_private;
   static XComposeStatus compose;
   KeySym keysym;
   int charcount;
@@ -295,7 +295,7 @@
   window = gdk_window_lookup (xevent->xany.window);
   /* FIXME: window might be a GdkPixmap!!! */
   
-  window_private = (GdkWindowPrivate *) window;
+  window_private = (GdkWindowObject *) window;
   
   if (window != NULL)
     gdk_window_ref (window);
@@ -303,7 +303,7 @@
   event->any.window = window;
   event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
   
-  if (window_private && GDK_DRAWABLE_DESTROYED (window))
+  if (window_private && GDK_WINDOW_DESTROYED (window))
     {
       if (xevent->type != DestroyNotify)
 	return FALSE;
@@ -327,7 +327,7 @@
 
 #ifdef USE_XIM
   if (window == NULL && gdk_xim_window && xevent->type == KeyPress &&
-      !GDK_DRAWABLE_DESTROYED (gdk_xim_window))
+      !GDK_WINDOW_DESTROYED (gdk_xim_window))
     {
       /*
        * If user presses a key in Preedit or Status window, keypress event
@@ -342,7 +342,7 @@
       GdkFilterReturn result;
 
       window = gdk_xim_window;
-      window_private = (GdkWindowPrivate *) window;
+      window_private = (GdkWindowObject *) window;
       gdk_window_ref (window);
       event->any.window = window;
 
@@ -636,7 +636,7 @@
       
       /* Tell XInput stuff about it if appropriate */
       if (window_private &&
-	  !GDK_DRAWABLE_DESTROYED (window) &&
+	  !GDK_WINDOW_DESTROYED (window) &&
 	  (window_private->extension_events != 0) &&
 	  gdk_input_vtable.enter_event)
 	gdk_input_vtable.enter_event (&xevent->xcrossing, window);
@@ -939,9 +939,9 @@
       event->any.type = GDK_DESTROY;
       event->any.window = window;
       
-      return_val = window_private && !GDK_DRAWABLE_DESTROYED (window);
+      return_val = window_private && !GDK_WINDOW_DESTROYED (window);
       
-      if (window && GDK_DRAWABLE_XID (window) != GDK_ROOT_WINDOW())
+      if (window && GDK_WINDOW_XID (window) != GDK_ROOT_WINDOW())
 	gdk_window_destroy_notify (window);
       break;
       
@@ -1002,16 +1002,16 @@
 			   xevent->xconfigure.override_redirect,
 			   !window
 			   ? " (discarding)"
-			   : GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_CHILD
+			   : GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD
 			   ? " (discarding child)"
 			   : ""));
       if (window &&
-	  !GDK_DRAWABLE_DESTROYED (window) &&
+	  !GDK_WINDOW_DESTROYED (window) &&
 	  (window_private->extension_events != 0) &&
 	  gdk_input_vtable.configure_event)
 	gdk_input_vtable.configure_event (&xevent->xconfigure, window);
 
-      if (!window || GDK_DRAWABLE_TYPE (window) == GDK_WINDOW_CHILD)
+      if (!window || GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
 	return_val = FALSE;
       else
 	{
@@ -1022,7 +1022,7 @@
 	  
 	  if (!xevent->xconfigure.x &&
 	      !xevent->xconfigure.y &&
-	      !GDK_DRAWABLE_DESTROYED (window))
+	      !GDK_WINDOW_DESTROYED (window))
 	    {
 	      gint tx = 0;
 	      gint ty = 0;
@@ -1052,8 +1052,8 @@
 	    }
 	  window_private->x = event->configure.x;
 	  window_private->y = event->configure.y;
-	  window_private->drawable.width = xevent->xconfigure.width;
-	  window_private->drawable.height = xevent->xconfigure.height;
+	  GDK_WINDOW_IMPL (window_private->impl)->width = xevent->xconfigure.width;
+	  GDK_WINDOW_IMPL (window_private->impl)->height = xevent->xconfigure.height;
 	  if (window_private->resize_count > 1)
 	    window_private->resize_count -= 1;
 	}
@@ -1195,7 +1195,7 @@
       /* something else - (e.g., a Xinput event) */
       
       if (window_private &&
-	  !window_private->drawable.destroyed &&
+	  !GDK_WINDOW_DESTROYED (window_private) &&
 	  (window_private->extension_events != 0) &&
 	  gdk_input_vtable.other_event)
 	return_val = gdk_input_vtable.other_event(event, xevent, window);
Index: gdk/x11/gdkgc-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkgc-x11.c,v
retrieving revision 1.3
retrieving revision 1.3.4.1
diff -u -r1.3 -r1.3.4.1
--- gdk/x11/gdkgc-x11.c	2000/04/05 04:11:10	1.3
+++ gdk/x11/gdkgc-x11.c	2000/05/17 23:29:04	1.3.4.1
@@ -42,6 +42,11 @@
   XGCValues xvalues;
   unsigned long xvalues_mask;
 
+  /* NOTICE that the drawable here has to be the impl drawable,
+   * not the publically-visible drawables.
+   */
+  g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL (drawable), NULL);
+  
   gc = gdk_gc_alloc ();
   private = (GdkGCPrivate *)gc;
 
@@ -51,7 +56,7 @@
   data->dirty_mask = 0;
   data->clip_region = NULL;
     
-  GDK_GC_XDATA (gc)->xdisplay = GDK_DRAWABLE_XDISPLAY (drawable);
+  GDK_GC_XDATA (gc)->xdisplay = GDK_DRAWABLE_IMPL (drawable)->xdisplay;
 
   if (values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN))
     {
@@ -75,7 +80,7 @@
   gdk_x11_gc_values_to_xvalues (values, values_mask, &xvalues, &xvalues_mask);
   
   data->xgc = XCreateGC (GDK_GC_XDISPLAY (gc),
-			 GDK_DRAWABLE_XID (drawable),
+                         GDK_DRAWABLE_IMPL (drawable)->xid,
 			 xvalues_mask, &xvalues);
 
   return gc;
Index: gdk/x11/gdkgeometry-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkgeometry-x11.c,v
retrieving revision 1.2
retrieving revision 1.2.6.3
diff -u -r1.2 -r1.2.6.3
--- gdk/x11/gdkgeometry-x11.c	2000/03/28 01:24:43	1.2
+++ gdk/x11/gdkgeometry-x11.c	2000/05/18 02:56:13	1.2.6.3
@@ -62,10 +62,10 @@
   GdkRectangle clip_rect;
 };
 
-static void gdk_window_compute_position   (GdkWindow          *window,
+static void gdk_window_compute_position   (GdkWindowImpl      *window,
 					   GdkWindowParentPos *parent_pos,
 					   GdkXPositionInfo   *info);
-static void gdk_window_compute_parent_pos (GdkWindow          *window,
+static void gdk_window_compute_parent_pos (GdkWindowImpl      *window,
 					   GdkWindowParentPos *parent_pos);
 static void gdk_window_premove            (GdkWindow          *window,
 					   GdkWindowParentPos *parent_pos);
@@ -87,27 +87,26 @@
 				   gint      *x_offset,
 				   gint      *y_offset)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-  GdkWindowXData *data = (GdkWindowXData *)private->drawable.klass_data;
+  GdkWindowImpl *impl =
+    GDK_WINDOW_IMPL (((GdkWindowObject *) GDK_WINDOW (window))->impl);
 
-  *x_offset = data->position_info.x_offset;
-  *y_offset = data->position_info.y_offset;
+  *x_offset = impl->position_info.x_offset;
+  *y_offset = impl->position_info.y_offset;
 }
 
 void
 _gdk_window_init_position (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-  GdkWindowXData *data;
   GdkWindowParentPos parent_pos;
-
-  g_return_if_fail (window != NULL);
+  GdkWindowImpl *impl;
+  
   g_return_if_fail (GDK_IS_WINDOW (window));
-
-  data = (GdkWindowXData *)private->drawable.klass_data;
 
-  gdk_window_compute_parent_pos (window, &parent_pos);
-  gdk_window_compute_position (window, &parent_pos, &data->position_info);
+  impl =
+    GDK_WINDOW_IMPL (((GdkWindowObject*) GDK_WINDOW (window))->impl);
+  
+  gdk_window_compute_parent_pos (impl, &parent_pos);
+  gdk_window_compute_position (impl, &parent_pos, &impl->position_info);
 }
 
 void
@@ -117,10 +116,10 @@
 			       gint       width,
 			       gint       height)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowImpl *impl;
+  GdkWindowObject *obj;
   GdkXPositionInfo new_info;
   GdkWindowParentPos parent_pos;
-  GdkWindowXData *data;
   GList *tmp_list;
   
   gint d_xoffset, d_yoffset;
@@ -130,36 +129,37 @@
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
-
-  data = (GdkWindowXData *)private->drawable.klass_data;
 
-  dx = x - private->x;
-  dy = y - private->y;
+  impl = GDK_WINDOW_IMPL (((GdkWindowObject *) GDK_WINDOW (window))->impl);
+  obj = (GdkWindowObject *) GDK_WINDOW (window);
+  
+  dx = x - obj->x;
+  dy = y - obj->y;
   
   is_move = dx != 0 || dy != 0;
-  is_resize = private->drawable.width != width || private->drawable.height != height;
+  is_resize = impl->width != width || impl->height != height;
 
   if (!is_move && !is_resize)
     return;
   
-  private->x = x;
-  private->y = y;
-  private->drawable.width = width;
-  private->drawable.height = height;
+  obj->x = x;
+  obj->y = y;
+  impl->width = width;
+  impl->height = height;
 
-  gdk_window_compute_parent_pos (window, &parent_pos);
-  gdk_window_compute_position (window, &parent_pos, &new_info);
+  gdk_window_compute_parent_pos (impl, &parent_pos);
+  gdk_window_compute_position (impl, &parent_pos, &new_info);
 
-  gdk_window_clip_changed (window, &data->position_info.clip_rect, &new_info.clip_rect);
+  gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
 
-  parent_pos.x += private->x;
-  parent_pos.y += private->y;
+  parent_pos.x += obj->x;
+  parent_pos.y += obj->y;
   parent_pos.x11_x += new_info.x;
   parent_pos.x11_y += new_info.y;
   parent_pos.clip_rect = new_info.clip_rect;
 
-  d_xoffset = new_info.x_offset - data->position_info.x_offset;
-  d_yoffset = new_info.y_offset - data->position_info.y_offset;
+  d_xoffset = new_info.x_offset - impl->position_info.x_offset;
+  d_yoffset = new_info.y_offset - impl->position_info.y_offset;
   
   if (d_xoffset != 0 || d_yoffset != 0)
     {
@@ -172,57 +172,57 @@
 	
       if (d_xoffset < 0)
 	{
-	  new_x0 = data->position_info.x + d_xoffset;
-	  new_x1 = data->position_info.x + data->position_info.width;
+	  new_x0 = impl->position_info.x + d_xoffset;
+	  new_x1 = impl->position_info.x + impl->position_info.width;
 	}
       else
 	{
-	  new_x0 = data->position_info.x;
-	  new_x1 = data->position_info.x + new_info.width + d_xoffset;
+	  new_x0 = impl->position_info.x;
+	  new_x1 = impl->position_info.x + new_info.width + d_xoffset;
 	}
 
       if (d_yoffset < 0)
 	{
-	  new_y0 = data->position_info.y + d_yoffset;
-	  new_y1 = data->position_info.y + data->position_info.height;
+	  new_y0 = impl->position_info.y + d_yoffset;
+	  new_y1 = impl->position_info.y + impl->position_info.height;
 	}
       else
 	{
-	  new_y0 = data->position_info.y;
-	  new_y1 = data->position_info.y + new_info.height + d_yoffset;
+	  new_y0 = impl->position_info.y;
+	  new_y1 = impl->position_info.y + new_info.height + d_yoffset;
 	}
       
-      XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
-			 GDK_DRAWABLE_XID (window),
+      XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+			 GDK_WINDOW_XID (window),
 			 new_x0, new_y0, new_x1 - new_x0, new_y1 - new_y0);
       
-      tmp_list = private->children;
+      tmp_list = obj->children;
       while (tmp_list)
 	{
 	  gdk_window_premove (tmp_list->data, &parent_pos);
 	  tmp_list = tmp_list->next;
 	}
 
-      XMoveWindow (GDK_DRAWABLE_XDISPLAY (window),
-		   GDK_DRAWABLE_XID (window),
+      XMoveWindow (GDK_WINDOW_XDISPLAY (window),
+		   GDK_WINDOW_XID (window),
 		   new_x0 + dx, new_y0 + dy);
       
       if (d_xoffset > 0 || d_yoffset > 0)
 	gdk_window_queue_translation (window, MAX (d_xoffset, 0), MAX (d_yoffset, 0));
       
-      XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
-			 GDK_DRAWABLE_XID (window),
+      XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+			 GDK_WINDOW_XID (window),
 			 new_info.x, new_info.y, new_info.width, new_info.height);
       
-      if (data->position_info.no_bg)
+      if (impl->position_info.no_bg)
 	gdk_window_tmp_reset_bg (window);
 
-      if (!data->position_info.mapped && new_info.mapped && private->mapped)
-	XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+      if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
+	XMapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
       
-      data->position_info = new_info;
+      impl->position_info = new_info;
       
-      tmp_list = private->children;
+      tmp_list = obj->children;
       while (tmp_list)
 	{
 	  gdk_window_postmove (tmp_list->data, &parent_pos);
@@ -234,10 +234,10 @@
       if (is_move && is_resize)
 	gdk_window_set_static_gravities (window, FALSE);
 
-      if (data->position_info.mapped && !new_info.mapped)
-	XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+      if (impl->position_info.mapped && !new_info.mapped)
+	XUnmapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
       
-      tmp_list = private->children;
+      tmp_list = obj->children;
       while (tmp_list)
 	{
 	  gdk_window_premove (tmp_list->data, &parent_pos);
@@ -245,87 +245,92 @@
 	}
 
       if (is_resize)
-	XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
-			   GDK_DRAWABLE_XID (window),
+	XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+			   GDK_WINDOW_XID (window),
 			   new_info.x, new_info.y, new_info.width, new_info.height);
       else
-	XMoveWindow (GDK_DRAWABLE_XDISPLAY (window),
-		     GDK_DRAWABLE_XID (window),
+	XMoveWindow (GDK_WINDOW_XDISPLAY (window),
+		     GDK_WINDOW_XID (window),
 		     new_info.x, new_info.y);
 
-      tmp_list = private->children;
+      tmp_list = obj->children;
       while (tmp_list)
 	{
 	  gdk_window_postmove (tmp_list->data, &parent_pos);
 	  tmp_list = tmp_list->next;
 	}
 
-      if (data->position_info.no_bg)
+      if (impl->position_info.no_bg)
 	gdk_window_tmp_reset_bg (window);
 
-      if (!data->position_info.mapped && new_info.mapped && private->mapped)
-	XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+      if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
+	XMapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
 
-      data->position_info = new_info;
+      impl->position_info = new_info;
     }
 }
 
 static void
-gdk_window_compute_position (GdkWindow          *window,
+gdk_window_compute_position (GdkWindowImpl      *window,
 			     GdkWindowParentPos *parent_pos,
 			     GdkXPositionInfo   *info)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *wrapper;
   int parent_x_offset;
   int parent_y_offset;
+
+  g_return_if_fail (GDK_IS_WINDOW_IMPL (window));
+
+  wrapper =
+    (GdkWindowObject *) GDK_WINDOW (GDK_DRAWABLE_IMPL (window)->wrapper);
   
   info->big = FALSE;
   
-  if (private->drawable.width <= 32768)
+  if (window->width <= 32768)
     {
-      info->width = private->drawable.width;
-      info->x = parent_pos->x + private->x - parent_pos->x11_x;
+      info->width = window->width;
+      info->x = parent_pos->x + wrapper->x - parent_pos->x11_x;
     }
   else
     {
       info->big = TRUE;
       info->width = 32768;
-      if (parent_pos->x + private->x < -16384)
+      if (parent_pos->x + wrapper->x < -16384)
 	{
-	  if (parent_pos->x + private->x + private->drawable.width < 16384)
-	    info->x = parent_pos->x + private->x + private->drawable.width - 32768 - parent_pos->x11_x;
+	  if (parent_pos->x + wrapper->x + window->width < 16384)
+	    info->x = parent_pos->x + wrapper->x + window->width - 32768 - parent_pos->x11_x;
 	  else
 	    info->x = -16384 - parent_pos->x11_y;
 	}
       else
-	info->x = parent_pos->x + private->x - parent_pos->x11_x;
+	info->x = parent_pos->x + wrapper->x - parent_pos->x11_x;
     }
 
-  if (private->drawable.height <= 32768)
+  if (window->height <= 32768)
     {
-      info->height = private->drawable.height;
-      info->y = parent_pos->y + private->y - parent_pos->x11_y;
+      info->height = window->height;
+      info->y = parent_pos->y + wrapper->y - parent_pos->x11_y;
     }
   else
     {
       info->big = TRUE;
       info->height = 32768;
-      if (parent_pos->y + private->y < -16384)
+      if (parent_pos->y + wrapper->y < -16384)
 	{
-	  if (parent_pos->y + private->y + private->drawable.height < 16384)
-	    info->y = parent_pos->y + private->y + private->drawable.height - 32768 - parent_pos->x11_y;
+	  if (parent_pos->y + wrapper->y + window->height < 16384)
+	    info->y = parent_pos->y + wrapper->y + window->height - 32768 - parent_pos->x11_y;
 	  else
 	    info->y = -16384 - parent_pos->x11_y;
 	}
       else
-	info->y = parent_pos->y + private->y - parent_pos->x11_y;
+	info->y = parent_pos->y + wrapper->y - parent_pos->x11_y;
     }
 
   parent_x_offset = parent_pos->x11_x - parent_pos->x;
   parent_y_offset = parent_pos->x11_y - parent_pos->y;
   
-  info->x_offset = parent_x_offset + info->x - private->x;
-  info->y_offset = parent_y_offset + info->y - private->y;
+  info->x_offset = parent_x_offset + info->x - wrapper->x;
+  info->y_offset = parent_y_offset + info->y - wrapper->y;
 
   /* We don't considering the clipping of toplevel windows and their immediate children
    * by their parents, and simply always map those windows.
@@ -343,17 +348,17 @@
 
   info->no_bg = FALSE;
 
-  if (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
+  if (GDK_WINDOW_TYPE (wrapper) == GDK_WINDOW_CHILD)
     {
-      info->clip_rect.x = private->x;
-      info->clip_rect.y = private->y;
-      info->clip_rect.width = private->drawable.width;
-      info->clip_rect.height = private->drawable.height;
+      info->clip_rect.x = wrapper->x;
+      info->clip_rect.y = wrapper->y;
+      info->clip_rect.width = window->width;
+      info->clip_rect.height = window->height;
       
       gdk_rectangle_intersect (&info->clip_rect, &parent_pos->clip_rect, &info->clip_rect);
 
-      info->clip_rect.x -= private->x;
-      info->clip_rect.y -= private->y;
+      info->clip_rect.x -= wrapper->x;
+      info->clip_rect.y -= wrapper->y;
     }
   else
     {
@@ -365,16 +370,21 @@
 }
 
 static void
-gdk_window_compute_parent_pos (GdkWindow          *window,
+gdk_window_compute_parent_pos (GdkWindowImpl      *window,
 			       GdkWindowParentPos *parent_pos)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-  GdkWindowXData *data;
+  GdkWindowObject *wrapper;
+  GdkWindowObject *parent;
   GdkRectangle tmp_clip;
   
   int clip_xoffset = 0;
   int clip_yoffset = 0;
 
+  g_return_if_fail (GDK_IS_WINDOW_IMPL (window));
+
+  wrapper =
+    (GdkWindowObject *) GDK_WINDOW (GDK_DRAWABLE_IMPL (window)->wrapper);
+  
   parent_pos->x = 0;
   parent_pos->y = 0;
   parent_pos->x11_x = 0;
@@ -396,27 +406,27 @@
   parent_pos->clip_rect.width = G_MAXINT;
   parent_pos->clip_rect.height = G_MAXINT;
 
-  private = (GdkWindowPrivate *)private->parent;
-  while (private && private->drawable.window_type == GDK_WINDOW_CHILD)
+  parent = (GdkWindowObject *)wrapper->parent;
+  while (parent && parent->window_type == GDK_WINDOW_CHILD)
     {
-      data = (GdkWindowXData *)private->drawable.klass_data;
-
+      GdkWindowImpl *impl = GDK_WINDOW_IMPL (parent->impl);
+      
       tmp_clip.x = - clip_xoffset;
       tmp_clip.y = - clip_yoffset;
-      tmp_clip.width = private->drawable.width;
-      tmp_clip.height = private->drawable.height;
+      tmp_clip.width = impl->width;
+      tmp_clip.height = impl->height;
 
       gdk_rectangle_intersect (&parent_pos->clip_rect, &tmp_clip, &parent_pos->clip_rect);
 
-      parent_pos->x += private->x;
-      parent_pos->y += private->y;
-      parent_pos->x11_x += data->position_info.x;
-      parent_pos->x11_y += data->position_info.y;
+      parent_pos->x += parent->x;
+      parent_pos->y += parent->y;
+      parent_pos->x11_x += impl->position_info.x;
+      parent_pos->x11_y += impl->position_info.y;
 
-      clip_xoffset += private->x;
-      clip_yoffset += private->y;
+      clip_xoffset += parent->x;
+      clip_yoffset += parent->y;
 
-      private = (GdkWindowPrivate *)private->parent;
+      parent = (GdkWindowObject *)parent->parent;
     }
 }
 
@@ -424,28 +434,31 @@
 gdk_window_premove (GdkWindow          *window,
 		    GdkWindowParentPos *parent_pos)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-  GdkWindowXData *data = GDK_WINDOW_XDATA (window);
+  GdkWindowImpl *impl;
+  GdkWindowObject *obj;
   GdkXPositionInfo new_info;
   GList *tmp_list;
   gint d_xoffset, d_yoffset;
   GdkWindowParentPos this_pos;
+
+  obj = (GdkWindowObject *) window;
+  impl = GDK_WINDOW_IMPL (obj->impl);
   
-  gdk_window_compute_position (window, parent_pos, &new_info);
+  gdk_window_compute_position (impl, parent_pos, &new_info);
 
-  gdk_window_clip_changed (window, &data->position_info.clip_rect, &new_info.clip_rect);
+  gdk_window_clip_changed (window, &impl->position_info.clip_rect, &new_info.clip_rect);
 
-  this_pos.x = parent_pos->x + private->x;
-  this_pos.y = parent_pos->y + private->y;
+  this_pos.x = parent_pos->x + obj->x;
+  this_pos.y = parent_pos->y + obj->y;
   this_pos.x11_x = parent_pos->x11_x + new_info.x;
   this_pos.x11_y = parent_pos->x11_y + new_info.y;
   this_pos.clip_rect = new_info.clip_rect;
 
-  if (data->position_info.mapped && !new_info.mapped)
+  if (impl->position_info.mapped && !new_info.mapped)
     XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
 
-  d_xoffset = new_info.x_offset - data->position_info.x_offset;
-  d_yoffset = new_info.y_offset - data->position_info.y_offset;
+  d_xoffset = new_info.x_offset - impl->position_info.x_offset;
+  d_yoffset = new_info.y_offset - impl->position_info.y_offset;
   
   if (d_xoffset != 0 || d_yoffset != 0)
     {
@@ -456,24 +469,24 @@
 	
       if (d_xoffset < 0)
 	{
-	  new_x0 = data->position_info.x + d_xoffset;
-	  new_x1 = data->position_info.x + data->position_info.width;
+	  new_x0 = impl->position_info.x + d_xoffset;
+	  new_x1 = impl->position_info.x + impl->position_info.width;
 	}
       else
 	{
-	  new_x0 = data->position_info.x;
-	  new_x1 = data->position_info.x + new_info.width + d_xoffset;
+	  new_x0 = impl->position_info.x;
+	  new_x1 = impl->position_info.x + new_info.width + d_xoffset;
 	}
 
       if (d_yoffset < 0)
 	{
-	  new_y0 = data->position_info.y + d_yoffset;
-	  new_y1 = data->position_info.y + data->position_info.height;
+	  new_y0 = impl->position_info.y + d_yoffset;
+	  new_y1 = impl->position_info.y + impl->position_info.height;
 	}
       else
 	{
-	  new_y0 = data->position_info.y;
-	  new_y1 = data->position_info.y + new_info.height + d_yoffset;
+	  new_y0 = impl->position_info.y;
+	  new_y1 = impl->position_info.y + new_info.height + d_yoffset;
 	}
 
       XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
@@ -481,7 +494,7 @@
 			 new_x0, new_y0, new_x1 - new_x0, new_y1 - new_y0);
     }
 
-  tmp_list = private->children;
+  tmp_list = obj->children;
   while (tmp_list)
     {
       gdk_window_premove (tmp_list->data, &this_pos);
@@ -493,23 +506,26 @@
 gdk_window_postmove (GdkWindow          *window,
 		     GdkWindowParentPos *parent_pos)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-  GdkWindowXData *data = (GdkWindowXData *)private->drawable.klass_data;
+  GdkWindowImpl *impl;
+  GdkWindowObject *obj;
   GdkXPositionInfo new_info;
   GList *tmp_list;
   gint d_xoffset, d_yoffset;
   GdkWindowParentPos this_pos;
+
+  obj = (GdkWindowObject *) window;
+  impl = GDK_WINDOW_IMPL (obj->impl);
   
-  gdk_window_compute_position (window, parent_pos, &new_info);
+  gdk_window_compute_position (impl, parent_pos, &new_info);
 
-  this_pos.x = parent_pos->x + private->x;
-  this_pos.y = parent_pos->y + private->y;
+  this_pos.x = parent_pos->x + obj->x;
+  this_pos.y = parent_pos->y + obj->y;
   this_pos.x11_x = parent_pos->x11_x + new_info.x;
   this_pos.x11_y = parent_pos->x11_y + new_info.y;
   this_pos.clip_rect = new_info.clip_rect;
 
-  d_xoffset = new_info.x_offset - data->position_info.x_offset;
-  d_yoffset = new_info.y_offset - data->position_info.y_offset;
+  d_xoffset = new_info.x_offset - impl->position_info.x_offset;
+  d_yoffset = new_info.y_offset - impl->position_info.y_offset;
   
   if (d_xoffset != 0 || d_yoffset != 0)
     {
@@ -521,15 +537,15 @@
 			 new_info.x, new_info.y, new_info.width, new_info.height);
     }
 
-  if (!data->position_info.mapped && new_info.mapped && private->mapped)
+  if (!impl->position_info.mapped && new_info.mapped && obj->mapped)
     XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
 
-  if (data->position_info.no_bg)
+  if (impl->position_info.no_bg)
     gdk_window_tmp_reset_bg (window);
 
-  data->position_info = new_info;
+  impl->position_info = new_info;
 
-  tmp_list = private->children;
+  tmp_list = obj->children;
   while (tmp_list)
     {
       gdk_window_postmove (tmp_list->data, &this_pos);
@@ -574,12 +590,13 @@
 			    gulong        serial,
 			    GdkRectangle *area)
 {
-  GdkWindowXData *data = GDK_WINDOW_XDATA (window);
+  GdkWindowImpl *impl;
   GdkRegion *invalidate_region = gdk_region_rectangle (area);
   GdkRegion *clip_region;
-
   GSList *tmp_list = translate_queue;
 
+  impl = GDK_WINDOW_IMPL (((GdkWindowObject *) window)->impl);
+  
   while (tmp_list)
     {
       GdkWindowQueueItem *item = tmp_list->data;
@@ -610,7 +627,7 @@
 	}
     }
 
-  clip_region = gdk_region_rectangle (&data->position_info.clip_rect);
+  clip_region = gdk_region_rectangle (&impl->position_info.clip_rect);
   gdk_region_intersect (invalidate_region, clip_region);
 
   if (!gdk_region_empty (invalidate_region))
@@ -623,12 +640,15 @@
 static void
 gdk_window_tmp_unset_bg (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-  GdkWindowXData *data = GDK_WINDOW_XDATA (window);
+  GdkWindowImpl *impl;
+  GdkWindowObject *obj;
 
-  data->position_info.no_bg = TRUE;
+  obj = (GdkWindowObject *) window;
+  impl = GDK_WINDOW_IMPL (obj->impl);
 
-  if (private->bg_pixmap != GDK_NO_BG)
+  impl->position_info.no_bg = TRUE;
+
+  if (obj->bg_pixmap != GDK_NO_BG)
     XSetWindowBackgroundPixmap (GDK_DRAWABLE_XDISPLAY (window),
 				GDK_DRAWABLE_XID (window), None);
 }
@@ -636,22 +656,25 @@
 static void
 gdk_window_tmp_reset_bg (GdkWindow *window)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-  GdkWindowXData *data = GDK_WINDOW_XDATA (window);
+  GdkWindowImpl *impl;
+  GdkWindowObject *obj;
+
+  obj = (GdkWindowObject *) window;
+  impl = GDK_WINDOW_IMPL (obj->impl);
 
-  data->position_info.no_bg = FALSE;
+  impl->position_info.no_bg = FALSE;
 
-  if (private->bg_pixmap == GDK_NO_BG)
+  if (obj->bg_pixmap == GDK_NO_BG)
     return;
   
-  if (private->bg_pixmap)
+  if (obj->bg_pixmap)
     {
       Pixmap xpixmap;
 
-      if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG)
+      if (obj->bg_pixmap == GDK_PARENT_RELATIVE_BG)
 	xpixmap = ParentRelative;
       else 
-	xpixmap = GDK_DRAWABLE_XID (private->bg_pixmap);
+	xpixmap = GDK_DRAWABLE_XID (obj->bg_pixmap);
 
       XSetWindowBackgroundPixmap (GDK_DRAWABLE_XDISPLAY (window),
 				  GDK_DRAWABLE_XID (window), xpixmap);
@@ -660,28 +683,31 @@
     {
       XSetWindowBackground (GDK_DRAWABLE_XDISPLAY (window),
 			    GDK_DRAWABLE_XID (window),
-			    private->bg_color.pixel);
+			    obj->bg_color.pixel);
     }
 }
 
 static void
 gdk_window_clip_changed (GdkWindow *window, GdkRectangle *old_clip, GdkRectangle *new_clip)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+  GdkWindowImpl *impl;
+  GdkWindowObject *obj;
   GdkRegion *old_clip_region;
   GdkRegion *new_clip_region;
-
-  if (private->input_only)
+  
+  if (((GdkWindowObject *)window)->input_only)
     return;
-    
+
+  obj = (GdkWindowObject *) window;
+  impl = GDK_WINDOW_IMPL (obj->impl);
+  
   old_clip_region = gdk_region_rectangle (old_clip);
   new_clip_region = gdk_region_rectangle (new_clip);
 
   /* Trim invalid region of window to new clip rectangle
    */
-  if (private->update_area)
-    gdk_region_intersect (private->update_area, new_clip_region);
+  if (obj->update_area)
+    gdk_region_intersect (obj->update_area, new_clip_region);
 
   /* Invalidate newly exposed portion of window
    */
Index: gdk/x11/gdkglobals-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkglobals-x11.c,v
retrieving revision 1.22
retrieving revision 1.22.8.1
diff -u -r1.22 -r1.22.8.1
--- gdk/x11/gdkglobals-x11.c	1999/11/08 20:14:58	1.22
+++ gdk/x11/gdkglobals-x11.c	2000/05/17 19:48:28	1.22.8.1
@@ -50,6 +50,6 @@
 #endif /* USE_XIM */
 GdkWindow        *gdk_xim_window;		/* currently using Widow */
 
-GdkWindowPrivate *gdk_xgrab_window = NULL;  /* Window that currently holds the
-					     *	x pointer grab
-					     */
+GdkWindowObject *gdk_xgrab_window = NULL;  /* Window that currently holds the
+                                            *	x pointer grab
+                                            */
Index: gdk/x11/gdkim-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkim-x11.c,v
retrieving revision 1.19
retrieving revision 1.19.6.1
diff -u -r1.19 -r1.19.6.1
--- gdk/x11/gdkim-x11.c	2000/03/28 01:24:43	1.19
+++ gdk/x11/gdkim-x11.c	2000/05/17 19:48:28	1.19.6.1
@@ -625,7 +625,7 @@
     }
 
   if (attr->client_window == NULL ||
-      GDK_DRAWABLE_DESTROYED (attr->client_window))
+      GDK_WINDOW_DESTROYED (attr->client_window))
     {
       g_warning ("Client_window is null or already destroyed.\n");
       return NULL;
@@ -1084,7 +1084,7 @@
   if (mask & GDK_IC_PREEDIT_PIXMAP)
     {
       if (attr->preedit_pixmap != NULL &&
-	  GDK_DRAWABLE_DESTROYED (attr->preedit_pixmap))
+	  GDK_WINDOW_DESTROYED (attr->preedit_pixmap))
 	{
 	  g_warning ("Preedit pixmap is already destroyed.\n");
 	  error |= GDK_IC_PREEDIT_PIXMAP;
@@ -1171,7 +1171,7 @@
   if (mask & GDK_IC_STATUS_PIXMAP)
     {
       if (attr->status_pixmap != NULL &&
-	  GDK_DRAWABLE_DESTROYED (attr->status_pixmap))
+	  GDK_WINDOW_DESTROYED (attr->status_pixmap))
 	{
 	  g_warning ("Preedit pixmap is already destroyed.\n");
 	  error |= GDK_IC_STATUS_PIXMAP;
Index: gdk/x11/gdkimage-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkimage-x11.c,v
retrieving revision 1.20
retrieving revision 1.20.6.2
diff -u -r1.20 -r1.20.6.2
--- gdk/x11/gdkimage-x11.c	2000/03/28 01:24:43	1.20
+++ gdk/x11/gdkimage-x11.c	2000/05/17 23:29:04	1.20.6.2
@@ -160,7 +160,7 @@
 }
 
 void
-gdk_image_init (void)
+gdk_windowing_image_init (void)
 {
   if (gdk_use_xshm)
     {
@@ -346,7 +346,7 @@
 
   g_return_val_if_fail (window != NULL, NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return NULL;
 
   private = g_new (GdkImagePrivateX, 1);
@@ -473,7 +473,7 @@
   g_return_if_fail (image != NULL);
   g_return_if_fail (gc != NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable))
+  if (GDK_WINDOW_DESTROYED (drawable))
     return;
   image_private = (GdkImagePrivateX*) image;
 
@@ -502,8 +502,9 @@
   g_return_if_fail (image != NULL);
   g_return_if_fail (gc != NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (drawable))
+  if (GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable))
     return;
+  
   image_private = (GdkImagePrivateX*) image;
 
   g_return_if_fail (image->type == GDK_IMAGE_SHARED);
Index: gdk/x11/gdkinput.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkinput.c,v
retrieving revision 1.14
retrieving revision 1.14.6.1
diff -u -r1.14 -r1.14.6.1
--- gdk/x11/gdkinput.c	2000/03/14 19:57:22	1.14
+++ gdk/x11/gdkinput.c	2000/05/17 19:48:28	1.14.6.1
@@ -115,7 +115,7 @@
   g_return_val_if_fail (window != NULL, NULL);
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
   
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return NULL;
 
   if (deviceid == GDK_CORE_POINTER)
@@ -200,15 +200,15 @@
 gdk_input_set_extension_events (GdkWindow *window, gint mask,
 				GdkExtensionMode mode)
 {
-  GdkWindowPrivate *window_private;
+  GdkWindowObject *window_private;
   GList *tmp_list;
   GdkInputWindow *iw;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  window_private = (GdkWindowPrivate*) window;
-  if (GDK_DRAWABLE_DESTROYED (window))
+  window_private = (GdkWindowObject*) window;
+  if (GDK_WINDOW_DESTROYED (window))
     return;
 
   if (mode == GDK_EXTENSION_EVENTS_NONE)
Index: gdk/x11/gdkmain-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkmain-x11.c,v
retrieving revision 1.115
retrieving revision 1.115.6.1
diff -u -r1.115 -r1.115.6.1
--- gdk/x11/gdkmain-x11.c	2000/03/28 01:24:43	1.115
+++ gdk/x11/gdkmain-x11.c	2000/05/17 19:48:28	1.115.6.1
@@ -246,12 +246,12 @@
   
   cursor_private = (GdkCursorPrivate*) cursor;
   
-  xwindow = GDK_DRAWABLE_XID (window);
+  xwindow = GDK_WINDOW_XID (window);
   
-  if (!confine_to || GDK_DRAWABLE_DESTROYED (confine_to))
+  if (!confine_to || GDK_WINDOW_DESTROYED (confine_to))
     xconfine_to = None;
   else
-    xconfine_to = GDK_DRAWABLE_XID (confine_to);
+    xconfine_to = GDK_WINDOW_XID (confine_to);
   
   if (!cursor)
     xcursor = None;
@@ -277,8 +277,8 @@
   
   if (return_val == Success)
     {
-      if (!GDK_DRAWABLE_DESTROYED (window))
-	return_val = XGrabPointer (GDK_DRAWABLE_XDISPLAY (window),
+      if (!GDK_WINDOW_DESTROYED (window))
+	return_val = XGrabPointer (GDK_WINDOW_XDISPLAY (window),
 				   xwindow,
 				   owner_events,
 				   xevent_mask,
@@ -291,7 +291,7 @@
     }
   
   if (return_val == GrabSuccess)
-    gdk_xgrab_window = (GdkWindowPrivate *)window;
+    gdk_xgrab_window = (GdkWindowObject *)window;
   
   return return_val;
 }
@@ -370,9 +370,9 @@
   g_return_val_if_fail (window != NULL, 0);
   g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    return XGrabKeyboard (GDK_DRAWABLE_XDISPLAY (window),
-			  GDK_DRAWABLE_XID (window),
+  if (!GDK_WINDOW_DESTROYED (window))
+    return XGrabKeyboard (GDK_WINDOW_XDISPLAY (window),
+			  GDK_WINDOW_XID (window),
 			  owner_events,
 			  GrabModeAsync, GrabModeAsync,
 			  time);
Index: gdk/x11/gdkpixmap-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkpixmap-x11.c,v
retrieving revision 1.31
retrieving revision 1.31.6.4
diff -u -r1.31 -r1.31.6.4
--- gdk/x11/gdkpixmap-x11.c	2000/03/28 01:24:43	1.31
+++ gdk/x11/gdkpixmap-x11.c	2000/05/17 23:29:04	1.31.6.4
@@ -32,7 +32,8 @@
 #include <unistd.h>
 #include <X11/Xlib.h>
 
-#include "gdkpixmap.h"
+#include <gdk/gdkpixmap.h>
+#include "gdkpixmap-x11.h"
 #include "gdkprivate-x11.h"
 
 typedef struct
@@ -49,42 +50,85 @@
   gulong pixels[1];
 } _GdkPixmapInfo;
 
-GdkDrawableClass _gdk_x11_pixmap_class;
+static void gdk_pixmap_impl_get_size   (GdkDrawable        *drawable,
+                                        gint               *width,
+                                        gint               *height);
+
+static void gdk_pixmap_impl_init       (GdkPixmapImpl      *pixmap);
+static void gdk_pixmap_impl_class_init (GdkPixmapImplClass *klass);
+static void gdk_pixmap_impl_finalize   (GObject            *object);
+
+static gpointer parent_class = NULL;
+
+GType
+gdk_pixmap_impl_get_type (void)
+{
+  static GType object_type = 0;
+
+  if (!object_type)
+    {
+      static const GTypeInfo object_info =
+      {
+        sizeof (GdkPixmapImplClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gdk_pixmap_impl_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (GdkPixmapImpl),
+        0,              /* n_preallocs */
+        (GInstanceInitFunc) gdk_pixmap_impl_init,
+      };
+      
+      object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL,
+                                            "GdkPixmapImpl",
+                                            &object_info);
+    }
+  
+  return object_type;
+}
 
 static void
-gdk_x11_pixmap_destroy (GdkPixmap *pixmap)
+gdk_pixmap_impl_init (GdkPixmapImpl *impl)
 {
-  XFreePixmap (GDK_DRAWABLE_XDISPLAY (pixmap), GDK_DRAWABLE_XID (pixmap));
-  gdk_xid_table_remove (GDK_DRAWABLE_XID (pixmap));
-
-  g_free (GDK_DRAWABLE_XDATA (pixmap));
+  impl->width = 1;
+  impl->height = 1;
 }
 
-static GdkDrawable *
-gdk_x11_pixmap_alloc (void)
+static void
+gdk_pixmap_impl_class_init (GdkPixmapImplClass *klass)
 {
-  GdkDrawable *drawable;
-  GdkDrawablePrivate *private;
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
   
-  static GdkDrawableClass klass;
-  static gboolean initialized = FALSE;
+  parent_class = g_type_class_peek (GDK_TYPE_DRAWABLE_IMPL);
 
-  if (!initialized)
-    {
-      initialized = TRUE;
-      
-      klass = _gdk_x11_drawable_class;
-      klass.destroy = gdk_x11_pixmap_destroy;
-    }
+  object_class->finalize = gdk_pixmap_impl_finalize;
 
-  drawable = gdk_drawable_alloc ();
-  private = (GdkDrawablePrivate *)drawable;
+  drawable_class->get_size = gdk_pixmap_impl_get_size;
+}
 
-  private->klass = &klass;
-  private->klass_data = g_new (GdkDrawableXData, 1);
-  private->window_type = GDK_DRAWABLE_PIXMAP;
+static void
+gdk_pixmap_impl_finalize (GObject *object)
+{
+  GdkPixmapImpl *impl = GDK_PIXMAP_IMPL (object);
+  GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL (impl)->wrapper);
+  
+  XFreePixmap (GDK_PIXMAP_XDISPLAY (wrapper), GDK_PIXMAP_XID (wrapper));
+  gdk_xid_table_remove (GDK_PIXMAP_XID (wrapper));
+  
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
 
-  return drawable;
+static void
+gdk_pixmap_impl_get_size   (GdkDrawable *drawable,
+                            gint *width,
+                            gint *height)
+{
+  if (width)
+    *width = GDK_PIXMAP_IMPL (drawable)->width;
+  if (height)
+    *height = GDK_PIXMAP_IMPL (drawable)->height;
 }
 
 GdkPixmap*
@@ -94,8 +138,9 @@
 		gint       depth)
 {
   GdkPixmap *pixmap;
-  GdkDrawablePrivate *private;
-
+  GdkDrawableImpl *draw_impl;
+  GdkPixmapImpl *pix_impl;
+  
   g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
   g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
   g_return_val_if_fail ((width != 0) && (height != 0), NULL);
@@ -103,25 +148,28 @@
   if (!window)
     window = gdk_parent_root;
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return NULL;
 
   if (depth == -1)
-    depth = gdk_drawable_get_visual (window)->depth;
+    depth = gdk_drawable_get_depth (GDK_DRAWABLE (window));
 
-  pixmap = gdk_x11_pixmap_alloc ();
-  private = (GdkDrawablePrivate *)pixmap;
+  pixmap = GDK_PIXMAP (g_type_create_instance (gdk_pixmap_get_type ()));
+  draw_impl = GDK_DRAWABLE_IMPL (((GdkPixmapObject *) pixmap)->impl);
+  pix_impl = GDK_PIXMAP_IMPL (((GdkPixmapObject *) pixmap)->impl);
+  draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+  
+  draw_impl->xdisplay = GDK_WINDOW_XDISPLAY (window);
+  draw_impl->xid = XCreatePixmap (GDK_PIXMAP_XDISPLAY (pixmap),
+                                  GDK_WINDOW_XID (window),
+                                  width, height, depth);
+  
+  pix_impl->width = width;
+  pix_impl->height = height;
+  ((GdkPixmapObject *)pixmap)->depth = depth;
 
-  GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
-  GDK_DRAWABLE_XDATA (private)->xid = XCreatePixmap (GDK_DRAWABLE_XDISPLAY (pixmap),
-						     GDK_DRAWABLE_XID (window),
-						     width, height, depth);
-  private->width = width;
-  private->height = height;
-  private->depth = depth;
+  gdk_xid_table_insert (&GDK_PIXMAP_XID (pixmap), pixmap);
 
-  gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
-
   return pixmap;
 }
 
@@ -132,8 +180,9 @@
 			     gint         height)
 {
   GdkPixmap *pixmap;
-  GdkDrawablePrivate *private;
-
+  GdkDrawableImpl *draw_impl;
+  GdkPixmapImpl *pix_impl;
+  
   g_return_val_if_fail (data != NULL, NULL);
   g_return_val_if_fail ((width != 0) && (height != 0), NULL);
   g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
@@ -141,23 +190,25 @@
   if (!window)
     window = gdk_parent_root;
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return NULL;
 
-  pixmap = gdk_x11_pixmap_alloc ();
-  private = (GdkDrawablePrivate *)pixmap;
+  pixmap = GDK_PIXMAP (g_type_create_instance (gdk_pixmap_get_type ()));
+  draw_impl = GDK_DRAWABLE_IMPL (((GdkPixmapObject *) pixmap)->impl);
+  pix_impl = GDK_PIXMAP_IMPL (((GdkPixmapObject *) pixmap)->impl);
+  draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+
+  pix_impl->width = width;
+  pix_impl->height = height;
+  ((GdkPixmapObject *) pixmap)->depth = 1;
+
+  draw_impl->xdisplay = GDK_WINDOW_XDISPLAY (window);
+  draw_impl->xid = XCreateBitmapFromData (GDK_WINDOW_XDISPLAY (window),
+                                          GDK_WINDOW_XID (window),
+                                          (char *)data, width, height);
 
-  private->width = width;
-  private->height = height;
-  private->depth = 1;
-
-  GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
-  GDK_DRAWABLE_XDATA (private)->xid = XCreateBitmapFromData (GDK_DRAWABLE_XDISPLAY (window),
-							     GDK_DRAWABLE_XID (window),
-							     (char *)data, width, height);
-
-  gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
-
+  gdk_xid_table_insert (&GDK_PIXMAP_XID (pixmap), pixmap);
+  
   return pixmap;
 }
 
@@ -171,7 +222,8 @@
 			     GdkColor    *bg)
 {
   GdkPixmap *pixmap;
-  GdkDrawablePrivate *private;
+  GdkDrawableImpl *draw_impl;
+  GdkPixmapImpl *pix_impl;
 
   g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
   g_return_val_if_fail (data != NULL, NULL);
@@ -183,26 +235,28 @@
   if (!window)
     window = gdk_parent_root;
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return NULL;
 
   if (depth == -1)
     depth = gdk_drawable_get_visual (window)->depth;
-
-  pixmap = gdk_x11_pixmap_alloc ();
-  private = (GdkDrawablePrivate *)pixmap;
 
-  private->width = width;
-  private->height = height;
-  private->depth = depth;
-
-  GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
-  GDK_DRAWABLE_XDATA (private)->xid = XCreatePixmapFromBitmapData (GDK_DRAWABLE_XDISPLAY (window),
-								   GDK_DRAWABLE_XID (window),
-								   (char *)data, width, height,
-								   fg->pixel, bg->pixel, depth);
+  pixmap = GDK_PIXMAP (g_type_create_instance (gdk_pixmap_get_type ()));
+  draw_impl = GDK_DRAWABLE_IMPL (((GdkPixmapObject *) pixmap)->impl);
+  pix_impl = GDK_PIXMAP_IMPL (((GdkPixmapObject *) pixmap)->impl);
+  draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+  
+  pix_impl->width = width;
+  pix_impl->height = height;
+  ((GdkPixmapObject *) pixmap)->depth = depth;
+
+  draw_impl->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
+  draw_impl->xid = XCreatePixmapFromBitmapData (GDK_WINDOW_XDISPLAY (window),
+                                                GDK_WINDOW_XID (window),
+                                                (char *)data, width, height,
+                                                fg->pixel, bg->pixel, depth);
 
-  gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
+  gdk_xid_table_insert (&GDK_PIXMAP_XID (pixmap), pixmap);
 
   return pixmap;
 }
@@ -779,7 +833,8 @@
 gdk_pixmap_foreign_new (guint32 anid)
 {
   GdkPixmap *pixmap;
-  GdkDrawablePrivate *private;
+  GdkDrawableImpl *draw_impl;
+  GdkPixmapImpl *pix_impl;
   Pixmap xpixmap;
   Window root_return;
   unsigned int x_ret, y_ret, w_ret, h_ret, bw_ret, depth_ret;
@@ -797,18 +852,21 @@
 		    xpixmap, &root_return,
 		    &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
       return NULL;
-      
-  pixmap = gdk_x11_pixmap_alloc ();
-  private = (GdkDrawablePrivate *)pixmap;
+
+  pixmap = GDK_PIXMAP (g_type_create_instance (gdk_pixmap_get_type ()));
+  draw_impl = GDK_DRAWABLE_IMPL (((GdkPixmapObject *) pixmap)->impl);
+  pix_impl = GDK_PIXMAP_IMPL (((GdkPixmapObject *) pixmap)->impl);
+  draw_impl->wrapper = GDK_DRAWABLE (pixmap);
+  
 
-  GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DISPLAY ();
-  GDK_DRAWABLE_XDATA (private)->xid = xpixmap;
+  draw_impl->xdisplay = GDK_DISPLAY ();
+  draw_impl->xid = xpixmap;
 
-  private->width = w_ret;
-  private->height = h_ret;
-  private->depth = depth_ret;
+  pix_impl->width = w_ret;
+  pix_impl->height = h_ret;
+  ((GdkPixmapObject *) pixmap)->depth = depth_ret;
   
-  gdk_xid_table_insert(&GDK_DRAWABLE_XID (pixmap), pixmap);
+  gdk_xid_table_insert(&GDK_PIXMAP_XID (pixmap), pixmap);
 
   return pixmap;
 }
Index: gdk/x11/gdkpixmap-x11.h
===================================================================
RCS file: gdkpixmap-x11.h
diff -N gdkpixmap-x11.h
--- /dev/null	Tue May  5 16:32:27 1998
+++ /tmp/cvsl6x1OP	Wed May 17 23:03:16 2000
@@ -0,0 +1,70 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#ifndef __GDK_PIXMAP_X11_H__
+#define __GDK_PIXMAP_X11_H__
+
+#include <gdk/x11/gdkdrawable-x11.h>
+#include <gdk/gdkpixmap.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* Pixmap implementation for X11
+ */
+
+typedef struct _GdkPixmapImpl GdkPixmapImpl;
+typedef struct _GdkPixmapImplClass GdkPixmapImplClass;
+
+#define GDK_TYPE_PIXMAP_IMPL              (gdk_pixmap_impl_get_type ())
+#define GDK_PIXMAP_IMPL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP_IMPL, GdkPixmapImpl))
+#define GDK_PIXMAP_IMPL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP_IMPL, GdkPixmapImplClass))
+#define GDK_IS_PIXMAP_IMPL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP_IMPL))
+#define GDK_IS_PIXMAP_IMPL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP_IMPL))
+#define GDK_PIXMAP_IMPL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP_IMPL, GdkPixmapImplClass))
+
+struct _GdkPixmapImpl
+{
+  GdkDrawableImpl parent_instance;
+
+  gint width;
+  gint height;
+};
+ 
+struct _GdkPixmapImplClass 
+{
+  GdkDrawableImplClass parent_class;
+
+};
+
+GType gdk_pixmap_impl_get_type (void);
+ 
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GDK_PIXMAP_X11_H__ */
Index: gdk/x11/gdkprivate-x11.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkprivate-x11.h,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -r1.2 -r1.2.6.1
--- gdk/x11/gdkprivate-x11.h	2000/03/28 01:24:43	1.2
+++ gdk/x11/gdkprivate-x11.h	2000/05/17 18:34:14	1.2.6.1
@@ -63,17 +63,16 @@
 				 gboolean  excl_child);
 
 /* Routines from gdkgeometry-x11.c */
+void _gdk_window_init_position     (GdkWindow     *window);
+void _gdk_window_move_resize_child (GdkWindow     *window,
+                                    gint           x,
+                                    gint           y,
+                                    gint           width,
+                                    gint           height);
+void _gdk_window_process_expose    (GdkWindow     *window,
+                                    gulong         serial,
+                                    GdkRectangle  *area);
 
-void _gdk_window_init_position     (GdkWindow    *window);
-void _gdk_window_move_resize_child (GdkWindow    *window,
-				    gint          x,
-				    gint          y,
-				    gint          width,
-				    gint          height);
-void _gdk_window_process_expose    (GdkWindow    *window,
-				    gulong        serial,
-				    GdkRectangle *area);
-
 extern GdkDrawableClass  _gdk_x11_drawable_class;
 extern gboolean	         gdk_use_xshm;
 extern Atom		 gdk_wm_delete_window;
@@ -85,9 +84,9 @@
 extern const int         gdk_nevent_masks;
 extern const int         gdk_event_mask_table[];
 
-extern GdkWindowPrivate *gdk_xgrab_window;  /* Window that currently holds the
-					     * x pointer grab
-					     */
+extern GdkWindowObject *gdk_xgrab_window;  /* Window that currently holds the
+					    * x pointer grab
+					    */
 
 #ifdef USE_XIM
 extern GdkICPrivate *gdk_xim_ic;		/* currently using IC */
Index: gdk/x11/gdkproperty-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkproperty-x11.c,v
retrieving revision 1.17
retrieving revision 1.17.6.2
diff -u -r1.17 -r1.17.6.2
--- gdk/x11/gdkproperty-x11.c	2000/03/14 19:57:22	1.17
+++ gdk/x11/gdkproperty-x11.c	2000/05/17 23:29:04	1.17.6.2
@@ -117,11 +117,11 @@
 
   if (window)
     {
-      if (GDK_DRAWABLE_DESTROYED (window))
+      if (GDK_WINDOW_DESTROYED (window))
 	return FALSE;
 
-      xdisplay = GDK_DRAWABLE_XDISPLAY (window);
-      xwindow = GDK_DRAWABLE_XID (window);
+      xdisplay = GDK_WINDOW_XDISPLAY (window);
+      xwindow = GDK_WINDOW_XID (window);
     }
   else
     {
@@ -206,11 +206,11 @@
 
   if (window)
     {
-      if (GDK_DRAWABLE_DESTROYED (window))
+      if (GDK_WINDOW_DESTROYED (window))
 	return;
 
-      xdisplay = GDK_DRAWABLE_XDISPLAY (window);
-      xwindow = GDK_DRAWABLE_XID (window);
+      xdisplay = GDK_WINDOW_XDISPLAY (window);
+      xwindow = GDK_WINDOW_XID (window);
     }
   else
     {
@@ -234,11 +234,11 @@
 
   if (window)
     {
-      if (GDK_DRAWABLE_DESTROYED (window))
+      if (GDK_WINDOW_DESTROYED (window))
 	return;
 
-      xdisplay = GDK_DRAWABLE_XDISPLAY (window);
-      xwindow = GDK_DRAWABLE_XID (window);
+      xdisplay = GDK_WINDOW_XDISPLAY (window);
+      xwindow = GDK_WINDOW_XID (window);
     }
   else
     {
Index: gdk/x11/gdkselection-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkselection-x11.c,v
retrieving revision 1.11
retrieving revision 1.11.6.2
diff -u -r1.11 -r1.11.6.2
--- gdk/x11/gdkselection-x11.c	2000/03/28 01:24:43	1.11
+++ gdk/x11/gdkselection-x11.c	2000/05/17 23:29:04	1.11.6.2
@@ -45,11 +45,11 @@
 
   if (owner)
     {
-      if (GDK_DRAWABLE_DESTROYED (owner))
+      if (GDK_WINDOW_DESTROYED (owner))
 	return FALSE;
 
-      xdisplay = GDK_DRAWABLE_XDISPLAY (owner);
-      xwindow = GDK_DRAWABLE_XID (owner);
+      xdisplay = GDK_WINDOW_XDISPLAY (owner);
+      xwindow = GDK_WINDOW_XID (owner);
     }
   else
     {
@@ -80,11 +80,11 @@
 		       GdkAtom    target,
 		       guint32    time)
 {
-  if (GDK_DRAWABLE_DESTROYED (requestor))
+  if (GDK_WINDOW_DESTROYED (requestor))
     return;
 
-  XConvertSelection (GDK_DRAWABLE_XDISPLAY (requestor), selection, target,
-		     gdk_selection_property, GDK_DRAWABLE_XID (requestor), time);
+  XConvertSelection (GDK_WINDOW_XDISPLAY (requestor), selection, target,
+		     gdk_selection_property, GDK_WINDOW_XID (requestor), time);
 }
 
 gint
@@ -107,12 +107,12 @@
      should be) it would be a win to try first with a buffer of
      moderate length, to avoid two round trips to the server */
 
-  if (GDK_DRAWABLE_DESTROYED (requestor))
+  if (GDK_WINDOW_DESTROYED (requestor))
     return 0;
 
   t = NULL;
-  XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (requestor),
-		      GDK_DRAWABLE_XID (requestor),
+  XGetWindowProperty (GDK_WINDOW_XDISPLAY (requestor),
+		      GDK_WINDOW_XID (requestor),
 		      gdk_selection_property, 0, 0, False,
 		      AnyPropertyType, &prop_type, &prop_format,
 		      &nitems, &nbytes, &t);
Index: gdk/x11/gdkwindow-x11.c
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkwindow-x11.c,v
retrieving revision 1.90
retrieving revision 1.90.2.6
diff -u -r1.90 -r1.90.2.6
--- gdk/x11/gdkwindow-x11.c	2000/05/15 16:09:50	1.90
+++ gdk/x11/gdkwindow-x11.c	2000/05/18 02:56:13	1.90.2.6
@@ -37,6 +37,7 @@
 #include "gdkregion.h"
 #include "gdkinternals.h"
 #include "MwmUtil.h"
+#include "gdkwindow-x11.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -79,59 +80,160 @@
 						   gboolean   on);
 static gboolean gdk_window_have_shape_ext (void);
 
-GdkDrawableClass _gdk_windowing_window_class;
+static GdkColormap* gdk_window_impl_get_colormap (GdkDrawable *drawable);
+static void         gdk_window_impl_set_colormap (GdkDrawable *drawable,
+                                                  GdkColormap *cmap);
+static void         gdk_window_impl_get_size     (GdkDrawable *drawable,
+                                                  gint *width,
+                                                  gint *height);
+static void gdk_window_impl_init       (GdkWindowImpl      *window);
+static void gdk_window_impl_class_init (GdkWindowImplClass *klass);
+static void gdk_window_impl_finalize   (GObject            *object);
+
+static gpointer parent_class = NULL;
 
-static void
-gdk_x11_window_destroy (GdkDrawable *drawable)
+GType
+gdk_window_impl_get_type (void)
 {
-  if (!GDK_DRAWABLE_DESTROYED (drawable))
+  static GType object_type = 0;
+
+  if (!object_type)
     {
-      if (GDK_DRAWABLE_TYPE (drawable) != GDK_WINDOW_FOREIGN)
-	{
-	  g_warning ("losing last reference to undestroyed window\n");
-	  _gdk_window_destroy (drawable, FALSE);
-	}
-      else
-	/* We use TRUE here, to keep us from actually calling
-	 * XDestroyWindow() on the window
-	 */
-	_gdk_window_destroy (drawable, TRUE);
-      
-      gdk_xid_table_remove (GDK_DRAWABLE_XID (drawable));
+      static const GTypeInfo object_info =
+      {
+        sizeof (GdkWindowImplClass),
+        (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+        (GClassInitFunc) gdk_window_impl_class_init,
+        NULL,           /* class_finalize */
+        NULL,           /* class_data */
+        sizeof (GdkWindowImpl),
+        0,              /* n_preallocs */
+        (GInstanceInitFunc) gdk_window_impl_init,
+      };
+      
+      object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL,
+                                            "GdkWindowImpl",
+                                            &object_info);
     }
+  
+  return object_type;
+}
 
-  g_free (GDK_DRAWABLE_XDATA (drawable));
+static void
+gdk_window_impl_init (GdkWindowImpl *impl)
+{
+  impl->width = 1;
+  impl->height = 1;
 }
 
-static GdkWindow *
-gdk_x11_window_alloc (void)
+static void
+gdk_window_impl_class_init (GdkWindowImplClass *klass)
 {
-  GdkWindow *window;
-  GdkWindowPrivate *private;
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
+  
+  parent_class = g_type_class_peek (GDK_TYPE_DRAWABLE_IMPL);
+
+  object_class->finalize = gdk_window_impl_finalize;
+
+  drawable_class->set_colormap = gdk_window_impl_set_colormap;
+  drawable_class->get_colormap = gdk_window_impl_get_colormap;
+  drawable_class->get_size = gdk_window_impl_get_size;
+}
+
+static void
+gdk_window_impl_finalize (GObject *object)
+{
+  GdkWindowObject *wrapper;
+  GdkDrawableImpl *draw_impl;
+  GdkWindowImpl *window_impl;
   
-  static gboolean initialized = FALSE;
+  g_return_if_fail (GDK_IS_WINDOW_IMPL (object));
 
-  if (!initialized)
+  draw_impl = GDK_DRAWABLE_IMPL (object);
+  window_impl = GDK_WINDOW_IMPL (object);
+  
+  wrapper = (GdkWindowObject*) draw_impl->wrapper;
+
+  if (!GDK_WINDOW_DESTROYED (wrapper))
     {
-      initialized = TRUE;
+      gdk_xid_table_remove (draw_impl->xid);
+    }
+
+  G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static GdkColormap*
+gdk_window_impl_get_colormap (GdkDrawable *drawable)
+{
+  GdkDrawableImpl *drawable_impl;
+  GdkWindowImpl *window_impl;
+  
+  g_return_val_if_fail (GDK_IS_WINDOW_IMPL (drawable), NULL);
 
-      _gdk_windowing_window_class = _gdk_x11_drawable_class;
-      _gdk_windowing_window_class.destroy = gdk_x11_window_destroy;
+  drawable_impl = GDK_DRAWABLE_IMPL (drawable);
+  window_impl = GDK_WINDOW_IMPL (drawable);
+
+  if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only && 
+      drawable_impl->colormap == NULL)
+    {
+      XWindowAttributes window_attributes;
+      
+      XGetWindowAttributes (drawable_impl->xdisplay,
+                            drawable_impl->xid,
+                            &window_attributes);
+      drawable_impl->colormap =
+        gdk_colormap_lookup (window_attributes.colormap);
     }
+  
+  return drawable_impl->colormap;
+}
+
+static void
+gdk_window_impl_set_colormap (GdkDrawable *drawable,
+                              GdkColormap *cmap)
+{
+  GdkWindowImpl *impl;
+  GdkDrawableImpl *draw_impl;
+  
+  g_return_if_fail (GDK_IS_WINDOW_IMPL (drawable));
+  g_return_if_fail (gdk_colormap_get_visual (cmap) != gdk_drawable_get_visual (drawable));
 
-  window = _gdk_window_alloc ();
-  private = (GdkWindowPrivate *)window;
+  impl = GDK_WINDOW_IMPL (drawable);
+  draw_impl = GDK_DRAWABLE_IMPL (drawable);
 
-  private->drawable.klass = &_gdk_window_class;
-  private->drawable.klass_data = g_new (GdkWindowXData, 1);
+  GDK_DRAWABLE_GET_CLASS (draw_impl)->set_colormap (drawable, cmap);
+  
+  XSetWindowColormap (draw_impl->xdisplay,
+                      draw_impl->xid,
+                      GDK_COLORMAP_XCOLORMAP (cmap));
 
-  return window;
+  if (((GdkWindowObject*)draw_impl->wrapper)->window_type !=
+      GDK_WINDOW_TOPLEVEL)
+    gdk_window_add_colormap_windows (GDK_WINDOW (draw_impl->wrapper));
+}
+
+
+static void
+gdk_window_impl_get_size (GdkDrawable *drawable,
+                          gint *width,
+                          gint *height)
+{
+  g_return_if_fail (GDK_IS_WINDOW_IMPL (drawable));
+
+  if (width)
+    *width = GDK_WINDOW_IMPL (drawable)->width;
+  if (height)
+    *height = GDK_WINDOW_IMPL (drawable)->height;
 }
 
 void
-gdk_window_init (void)
+gdk_windowing_window_init (void)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
+  GdkWindowImpl *impl;
+  GdkDrawableImpl *draw_impl;
   XWindowAttributes xattributes;
   unsigned int width;
   unsigned int height;
@@ -142,16 +244,20 @@
   XGetGeometry (gdk_display, gdk_root_window, &gdk_root_window,
 		&x, &y, &width, &height, &border_width, &depth);
   XGetWindowAttributes (gdk_display, gdk_root_window, &xattributes);
-
-  gdk_parent_root = gdk_x11_window_alloc ();
-  private = (GdkWindowPrivate *)gdk_parent_root;
-  
-  GDK_DRAWABLE_XDATA (gdk_parent_root)->xdisplay = gdk_display;
-  GDK_DRAWABLE_XDATA (gdk_parent_root)->xid = gdk_root_window;
 
-  private->drawable.window_type = GDK_WINDOW_ROOT;
-  private->drawable.width = width;
-  private->drawable.height = height;
+  gdk_parent_root = GDK_WINDOW (g_type_create_instance (gdk_window_get_type ()));
+  private = (GdkWindowObject *)gdk_parent_root;
+  impl = GDK_WINDOW_IMPL (private->impl);
+  draw_impl = GDK_DRAWABLE_IMPL (private->impl);
+  
+  draw_impl->xdisplay = gdk_display;
+  draw_impl->xid = gdk_root_window;
+  draw_impl->wrapper = GDK_DRAWABLE (private);
+  
+  private->window_type = GDK_WINDOW_ROOT;
+  private->depth = depth;
+  impl->width = width;
+  impl->height = height;
   
   gdk_xid_table_insert (&gdk_root_window, gdk_parent_root);
 }
@@ -164,8 +270,10 @@
 		gint           attributes_mask)
 {
   GdkWindow *window;
-  GdkWindowPrivate *private;
-  GdkWindowPrivate *parent_private;
+  GdkWindowObject *private;
+  GdkWindowObject *parent_private;
+  GdkWindowImpl *impl;
+  GdkDrawableImpl *draw_impl;
   
   GdkVisual *visual;
   Window xparent;
@@ -186,19 +294,24 @@
   
   if (!parent)
     parent = gdk_parent_root;
+
+  g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL);
   
-  parent_private = (GdkWindowPrivate*) parent;
-  if (GDK_DRAWABLE_DESTROYED (parent))
+  parent_private = (GdkWindowObject*) parent;
+  if (GDK_WINDOW_DESTROYED (parent))
     return NULL;
   
-  xparent = GDK_DRAWABLE_XID (parent);
+  xparent = GDK_WINDOW_XID (parent);
   
-  window = gdk_x11_window_alloc ();
-  private = (GdkWindowPrivate *)window;
-
-  GDK_DRAWABLE_XDATA (window)->xdisplay = GDK_DRAWABLE_XDISPLAY (parent);
+  window = GDK_WINDOW (g_type_create_instance (gdk_window_get_type ()));
+  private = (GdkWindowObject *)window;
+  impl = GDK_WINDOW_IMPL (private->impl);
+  draw_impl = GDK_DRAWABLE_IMPL (private->impl);
+  draw_impl->wrapper = GDK_DRAWABLE (window);
+  
+  draw_impl->xdisplay = GDK_WINDOW_XDISPLAY (parent); 
   
-  private->parent = parent;
+  private->parent = (GdkWindowObject *)parent;
 
   xattributes_mask = 0;
   
@@ -214,12 +327,12 @@
   
   private->x = x;
   private->y = y;
-  private->drawable.width = (attributes->width > 1) ? (attributes->width) : (1);
-  private->drawable.height = (attributes->height > 1) ? (attributes->height) : (1);
-  private->drawable.window_type = attributes->window_type;
+  impl->width = (attributes->width > 1) ? (attributes->width) : (1);
+  impl->height = (attributes->height > 1) ? (attributes->height) : (1);
+  private->window_type = attributes->window_type;
 
-  _gdk_window_init_position (window);
-  if (GDK_WINDOW_XDATA (window)->position_info.big)
+  _gdk_window_init_position (GDK_WINDOW (private));
+  if (impl->position_info.big)
     private->guffaw_gravity = TRUE;
   
   if (attributes_mask & GDK_WA_VISUAL)
@@ -259,16 +372,26 @@
       depth = visual->depth;
 
       private->input_only = FALSE;
-      private->drawable.depth = depth;
+      private->depth = depth;
       
       if (attributes_mask & GDK_WA_COLORMAP)
-	private->drawable.colormap = attributes->colormap;
+        {
+          draw_impl->colormap = attributes->colormap;
+          gdk_colormap_ref (attributes->colormap);
+        }
       else
 	{
 	  if ((((GdkVisualPrivate*)gdk_visual_get_system ())->xvisual) == xvisual)
-	    private->drawable.colormap = gdk_colormap_get_system ();
+            {
+              draw_impl->colormap =
+                gdk_colormap_get_system ();
+              gdk_colormap_ref (draw_impl->colormap);
+            }
 	  else
-	    private->drawable.colormap = gdk_colormap_new (visual, False);
+            {
+              draw_impl->colormap =
+                gdk_colormap_new (visual, FALSE);
+            }
 	}
       
       private->bg_color.pixel = BlackPixel (gdk_display, gdk_screen);
@@ -286,29 +409,29 @@
       
       xattributes_mask |= CWBitGravity;
   
-      switch (private->drawable.window_type)
+      switch (private->window_type)
 	{
 	case GDK_WINDOW_TOPLEVEL:
-	  xattributes.colormap = GDK_COLORMAP_XCOLORMAP (private->drawable.colormap);
+	  xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
 	  xattributes_mask |= CWColormap;
 	  
 	  xparent = gdk_root_window;
 	  break;
 	  
 	case GDK_WINDOW_CHILD:
-	  xattributes.colormap = GDK_COLORMAP_XCOLORMAP (private->drawable.colormap);
+	  xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
 	  xattributes_mask |= CWColormap;
 	  break;
 	  
 	case GDK_WINDOW_DIALOG:
-	  xattributes.colormap = GDK_COLORMAP_XCOLORMAP (private->drawable.colormap);
+	  xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
 	  xattributes_mask |= CWColormap;
 	  
 	  xparent = gdk_root_window;
 	  break;
 	  
 	case GDK_WINDOW_TEMP:
-	  xattributes.colormap = GDK_COLORMAP_XCOLORMAP (private->drawable.colormap);
+	  xattributes.colormap = GDK_COLORMAP_XCOLORMAP (draw_impl->colormap);
 	  xattributes_mask |= CWColormap;
 	  
 	  xparent = gdk_root_window;
@@ -321,30 +444,27 @@
 	case GDK_WINDOW_ROOT:
 	  g_error ("cannot make windows of type GDK_WINDOW_ROOT");
 	  break;
-	case GDK_WINDOW_PIXMAP:
-	  g_error ("cannot make windows of type GDK_WINDOW_PIXMAP (use gdk_pixmap_new)");
-	  break;
 	}
     }
   else
     {
       depth = 0;
+      private->depth = 0;
       class = InputOnly;
       private->input_only = TRUE;
-      private->drawable.colormap = NULL;
+      draw_impl->colormap = NULL;
     }
+
+  draw_impl->xid = XCreateWindow (GDK_WINDOW_XDISPLAY (parent),
+                                  xparent,
+                                  x, y,
+                                  impl->width, impl->height,
+                                  0, depth, class, xvisual,
+                                  xattributes_mask, &xattributes);
 
-  GDK_DRAWABLE_XDATA (private)->xid = XCreateWindow (GDK_DRAWABLE_XDISPLAY (parent),
-						     xparent,
-						     x, y, private->drawable.width, private->drawable.height,
-						     0, depth, class, xvisual,
-						     xattributes_mask, &xattributes);
   gdk_drawable_ref (window);
-  gdk_xid_table_insert (&GDK_DRAWABLE_XID (window), window);
+  gdk_xid_table_insert (&GDK_WINDOW_XID (window), window);
   
-  if (private->drawable.colormap)
-    gdk_colormap_ref (private->drawable.colormap);
-  
   gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
 				  (attributes->cursor) :
 				  NULL));
@@ -352,22 +472,22 @@
   if (parent_private)
     parent_private->children = g_list_prepend (parent_private->children, window);
   
-  switch (private->drawable.window_type)
+  switch (GDK_WINDOW_TYPE (private))
     {
     case GDK_WINDOW_DIALOG:
-      XSetTransientForHint (GDK_DRAWABLE_XDISPLAY (window),
-			    GDK_DRAWABLE_XID (window),
+      XSetTransientForHint (GDK_WINDOW_XDISPLAY (window),
+			    GDK_WINDOW_XID (window),
 			    xparent);
     case GDK_WINDOW_TOPLEVEL:
     case GDK_WINDOW_TEMP:
-      XSetWMProtocols (GDK_DRAWABLE_XDISPLAY (window),
-		       GDK_DRAWABLE_XID (window),
+      XSetWMProtocols (GDK_WINDOW_XDISPLAY (window),
+		       GDK_WINDOW_XID (window),
 		       gdk_wm_window_protocols, 2);
       break;
     case GDK_WINDOW_CHILD:
       if ((attributes->wclass == GDK_INPUT_OUTPUT) &&
-	  (private->drawable.colormap != gdk_colormap_get_system ()) &&
-	  (private->drawable.colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
+	  (draw_impl->colormap != gdk_colormap_get_system ()) &&
+	  (draw_impl->colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
 	{
 	  GDK_NOTE (MISC, g_message ("adding colormap window\n"));
 	  gdk_window_add_colormap_windows (window);
@@ -380,8 +500,8 @@
     }
   
   size_hints.flags = PSize;
-  size_hints.width = private->drawable.width;
-  size_hints.height = private->drawable.height;
+  size_hints.width = impl->width;
+  size_hints.height = impl->height;
   
   wm_hints.flags = InputHint | StateHint | WindowGroupHint;
   wm_hints.window_group = gdk_leader_window;
@@ -392,19 +512,19 @@
    * attention to PSize, and even if they do, is this the
    * correct value???
    */
-  XSetWMNormalHints (GDK_DRAWABLE_XDISPLAY (window),
-		     GDK_DRAWABLE_XID (window),
+  XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
+		     GDK_WINDOW_XID (window),
 		     &size_hints);
   
-  XSetWMHints (GDK_DRAWABLE_XDISPLAY (window),
-	       GDK_DRAWABLE_XID (window),
+  XSetWMHints (GDK_WINDOW_XDISPLAY (window),
+	       GDK_WINDOW_XID (window),
 	       &wm_hints);
   
   if (!wm_client_leader_atom)
     wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
   
-  XChangeProperty (GDK_DRAWABLE_XDISPLAY (window),
-		   GDK_DRAWABLE_XID (window),
+  XChangeProperty (GDK_WINDOW_XDISPLAY (window),
+		   GDK_WINDOW_XID (window),
 	   	   wm_client_leader_atom,
 		   XA_WINDOW, 32, PropModeReplace,
 		   (guchar*) &gdk_leader_window, 1);
@@ -414,8 +534,8 @@
   else
     title = g_get_prgname ();
   
-  XmbSetWMProperties (GDK_DRAWABLE_XDISPLAY (window),
-		      GDK_DRAWABLE_XID (window),
+  XmbSetWMProperties (GDK_WINDOW_XDISPLAY (window),
+		      GDK_WINDOW_XID (window),
                       title, title,
                       NULL, 0,
                       NULL, NULL, NULL);
@@ -425,8 +545,8 @@
       class_hint = XAllocClassHint ();
       class_hint->res_name = attributes->wmclass_name;
       class_hint->res_class = attributes->wmclass_class;
-      XSetClassHint (GDK_DRAWABLE_XDISPLAY (window),
-		     GDK_DRAWABLE_XID (window),
+      XSetClassHint (GDK_WINDOW_XDISPLAY (window),
+		     GDK_WINDOW_XID (window),
 		     class_hint);
       XFree (class_hint);
     }
@@ -438,8 +558,10 @@
 gdk_window_foreign_new (guint32 anid)
 {
   GdkWindow *window;
-  GdkWindowPrivate *private;
-  GdkWindowPrivate *parent_private;
+  GdkWindowObject *private;
+  GdkWindowObject *parent_private;
+  GdkWindowImpl *impl;
+  GdkDrawableImpl *draw_impl;
   XWindowAttributes attrs;
   Window root, parent;
   Window *children = NULL;
@@ -461,29 +583,33 @@
   if (children)
     XFree (children);
   
-  window = gdk_x11_window_alloc ();
-  private = (GdkWindowPrivate *)window;
-
+  window = GDK_WINDOW (g_type_create_instance (gdk_window_get_type ()));
+  private = (GdkWindowObject *)window;
+  impl = GDK_WINDOW_IMPL (private->impl);
+  draw_impl = GDK_DRAWABLE_IMPL (private->impl);
+  draw_impl->wrapper = GDK_DRAWABLE (window);
+  
   private->parent = gdk_xid_table_lookup (parent);
   
-  parent_private = (GdkWindowPrivate *)private->parent;
+  parent_private = (GdkWindowObject *)private->parent;
   
   if (parent_private)
     parent_private->children = g_list_prepend (parent_private->children, window);
-  
-  GDK_DRAWABLE_XDATA (window)->xid = anid;
-  GDK_DRAWABLE_XDATA (window)->xdisplay = gdk_display;
 
+  draw_impl->xid = anid;
+  draw_impl->xdisplay = gdk_display;
+
   private->x = attrs.x;
   private->y = attrs.y;
-  private->drawable.width = attrs.width;
-  private->drawable.height = attrs.height;
-  private->drawable.window_type = GDK_WINDOW_FOREIGN;
-  private->drawable.destroyed = FALSE;
+  impl->width = attrs.width;
+  impl->height = attrs.height;
+  private->window_type = GDK_WINDOW_FOREIGN;
+  private->destroyed = FALSE;
   private->mapped = (attrs.map_state != IsUnmapped);
+  private->depth = attrs.depth;
   
   gdk_drawable_ref (window);
-  gdk_xid_table_insert (&GDK_DRAWABLE_XID (window), window);
+  gdk_xid_table_insert (&GDK_WINDOW_XID (window), window);
   
   return window;
 }
@@ -493,12 +619,14 @@
 			       gboolean   recursing,
 			       gboolean   foreign_destroy)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
 
+  g_return_if_fail (GDK_IS_WINDOW (window));
+  
   if (private->extension_events != 0)
     gdk_input_window_destroy (window);
 
-  if (private->drawable.window_type == GDK_WINDOW_FOREIGN)
+  if (private->window_type == GDK_WINDOW_FOREIGN)
     {
       if (!foreign_destroy && (private->parent != NULL))
 	{
@@ -513,21 +641,21 @@
 	  gdk_window_reparent (window, NULL, 0, 0);
 	  
 	  xevent.type = ClientMessage;
-	  xevent.window = GDK_DRAWABLE_XID (window);
+	  xevent.window = GDK_WINDOW_XID (window);
 	  xevent.message_type = gdk_wm_protocols;
 	  xevent.format = 32;
 	  xevent.data.l[0] = gdk_wm_delete_window;
 	  xevent.data.l[1] = CurrentTime;
 	  
-	  XSendEvent (GDK_DRAWABLE_XDISPLAY (window),
-		      GDK_DRAWABLE_XID (window),
+	  XSendEvent (GDK_WINDOW_XDISPLAY (window),
+		      GDK_WINDOW_XID (window),
 		      False, 0, (XEvent *)&xevent);
 	  gdk_flush ();
 	  gdk_error_trap_pop ();
 	}
     }
   else if (!recursing && !foreign_destroy)
-    XDestroyWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+    XDestroyWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
 }
 
 /* This function is called when the XWindow is really gone.
@@ -537,68 +665,68 @@
 {
   g_return_if_fail (window != NULL);
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
-      if (GDK_DRAWABLE_TYPE(window) != GDK_WINDOW_FOREIGN)
-	g_warning ("GdkWindow %#lx unexpectedly destroyed", GDK_DRAWABLE_XID (window));
+      if (GDK_WINDOW_TYPE(window) != GDK_WINDOW_FOREIGN)
+	g_warning ("GdkWindow %#lx unexpectedly destroyed", GDK_WINDOW_XID (window));
 
       _gdk_window_destroy (window, TRUE);
     }
   
-  gdk_xid_table_remove (GDK_DRAWABLE_XID (window));
+  gdk_xid_table_remove (GDK_WINDOW_XID (window));
   gdk_drawable_unref (window);
 }
 
 void
 gdk_window_show (GdkWindow *window)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   
-  g_return_if_fail (window != NULL);
+  g_return_if_fail (GDK_IS_WINDOW (window));
   
-  private = (GdkWindowPrivate*) window;
-  if (!private->drawable.destroyed)
+  private = (GdkWindowObject*) window;
+  if (!private->destroyed)
     {
       private->mapped = TRUE;
-      XRaiseWindow (GDK_DRAWABLE_XDISPLAY (window),
-		    GDK_DRAWABLE_XID (window));
+      XRaiseWindow (GDK_WINDOW_XDISPLAY (window),
+		    GDK_WINDOW_XID (window));
       
-      if (GDK_WINDOW_XDATA (window)->position_info.mapped)
-	XMapWindow (GDK_DRAWABLE_XDISPLAY (window),
-		    GDK_DRAWABLE_XID (window));
+      if (GDK_WINDOW_IMPL (private->impl)->position_info.mapped)
+	XMapWindow (GDK_WINDOW_XDISPLAY (window),
+		    GDK_WINDOW_XID (window));
     }
 }
 
 void
 gdk_window_hide (GdkWindow *window)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   
   g_return_if_fail (window != NULL);
 
-  private = (GdkWindowPrivate*) window;
-  if (!private->drawable.destroyed)
+  private = (GdkWindowObject*) window;
+  if (!private->destroyed)
     {
       private->mapped = FALSE;
 
       _gdk_window_clear_update_area (window);
       
-      XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window),
-		    GDK_DRAWABLE_XID (window));
+      XUnmapWindow (GDK_WINDOW_XDISPLAY (window),
+		    GDK_WINDOW_XID (window));
     }
 }
 
 void
 gdk_window_withdraw (GdkWindow *window)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   
   g_return_if_fail (window != NULL);
   
-  private = (GdkWindowPrivate*) window;
-  if (!private->drawable.destroyed)
-    XWithdrawWindow (GDK_DRAWABLE_XDISPLAY (window),
-		     GDK_DRAWABLE_XID (window), 0);
+  private = (GdkWindowObject*) window;
+  if (!private->destroyed)
+    XWithdrawWindow (GDK_WINDOW_XDISPLAY (window),
+		     GDK_WINDOW_XID (window), 0);
 }
 
 void
@@ -606,13 +734,16 @@
 		 gint       x,
 		 gint       y)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-  
+  GdkWindowObject *private = (GdkWindowObject *)window;
+  GdkWindowImpl *impl;
+
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
+  impl = GDK_WINDOW_IMPL (private->impl);
+  
   gdk_window_move_resize (window, x, y,
-			  private->drawable.width, private->drawable.height);
+			  impl->width, impl->height);
 }
 
 void
@@ -620,7 +751,7 @@
 		   gint       width,
 		   gint       height)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -630,17 +761,17 @@
   if (height < 1)
     height = 1;
 
-  private = (GdkWindowPrivate*) window;
+  private = (GdkWindowObject*) window;
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
-      if (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
+      if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
 	_gdk_window_move_resize_child (window, private->x, private->y,
 				       width, height);
       else
 	{
-	  XResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
-			 GDK_DRAWABLE_XID (window),
+	  XResizeWindow (GDK_WINDOW_XDISPLAY (window),
+			 GDK_WINDOW_XID (window),
 			 width, height);
 	  private->resize_count += 1;
 	}
@@ -654,7 +785,7 @@
 			gint       width,
 			gint       height)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -664,16 +795,16 @@
   if (height < 1)
     height = 1;
   
-  private = (GdkWindowPrivate*) window;
+  private = (GdkWindowObject*) window;
 
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
-      if (GDK_DRAWABLE_TYPE (private) == GDK_WINDOW_CHILD)
+      if (GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD)
 	_gdk_window_move_resize_child (window, x, y, width, height);
       else
 	{
-	  XMoveResizeWindow (GDK_DRAWABLE_XDISPLAY (window),
-			     GDK_DRAWABLE_XID (window),
+	  XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
+			     GDK_WINDOW_XID (window),
 			     x, y, width, height);
 	}
     }
@@ -685,9 +816,9 @@
 		     gint       x,
 		     gint       y)
 {
-  GdkWindowPrivate *window_private;
-  GdkWindowPrivate *parent_private;
-  GdkWindowPrivate *old_parent_private;
+  GdkWindowObject *window_private;
+  GdkWindowObject *parent_private;
+  GdkWindowObject *old_parent_private;
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -697,17 +828,17 @@
   if (!new_parent)
     new_parent = gdk_parent_root;
   
-  window_private = (GdkWindowPrivate*) window;
-  old_parent_private = (GdkWindowPrivate*)window_private->parent;
-  parent_private = (GdkWindowPrivate*) new_parent;
-  
-  if (!GDK_DRAWABLE_DESTROYED (window) && !GDK_DRAWABLE_DESTROYED (new_parent))
-    XReparentWindow (GDK_DRAWABLE_XDISPLAY (window),
-		     GDK_DRAWABLE_XID (window),
-		     GDK_DRAWABLE_XID (new_parent),
+  window_private = (GdkWindowObject*) window;
+  old_parent_private = (GdkWindowObject*)window_private->parent;
+  parent_private = (GdkWindowObject*) new_parent;
+  
+  if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (new_parent))
+    XReparentWindow (GDK_WINDOW_XDISPLAY (window),
+		     GDK_WINDOW_XID (window),
+		     GDK_WINDOW_XID (new_parent),
 		     x, y);
   
-  window_private->parent = new_parent;
+  window_private->parent = (GdkWindowObject *)new_parent;
   
   if (old_parent_private)
     old_parent_private->children = g_list_remove (old_parent_private->children, window);
@@ -730,8 +861,8 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    XClearArea (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+  if (!GDK_WINDOW_DESTROYED (window))
+    XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
 		x, y, width, height, False);
 }
 
@@ -745,8 +876,8 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    XClearArea (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+  if (!GDK_WINDOW_DESTROYED (window))
+    XClearArea (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
 		x, y, width, height, True);
 }
 
@@ -756,8 +887,8 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    XRaiseWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+  if (!GDK_WINDOW_DESTROYED (window))
+    XRaiseWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
 }
 
 void
@@ -766,8 +897,8 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    XLowerWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+  if (!GDK_WINDOW_DESTROYED (window))
+    XLowerWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
 }
 
 void
@@ -785,7 +916,7 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
   size_hints.flags = 0;
@@ -814,8 +945,8 @@
   /* FIXME: Would it be better to delete this property of
    *        flags == 0? It would save space on the server
    */
-  XSetWMNormalHints (GDK_DRAWABLE_XDISPLAY (window),
-		     GDK_DRAWABLE_XID (window),
+  XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
+		     GDK_WINDOW_XID (window),
 		     &size_hints);
 }
 
@@ -829,7 +960,7 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
   size_hints.flags = 0;
@@ -901,8 +1032,8 @@
   /* FIXME: Would it be better to delete this property of
    *        geom_mask == 0? It would save space on the server
    */
-  XSetWMNormalHints (GDK_DRAWABLE_XDISPLAY (window),
-		     GDK_DRAWABLE_XID (window),
+  XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window),
+		     GDK_WINDOW_XID (window),
 		     &size_hints);
 }
 
@@ -913,9 +1044,9 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    XmbSetWMProperties (GDK_DRAWABLE_XDISPLAY (window),
-			GDK_DRAWABLE_XID (window),
+  if (!GDK_WINDOW_DESTROYED (window))
+    XmbSetWMProperties (GDK_WINDOW_XDISPLAY (window),
+			GDK_WINDOW_XID (window),
 			title, title, NULL, 0, NULL, NULL, NULL);
 }
 
@@ -926,14 +1057,14 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
       if (role)
-	XChangeProperty (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+	XChangeProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
 			 gdk_atom_intern ("WM_WINDOW_ROLE", FALSE), XA_STRING,
 			 8, PropModeReplace, role, strlen (role));
       else
-	XDeleteProperty (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+	XDeleteProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
 			 gdk_atom_intern ("WM_WINDOW_ROLE", FALSE));
     }
 }
@@ -942,33 +1073,33 @@
 gdk_window_set_transient_for (GdkWindow *window, 
 			      GdkWindow *parent)
 {
-  GdkWindowPrivate *private;
-  GdkWindowPrivate *parent_private;
+  GdkWindowObject *private;
+  GdkWindowObject *parent_private;
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  private = (GdkWindowPrivate*) window;
-  parent_private = (GdkWindowPrivate*) parent;
+  private = (GdkWindowObject*) window;
+  parent_private = (GdkWindowObject*) parent;
   
-  if (!GDK_DRAWABLE_DESTROYED (window) && !GDK_DRAWABLE_DESTROYED (parent))
-    XSetTransientForHint (GDK_DRAWABLE_XDISPLAY (window), 
-			  GDK_DRAWABLE_XID (window),
-			  GDK_DRAWABLE_XID (parent));
+  if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (parent))
+    XSetTransientForHint (GDK_WINDOW_XDISPLAY (window), 
+			  GDK_WINDOW_XID (window),
+			  GDK_WINDOW_XID (parent));
 }
 
 void
 gdk_window_set_background (GdkWindow *window,
 			   GdkColor  *color)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    XSetWindowBackground (GDK_DRAWABLE_XDISPLAY (window),
-			  GDK_DRAWABLE_XID (window), color->pixel);
+  if (!GDK_WINDOW_DESTROYED (window))
+    XSetWindowBackground (GDK_WINDOW_XDISPLAY (window),
+			  GDK_WINDOW_XID (window), color->pixel);
 
   private->bg_color = *color;
 
@@ -986,7 +1117,7 @@
 			    GdkPixmap *pixmap,
 			    gboolean   parent_relative)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   Pixmap xpixmap;
   
   g_return_if_fail (window != NULL);
@@ -1009,7 +1140,7 @@
 	{
 	  gdk_pixmap_ref (pixmap);
 	  private->bg_pixmap = pixmap;
-	  xpixmap = GDK_DRAWABLE_XID (pixmap);
+	  xpixmap = GDK_PIXMAP_XID (pixmap);
 	}
       else
 	{
@@ -1018,9 +1149,9 @@
 	}
     }
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    XSetWindowBackgroundPixmap (GDK_DRAWABLE_XDISPLAY (window),
-				GDK_DRAWABLE_XID (window), xpixmap);
+  if (!GDK_WINDOW_DESTROYED (window))
+    XSetWindowBackgroundPixmap (GDK_WINDOW_XDISPLAY (window),
+				GDK_WINDOW_XID (window), xpixmap);
 }
 
 void
@@ -1040,9 +1171,9 @@
   else
     xcursor = cursor_private->xcursor;
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
-    XDefineCursor (GDK_DRAWABLE_XDISPLAY (window),
-		   GDK_DRAWABLE_XID (window),
+  if (!GDK_WINDOW_DESTROYED (window))
+    XDefineCursor (GDK_WINDOW_XDISPLAY (window),
+		   GDK_WINDOW_XID (window),
 		   xcursor);
 }
 
@@ -1067,10 +1198,10 @@
   if (!window)
     window = gdk_parent_root;
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
-      XGetGeometry (GDK_DRAWABLE_XDISPLAY (window),
-		    GDK_DRAWABLE_XID (window),
+      XGetGeometry (GDK_WINDOW_XDISPLAY (window),
+		    GDK_WINDOW_XID (window),
 		    &root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
       
       if (x)
@@ -1098,10 +1229,10 @@
   
   g_return_val_if_fail (window != NULL, 0);
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
-      return_val = XTranslateCoordinates (GDK_DRAWABLE_XDISPLAY (window),
-					  GDK_DRAWABLE_XID (window),
+      return_val = XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
+					  GDK_WINDOW_XID (window),
 					  gdk_root_window,
 					  0, 0, &tx, &ty,
 					  &child);
@@ -1136,13 +1267,13 @@
   g_return_val_if_fail (window != NULL, 0);
   g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
       if (!atom)
 	atom = gdk_atom_intern ("ENLIGHTENMENT_DESKTOP", FALSE);
-      win = GDK_DRAWABLE_XID (window);
+      win = GDK_WINDOW_XID (window);
       
-      while (XQueryTree (GDK_DRAWABLE_XDISPLAY (window), win, &root, &parent,
+      while (XQueryTree (GDK_WINDOW_XDISPLAY (window), win, &root, &parent,
 			 &child, (unsigned int *)&num_children))
 	{
 	  if ((child) && (num_children > 0))
@@ -1157,7 +1288,7 @@
 	    break;
 	  
 	  data_return = NULL;
-	  XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (window), win, atom, 0, 0,
+	  XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), win, atom, 0, 0,
 			      False, XA_CARDINAL, &type_return, &format_return,
 			      &number_return, &bytes_after_return, &data_return);
 	  if (type_return == XA_CARDINAL)
@@ -1167,8 +1298,8 @@
 	    }
 	}
       
-      return_val = XTranslateCoordinates (GDK_DRAWABLE_XDISPLAY (window),
-					  GDK_DRAWABLE_XID (window),
+      return_val = XTranslateCoordinates (GDK_WINDOW_XDISPLAY (window),
+					  GDK_WINDOW_XID (window),
 					  win,
 					  0, 0, &tx, &ty,
 					  &root);
@@ -1187,7 +1318,7 @@
 			    gint      *x,
 			    gint      *y)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   Window xwindow;
   Window xparent;
   Window root;
@@ -1197,25 +1328,25 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  private = (GdkWindowPrivate*) window;
+  private = (GdkWindowObject*) window;
   if (x)
     *x = 0;
   if (y)
     *y = 0;
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
-  while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
-    private = (GdkWindowPrivate*) private->parent;
-  if (GDK_DRAWABLE_DESTROYED (window))
+  while (private->parent && ((GdkWindowObject*) private->parent)->parent)
+    private = (GdkWindowObject*) private->parent;
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
-  xparent = GDK_DRAWABLE_XID (window);
+  xparent = GDK_WINDOW_XID (window);
   do
     {
       xwindow = xparent;
-      if (!XQueryTree (GDK_DRAWABLE_XDISPLAY (window), xwindow,
+      if (!XQueryTree (GDK_WINDOW_XDISPLAY (window), xwindow,
 		       &root, &xparent,
 		       &children, &nchildren))
 	return;
@@ -1230,7 +1361,7 @@
       unsigned int ww, wh, wb, wd;
       int wx, wy;
       
-      if (XGetGeometry (GDK_DRAWABLE_XDISPLAY (window), xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
+      if (XGetGeometry (GDK_WINDOW_XDISPLAY (window), xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
 	{
 	  if (x)
 	    *x = wx;
@@ -1263,9 +1394,9 @@
   _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
 
   return_val = NULL;
-  if (!GDK_DRAWABLE_DESTROYED (window) &&
-      XQueryPointer (GDK_DRAWABLE_XDISPLAY (window),
-		     GDK_DRAWABLE_XID (window),
+  if (!GDK_WINDOW_DESTROYED (window) &&
+      XQueryPointer (GDK_WINDOW_XDISPLAY (window),
+		     GDK_WINDOW_XID (window),
 		     &root, &child, &rootx, &rooty, &winx, &winy, &xmask))
     {
       if (child)
@@ -1334,11 +1465,11 @@
   g_return_val_if_fail (window != NULL, NULL);
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return NULL;
   
-  XQueryTree (GDK_DRAWABLE_XDISPLAY (window),
-	      GDK_DRAWABLE_XID (window),
+  XQueryTree (GDK_WINDOW_XDISPLAY (window),
+	      GDK_WINDOW_XID (window),
 	      &root, &parent, &xchildren, &nchildren);
   
   children = NULL;
@@ -1369,12 +1500,12 @@
   g_return_val_if_fail (window != NULL, 0);
   g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return 0;
   else
     {
-      XGetWindowAttributes (GDK_DRAWABLE_XDISPLAY (window),
-			    GDK_DRAWABLE_XID (window), 
+      XGetWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+			    GDK_WINDOW_XID (window), 
 			    &attrs);
       
       event_mask = 0;
@@ -1398,7 +1529,7 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
       xevent_mask = StructureNotifyMask;
       for (i = 0; i < gdk_nevent_masks; i++)
@@ -1407,8 +1538,8 @@
 	    xevent_mask |= gdk_event_mask_table[i];
 	}
       
-      XSelectInput (GDK_DRAWABLE_XDISPLAY (window),
-		    GDK_DRAWABLE_XID (window),
+      XSelectInput (GDK_WINDOW_XDISPLAY (window),
+		    GDK_WINDOW_XID (window),
 		    xevent_mask);
     }
 }
@@ -1425,19 +1556,19 @@
   g_return_if_fail (GDK_IS_WINDOW (window));
   
   toplevel = gdk_window_get_toplevel (window);
-  if (GDK_DRAWABLE_DESTROYED (toplevel))
+  if (GDK_WINDOW_DESTROYED (toplevel))
     return;
   
   old_windows = NULL;
-  if (!XGetWMColormapWindows (GDK_DRAWABLE_XDISPLAY (toplevel),
-			      GDK_DRAWABLE_XID (toplevel),
+  if (!XGetWMColormapWindows (GDK_WINDOW_XDISPLAY (toplevel),
+			      GDK_WINDOW_XID (toplevel),
 			      &old_windows, &count))
     {
       count = 0;
     }
   
   for (i = 0; i < count; i++)
-    if (old_windows[i] == GDK_DRAWABLE_XID (window))
+    if (old_windows[i] == GDK_WINDOW_XID (window))
       {
 	XFree (old_windows);
 	return;
@@ -1447,10 +1578,10 @@
   
   for (i = 0; i < count; i++)
     new_windows[i] = old_windows[i];
-  new_windows[count] = GDK_DRAWABLE_XID (window);
+  new_windows[count] = GDK_WINDOW_XID (window);
   
-  XSetWMColormapWindows (GDK_DRAWABLE_XDISPLAY (toplevel),
-			 GDK_DRAWABLE_XID (toplevel),
+  XSetWMColormapWindows (GDK_WINDOW_XDISPLAY (toplevel),
+			 GDK_WINDOW_XID (toplevel),
 			 new_windows, count + 1);
   
   g_free (new_windows);
@@ -1492,14 +1623,14 @@
   g_return_if_fail (GDK_IS_WINDOW (window));
   
 #ifdef HAVE_SHAPE_EXT
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
   if (gdk_window_have_shape_ext ())
     {
       if (mask)
 	{
-	  pixmap = GDK_DRAWABLE_XID (mask);
+	  pixmap = GDK_PIXMAP_XID (mask);
 	}
       else
 	{
@@ -1508,8 +1639,8 @@
 	  pixmap = None;
 	}
       
-      XShapeCombineMask (GDK_DRAWABLE_XDISPLAY (window),
-			 GDK_DRAWABLE_XID (window),
+      XShapeCombineMask (GDK_WINDOW_XDISPLAY (window),
+			 GDK_WINDOW_XID (window),
 			 ShapeBounding,
 			 x, y,
 			 pixmap,
@@ -1527,11 +1658,11 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     {
       attr.override_redirect = (override_redirect == FALSE)?False:True;
-      XChangeWindowAttributes (GDK_DRAWABLE_XDISPLAY (window),
-			       GDK_DRAWABLE_XID (window),
+      XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+			       GDK_WINDOW_XID (window),
 			       CWOverrideRedirect,
 			       &attr);
     }
@@ -1548,34 +1679,34 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  wm_hints = XGetWMHints (GDK_DRAWABLE_XDISPLAY (window),
-			  GDK_DRAWABLE_XID (window));
+  wm_hints = XGetWMHints (GDK_WINDOW_XDISPLAY (window),
+			  GDK_WINDOW_XID (window));
   if (!wm_hints)
     wm_hints = XAllocWMHints ();
 
   if (icon_window != NULL)
     {
       wm_hints->flags |= IconWindowHint;
-      wm_hints->icon_window = GDK_DRAWABLE_XID (icon_window);
+      wm_hints->icon_window = GDK_WINDOW_XID (icon_window);
     }
   
   if (pixmap != NULL)
     {
       wm_hints->flags |= IconPixmapHint;
-      wm_hints->icon_pixmap = GDK_DRAWABLE_XID (pixmap);
+      wm_hints->icon_pixmap = GDK_PIXMAP_XID (pixmap);
     }
   
   if (mask != NULL)
     {
       wm_hints->flags |= IconMaskHint;
-      wm_hints->icon_mask = GDK_DRAWABLE_XID (mask);
+      wm_hints->icon_mask = GDK_PIXMAP_XID (mask);
     }
 
-  XSetWMHints (GDK_DRAWABLE_XDISPLAY (window),
-	       GDK_DRAWABLE_XID (window), wm_hints);
+  XSetWMHints (GDK_WINDOW_XDISPLAY (window),
+	       GDK_WINDOW_XID (window), wm_hints);
   XFree (wm_hints);
 }
 
@@ -1589,10 +1720,10 @@
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
-  res = XmbTextListToTextProperty (GDK_DRAWABLE_XDISPLAY (window),
+  res = XmbTextListToTextProperty (GDK_WINDOW_XDISPLAY (window),
 				   &name, 1, XStdICCTextStyle,
                                	   &property);
   if (res < 0)
@@ -1601,8 +1732,8 @@
       return;
     }
   
-  XSetWMIconName (GDK_DRAWABLE_XDISPLAY (window),
-		  GDK_DRAWABLE_XID (window),
+  XSetWMIconName (GDK_WINDOW_XDISPLAY (window),
+		  GDK_WINDOW_XID (window),
 		  &property);
   
   if (property.value)
@@ -1620,19 +1751,19 @@
   g_return_if_fail (leader != NULL);
   g_return_if_fail (GDK_IS_WINDOW (leader));
 
-  if (GDK_DRAWABLE_DESTROYED (window) || GDK_DRAWABLE_DESTROYED (leader))
+  if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (leader))
     return;
   
-  wm_hints = XGetWMHints (GDK_DRAWABLE_XDISPLAY (window),
-			  GDK_DRAWABLE_XID (window));
+  wm_hints = XGetWMHints (GDK_WINDOW_XDISPLAY (window),
+			  GDK_WINDOW_XID (window));
   if (!wm_hints)
     wm_hints = XAllocWMHints ();
 
   wm_hints->flags |= WindowGroupHint;
-  wm_hints->window_group = GDK_DRAWABLE_XID (leader);
+  wm_hints->window_group = GDK_WINDOW_XID (leader);
 
-  XSetWMHints (GDK_DRAWABLE_XDISPLAY (window),
-	       GDK_DRAWABLE_XID (window), wm_hints);
+  XSetWMHints (GDK_WINDOW_XDISPLAY (window),
+	       GDK_WINDOW_XID (window), wm_hints);
   XFree (wm_hints);
 }
 
@@ -1647,14 +1778,14 @@
   gulong nitems;
   gulong bytes_after;
   
-  if (GDK_DRAWABLE_DESTROYED (window))
+  if (GDK_WINDOW_DESTROYED (window))
     return;
   
   if (!hints_atom)
-    hints_atom = XInternAtom (GDK_DRAWABLE_XDISPLAY (window), 
+    hints_atom = XInternAtom (GDK_WINDOW_XDISPLAY (window), 
 			      _XA_MOTIF_WM_HINTS, FALSE);
   
-  XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+  XGetWindowProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
 		      hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
 		      False, AnyPropertyType, &type, &format, &nitems,
 		      &bytes_after, (guchar **)&hints);
@@ -1675,7 +1806,7 @@
 	}
     }
   
-  XChangeProperty (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window),
+  XChangeProperty (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window),
 		   hints_atom, hints_atom, 32, PropModeReplace,
 		   (guchar *)hints, sizeof (MotifWmHints)/sizeof (long));
   
@@ -2032,10 +2163,10 @@
   g_return_if_fail (GDK_IS_WINDOW (window));
   
 #ifdef HAVE_SHAPE_EXT
-  if (!GDK_DRAWABLE_DESTROYED (window) &&
+  if (!GDK_WINDOW_DESTROYED (window) &&
       gdk_window_have_shape_ext ())
-    gdk_propagate_shapes (GDK_DRAWABLE_XDISPLAY (window),
-			  GDK_DRAWABLE_XID (window), FALSE);
+    gdk_propagate_shapes (GDK_WINDOW_XDISPLAY (window),
+			  GDK_WINDOW_XID (window), FALSE);
 #endif   
 }
 
@@ -2046,10 +2177,10 @@
   g_return_if_fail (GDK_IS_WINDOW (window));
   
 #ifdef HAVE_SHAPE_EXT
-  if (!GDK_DRAWABLE_DESTROYED (window) &&
+  if (!GDK_WINDOW_DESTROYED (window) &&
       gdk_window_have_shape_ext ())
-    gdk_propagate_shapes (GDK_DRAWABLE_XDISPLAY (window),
-			  GDK_DRAWABLE_XID (window), TRUE);
+    gdk_propagate_shapes (GDK_WINDOW_XDISPLAY (window),
+			  GDK_WINDOW_XID (window), TRUE);
 #endif   
 }
 
@@ -2125,8 +2256,8 @@
   xattributes.bit_gravity = StaticGravity;
   xattributes_mask |= CWBitGravity;
   xattributes.bit_gravity = on ? StaticGravity : ForgetGravity;
-  XChangeWindowAttributes (GDK_DRAWABLE_XDISPLAY (window),
-			   GDK_DRAWABLE_XID (window),
+  XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+			   GDK_WINDOW_XID (window),
 			   CWBitGravity,  &xattributes);
 }
 
@@ -2139,8 +2270,8 @@
   
   xattributes.win_gravity = on ? StaticGravity : NorthWestGravity;
   
-  XChangeWindowAttributes (GDK_DRAWABLE_XDISPLAY (window),
-			   GDK_DRAWABLE_XID (window),
+  XChangeWindowAttributes (GDK_WINDOW_XDISPLAY (window),
+			   GDK_WINDOW_XID (window),
 			   CWWinGravity,  &xattributes);
 }
 
@@ -2160,7 +2291,7 @@
 gdk_window_set_static_gravities (GdkWindow *window,
 				 gboolean   use_static)
 {
-  GdkWindowPrivate *private = (GdkWindowPrivate *)window;
+  GdkWindowObject *private = (GdkWindowObject *)window;
   GList *tmp_list;
   
   g_return_val_if_fail (window != NULL, FALSE);
@@ -2174,7 +2305,7 @@
   
   private->guffaw_gravity = use_static;
   
-  if (!GDK_DRAWABLE_DESTROYED (window))
+  if (!GDK_WINDOW_DESTROYED (window))
     {
       gdk_window_set_static_bit_gravity (window, use_static);
       
@@ -2262,7 +2393,7 @@
 			  gboolean excl_child)
 {
   GdkWindow *window;
-  GdkDrawablePrivate *private;
+  GdkDrawable *drawable;
   Display *xdisplay;
   Window *list = NULL;
   Window root, child = 0, parent_win = 0, root_win = 0;
@@ -2270,9 +2401,9 @@
   int i;
 
   window = gdk_parent_root;
-  private = (GdkDrawablePrivate*) window;
-  xdisplay = GDK_DRAWABLE_XDISPLAY (private);
-  root = GDK_DRAWABLE_XID (private);
+  drawable = GDK_DRAWABLE (window);
+  xdisplay = GDK_WINDOW_XDISPLAY (window);
+  root = GDK_WINDOW_XID (window);
   num = g_list_length (excludes);
   
   XGrabServer (xdisplay);
Index: gdk/x11/gdkwindow-x11.h
===================================================================
RCS file: gdkwindow-x11.h
diff -N gdkwindow-x11.h
--- /dev/null	Tue May  5 16:32:27 1998
+++ /tmp/cvsUxDx6y	Wed May 17 23:03:16 2000
@@ -0,0 +1,89 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#ifndef __GDK_WINDOW_X11_H__
+#define __GDK_WINDOW_X11_H__
+
+#include <gdk/x11/gdkdrawable-x11.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct _GdkXPositionInfo    GdkXPositionInfo;
+
+struct _GdkXPositionInfo
+{
+  gint x;
+  gint y;
+  gint width;
+  gint height;
+  gint x_offset;		/* Offsets to add to X coordinates within window */
+  gint y_offset;		/*   to get GDK coodinates within window */
+  gboolean big : 1;
+  gboolean mapped : 1;
+  gboolean no_bg : 1;	        /* Set when the window background is temporarily
+				 * unset during resizing and scaling */
+  GdkRectangle clip_rect;	/* visible rectangle of window */
+};
+
+
+/* Window implementation for X11
+ */
+
+typedef struct _GdkWindowImpl GdkWindowImpl;
+typedef struct _GdkWindowImplClass GdkWindowImplClass;
+
+#define GDK_TYPE_WINDOW_IMPL              (gdk_window_impl_get_type ())
+#define GDK_WINDOW_IMPL(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
+#define GDK_WINDOW_IMPL_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
+#define GDK_IS_WINDOW_IMPL(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL))
+#define GDK_IS_WINDOW_IMPL_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL))
+#define GDK_WINDOW_IMPL_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
+
+struct _GdkWindowImpl
+{
+  GdkDrawableImpl parent_instance;
+
+  gint width;
+  gint height;
+  
+  GdkXPositionInfo position_info;
+};
+ 
+struct _GdkWindowImplClass 
+{
+  GdkDrawableImplClass parent_class;
+
+};
+
+GType gdk_window_impl_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GDK_WINDOW_X11_H__ */
Index: gdk/x11/gdkx.h
===================================================================
RCS file: /cvs/gnome/gtk+/gdk/x11/gdkx.h,v
retrieving revision 1.9
retrieving revision 1.9.6.3
diff -u -r1.9 -r1.9.6.3
--- gdk/x11/gdkx.h	2000/03/28 01:24:43	1.9
+++ gdk/x11/gdkx.h	2000/05/17 19:48:28	1.9.6.3
@@ -33,10 +33,10 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
+#include <gdk/x11/gdkwindow-x11.h>
+#include <gdk/x11/gdkpixmap-x11.h>
+
 typedef struct _GdkGCXData          GdkGCXData;
-typedef struct _GdkDrawableXData    GdkDrawableXData;
-typedef struct _GdkWindowXData      GdkWindowXData;
-typedef struct _GdkXPositionInfo    GdkXPositionInfo;
 typedef struct _GdkColormapPrivateX GdkColormapPrivateX;
 typedef struct _GdkCursorPrivate    GdkCursorPrivate;
 typedef struct _GdkFontPrivateX     GdkFontPrivateX;
@@ -47,7 +47,6 @@
 typedef struct _GdkICPrivate        GdkICPrivate;
 #endif /* USE_XIM */
 
-#define GDK_DRAWABLE_XDATA(win) ((GdkDrawableXData *)(((GdkDrawablePrivate*)(win))->klass_data))
 #define GDK_WINDOW_XDATA(win) ((GdkWindowXData *)(((GdkDrawablePrivate*)(win))->klass_data))
 #define GDK_GC_XDATA(gc) ((GdkGCXData *)(((GdkGCPrivate*)(gc))->klass_data))
 
@@ -59,33 +58,6 @@
   guint dirty_mask;
 };
 
-struct _GdkDrawableXData
-{
-  Window xid;
-  Display *xdisplay;
-};
-
-struct _GdkXPositionInfo
-{
-  gint x;
-  gint y;
-  gint width;
-  gint height;
-  gint x_offset;		/* Offsets to add to X coordinates within window */
-  gint y_offset;		/*   to get GDK coodinates within window */
-  gboolean big : 1;
-  gboolean mapped : 1;
-  gboolean no_bg : 1;	        /* Set when the window background is temporarily
-				 * unset during resizing and scaling */
-  GdkRectangle clip_rect;	/* visible rectangle of window */
-};
-
-struct _GdkWindowXData
-{
-  GdkDrawableXData drawable_data;
-  GdkXPositionInfo position_info;
-};
-
 struct _GdkCursorPrivate
 {
   GdkCursor cursor;
@@ -147,8 +119,12 @@
 #define GDK_ROOT_WINDOW()             gdk_root_window
 #define GDK_ROOT_PARENT()             ((GdkWindow *)gdk_parent_root)
 #define GDK_DISPLAY()                 gdk_display
-#define GDK_DRAWABLE_XDISPLAY(win)    (GDK_DRAWABLE_XDATA(win)->xdisplay)
-#define GDK_DRAWABLE_XID(win)         (GDK_DRAWABLE_XDATA(win)->xid)
+#define GDK_WINDOW_XDISPLAY(win)      (GDK_DRAWABLE_IMPL(((GdkWindowObject*)win)->impl)->xdisplay)
+#define GDK_WINDOW_XID(win)           (GDK_DRAWABLE_IMPL(((GdkWindowObject*)win)->impl)->xid)
+#define GDK_PIXMAP_XDISPLAY(win)      (GDK_DRAWABLE_IMPL(((GdkPixmapObject*)win)->impl)->xdisplay)
+#define GDK_PIXMAP_XID(win)           (GDK_DRAWABLE_IMPL(((GdkPixmapObject*)win)->impl)->xid)
+#define GDK_DRAWABLE_XDISPLAY(win)    (GDK_IS_WINDOW (win) ? GDK_WINDOW_XDISPLAY (win) : GDK_PIXMAP_XDISPLAY (win))
+#define GDK_DRAWABLE_XID(win)         (GDK_IS_WINDOW (win) ? GDK_WINDOW_XID (win) : GDK_PIXMAP_XID (win))
 #define GDK_IMAGE_XDISPLAY(image)     (((GdkImagePrivate*) image)->xdisplay)
 #define GDK_IMAGE_XIMAGE(image)       (((GdkImagePrivate*) image)->ximage)
 #define GDK_GC_XDISPLAY(gc)           (GDK_GC_XDATA(gc)->xdisplay)
@@ -160,9 +136,7 @@
 
 #define GDK_GC_XGC(gc)       (GDK_GC_XDATA(gc)->xgc)
 #define GDK_GC_GET_XGC(gc)   (GDK_GC_XDATA(gc)->dirty_mask ? _gdk_x11_gc_flush (gc) : GDK_GC_XGC (gc))
-
-#define GDK_WINDOW_XWINDOW            GDK_DRAWABLE_XID
-#define GDK_WINDOW_XDISPLAY           GDK_DRAWABLE_XDISPLAY
+#define GDK_WINDOW_XWINDOW    GDK_WINDOW_XID
 
 extern Display		*gdk_display;
 extern Window		 gdk_root_window;
Index: gtk/gtk-boxed.defs
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtk-boxed.defs,v
retrieving revision 1.5
retrieving revision 1.5.10.1
diff -u -r1.5 -r1.5.10.1
--- gtk/gtk-boxed.defs	1998/11/26 18:47:54	1.5
+++ gtk/gtk-boxed.defs	2000/05/17 23:29:05	1.5.10.1
@@ -41,10 +41,6 @@
   gdk_font_ref
   gdk_font_unref)
 
-(define-boxed GdkWindow
-  gdk_window_ref
-  gdk_window_unref)
-
 (define-boxed GdkDragContext
   gdk_drag_context_ref
   gdk_drag_context_unref)
Index: gtk/gtkplug.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkplug.c,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -r1.16 -r1.16.2.1
--- gtk/gtkplug.c	2000/05/12 15:25:47	1.16
+++ gtk/gtkplug.c	2000/05/17 23:29:05	1.16.2.1
@@ -210,7 +210,7 @@
       widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
     }
   
-  GDK_DRAWABLE_TYPE (window) = GDK_WINDOW_TOPLEVEL;
+  GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL;
   gdk_window_set_user_data (widget->window, window);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
Index: gtk/gtksocket.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtksocket.c,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -r1.17 -r1.17.2.1
--- gtk/gtksocket.c	2000/05/12 15:25:47	1.17
+++ gtk/gtksocket.c	2000/05/17 23:29:05	1.17.2.1
@@ -155,7 +155,8 @@
 
   gdk_error_trap_push ();
   
-  if (socket->plug_window && socket->plug_window->user_data)
+  if (socket->plug_window &&
+      ((GdkWindowObject *)socket->plug_window)->user_data)
     {
       /*
 	GtkWidget *child_widget;
Index: gtk/gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.36
retrieving revision 1.36.2.1
diff -u -r1.36 -r1.36.2.1
--- gtk/gtkstyle.c	2000/05/01 22:06:48	1.36
+++ gtk/gtkstyle.c	2000/05/17 23:29:05	1.36.2.1
@@ -1187,7 +1187,7 @@
     }
   
   if (!style->bg_pixmap[state_type] ||
-      gdk_window_get_type (window) == GDK_WINDOW_PIXMAP ||
+      GDK_IS_PIXMAP (window) ||
       (!set_bg && style->bg_pixmap[state_type] != (GdkPixmap*) GDK_PARENT_RELATIVE))
     {
       GdkGC *gc = style->bg_gc[state_type];
@@ -2187,7 +2187,7 @@
     gdk_window_get_size (window, NULL, &height);
   
   if (!style->bg_pixmap[state_type] || 
-      gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
+      GDK_IS_PIXMAP (window))
     {
       if (area)
 	gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
@@ -2246,7 +2246,7 @@
     gc1 = style->bg_gc[state_type];
   
   if (!style->bg_pixmap[state_type] || gc1 != style->bg_gc[state_type] ||
-      gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
+      GDK_IS_PIXMAP (window))
     {
       if (area)
 	gdk_gc_set_clip_rectangle (gc1, area);
Index: gtk/gtkwidget.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwidget.c,v
retrieving revision 1.161
retrieving revision 1.161.2.1
diff -u -r1.161 -r1.161.2.1
--- gtk/gtkwidget.c	2000/05/15 16:09:52	1.161
+++ gtk/gtkwidget.c	2000/05/17 23:29:05	1.161.2.1
@@ -4361,11 +4361,11 @@
 gtk_reset_shapes_recurse (GtkWidget *widget,
 			  GdkWindow *window)
 {
-  GdkWindowPrivate *private;
+  GdkWindowObject *private;
   gpointer data;
   GList *list;
 
-  private = (GdkWindowPrivate*) window;
+  private = (GdkWindowObject*) window;
 
   gdk_window_get_user_data (window, &data);
   if (data != widget)






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