[gtk+] win32: gdk3 resurrection



commit 1d838f586c574af7f05c618a337f8d34a58d9125
Author: Hans Breuer <hans breuer org>
Date:   Sun Jan 2 11:51:25 2011 +0100

    win32: gdk3 resurrection
    
    There are sure regressions but basic stuff seems to be working
    again after all the API breakage done with comments like
    "Win32 and Quartz need to be ported still."

 gdk/gdk.symbols                    |    9 +-
 gdk/gdkdisplaymanager.c            |    8 +
 gdk/makefile.msc                   |   78 ++--
 gdk/win32/gdkcursor-win32.c        |  115 +++--
 gdk/win32/gdkdevice-win32.c        |   28 +-
 gdk/win32/gdkdevice-wintab.c       |    2 +-
 gdk/win32/gdkdevicemanager-win32.c |   13 +-
 gdk/win32/gdkdevicemanager-win32.h |    2 +-
 gdk/win32/gdkdisplay-win32.c       |  212 +++++++--
 gdk/win32/gdkdnd-win32.c           |  143 +++---
 gdk/win32/gdkdrawable-win32.c      |  222 --------
 gdk/win32/gdkdrawable-win32.h      |   73 ---
 gdk/win32/gdkevents-win32.c        |  188 +++-----
 gdk/win32/gdkgeometry-win32.c      |  138 +----
 gdk/win32/gdkim-win32.c            |   44 --
 gdk/win32/gdkinput.c               |   11 +-
 gdk/win32/gdkkeys-win32.c          |   88 +++-
 gdk/win32/gdkmain-win32.c          |   72 +---
 gdk/win32/gdkprivate-win32.h       |  157 ++++++-
 gdk/win32/gdkproperty-win32.c      |   28 +-
 gdk/win32/gdkscreen-win32.c        |  147 +++++-
 gdk/win32/gdkselection-win32.c     |   65 ++--
 gdk/win32/gdkspawn-win32.c         |  106 ----
 gdk/win32/gdktestutils-win32.c     |    9 +-
 gdk/win32/gdkvisual-win32.c        |   79 +---
 gdk/win32/gdkwin32.h               |   27 +-
 gdk/win32/gdkwin32cursor.h         |   56 ++
 gdk/win32/gdkwin32display.h        |   56 ++
 gdk/win32/gdkwin32displaymanager.h |   49 ++
 gdk/win32/gdkwin32dnd.h            |   49 ++
 gdk/win32/gdkwin32keys.h           |   49 ++
 gdk/win32/gdkwin32screen.h         |   56 ++
 gdk/win32/gdkwin32window.h         |   56 ++
 gdk/win32/gdkwindow-win32.c        |  998 ++++++++++++++++++++----------------
 gdk/win32/gdkwindow-win32.h        |   40 +-
 gdk/win32/makefile.msc             |   15 +-
 36 files changed, 1875 insertions(+), 1613 deletions(-)
---
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index e9b45f9..1f63b45 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -350,13 +350,16 @@ gdk_visual_get_type G_GNUC_CONST
 gdk_visual_get_visual_type
 gdk_visual_type_get_type G_GNUC_CONST
 #ifdef GDK_WINDOWING_WIN32
-gdk_win32_drawable_get_handle
 gdk_win32_handle_table_lookup
 gdk_win32_icon_to_pixbuf_libgtk_only
 gdk_win32_pixbuf_to_hicon_libgtk_only
 gdk_win32_selection_add_targets
 gdk_win32_set_modal_dialog_libgtk_only
 gdk_win32_window_is_win32
+gdk_win32_window_get_handle
+gdk_win32_display_get_type
+gdk_win32_window_foreign_new_for_display
+gdk_win32_window_lookup_for_display
 #endif
 gdk_window_add_filter
 gdk_window_at_pointer
@@ -429,7 +432,9 @@ gdk_window_hide
 gdk_window_hints_get_type G_GNUC_CONST
 gdk_window_iconify
 gdk_window_impl_get_type G_GNUC_CONST
+#ifdef GDK_WINDOWING_X11
 gdk_window_impl_x11_get_type G_GNUC_CONST
+#endif
 gdk_window_input_shape_combine_region
 gdk_window_invalidate_maybe_recurse
 gdk_window_invalidate_rect
@@ -508,6 +513,7 @@ gdk_window_unstick
 gdk_window_withdraw
 gdk_wm_decoration_get_type G_GNUC_CONST
 gdk_wm_function_get_type G_GNUC_CONST
+#ifdef GDK_WINDOWING_X11
 gdk_x11_app_launch_context_get_type
 gdk_x11_atom_to_xatom
 gdk_x11_atom_to_xatom_for_display
@@ -570,3 +576,4 @@ gdk_x11_window_move_to_current_desktop
 gdk_x11_window_set_user_time
 gdk_x11_xatom_to_atom
 gdk_x11_xatom_to_atom_for_display
+#endif
diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c
index c9c5d3c..79ed85a 100644
--- a/gdk/gdkdisplaymanager.c
+++ b/gdk/gdkdisplaymanager.c
@@ -44,6 +44,9 @@
 #include "quartz/gdkquartzdisplaymanager.h"
 #endif
 
+#ifdef GDK_WINDOWING_WIN32
+#include "win32/gdkwin32.h"
+#endif
 
 /**
  * SECTION:gdkdisplaymanager
@@ -195,6 +198,11 @@ gdk_display_manager_get (void)
         manager = g_object_new (gdk_quartz_display_manager_get_type (), NULL);
       else
 #endif
+#ifdef GDK_WINDOWING_WIN32
+      if (backend == NULL || strcmp (backend, "win32") == 0)
+        manager = g_object_new (gdk_win32_display_manager_get_type (), NULL);
+      else
+#endif
       if (backend != NULL)
         g_error ("Unsupported GDK backend: %s", backend);
       else
diff --git a/gdk/makefile.msc b/gdk/makefile.msc
index 49c5978..0d88d1e 100644
--- a/gdk/makefile.msc
+++ b/gdk/makefile.msc
@@ -19,8 +19,7 @@ WTKIT = $(TOP)\wtkit126
 
 # Nothing much configurable below
 # overwrite version?
-GTK_VER=2.0
-GDK_PIXBUF_VER=$(GTK_VER)
+GTK_VER=3.0
 
 !IFNDEF PERL
 PERL = perl
@@ -28,20 +27,19 @@ PERL = perl
 
 INCLUDES = -FImsvc_recommended_pragmas.h \
 	-I . -I .. \
-	$(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CAIRO_CFLAGS) -I ../gdk-pixbuf \
+	$(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CAIRO_CFLAGS) $(GDK_PIXBUF_CFLAGS) \
 
 DEFINES = \
-	-DHAVE_CONFIG_H -DGDK_ENABLE_BROKEN \
+	-DHAVE_CONFIG_H \
 	-DGDK_VERSION=\"$(GTK_VER)\" \
 	-DG_LOG_DOMAIN=\"Gdk\" \
 	-DGDK_COMPILATION -DG_LOG_DOMAIN=\"Gdk\"
 
 EXTRALIBS = \
 	$(WTKIT)\lib\i386\wntab32x.lib \
-	$(GLIB_LIBS) \
-	..\gdk-pixbuf\gdk_pixbuf-$(GDK_PIXBUF_VER).lib \
-	$(PANGOWIN32_LIBS) $(PANGOCAIRO_LIBS) $(INTL_LIBS) $(CAIRO_LIBS) \
-	$(PANGOCAIRO_LIBS)
+	$(GLIB_LIBS) $(GDK_PIXBUF_LIBS) \
+	$(CAIRO_LIBS) $(CAIRO_GOBJECT_LIBS) \
+	$(PANGOWIN32_LIBS) $(PANGOCAIRO_LIBS) $(INTL_LIBS)
 
 gdk-win32-backend :
 	cd win32
@@ -57,8 +55,8 @@ all: \
 	gdkmarshalers.c \
 	gdk-win32-backend \
 	libgdk-win32-$(GTK_VER)-0.dll \
-	testgdk.exe \
-	gdk-win32-$(GTK_VER)s.lib \
+#	testgdk.exe \
+#	gdk-win32-$(GTK_VER)s.lib \
 #	gdk-x11-$(GTK_VER).dll \
 
 gdk_OBJECTS = \
@@ -67,15 +65,14 @@ gdk_OBJECTS = \
 	gdkcairo.obj \
 	gdkcolor.obj \
 	gdkcursor.obj \
+	gdkdevice.obj \
+	gdkdevicemanager.obj \
 	gdkdisplay.obj \
 	gdkdisplaymanager.obj \
 	gdkdnd.obj \
-	gdkdraw.obj \
 	gdkenumtypes.obj \
 	gdkevents.obj \
-	gdkgc.obj \
 	gdkglobals.obj \
-	gdkwindowimpl.obj \
 	gdkkeynames.obj \
 	gdkkeys.obj \
 	gdkkeyuni.obj \
@@ -83,31 +80,43 @@ gdk_OBJECTS = \
 	gdkoffscreenwindow.obj \
 	gdkpango.obj \
 	gdkpixbuf-drawable.obj \
-	gdkpixbuf-render.obj \
 	gdkrectangle.obj \
+	gdkrgba.obj \
 	gdkscreen.obj \
 	gdkselection.obj \
 	gdkvisual.obj \
-	gdkwindow.obj
-
-gdk_public_h_sources = \
-	gdk.h		\
-	gdkcolor.h	\
-	gdkcursor.h     \
-	gdkdnd.h	\
-	gdkdrawable.h	\
-	gdkevents.h	\
-	gdkgc.h		\
-	gdkkeysyms.h	\
-	gdkinput.h	\
-	gdkkeys.h	\
-	gdkpango.h	\
-	gdkpixbuf.h	\
-	gdkproperty.h	\
-	gdkselection.h	\
-	gdktypes.h	\
-	gdkvisual.h	\
-	gdkwindow.h	\
+	gdkwindow.obj \
+	gdkwindowimpl.obj \
+
+gdk_public_h_sources = 				\
+	gdk.h					\
+	gdkapplaunchcontext.h			\
+	gdkcairo.h				\
+	gdkcolor.h				\
+	gdkcursor.h				\
+	gdkdevice.h				\
+	gdkdevicemanager.h			\
+	gdkdisplay.h				\
+	gdkdisplaymanager.h			\
+	gdkdnd.h				\
+	gdkevents.h				\
+	gdkkeys.h				\
+	gdkkeysyms.h				\
+	gdkkeysyms-compat.h			\
+	gdkmain.h				\
+	gdkpango.h				\
+	gdkpixbuf.h				\
+	gdkprivate.h				\
+	gdkproperty.h				\
+	gdkrectangle.h				\
+	gdkrgba.h				\
+	gdkscreen.h				\
+	gdkselection.h				\
+	gdktestutils.h				\
+	gdkthreads.h				\
+	gdktypes.h				\
+	gdkvisual.h				\
+	gdkwindow.h
 
 # private marshalers
 gdkmarshalers.h : gdkmarshalers.list
@@ -136,6 +145,7 @@ gdk.def: gdk.symbols
 		-DG_GNUC_CONST= \
 		gdk.symbols >> gdk.def
 
+# /force /verbose:lib 
 libgdk-win32-$(GTK_VER)-0.dll : $(gdk_OBJECTS) gdk.def win32\gdk-win32.lib
 	$(CC) $(CFLAGS) -LD -Fe$@ $(gdk_OBJECTS) win32\gdk-win32.lib $(EXTRALIBS) \
 	gdi32.lib user32.lib imm32.lib shell32.lib ole32.lib uuid.lib win32\gdk.res \
diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c
index 631c1d2..313b0d8 100644
--- a/gdk/win32/gdkcursor-win32.c
+++ b/gdk/win32/gdkcursor-win32.c
@@ -24,6 +24,7 @@
 #include "gdkscreen.h"
 #include "gdkcursor.h"
 #include "gdkprivate-win32.h"
+#include "gdkwin32cursor.h"
 
 #ifdef __MINGW32__
 #include <w32api.h>
@@ -135,25 +136,47 @@ hcursor_from_type (GdkCursorType cursor_type)
   return rv;
 }
 
+struct _GdkWin32CursorClass
+{
+  GdkCursorClass cursor_class;
+};
+
+G_DEFINE_TYPE (GdkWin32Cursor, gdk_win32_cursor, GDK_TYPE_CURSOR)
+
+static void
+_gdk_win32_cursor_finalize (GObject *object)
+{
+  GdkWin32Cursor *private = GDK_WIN32_CURSOR (object);
+
+  if (GetCursor () == private->hcursor)
+    SetCursor (NULL);
+
+  if (!DestroyCursor (private->hcursor))
+    WIN32_API_FAILED ("DestroyCursor");
+
+  G_OBJECT_CLASS (gdk_win32_cursor_parent_class)->finalize (object);
+}
+
 static GdkCursor*
 cursor_new_from_hcursor (HCURSOR       hcursor,
 			 GdkCursorType cursor_type)
 {
-  GdkCursorPrivate *private;
+  GdkWin32Cursor *private;
   GdkCursor *cursor;
 
-  private = g_new (GdkCursorPrivate, 1);
+  private = g_object_new (GDK_TYPE_WIN32_CURSOR,
+                          "cursor-type", cursor_type,
+                          "display", _gdk_display,
+			  NULL);
   private->hcursor = hcursor;
   cursor = (GdkCursor*) private;
-  cursor->type = cursor_type;
-  cursor->ref_count = 1;
 
   return cursor;
 }
 
 GdkCursor*
-gdk_cursor_new_for_display (GdkDisplay   *display,
-			    GdkCursorType cursor_type)
+_gdk_win32_display_get_cursor_for_type (GdkDisplay   *display,
+					GdkCursorType cursor_type)
 {
   HCURSOR hcursor;
 
@@ -206,8 +229,8 @@ static struct {
 };
 
 GdkCursor*  
-gdk_cursor_new_from_name (GdkDisplay  *display,
-			  const gchar *name)
+_gdk_win32_display_get_cursor_for_name (GdkDisplay  *display,
+				        const gchar *name)
 {
   HCURSOR hcursor = NULL;
   int i;
@@ -229,26 +252,6 @@ gdk_cursor_new_from_name (GdkDisplay  *display,
   return NULL;
 }
 
-void
-_gdk_cursor_destroy (GdkCursor *cursor)
-{
-  GdkCursorPrivate *private;
-
-  g_return_if_fail (cursor != NULL);
-  private = (GdkCursorPrivate *) cursor;
-
-  GDK_NOTE (CURSOR, g_print ("_gdk_cursor_destroy: %p\n",
-			     (cursor->type == GDK_CURSOR_IS_PIXMAP) ? private->hcursor : 0));
-
-  if (GetCursor () == private->hcursor)
-    SetCursor (NULL);
-
-  if (!DestroyCursor (private->hcursor))
-    WIN32_API_FAILED ("DestroyCursor");
-
-  g_free (private);
-}
-
 GdkPixbuf *
 gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon)
 {
@@ -425,19 +428,19 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon)
   return pixbuf;
 }
 
-GdkPixbuf*  
-gdk_cursor_get_image (GdkCursor *cursor)
+static GdkPixbuf *
+_gdk_win32_cursor_get_image (GdkCursor *cursor)
 {
   g_return_val_if_fail (cursor != NULL, NULL);
 
-  return gdk_win32_icon_to_pixbuf_libgtk_only (((GdkCursorPrivate *) cursor)->hcursor);
+  return gdk_win32_icon_to_pixbuf_libgtk_only (((GdkWin32Cursor *) cursor)->hcursor);
 }
 
 GdkCursor *
-gdk_cursor_new_from_pixbuf (GdkDisplay *display, 
-			    GdkPixbuf  *pixbuf,
-			    gint        x,
-			    gint        y)
+_gdk_win32_display_get_cursor_for_pixbuf (GdkDisplay *display, 
+					  GdkPixbuf  *pixbuf,
+					  gint        x,
+					  gint        y)
 {
   HCURSOR hcursor;
 
@@ -452,8 +455,8 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
   return cursor_new_from_hcursor (hcursor, GDK_CURSOR_IS_PIXMAP);
 }
 
-gboolean 
-gdk_display_supports_cursor_alpha (GdkDisplay    *display)
+gboolean
+_gdk_win32_display_supports_cursor_alpha (GdkDisplay    *display)
 {
   g_return_val_if_fail (display == _gdk_display, FALSE);
 
@@ -461,25 +464,30 @@ gdk_display_supports_cursor_alpha (GdkDisplay    *display)
 }
 
 gboolean 
-gdk_display_supports_cursor_color (GdkDisplay    *display)
+_gdk_win32_display_supports_cursor_color (GdkDisplay    *display)
 {
   g_return_val_if_fail (display == _gdk_display, FALSE);
 
   return TRUE;
 }
 
-guint     
-gdk_display_get_default_cursor_size (GdkDisplay    *display)
+void
+_gdk_win32_display_get_default_cursor_size (GdkDisplay *display,
+					    guint       *width,
+					    guint       *height)
 {
-  g_return_val_if_fail (display == _gdk_display, 0);
-  
-  return MIN (GetSystemMetrics (SM_CXCURSOR), GetSystemMetrics (SM_CYCURSOR));
+  g_return_if_fail (display == _gdk_display);
+
+  if (width)
+    *width = GetSystemMetrics (SM_CXCURSOR);
+  if (height)
+    *height = GetSystemMetrics (SM_CYCURSOR);
 }
 
 void     
-gdk_display_get_maximal_cursor_size (GdkDisplay *display,
-				     guint       *width,
-				     guint       *height)
+_gdk_win32_display_get_maximal_cursor_size (GdkDisplay *display,
+					    guint       *width,
+					    guint       *height)
 {
   g_return_if_fail (display == _gdk_display);
   
@@ -812,3 +820,18 @@ gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf)
 {
   return _gdk_win32_pixbuf_to_hicon (pixbuf);
 }
+
+static void
+gdk_win32_cursor_init (GdkWin32Cursor *cursor)
+{
+}
+static void
+gdk_win32_cursor_class_init(GdkWin32CursorClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (klass);
+
+  object_class->finalize = _gdk_win32_cursor_finalize;
+  
+  cursor_class->get_image = _gdk_win32_cursor_get_image;
+}
diff --git a/gdk/win32/gdkdevice-win32.c b/gdk/win32/gdkdevice-win32.c
index 54f1f0b..c0a1bb3 100644
--- a/gdk/win32/gdkdevice-win32.c
+++ b/gdk/win32/gdkdevice-win32.c
@@ -24,6 +24,7 @@
 #include <windowsx.h>
 #include <objbase.h>
 
+#include "gdkdisplayprivate.h"
 #include "gdkdevice-win32.h"
 #include "gdkwin32.h"
 
@@ -134,14 +135,14 @@ gdk_device_win32_set_window_cursor (GdkDevice *device,
                                     GdkWindow *window,
                                     GdkCursor *cursor)
 {
-  GdkCursorPrivate *cursor_private;
-  GdkWindowObject *parent_window;
+  GdkWin32Cursor *cursor_private;
+  GdkWindow *parent_window;
   GdkWindowImplWin32 *impl;
   HCURSOR hcursor;
   HCURSOR hprevcursor;
 
-  impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
-  cursor_private = (GdkCursorPrivate*) cursor;
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
+  cursor_private = (GdkWin32Cursor*) cursor;
 
   hprevcursor = impl->hcursor;
 
@@ -164,13 +165,11 @@ gdk_device_win32_set_window_cursor (GdkDevice *device,
            * first ancestor that has cursor defined, and if so, set
            * new cursor.
            */
-          GdkWindowObject *curr_window_obj = GDK_WINDOW_OBJECT (curr_window);
-
-          while (curr_window_obj &&
-                 !GDK_WINDOW_IMPL_WIN32 (curr_window_obj->impl)->hcursor)
+          while (curr_window && curr_window->impl &&
+                 !GDK_WINDOW_IMPL_WIN32 (curr_window->impl)->hcursor)
             {
-              curr_window_obj = curr_window_obj->parent;
-              if (curr_window_obj == GDK_WINDOW_OBJECT (window))
+              curr_window = curr_window->parent;
+              if (curr_window == GDK_WINDOW (window))
                 {
                   SetCursor (hcursor);
                   break;
@@ -188,7 +187,7 @@ gdk_device_win32_set_window_cursor (GdkDevice *device,
     {
       /* Look for a suitable cursor to use instead */
       hcursor = NULL;
-      parent_window = GDK_WINDOW_OBJECT (window)->parent;
+      parent_window = GDK_WINDOW (window)->parent;
 
       while (hcursor == NULL)
         {
@@ -329,12 +328,19 @@ static void
 gdk_device_win32_ungrab (GdkDevice *device,
                          guint32    time_)
 {
+  GdkDeviceGrabInfo *info;
   GdkDisplay *display;
 
   display = gdk_device_get_display (device);
+  info = _gdk_display_get_last_device_grab (display, device);
+
+  if (info)
+    info->serial_end = 0;
 
   if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
     ReleaseCapture ();
+
+  _gdk_display_device_grab_update (display, device, NULL, 0);
 }
 
 static GdkWindow *
diff --git a/gdk/win32/gdkdevice-wintab.c b/gdk/win32/gdkdevice-wintab.c
index 9d5ed79..351105f 100644
--- a/gdk/win32/gdkdevice-wintab.c
+++ b/gdk/win32/gdkdevice-wintab.c
@@ -372,7 +372,7 @@ _gdk_input_check_extension_events (GdkDevice *device)
 
   for (l = input_windows; l; l = l->next)
     {
-      GdkWindowObject *window_private;
+      GdkWindow *window_private;
       GdkEventMask event_mask = 0;
 
       window_private = l->data;
diff --git a/gdk/win32/gdkdevicemanager-win32.c b/gdk/win32/gdkdevicemanager-win32.c
index 6a7b6e7..1af9039 100644
--- a/gdk/win32/gdkdevicemanager-win32.c
+++ b/gdk/win32/gdkdevicemanager-win32.c
@@ -29,6 +29,8 @@
 #include "gdkdeviceprivate.h"
 #include "gdkdevice-win32.h"
 #include "gdkdevice-wintab.h"
+#include "gdkwin32.h"
+#include "gdkdisplayprivate.h"
 
 #include <windows.h>
 #include <wintab.h>
@@ -860,7 +862,6 @@ _gdk_input_other_event (GdkEvent  *event,
                         GdkWindow *window)
 {
   GdkDisplay *display;
-  GdkWindowObject *obj;
   GdkDeviceWintab *device = NULL;
   GdkDeviceGrabInfo *last_grab;
   GdkEventMask masktest;
@@ -900,8 +901,6 @@ _gdk_input_other_event (GdkEvent  *event,
         return FALSE;
     }
 
-  obj = GDK_WINDOW_OBJECT (window);
-
   switch (msg->message)
     {
     case WT_PACKET:
@@ -928,7 +927,6 @@ _gdk_input_other_event (GdkEvent  *event,
           g_object_unref (window);
 
           window = g_object_ref (last_grab->window);
-          obj = GDK_WINDOW_OBJECT (window);
         }
 
       if (window == _gdk_root)
@@ -1006,12 +1004,12 @@ _gdk_input_other_event (GdkEvent  *event,
         {
           GDK_NOTE (EVENTS_OR_INPUT, g_print ("... not selected\n"));
 
-          if (obj->parent == GDK_WINDOW_OBJECT (_gdk_root))
+          if (window->parent == GDK_WINDOW (_gdk_root))
             return FALSE;
 
           /* It is not good to propagate the extended events up to the parent
            * if this window wants normal (not extended) motion/button events */
-          if (obj->event_mask & masktest)
+          if (window->event_mask & masktest)
             {
               GDK_NOTE (EVENTS_OR_INPUT,
                         g_print ("... wants ordinary event, ignoring this\n"));
@@ -1022,8 +1020,7 @@ _gdk_input_other_event (GdkEvent  *event,
           pt.y = y;
           ClientToScreen (GDK_WINDOW_HWND (window), &pt);
           g_object_unref (window);
-          window = (GdkWindow *) obj->parent;
-          obj = GDK_WINDOW_OBJECT (window);
+          window = window->parent;
           g_object_ref (window);
           ScreenToClient (GDK_WINDOW_HWND (window), &pt);
           x = pt.x;
diff --git a/gdk/win32/gdkdevicemanager-win32.h b/gdk/win32/gdkdevicemanager-win32.h
index 69d26b7..6e09737 100644
--- a/gdk/win32/gdkdevicemanager-win32.h
+++ b/gdk/win32/gdkdevicemanager-win32.h
@@ -20,7 +20,7 @@
 #ifndef __GDK_DEVICE_MANAGER_WIN32_H__
 #define __GDK_DEVICE_MANAGER_WIN32_H__
 
-#include <gdk/gdkdevicemanager.h>
+#include <gdk/gdkdevicemanagerprivate.h>
 
 G_BEGIN_DECLS
 
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index 3d43c26..da92098 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -21,6 +21,10 @@
 #include "config.h"
 #include "gdk.h"
 #include "gdkprivate-win32.h"
+#include "gdkdisplayprivate.h"
+#include "gdkwin32display.h"
+#include "gdkwin32screen.h"
+#include "gdkwin32window.h"
 
 #define HAVE_MONITOR_INFO
 
@@ -36,8 +40,8 @@ _gdk_windowing_set_default_display (GdkDisplay *display)
   g_assert (display == NULL || _gdk_display == display);
 }
 
-gulong
-_gdk_windowing_window_get_next_serial (GdkDisplay *display)
+static gulong
+gdk_win32_display_get_next_serial (GdkDisplay *display)
 {
 	return 0;
 }
@@ -179,7 +183,7 @@ _gdk_monitor_init (void)
 }
 
 GdkDisplay *
-gdk_display_open (const gchar *display_name)
+_gdk_win32_display_open (const gchar *display_name)
 {
   GDK_NOTE (MISC, g_print ("gdk_display_open: %s\n", (display_name ? display_name : "NULL")));
 
@@ -199,8 +203,8 @@ gdk_display_open (const gchar *display_name)
       return NULL;
     }
 
-  _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL);
-  _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL);
+  _gdk_display = g_object_new (GDK_TYPE_WIN32_DISPLAY, NULL);
+  _gdk_screen = g_object_new (GDK_TYPE_WIN32_SCREEN, NULL);
 
   _gdk_monitor_init ();
   _gdk_visual_init ();
@@ -220,8 +224,20 @@ gdk_display_open (const gchar *display_name)
   return _gdk_display;
 }
 
-G_CONST_RETURN gchar *
-gdk_display_get_name (GdkDisplay *display)
+struct _GdkWin32Display
+{
+  GdkDisplay display;
+};
+
+struct _GdkWin32DisplayClass
+{
+  GdkDisplayClass display_class;
+};
+
+G_DEFINE_TYPE (GdkWin32Display, gdk_win32_display, GDK_TYPE_DISPLAY)
+
+static G_CONST_RETURN gchar *
+gdk_win32_display_get_name (GdkDisplay *display)
 {
   HDESK hdesk = GetThreadDesktop (GetCurrentThreadId ());
   char dummy;
@@ -277,24 +293,24 @@ gdk_display_get_name (GdkDisplay *display)
 				  window_station_name,
 				  desktop_name);
 
-  GDK_NOTE (MISC, g_print ("gdk_display_get_name: %s\n", display_name));
+  GDK_NOTE (MISC, g_print ("gdk_win32_display_get_name: %s\n", display_name));
 
   display_name_cache = display_name;
 
   return display_name_cache;
 }
 
-gint
-gdk_display_get_n_screens (GdkDisplay *display)
+static gint
+gdk_win32_display_get_n_screens (GdkDisplay *display)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
   
   return 1;
 }
 
-GdkScreen *
-gdk_display_get_screen (GdkDisplay *display,
-			gint        screen_num)
+static GdkScreen *
+gdk_win32_display_get_screen (GdkDisplay *display,
+			      gint        screen_num)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
   g_return_val_if_fail (screen_num == 0, NULL);
@@ -302,16 +318,16 @@ gdk_display_get_screen (GdkDisplay *display,
   return _gdk_screen;
 }
 
-GdkScreen *
-gdk_display_get_default_screen (GdkDisplay *display)
+static GdkScreen *
+gdk_win32_display_get_default_screen (GdkDisplay *display)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
 
   return _gdk_screen;
 }
 
-GdkWindow *
-gdk_display_get_default_group (GdkDisplay *display)
+static GdkWindow *
+gdk_win32_display_get_default_group (GdkDisplay *display)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
 
@@ -320,30 +336,30 @@ gdk_display_get_default_group (GdkDisplay *display)
   return NULL;
 }
 
-gboolean 
-gdk_display_supports_selection_notification (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_selection_notification (GdkDisplay *display)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
 
   return FALSE;
 }
 
-gboolean 
-gdk_display_request_selection_notification (GdkDisplay *display,
+static gboolean 
+gdk_win32_display_request_selection_notification (GdkDisplay *display,
                                             GdkAtom     selection)
 
 {
   return FALSE;
 }
 
-gboolean
-gdk_display_supports_clipboard_persistence (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_clipboard_persistence (GdkDisplay *display)
 {
   return FALSE;
 }
 
-void
-gdk_display_store_clipboard (GdkDisplay    *display,
+static void
+gdk_win32_display_store_clipboard (GdkDisplay    *display,
 			     GdkWindow     *clipboard_window,
 			     guint32        time_,
 			     const GdkAtom *targets,
@@ -351,16 +367,16 @@ gdk_display_store_clipboard (GdkDisplay    *display,
 {
 }
 
-gboolean 
-gdk_display_supports_shapes (GdkDisplay *display)
+static gboolean 
+gdk_win32_display_supports_shapes (GdkDisplay *display)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
 
   return TRUE;
 }
 
-gboolean 
-gdk_display_supports_input_shapes (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_input_shapes (GdkDisplay *display)
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
 
@@ -371,8 +387,142 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
   return FALSE;
 }
 
-gboolean
-gdk_display_supports_composite (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_composite (GdkDisplay *display)
 {
   return FALSE;
 }
+
+static void
+gdk_win32_display_beep (GdkDisplay *display)
+{
+  g_return_if_fail (display == gdk_display_get_default());
+  if (!MessageBeep (-1))
+    Beep(1000, 50);
+}
+
+static void
+gdk_win32_display_flush (GdkDisplay * display)
+{
+  g_return_if_fail (display == _gdk_display);
+
+  GdiFlush ();
+}
+
+static void
+gdk_win32_display_dispose (GObject *object)
+{
+}
+
+static void
+gdk_win32_display_finalize (GObject *object)
+{
+}
+
+static void
+gdk_win32_display_init(GdkWin32Display *display)
+{
+}
+
+static void
+gdk_win32_display_before_process_all_updates (GdkDisplay  *display)
+{
+  /* nothing */
+}
+static void
+gdk_win32_display_after_process_all_updates (GdkDisplay  *display)
+{
+  /* nothing */
+}
+static void
+gdk_win32_display_notify_startup_complete (GdkDisplay  *display,
+                                           const gchar *startup_id)
+{
+  /* nothing */
+}
+static void
+gdk_win32_display_event_data_copy (GdkDisplay    *display,
+                                   const GdkEvent *src,
+                                   GdkEvent       *dst)
+{
+  /* nothing */
+}
+static void
+gdk_win32_display_event_data_free (GdkDisplay *display,
+                                   GdkEvent *event)
+{
+  /* nothing */
+}
+static void
+gdk_win32_display_push_error_trap (GdkDisplay *display)
+{
+  /* nothing */
+}
+static gint
+gdk_win32_display_pop_error_trap (GdkDisplay *display,
+				  gboolean    ignored)
+{
+  return 0;
+}
+static void
+gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (klass);
+
+  object_class->dispose = gdk_win32_display_dispose;
+  object_class->finalize = gdk_win32_display_finalize;
+
+  display_class->window_type = GDK_TYPE_WIN32_WINDOW;
+
+  display_class->get_name = gdk_win32_display_get_name;
+  display_class->get_n_screens = gdk_win32_display_get_n_screens;
+  display_class->get_screen = gdk_win32_display_get_screen;
+  display_class->get_default_screen = gdk_win32_display_get_default_screen;
+  display_class->beep = gdk_win32_display_beep;
+  display_class->sync = _gdk_win32_display_sync;
+  display_class->flush = gdk_win32_display_flush;
+  display_class->has_pending = _gdk_win32_display_has_pending;
+  display_class->queue_events = _gdk_win32_display_queue_events;
+  display_class->get_default_group = gdk_win32_display_get_default_group;
+
+  display_class->supports_selection_notification = gdk_win32_display_supports_selection_notification;
+  display_class->request_selection_notification = gdk_win32_display_request_selection_notification;
+  display_class->supports_clipboard_persistence = gdk_win32_display_supports_clipboard_persistence;
+  display_class->store_clipboard = gdk_win32_display_store_clipboard;
+  display_class->supports_shapes = gdk_win32_display_supports_shapes;
+  display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes;
+  display_class->supports_composite = gdk_win32_display_supports_composite;
+
+  display_class->list_devices = _gdk_win32_display_list_devices;
+  display_class->send_client_message = _gdk_win32_display_send_client_message;
+  display_class->add_client_message_filter = _gdk_win32_display_add_client_message_filter;
+  //? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
+  display_class->get_drag_protocol = _gdk_win32_display_get_drag_protocol;
+  display_class->get_cursor_for_type = _gdk_win32_display_get_cursor_for_type;
+  display_class->get_cursor_for_name = _gdk_win32_display_get_cursor_for_name;
+  display_class->get_cursor_for_pixbuf = _gdk_win32_display_get_cursor_for_pixbuf;
+  display_class->get_default_cursor_size = _gdk_win32_display_get_default_cursor_size;
+  display_class->get_maximal_cursor_size = _gdk_win32_display_get_maximal_cursor_size;
+  display_class->supports_cursor_alpha = _gdk_win32_display_supports_cursor_alpha;
+  display_class->supports_cursor_color = _gdk_win32_display_supports_cursor_color;
+
+  display_class->before_process_all_updates = gdk_win32_display_before_process_all_updates;
+  display_class->after_process_all_updates = gdk_win32_display_after_process_all_updates;
+  display_class->get_next_serial = gdk_win32_display_get_next_serial;
+  display_class->notify_startup_complete = gdk_win32_display_notify_startup_complete;
+  display_class->event_data_copy = gdk_win32_display_event_data_copy;
+  display_class->event_data_free = gdk_win32_display_event_data_free;
+  display_class->create_window_impl = _gdk_win32_display_create_window_impl;
+
+  display_class->get_keymap = _gdk_win32_display_get_keymap;
+  display_class->push_error_trap = gdk_win32_display_push_error_trap;
+  display_class->pop_error_trap = gdk_win32_display_pop_error_trap;
+  display_class->get_selection_owner = _gdk_win32_display_get_selection_owner;
+  display_class->set_selection_owner = _gdk_win32_display_set_selection_owner;
+  display_class->send_selection_notify = _gdk_win32_display_send_selection_notify;
+  display_class->get_selection_property = _gdk_win32_display_get_selection_property;
+  display_class->convert_selection = _gdk_win32_display_convert_selection;
+  display_class->text_property_to_utf8_list = _gdk_win32_display_text_property_to_utf8_list;
+  display_class->utf8_to_string_target = _gdk_win32_display_utf8_to_string_target;
+}
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
index d7c2905..9788e90 100644
--- a/gdk/win32/gdkdnd-win32.c
+++ b/gdk/win32/gdkdnd-win32.c
@@ -76,6 +76,9 @@
 #include "gdkproperty.h"
 #include "gdkinternals.h"
 #include "gdkprivate-win32.h"
+#include "gdkwin32.h"
+#include "gdkwin32dnd.h"
+#include "gdk/gdkdndprivate.h"
 
 #include <ole2.h>
 
@@ -107,23 +110,29 @@ struct _GdkDragContextPrivateWin32 {
   guint drop_failed : 1;	/* Whether the drop was unsuccessful */
 };
 
-#define PRIVATE_DATA(context) ((GdkDragContextPrivateWin32 *) GDK_DRAG_CONTEXT (context)->windowing_data)
+#define PRIVATE_DATA(context) (GDK_WIN32_DRAG_CONTEXT (context)->windowing_data)
 
 static GList *contexts;
 static GdkDragContext *current_dest_drag = NULL;
 
-static void gdk_drag_context_init       (GdkDragContext      *dragcontext);
-static void gdk_drag_context_class_init (GdkDragContextClass *klass);
-static void gdk_drag_context_finalize   (GObject              *object);
+struct _GdkWin32DragContext
+{
+  GdkDragContext context;
+  
+  GdkDragContextPrivateWin32 *windowing_data;
+};
+
+struct _GdkWin32DragContextClass
+{
+  GdkDragContextClass parent_class;
+};
 
-static gpointer parent_class = NULL;
+G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
 
 static gboolean use_ole2_dnd = FALSE;
 
-G_DEFINE_TYPE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
-
 static void
-gdk_drag_context_init (GdkDragContext *dragcontext)
+gdk_win32_drag_context_init (GdkWin32DragContext *dragcontext)
 {
   GdkDragContextPrivateWin32 *private;
 
@@ -148,19 +157,7 @@ gdk_drag_context_init (GdkDragContext *dragcontext)
 }
 
 static void
-gdk_drag_context_class_init (GdkDragContextClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-  parent_class = g_type_class_peek_parent (klass);
-
-  object_class->finalize = gdk_drag_context_finalize;
-
-  g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateWin32));
-}
-
-static void
-gdk_drag_context_finalize (GObject *object)
+gdk_win32_drag_context_finalize (GObject *object)
 {
   GdkDragContext *context = GDK_DRAG_CONTEXT (object);
 
@@ -192,7 +189,7 @@ gdk_drag_context_finalize (GObject *object)
 	}
     }
 
-  G_OBJECT_CLASS (parent_class)->finalize (object);
+  G_OBJECT_CLASS (gdk_win32_drag_context_parent_class)->finalize (object);
 }
 
 /* Drag Contexts */
@@ -1203,7 +1200,7 @@ target_context_new (GdkWindow *window)
   result->context->suggested_action = GDK_ACTION_MOVE;
   result->context->action = GDK_ACTION_MOVE;
 
-  private = result->context->windowing_data;
+  private = PRIVATE_DATA(result->context);
   private->iface = (IUnknown *) &result->idt;
   idroptarget_addref (&result->idt);
 
@@ -1239,7 +1236,7 @@ source_context_new (GdkWindow *window,
   result->context->dest_window = NULL;
   result->context->targets = g_list_copy (targets);
 
-  private = result->context->windowing_data;
+  private = PRIVATE_DATA(result->context);
   private->iface = (IUnknown *) &result->ids;
   idropsource_addref (&result->ids);
 
@@ -1819,8 +1816,9 @@ gdk_drag_do_leave (GdkDragContext *context,
 }
 
 GdkDragContext *
-gdk_drag_begin (GdkWindow *window,
-		GList     *targets)
+_gdk_win32_window_drag_begin (GdkWindow *window,
+			      GdkDevice *device,
+			      GList     *targets)
 {
   if (!use_ole2_dnd)
     {
@@ -1840,6 +1838,7 @@ gdk_drag_begin (GdkWindow *window,
 
       new_context->source_window = window;
       g_object_ref (window);
+      gdk_drag_context_set_device (new_context, device);
 
       new_context->targets = g_list_copy (targets);
       new_context->actions = 0;
@@ -1974,13 +1973,14 @@ _gdk_win32_dnd_do_dragdrop (void)
 }
 
 GdkNativeWindow
-gdk_drag_get_protocol_for_display (GdkDisplay      *display,
-				   GdkNativeWindow  xid,
-				   GdkDragProtocol *protocol)
+_gdk_win32_display_get_drag_protocol (GdkDisplay      *display,
+				      GdkNativeWindow  xid,
+				      GdkDragProtocol *protocol,
+				      guint           *version)
 {
   GdkWindow *window;
 
-  window = gdk_window_lookup (xid);
+  window = gdk_win32_window_lookup_for_display (display, xid);
   if (window &&
       gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN)
     {
@@ -1991,6 +1991,9 @@ gdk_drag_get_protocol_for_display (GdkDisplay      *display,
 	  else
 	    *protocol = GDK_DRAG_PROTO_LOCAL;
 
+	  /* even X11 code not always intializes it */
+	  *version = 0;
+
 	  return xid;
 	}
     }
@@ -1998,15 +2001,15 @@ gdk_drag_get_protocol_for_display (GdkDisplay      *display,
   return 0;
 }
 
-void
-gdk_drag_find_window_for_screen (GdkDragContext  *context,
+static GdkWindow *
+gdk_win32_drag_context_find_window (GdkDragContext  *context,
 				 GdkWindow       *drag_window,
 				 GdkScreen       *screen,
 				 gint             x_root,
 				 gint             y_root,
-				 GdkWindow      **dest_window,
 				 GdkDragProtocol *protocol)
 {
+  GdkWindow *dest_window;
   POINT pt;
   HWND hwnd;
 
@@ -2016,14 +2019,14 @@ gdk_drag_find_window_for_screen (GdkDragContext  *context,
   hwnd = WindowFromPoint (pt);
 
   if (hwnd == NULL)
-    *dest_window = NULL;
+    dest_window = NULL;
   else
     {
-      *dest_window = gdk_win32_handle_table_lookup (hwnd);
-      if (*dest_window)
-	g_object_ref (*dest_window);
+      dest_window = gdk_win32_handle_table_lookup (hwnd);
+      if (dest_window)
+	g_object_ref (dest_window);
       else
-	*dest_window = gdk_window_foreign_new_for_display (_gdk_display, hwnd);
+	dest_window = gdk_win32_window_foreign_new_for_display (_gdk_display, hwnd);
 
       if (use_ole2_dnd)
 	*protocol = GDK_DRAG_PROTO_OLE2;
@@ -2038,12 +2041,14 @@ gdk_drag_find_window_for_screen (GdkDragContext  *context,
 		     (drag_window ? GDK_WINDOW_HWND (drag_window) : NULL),
 		     x_root, y_root,
 		     hwnd,
-		     (*dest_window ? GDK_WINDOW_HWND (*dest_window) : NULL),
+		     (dest_window ? GDK_WINDOW_HWND (dest_window) : NULL),
 		     _gdk_win32_drag_protocol_to_string (*protocol)));
+
+  return dest_window;
 }
 
-gboolean
-gdk_drag_motion (GdkDragContext *context,
+static gboolean
+gdk_win32_drag_context_drag_motion (GdkDragContext *context,
 		 GdkWindow      *dest_window,
 		 GdkDragProtocol protocol,
 		 gint            x_root,
@@ -2181,8 +2186,8 @@ gdk_drag_motion (GdkDragContext *context,
   return FALSE;
 }
 
-void
-gdk_drag_drop (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drag_drop (GdkDragContext *context,
 	       guint32         time)
 {
   g_return_if_fail (context != NULL);
@@ -2201,8 +2206,8 @@ gdk_drag_drop (GdkDragContext *context,
     }
 }
 
-void
-gdk_drag_abort (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drag_abort (GdkDragContext *context,
 		guint32         time)
 {
   g_return_if_fail (context != NULL);
@@ -2215,8 +2220,8 @@ gdk_drag_abort (GdkDragContext *context,
 
 /* Destination side */
 
-void
-gdk_drag_status (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drag_status (GdkDragContext *context,
 		 GdkDragAction   action,
 		 guint32         time)
 {
@@ -2270,8 +2275,8 @@ gdk_drag_status (GdkDragContext *context,
     }
 }
 
-void
-gdk_drop_reply (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drop_reply (GdkDragContext *context,
 		gboolean        ok,
 		guint32         time)
 {
@@ -2287,8 +2292,8 @@ gdk_drop_reply (GdkDragContext *context,
       }
 }
 
-void
-gdk_drop_finish (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drop_finish (GdkDragContext *context,
 		 gboolean        success,
 		 guint32         time)
 {
@@ -2357,7 +2362,7 @@ gdk_destroy_filter (GdkXEvent *xev,
 #endif
 
 void
-gdk_window_register_dnd (GdkWindow *window)
+_gdk_win32_window_register_dnd (GdkWindow *window)
 {
   target_drag_context *ctx;
   HRESULT hr;
@@ -2416,8 +2421,14 @@ gdk_window_register_dnd (GdkWindow *window)
     }
 }
 
-GdkAtom
-gdk_drag_get_selection (GdkDragContext *context)
+static gboolean
+gdk_win32_drag_context_drop_status (GdkDragContext *context)
+{
+  return ! PRIVATE_DATA (context)->drop_failed;
+}
+
+static GdkAtom
+gdk_win32_drag_context_get_selection (GdkDragContext *context)
 {
   switch (context->protocol)
     {
@@ -2432,15 +2443,25 @@ gdk_drag_get_selection (GdkDragContext *context)
     }
 }
 
-gboolean
-gdk_drag_drop_succeeded (GdkDragContext *context)
+static void
+gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
 {
-  GdkDragContextPrivateWin32 *private;
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
 
-  g_return_val_if_fail (context != NULL, FALSE);
+  gdk_win32_drag_context_parent_class = g_type_class_peek_parent (klass);
 
-  private = PRIVATE_DATA (context);
+  object_class->finalize = gdk_win32_drag_context_finalize;
 
-  /* FIXME: Can we set drop_failed when the drop has failed? */
-  return !private->drop_failed;
+  context_class->find_window = gdk_win32_drag_context_find_window;
+  context_class->drag_status = gdk_win32_drag_context_drag_status;
+  context_class->drag_motion = gdk_win32_drag_context_drag_motion;
+  context_class->drag_abort = gdk_win32_drag_context_drag_abort;
+  context_class->drag_drop = gdk_win32_drag_context_drag_drop;
+  context_class->drop_reply = gdk_win32_drag_context_drop_reply;
+  context_class->drop_finish = gdk_win32_drag_context_drop_finish;
+  context_class->drop_status = gdk_win32_drag_context_drop_status;
+  context_class->get_selection = gdk_win32_drag_context_get_selection;
+
+  g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateWin32));
 }
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 78d6cbe..450f8c1 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -46,11 +46,15 @@
 #include <glib/gprintf.h>
 
 #include "gdk.h"
+#include "gdkdisplayprivate.h"
 #include "gdkprivate-win32.h"
 #include "gdkkeysyms.h"
 #include "gdkdevicemanager-win32.h"
 #include "gdkdeviceprivate.h"
 #include "gdkdevice-wintab.h"
+#include "gdkwin32.h"
+#include "gdkwin32dnd.h"
+#include "gdkdndprivate.h"
 
 #include <windowsx.h>
 
@@ -390,10 +394,10 @@ _gdk_events_init (void)
 }
 
 gboolean
-gdk_events_pending (void)
+_gdk_win32_display_has_pending (GdkDisplay *display)
 {
   MSG msg;
-  return (_gdk_event_queue_find_first (_gdk_display) ||
+  return (_gdk_event_queue_find_first (display) ||
 	  (modal_win32_dialog == NULL &&
 	   PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE)));
 }
@@ -449,15 +453,15 @@ _gdk_windowing_device_grab (GdkDevice    *device,
                             guint32	      time)
 {
   HCURSOR hcursor;
-  GdkCursorPrivate *cursor_private;
+  GdkWin32Cursor *cursor_private;
   gint return_val;
-  GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) native_window)->impl);
+  GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (native_window->impl);
 
   g_return_val_if_fail (window != NULL, 0);
   g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
   g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), 0);
   
-  cursor_private = (GdkCursorPrivate*) cursor;
+  cursor_private = (GdkWin32Cursor*) cursor;
   
   if (!cursor)
     hcursor = NULL;
@@ -492,28 +496,6 @@ _gdk_windowing_device_grab (GdkDevice    *device,
   return return_val;
 }
 
-void
-gdk_device_ungrab (GdkDevice *device,
-                   guint32    time)
-{
-  GdkDeviceGrabInfo *info;
-  GdkDisplay *display;
-
-  g_return_if_fail (GDK_IS_DEVICE (device));
-
-  display = gdk_device_get_display (device);
-  info = _gdk_display_get_last_device_grab (display, device);
-
-  if (info)
-    {
-      info->serial_end = 0;
-      GDK_DEVICE_GET_CLASS (device)->ungrab (device, time);
-    }
-
-  _gdk_display_device_grab_update (display, device, 0);
-}
-
-
 static GdkWindow *
 find_window_for_mouse_event (GdkWindow* reported_window,
 			     MSG*       msg)
@@ -562,11 +544,11 @@ find_window_for_mouse_event (GdkWindow* reported_window,
   return other_window;
 }
 
-void 
-gdk_display_add_client_message_filter (GdkDisplay   *display,
-				       GdkAtom       message_type,
-				       GdkFilterFunc func,
-				       gpointer      data)
+void
+_gdk_win32_display_add_client_message_filter (GdkDisplay   *display,
+					      GdkAtom       message_type,
+					      GdkFilterFunc func,
+					      gpointer      data)
 {
   GdkClientFilter *filter = g_new (GdkClientFilter, 1);
 
@@ -1096,7 +1078,7 @@ apply_event_filters (GdkWindow  *window,
 static void
 show_window_recurse (GdkWindow *window, gboolean hide_window)
 {
-  GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+  GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
   GSList *children = impl->transient_children;
   GdkWindow *child = NULL;
 
@@ -1119,9 +1101,9 @@ show_window_recurse (GdkWindow *window, gboolean hide_window)
 	{
 	  if (!hide_window)
 	    {
-	      if (GDK_WINDOW_OBJECT (window)->state & GDK_WINDOW_STATE_ICONIFIED)
+	      if (gdk_window_get_state (window) & GDK_WINDOW_STATE_ICONIFIED)
 		{
-		  if (GDK_WINDOW_OBJECT (window)->state & GDK_WINDOW_STATE_MAXIMIZED)
+		  if (gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED)
 		    {
 		      ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
 		    }
@@ -1145,7 +1127,7 @@ static void
 do_show_window (GdkWindow *window, gboolean hide_window)
 {
   GdkWindow *tmp_window = NULL;
-  GdkWindowImplWin32 *tmp_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+  GdkWindowImplWin32 *tmp_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   if (!tmp_impl->changing_state)
     {
@@ -1153,7 +1135,7 @@ do_show_window (GdkWindow *window, gboolean hide_window)
       while (tmp_impl->transient_owner != NULL)
 	{
 	  tmp_window = tmp_impl->transient_owner;
-	  tmp_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (tmp_window)->impl);
+	  tmp_impl = GDK_WINDOW_IMPL_WIN32 (tmp_window->impl);
 	}
 
       /* If we couldn't find one, use the window provided. */
@@ -1200,7 +1182,7 @@ synthesize_enter_or_leave_event (GdkWindow        *window,
   append_event (event);
   
   if (type == GDK_ENTER_NOTIFY &&
-      ((GdkWindowObject *) window)->extension_events != 0)
+      window->extension_events != 0)
     _gdk_device_wintab_update_window_coords (window);
 }
 			 
@@ -1226,7 +1208,7 @@ propagate (GdkWindow  **window,
        * device is used
        */
       if (check_extended &&
-	  ((GdkWindowObject *) grab_window)->extension_events != 0 &&
+	  grab_window->extension_events != 0 &&
 	  _gdk_input_ignore_core)
 	{
 	  GDK_NOTE (EVENTS, g_print (" (ignored for grabber)"));
@@ -1251,13 +1233,13 @@ propagate (GdkWindow  **window,
   while (TRUE)
     {
       if (check_extended &&
-	  ((GdkWindowObject *) *window)->extension_events != 0 &&
+	  (*window)->extension_events != 0 &&
 	  _gdk_input_ignore_core)
 	{
 	  GDK_NOTE (EVENTS, g_print (" (ignored)"));
 	  return FALSE;
 	}
-      if ((*doesnt_want_it) (((GdkWindowObject *) *window)->event_mask, msg))
+      if ((*doesnt_want_it) ((*window)->event_mask, msg))
 	{
 	  /* Owner doesn't want it, propagate to parent. */
 	  GdkWindow *parent = gdk_window_get_parent (*window);
@@ -1269,7 +1251,7 @@ propagate (GdkWindow  **window,
 		  /* Event source is grabbed with owner_events TRUE */
 
 		  if (check_extended &&
-		      ((GdkWindowObject *) grab_window)->extension_events != 0 &&
+		      grab_window->extension_events != 0 &&
 		      _gdk_input_ignore_core)
 		    {
 		      GDK_NOTE (EVENTS, g_print (" (ignored for grabber)"));
@@ -1329,7 +1311,6 @@ handle_configure_event (MSG       *msg,
 {
   RECT client_rect;
   POINT point;
-  GdkWindowObject *window_object;
 
   GetClientRect (msg->hwnd, &client_rect);
   point.x = client_rect.left; /* always 0 */
@@ -1343,17 +1324,15 @@ handle_configure_event (MSG       *msg,
       point.y += _gdk_offset_y;
     }
 
-  window_object = GDK_WINDOW_OBJECT (window);
-
-  window_object->width = client_rect.right - client_rect.left;
-  window_object->height = client_rect.bottom - client_rect.top;
+  window->width = client_rect.right - client_rect.left;
+  window->height = client_rect.bottom - client_rect.top;
   
-  window_object->x = point.x;
-  window_object->y = point.y;
+  window->x = point.x;
+  window->y = point.y;
 
   _gdk_window_update_size (window);
   
-  if (window_object->event_mask & GDK_STRUCTURE_MASK)
+  if (window->event_mask & GDK_STRUCTURE_MASK)
     {
       GdkEvent *event = gdk_event_new (GDK_CONFIGURE);
 
@@ -1601,7 +1580,7 @@ ensure_stacking_on_unminimize (MSG *msg)
       if (rover_gdkw)
 	{
 	  GdkWindowImplWin32 *rover_impl =
-	    (GdkWindowImplWin32 *)((GdkWindowObject *)rover_gdkw)->impl;
+	    GDK_WINDOW_IMPL_WIN32 (rover_gdkw->impl);
 
 	  if (GDK_WINDOW_IS_MAPPED (rover_gdkw) &&
 	      (rover_impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY ||
@@ -1624,7 +1603,7 @@ static gboolean
 ensure_stacking_on_window_pos_changing (MSG       *msg,
 					GdkWindow *window)
 {
-  GdkWindowImplWin32 *impl = (GdkWindowImplWin32 *)((GdkWindowObject *) window)->impl;
+  GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
   WINDOWPOS *windowpos = (WINDOWPOS *) msg->lParam;
 
   if (GetActiveWindow () == msg->hwnd &&
@@ -1652,7 +1631,7 @@ ensure_stacking_on_window_pos_changing (MSG       *msg,
 	  if (rover_gdkw)
 	    {
 	      GdkWindowImplWin32 *rover_impl =
-		(GdkWindowImplWin32 *)((GdkWindowObject *)rover_gdkw)->impl;
+		GDK_WINDOW_IMPL_WIN32 (rover_gdkw->impl);
 
 	      if (GDK_WINDOW_IS_MAPPED (rover_gdkw) &&
 		  (rover_impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY ||
@@ -1679,7 +1658,7 @@ static void
 ensure_stacking_on_activate_app (MSG       *msg,
 				 GdkWindow *window)
 {
-  GdkWindowImplWin32 *impl = (GdkWindowImplWin32 *)((GdkWindowObject *) window)->impl;
+  GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   if (impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY ||
       impl->type_hint == GDK_WINDOW_TYPE_HINT_DIALOG ||
@@ -1709,7 +1688,7 @@ ensure_stacking_on_activate_app (MSG       *msg,
 	  if (rover_gdkw)
 	    {
 	      GdkWindowImplWin32 *rover_impl =
-		(GdkWindowImplWin32 *)((GdkWindowObject *)rover_gdkw)->impl;
+		GDK_WINDOW_IMPL_WIN32 (rover_gdkw->impl);
 
 	      if (GDK_WINDOW_IS_MAPPED (rover_gdkw) &&
 		  (rover_impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY ||
@@ -1829,11 +1808,11 @@ gdk_event_translate (MSG  *msg,
    */
 #define return GOTO_DONE_INSTEAD
   
-  if (!GDK_WINDOW_DESTROYED (window) && ((GdkWindowObject *) window)->filters)
+  if (!GDK_WINDOW_DESTROYED (window) && window->filters)
     {
       /* Apply per-window filters */
 
-      GdkFilterReturn result = apply_event_filters (window, msg, &((GdkWindowObject *) window)->filters);
+      GdkFilterReturn result = apply_event_filters (window, msg, &window->filters);
 
       if (result == GDK_FILTER_REMOVE || result == GDK_FILTER_TRANSLATE)
 	{
@@ -2009,7 +1988,7 @@ gdk_event_translate (MSG  *msg,
       
       build_key_event_state (event, key_state);
 
-      gdk_keymap_translate_keyboard_state (NULL,
+      gdk_keymap_translate_keyboard_state (_gdk_win32_display_get_keymap (_gdk_display),
 					   event->key.hardware_keycode,
 					   event->key.state,
 					   event->key.group,
@@ -2089,7 +2068,7 @@ gdk_event_translate (MSG  *msg,
 
       for (i = 0; i < ccount; i++)
 	{
-	  if (((GdkWindowObject *) window)->event_mask & GDK_KEY_PRESS_MASK)
+	  if (window->event_mask & GDK_KEY_PRESS_MASK)
 	    {
 	      /* Build a key press event */
 	      event = gdk_event_new (GDK_KEY_PRESS);
@@ -2100,7 +2079,7 @@ gdk_event_translate (MSG  *msg,
 	      append_event (event);
 	    }
 	  
-	  if (((GdkWindowObject *) window)->event_mask & GDK_KEY_RELEASE_MASK)
+	  if (window->event_mask & GDK_KEY_RELEASE_MASK)
 	    {
 	      /* Build a key release event.  */
 	      event = gdk_event_new (GDK_KEY_RELEASE);
@@ -2174,7 +2153,7 @@ gdk_event_translate (MSG  *msg,
 
       assign_object (&window, find_window_for_mouse_event (window, msg));
 #if 0
-      if (((GdkWindowObject *) window)->extension_events != 0 &&
+      if (window->extension_events != 0 &&
 	  _gdk_input_ignore_core)
 	{
 	  GDK_NOTE (EVENTS, g_print (" (ignored)"));
@@ -2244,7 +2223,7 @@ gdk_event_translate (MSG  *msg,
 			 GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
 #if 0 /* TODO_CSW? */
       if (current_toplevel != NULL &&
-	  (((GdkWindowObject *) current_toplevel)->event_mask & GDK_LEAVE_NOTIFY_MASK))
+	  (current_toplevel->event_mask & GDK_LEAVE_NOTIFY_MASK))
 	{
 	  synthesize_enter_or_leave_event (current_toplevel, msg,
 	                                   GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL, GDK_NOTIFY_ANCESTOR);
@@ -2357,7 +2336,7 @@ gdk_event_translate (MSG  *msg,
 	 GdkWindow *tmp;
 
 	 if (gdk_window_get_window_type (window) == GDK_WINDOW_TEMP 
-	     || !((GdkWindowObject *)window)->accept_focus)
+	     || !window->accept_focus)
 	   {
 	     *ret_valp = MA_NOACTIVATE;
 	     return_val = TRUE;
@@ -2390,7 +2369,7 @@ gdk_event_translate (MSG  *msg,
 	  !keyboard_grab->owner_events)
 	break;
 
-      if (!(((GdkWindowObject *) window)->event_mask & GDK_FOCUS_CHANGE_MASK))
+      if (!(window->event_mask & GDK_FOCUS_CHANGE_MASK))
 	break;
 
       if (GDK_WINDOW_DESTROYED (window))
@@ -2433,7 +2412,7 @@ gdk_event_translate (MSG  *msg,
       if (grab_window != NULL && p_grab_cursor != NULL)
 	hcursor = p_grab_cursor;
       else if (!GDK_WINDOW_DESTROYED (window))
-	hcursor = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->hcursor;
+	hcursor = GDK_WINDOW_IMPL_WIN32 (window->impl)->hcursor;
       else
 	hcursor = NULL;
 
@@ -2456,7 +2435,7 @@ gdk_event_translate (MSG  *msg,
 				     (msg->lParam == SW_PARENTOPENING ? "PARENTOPENING" :
 				      "???")))))));
 
-      if (!(((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK))
+      if (!(window->event_mask & GDK_STRUCTURE_MASK))
 	break;
 
       if (msg->lParam == SW_OTHERUNZOOM ||
@@ -2473,7 +2452,7 @@ gdk_event_translate (MSG  *msg,
 
       if (event->any.type == GDK_UNMAP)
 	{
-	  impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+	  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
 	  if (impl->transient_owner && GetForegroundWindow () == GDK_WINDOW_HWND (window))
 	    {
@@ -2539,7 +2518,7 @@ gdk_event_translate (MSG  *msg,
 	  GdkWindowState withdrawn_bit =
 	    IsWindowVisible (msg->hwnd) ? GDK_WINDOW_STATE_WITHDRAWN : 0;
 
-	  if (((GdkWindowObject *) window)->state & GDK_WINDOW_STATE_ICONIFIED)
+	  if (window->state & GDK_WINDOW_STATE_ICONIFIED)
 	    ensure_stacking_on_unminimize (msg);
 
 	  if (!GDK_WINDOW_DESTROYED (window))
@@ -2566,10 +2545,10 @@ gdk_event_translate (MSG  *msg,
 					   GDK_WINDOW_STATE_MAXIMIZED);
 	    }
 
-	  if (((GdkWindowObject *) window)->resize_count > 1)
-	    ((GdkWindowObject *) window)->resize_count -= 1;
+	  if (window->resize_count > 1)
+	    window->resize_count -= 1;
 	  
-	  if (((GdkWindowObject *) window)->extension_events != 0)
+	  if (window->extension_events != 0)
       _gdk_device_wintab_update_window_coords (window);
 
 	  return_val = TRUE;
@@ -2628,11 +2607,11 @@ gdk_event_translate (MSG  *msg,
 	 GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
 	 !GDK_WINDOW_DESTROYED (window))
 	{
-	  if (((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK)
+	  if (window->event_mask & GDK_STRUCTURE_MASK)
 	    {
 	      GDK_NOTE (EVENTS, g_print (" do magic"));
-	      if (((GdkWindowObject *) window)->resize_count > 1)
-		((GdkWindowObject *) window)->resize_count -= 1;
+	      if (window->resize_count > 1)
+		window->resize_count -= 1;
 
 	      handle_configure_event (msg, window);
 	      g_main_context_iteration (NULL, FALSE);
@@ -2664,7 +2643,7 @@ gdk_event_translate (MSG  *msg,
 				 _gdk_win32_rect_to_string (&rect),
 				 _gdk_win32_rect_to_string (drag)));
 
-      impl = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl);
+      impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
       orig_drag = *drag;
       if (impl->hint_flags & GDK_HINT_RESIZE_INC)
 	{
@@ -2867,7 +2846,7 @@ gdk_event_translate (MSG  *msg,
       if (GDK_WINDOW_DESTROYED (window))
 	break;
 
-      impl = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl);
+      impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
       mmi = (MINMAXINFO*) msg->lParam;
       GDK_NOTE (EVENTS, g_print (" (mintrack:%ldx%ld maxtrack:%ldx%ld "
 				 "maxpos:%+ld%+ld maxsize:%ldx%ld)",
@@ -2941,7 +2920,7 @@ gdk_event_translate (MSG  *msg,
 
       append_event (event);
 
-      impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+      impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
       if (impl->transient_owner && GetForegroundWindow() == GDK_WINDOW_HWND (window))
 	{
@@ -3137,7 +3116,7 @@ done:
 }
 
 void
-_gdk_events_queue (GdkDisplay *display)
+_gdk_win32_display_queue_events (GdkDisplay *display)
 {
   MSG msg;
 
@@ -3205,7 +3184,7 @@ gdk_event_dispatch (GSource     *source,
  
   GDK_THREADS_ENTER ();
 
-  _gdk_events_queue (_gdk_display);
+  _gdk_win32_display_queue_events (_gdk_display);
   event = _gdk_event_unqueue (_gdk_display);
 
   if (event)
@@ -3254,9 +3233,9 @@ check_for_too_much_data (GdkEvent *event)
 }
 
 gboolean
-gdk_event_send_client_message_for_display (GdkDisplay     *display,
-                                           GdkEvent       *event, 
-                                           GdkNativeWindow winid)
+_gdk_win32_display_send_client_message (GdkDisplay     *display,
+                                        GdkEvent       *event, 
+                                        GdkNativeWindow winid)
 {
   check_for_too_much_data (event);
 
@@ -3266,7 +3245,7 @@ gdk_event_send_client_message_for_display (GdkDisplay     *display,
 }
 
 void
-gdk_screen_broadcast_client_message (GdkScreen *screen, 
+_gdk_win32_screen_broadcast_client_message (GdkScreen *screen, 
 				     GdkEvent  *event)
 {
   check_for_too_much_data (event);
@@ -3277,24 +3256,7 @@ gdk_screen_broadcast_client_message (GdkScreen *screen,
 }
 
 void
-gdk_flush (void)
-{
-#if 0
-  MSG msg;
-
-  /* Process all messages currently available */
-  while (PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE))
-    {
-      TranslateMessage (&msg);
-      DispatchMessageW (&msg);
-    }
-#endif
-
-  GdiFlush ();
-}
-
-void
-gdk_display_sync (GdkDisplay * display)
+_gdk_win32_display_sync (GdkDisplay * display)
 {
   MSG msg;
 
@@ -3305,27 +3267,3 @@ gdk_display_sync (GdkDisplay * display)
     DispatchMessageW (&msg);
 }
 
-void
-gdk_display_flush (GdkDisplay * display)
-{
-  g_return_if_fail (display == _gdk_display);
-
-  /* Nothing */
-}
-
-gboolean
-gdk_net_wm_supports (GdkAtom property)
-{
-  return FALSE;
-}
-
-void
-_gdk_windowing_event_data_copy (const GdkEvent *src,
-                                GdkEvent       *dst)
-{
-}
-
-void
-_gdk_windowing_event_data_free (GdkEvent *event)
-{
-}
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index 947095e..c169208 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -42,6 +42,7 @@
 #include "gdk.h"		/* For gdk_rectangle_intersect */
 #include "gdkinternals.h"
 #include "gdkprivate-win32.h"
+#include "gdkwin32.h"
 
 #define SIZE_LIMIT 32767
 
@@ -58,22 +59,20 @@ _gdk_window_move_resize_child (GdkWindow *window,
 			       gint       height)
 {
   GdkWindowImplWin32 *impl;
-  GdkWindowObject *obj;
   gboolean is_move;
   gboolean is_resize;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  obj = GDK_WINDOW_OBJECT (window);
-  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
-  is_move = (x - obj->x != 0) && (y - obj->y != 0);
-  is_resize = obj->width != width && obj->height != height;
+  is_move = (x - window->x != 0) && (y - window->y != 0);
+  is_resize = window->width != width && window->height != height;
   
   GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %s %+d%+d %dx%d %+d%+d\n",
-			   _gdk_win32_drawable_description (window),
-			   obj->x, obj->y, width, height, x, y));
+			   _gdk_win32_window_description (window),
+			   window->x, window->y, width, height, x, y));
 
   if (width > 65535 || height > 65535)
   {
@@ -85,10 +84,10 @@ _gdk_window_move_resize_child (GdkWindow *window,
       height = 65535;
   }
 
-  obj->x = x;
-  obj->y = y;
-  obj->width = width;
-  obj->height = height;
+  window->x = x;
+  window->y = y;
+  window->width = width;
+  window->height = height;
 
   _gdk_win32_window_tmp_unset_parent_bg (window);
   _gdk_win32_window_tmp_unset_bg (window, TRUE);
@@ -96,19 +95,18 @@ _gdk_window_move_resize_child (GdkWindow *window,
   GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
 			   "NOACTIVATE|NOZORDER%s%s)\n",
 			   GDK_WINDOW_HWND (window),
-			   obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y, 
+			   window->x + window->parent->abs_x, window->y + window->parent->abs_y, 
 			   width, height,
 			   (is_move ? "" : "|NOMOVE"),
 			   (is_resize ? "" : "|NOSIZE")));
 
   API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
-			   obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y, 
+			   window->x + window->parent->abs_x, window->y + window->parent->abs_y, 
 			   width, height,
 			   SWP_NOACTIVATE | SWP_NOZORDER | 
 			   (is_move ? 0 : SWP_NOMOVE) |
 			   (is_resize ? 0 : SWP_NOSIZE)));
 
-  //_gdk_win32_window_tmp_reset_parent_bg (window);
   _gdk_win32_window_tmp_reset_bg (window, TRUE);
 }
 
@@ -116,28 +114,24 @@ void
 _gdk_win32_window_tmp_unset_bg (GdkWindow *window,
 				gboolean recurse)
 {
-  GdkWindowObject *private;
-
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  private = (GdkWindowObject *)window;
-
-  if (private->input_only || private->destroyed ||
-      (private->window_type != GDK_WINDOW_ROOT &&
+  if (window->input_only || window->destroyed ||
+      (window->window_type != GDK_WINDOW_ROOT &&
        !GDK_WINDOW_IS_MAPPED (window)))
     return;
 
   if (_gdk_window_has_impl (window) &&
       GDK_WINDOW_IS_WIN32 (window) &&
-      private->window_type != GDK_WINDOW_ROOT &&
-      private->window_type != GDK_WINDOW_FOREIGN)
+      window->window_type != GDK_WINDOW_ROOT &&
+      window->window_type != GDK_WINDOW_FOREIGN)
     tmp_unset_bg (window);
 
   if (recurse)
     {
       GList *l;
 
-      for (l = private->children; l != NULL; l = l->next)
+      for (l = window->children; l != NULL; l = l->next)
 	_gdk_win32_window_tmp_unset_bg (l->data, TRUE);
     }
 }
@@ -146,10 +140,8 @@ static void
 tmp_unset_bg (GdkWindow *window)
 {
   GdkWindowImplWin32 *impl;
-  GdkWindowObject *obj;
 
-  obj = (GdkWindowObject *) window;
-  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   impl->no_bg = TRUE;
 }
@@ -157,11 +149,9 @@ tmp_unset_bg (GdkWindow *window)
 static void
 tmp_reset_bg (GdkWindow *window)
 {
-  GdkWindowObject *obj;
   GdkWindowImplWin32 *impl;
 
-  obj = GDK_WINDOW_OBJECT (window);
-  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   impl->no_bg = FALSE;
 }
@@ -169,12 +159,10 @@ tmp_reset_bg (GdkWindow *window)
 void
 _gdk_win32_window_tmp_unset_parent_bg (GdkWindow *window)
 {
-  GdkWindowObject *private = (GdkWindowObject*)window;
-
-  if (GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT)
+  if (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT)
     return;
 
-  window = _gdk_window_get_impl_window ((GdkWindow*)private->parent);
+  window = _gdk_window_get_impl_window (window->parent);
   _gdk_win32_window_tmp_unset_bg (window, FALSE);
 }
 
@@ -182,18 +170,16 @@ void
 _gdk_win32_window_tmp_reset_bg (GdkWindow *window,
 				gboolean   recurse)
 {
-  GdkWindowObject *private = (GdkWindowObject*)window;
-
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (private->input_only || private->destroyed ||
-      (private->window_type != GDK_WINDOW_ROOT && !GDK_WINDOW_IS_MAPPED (window)))
+  if (window->input_only || window->destroyed ||
+      (window->window_type != GDK_WINDOW_ROOT && !GDK_WINDOW_IS_MAPPED (window)))
     return;
 
   if (_gdk_window_has_impl (window) &&
       GDK_WINDOW_IS_WIN32 (window) &&
-      private->window_type != GDK_WINDOW_ROOT &&
-      private->window_type != GDK_WINDOW_FOREIGN)
+      window->window_type != GDK_WINDOW_ROOT &&
+      window->window_type != GDK_WINDOW_FOREIGN)
     {
       tmp_reset_bg (window);
     }
@@ -202,79 +188,7 @@ _gdk_win32_window_tmp_reset_bg (GdkWindow *window,
     {
       GList *l;
 
-      for (l = private->children; l != NULL; l = l->next)
+      for (l = window->children; l != NULL; l = l->next)
 	_gdk_win32_window_tmp_reset_bg (l->data, TRUE);
     }
 }
-
-/*
-void
-_gdk_win32_window_tmp_reset_bg (GdkWindow *window)
-{
-  GdkWindowImplWin32 *impl;
-  GdkWindowObject *obj;
-
-  obj = (GdkWindowObject *) window;
-  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
-
-  impl->no_bg = FALSE;
-}
-*/
-
-#if 0
-static cairo_region_t *
-gdk_window_clip_changed (GdkWindow    *window,
-			 GdkRectangle *old_clip,
-			 GdkRectangle *new_clip)
-{
-  GdkWindowImplWin32 *impl;
-  GdkWindowObject *obj;
-  cairo_region_t *old_clip_region;
-  cairo_region_t *new_clip_region;
-  
-  if (((GdkWindowObject *)window)->input_only)
-    return NULL;
-
-  obj = (GdkWindowObject *) window;
-  impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
-  
-  old_clip_region = cairo_region_create_rectangle (old_clip);
-  new_clip_region = cairo_region_create_rectangle (new_clip);
-
-  /* Trim invalid region of window to new clip rectangle
-   */
-  if (obj->update_area)
-    cairo_region_intersect (obj->update_area, new_clip_region);
-
-  /* Invalidate newly exposed portion of window
-   */
-  cairo_region_subtract (new_clip_region, old_clip_region);
-  if (!cairo_region_is_empty (new_clip_region))
-    gdk_window_tmp_unset_bg (window);
-  else
-    {
-      cairo_region_destroy (new_clip_region);
-      new_clip_region = NULL;
-    }
-
-  cairo_region_destroy (old_clip_region);
-
-  return new_clip_region;
-}
-#endif
-
-#if 0
-static void
-gdk_window_post_scroll (GdkWindow    *window,
-			cairo_region_t    *new_clip_region)
-{
-  GDK_NOTE (EVENTS,
-	    g_print ("gdk_window_clip_changed: invalidating region: %s\n",
-		     _gdk_win32_cairo_region_to_string (new_clip_region)));
-
-  gdk_window_invalidate_region (window, new_clip_region, FALSE);
-  g_print ("gdk_window_post_scroll\n");
-  cairo_region_destroy (new_clip_region);
-}
-
-#endif
diff --git a/gdk/win32/gdkinput.c b/gdk/win32/gdkinput.c
index 32de7fc..64e461d 100644
--- a/gdk/win32/gdkinput.c
+++ b/gdk/win32/gdkinput.c
@@ -34,7 +34,8 @@
 #include "config.h"
 
 #include "gdkdisplay.h"
-#include "gdkinput.h"
+#include "gdkdevice.h"
+#include "gdkdisplayprivate.h"
 
 #include "gdkprivate-win32.h"
 #include "gdkdevicemanager-win32.h"
@@ -47,11 +48,11 @@ GList            *_gdk_input_windows;
 GList *
 gdk_devices_list (void)
 {
-  return gdk_display_list_devices (_gdk_display);
+  return _gdk_win32_display_list_devices (_gdk_display);
 }
 
 GList *
-gdk_display_list_devices (GdkDisplay *dpy)
+_gdk_win32_display_list_devices (GdkDisplay *dpy)
 {
   g_return_val_if_fail (dpy == _gdk_display, NULL);
 
@@ -69,7 +70,6 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
                                 GdkExtensionMode mode)
 {
   GdkDeviceManager *device_manager;
-  GdkWindowObject *window_private;
   GList *devices, *d;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -80,8 +80,7 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
   if (mode == GDK_EXTENSION_EVENTS_NONE)
     mask = 0;
 
-  window_private = (GdkWindowObject *) window;
-  window_private->extension_events = mask;
+  window->extension_events = mask;
 
   device_manager = gdk_display_get_device_manager (_gdk_display);
   devices = gdk_device_manager_list_devices (device_manager,
diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c
index dbeb109..8b253d4 100644
--- a/gdk/win32/gdkkeys-win32.c
+++ b/gdk/win32/gdkkeys-win32.c
@@ -35,9 +35,28 @@
 #include "gdkprivate-win32.h"
 #include "gdkinternals.h"
 #include "gdkkeysyms.h"
+#include "gdkkeysprivate.h"
+#include "gdkwin32keys.h"
 
 #include "config.h"
 
+struct _GdkWin32KeymapClass
+{
+  GdkKeymapClass parent_class;
+};
+
+struct _GdkWin32Keymap
+{
+  GdkKeymap parent_instance;
+};
+
+G_DEFINE_TYPE (GdkWin32Keymap, gdk_win32_keymap, GDK_TYPE_KEYMAP)
+
+static void
+gdk_win32_keymap_init (GdkWin32Keymap *keymap)
+{
+}
+
 guint _gdk_keymap_serial = 0;
 gboolean _gdk_keyboard_has_altgr = FALSE;
 guint _scancode_rshift = 0;
@@ -489,18 +508,18 @@ update_keymap (void)
 } 
 
 GdkKeymap*
-gdk_keymap_get_for_display (GdkDisplay *display)
+_gdk_win32_display_get_keymap (GdkDisplay *display)
 {
   g_return_val_if_fail (display == gdk_display_get_default (), NULL);
 
   if (default_keymap == NULL)
-    default_keymap = g_object_new (gdk_keymap_get_type (), NULL);
+    default_keymap = g_object_new (gdk_win32_keymap_get_type (), NULL);
 
   return default_keymap;
 }
 
-PangoDirection
-gdk_keymap_get_direction (GdkKeymap *keymap)
+static PangoDirection
+gdk_win32_keymap_get_direction (GdkKeymap *keymap)
 {
   update_keymap ();
 
@@ -520,8 +539,8 @@ gdk_keymap_get_direction (GdkKeymap *keymap)
     }
 }
 
-gboolean
-gdk_keymap_have_bidi_layouts (GdkKeymap *keymap)
+static gboolean
+gdk_win32_keymap_have_bidi_layouts (GdkKeymap *keymap)
 {
   /* Should we check if the kayboard layouts switchable at the moment
    * cover both directionalities? What does the doc comment in
@@ -530,20 +549,20 @@ gdk_keymap_have_bidi_layouts (GdkKeymap *keymap)
   return FALSE;
 }
 
-gboolean
-gdk_keymap_get_caps_lock_state (GdkKeymap *keymap)
+static gboolean
+gdk_win32_keymap_get_caps_lock_state (GdkKeymap *keymap)
 {
   return ((GetKeyState (VK_CAPITAL) & 1) != 0);
 }
 
-gboolean
-gdk_keymap_get_num_lock_state (GdkKeymap *keymap)
+static gboolean
+gdk_win32_keymap_get_num_lock_state (GdkKeymap *keymap)
 {
   return ((GetKeyState (VK_NUMLOCK) & 1) != 0);
 }
 
-gboolean
-gdk_keymap_get_entries_for_keyval (GdkKeymap     *keymap,
+static gboolean
+gdk_win32_keymap_get_entries_for_keyval (GdkKeymap     *keymap,
                                    guint          keyval,
                                    GdkKeymapKey **keys,
                                    gint          *n_keys)
@@ -618,8 +637,8 @@ gdk_keymap_get_entries_for_keyval (GdkKeymap     *keymap,
   return *n_keys > 0;
 }
 
-gboolean
-gdk_keymap_get_entries_for_keycode (GdkKeymap     *keymap,
+static gboolean
+gdk_win32_keymap_get_entries_for_keycode (GdkKeymap     *keymap,
                                     guint          hardware_keycode,
                                     GdkKeymapKey **keys,
                                     guint        **keyvals,
@@ -712,8 +731,8 @@ gdk_keymap_get_entries_for_keycode (GdkKeymap     *keymap,
   return *n_entries > 0;
 }
 
-guint
-gdk_keymap_lookup_key (GdkKeymap          *keymap,
+static guint
+gdk_win32_keymap_lookup_key (GdkKeymap          *keymap,
                        const GdkKeymapKey *key)
 {
   guint sym;
@@ -741,8 +760,8 @@ gdk_keymap_lookup_key (GdkKeymap          *keymap,
     return sym;
 }
 
-gboolean
-gdk_keymap_translate_keyboard_state (GdkKeymap       *keymap,
+static gboolean
+gdk_win32_keymap_translate_keyboard_state (GdkKeymap       *keymap,
                                      guint            hardware_keycode,
                                      GdkModifierType  state,
                                      gint             group,
@@ -878,16 +897,41 @@ gdk_keymap_translate_keyboard_state (GdkKeymap       *keymap,
   return tmp_keyval != GDK_KEY_VoidSymbol;
 }
 
-void
-gdk_keymap_add_virtual_modifiers (GdkKeymap       *keymap,
+static void
+gdk_win32_keymap_add_virtual_modifiers (GdkKeymap       *keymap,
                                   GdkModifierType *state)
 {
 }
 
-gboolean
-gdk_keymap_map_virtual_modifiers (GdkKeymap       *keymap,
+static gboolean
+gdk_win32_keymap_map_virtual_modifiers (GdkKeymap       *keymap,
                                   GdkModifierType *state)
 {
   /* FIXME: Is this the right thing to do? */
   return TRUE;
 }
+
+static void
+gdk_win32_keymap_finalize (GObject *object)
+{
+}
+
+static void
+gdk_win32_keymap_class_init (GdkWin32KeymapClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkKeymapClass *keymap_class = GDK_KEYMAP_CLASS (klass);
+
+  object_class->finalize = gdk_win32_keymap_finalize;
+
+  keymap_class->get_direction = gdk_win32_keymap_get_direction;
+  keymap_class->have_bidi_layouts = gdk_win32_keymap_have_bidi_layouts;
+  keymap_class->get_caps_lock_state = gdk_win32_keymap_get_caps_lock_state;
+  keymap_class->get_num_lock_state = gdk_win32_keymap_get_num_lock_state;
+  keymap_class->get_entries_for_keyval = gdk_win32_keymap_get_entries_for_keyval;
+  keymap_class->get_entries_for_keycode = gdk_win32_keymap_get_entries_for_keycode;
+  keymap_class->lookup_key = gdk_win32_keymap_lookup_key;
+  keymap_class->translate_keyboard_state = gdk_win32_keymap_translate_keyboard_state;
+  keymap_class->add_virtual_modifiers = gdk_win32_keymap_add_virtual_modifiers;
+  keymap_class->map_virtual_modifiers = gdk_win32_keymap_map_virtual_modifiers;
+}
diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c
index afc6a22..a876631 100644
--- a/gdk/win32/gdkmain-win32.c
+++ b/gdk/win32/gdkmain-win32.c
@@ -38,6 +38,7 @@
 #include "gdkinternals.h"
 #include "gdkintl.h"
 #include "gdkprivate-win32.h"
+#include "gdkwin32.h"
 
 #include <objbase.h>
 
@@ -64,7 +65,7 @@ const GOptionEntry _gdk_windowing_args[] = {
   { NULL }
 };
 
-int __stdcall
+BOOL WINAPI
 DllMain (HINSTANCE hinstDLL,
 	 DWORD     dwReason,
 	 LPVOID    reserved)
@@ -75,7 +76,7 @@ DllMain (HINSTANCE hinstDLL,
 }
 
 void
-_gdk_windowing_init (void)
+_gdk_win32_windowing_init (void)
 {
   gchar buf[10];
 
@@ -151,67 +152,6 @@ _gdk_other_api_failed (const gchar *where,
   g_warning ("%s: %s failed", where, api);
 }
 
-gint
-gdk_screen_get_width (GdkScreen *screen)
-{
-  return GDK_WINDOW_OBJECT (_gdk_root)->width;
-}
-
-gint
-gdk_screen_get_height (GdkScreen *screen)
-{
-  return GDK_WINDOW_OBJECT (_gdk_root)->height;
-}
-gint
-gdk_screen_get_width_mm (GdkScreen *screen)
-{
-  return (double) gdk_screen_get_width (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSX) * 25.4;
-}
-
-gint
-gdk_screen_get_height_mm (GdkScreen *screen)
-{
-  return (double) gdk_screen_get_height (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSY) * 25.4;
-}
-
-void
-gdk_display_beep (GdkDisplay *display)
-{
-  g_return_if_fail (display == gdk_display_get_default());
-  Beep(1000, 50);
-}
-
-void
-gdk_error_trap_push (void)
-{
-}
-
-gint
-gdk_error_trap_pop (void)
-{
-  return 0;
-}
-
-void
-gdk_error_trap_pop_ignored (void)
-{
-}
-
-void
-gdk_notify_startup_complete (void)
-{
-}
-
-void
-gdk_notify_startup_complete_with_id (const gchar* startup_id)
-{
-}
-
-void          
-gdk_window_set_startup_id (GdkWindow   *window,
-			   const gchar *startup_id)
-{
-}
 
 #ifdef G_ENABLE_DEBUG
 
@@ -1021,13 +961,13 @@ _gdk_win32_cairo_region_to_string (const cairo_region_t *rgn)
 }
 
 gchar *
-_gdk_win32_drawable_description (GdkDrawable *d)
+_gdk_win32_window_description (GdkWindow *d)
 {
-  g_return_val_if_fail (GDK_IS_DRAWABLE (d), NULL);
+  g_return_val_if_fail (GDK_IS_WINDOW (d), NULL);
 
   return static_printf ("%s:%p:%dx%dx%d",
 			G_OBJECT_TYPE_NAME (d),
-			GDK_DRAWABLE_HANDLE (d),
+			GDK_WINDOW_HWND (d),
 			gdk_window_get_width (GDK_WINDOW (d)),
                         gdk_window_get_height (GDK_WINDOW (d)),
                         gdk_visual_get_depth (gdk_window_get_visual (GDK_WINDOW (d))));
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index f118a9c..6ff1cad 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -36,6 +36,7 @@
 #endif
 
 #include <gdk/gdkprivate.h>
+#include <gdk/gdkcursorprivate.h>
 #include <gdk/win32/gdkwindow-win32.h>
 
 #include "gdkinternals.h"
@@ -103,16 +104,15 @@
 #define GDK_DEBUG_MISC_OR_COLORMAP (GDK_DEBUG_MISC|GDK_DEBUG_COLORMAP)
 #define GDK_DEBUG_MISC_OR_EVENTS (GDK_DEBUG_MISC|GDK_DEBUG_EVENTS)
 
-//#define GDK_WINDOW_SCREEN(win)         (_gdk_screen)
 GdkScreen *GDK_WINDOW_SCREEN(GObject *win);
 
-#define GDK_WINDOW_IS_WIN32(win)        (GDK_IS_WINDOW_IMPL_WIN32 (((GdkWindowObject *)win)->impl))
+#define GDK_WINDOW_IS_WIN32(win)        (GDK_IS_WINDOW_IMPL_WIN32 (win->impl))
 
 typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
-typedef struct _GdkCursorPrivate        GdkCursorPrivate;
+typedef struct _GdkWin32Cursor          GdkWin32Cursor;
 typedef struct _GdkWin32SingleFont      GdkWin32SingleFont;
 
-struct _GdkCursorPrivate
+struct _GdkWin32Cursor
 {
   GdkCursor cursor;
   HCURSOR hcursor;
@@ -126,11 +126,6 @@ struct _GdkWin32SingleFont
   FONTSIGNATURE fs;
 };
 
-struct _GdkVisualClass
-{
-  GObjectClass parent_class;
-};
-
 typedef enum {
   GDK_WIN32_PE_STATIC,
   GDK_WIN32_PE_AVAILABLE,
@@ -208,7 +203,7 @@ gchar *_gdk_win32_window_style_to_string (LONG style);
 gchar *_gdk_win32_window_exstyle_to_string (LONG style);
 gchar *_gdk_win32_window_pos_bits_to_string (UINT flags);
 gchar *_gdk_win32_drag_action_to_string (GdkDragAction actions);
-gchar *_gdk_win32_drawable_description (GdkDrawable *d);
+gchar *_gdk_win32_window_description (GdkWindow *d);
 
 gchar *_gdk_win32_rop2_to_string       (int          rop2);
 gchar *_gdk_win32_lbstyle_to_string    (UINT         brush_style);
@@ -371,7 +366,149 @@ HICON _gdk_win32_pixbuf_to_hcursor (GdkPixbuf *pixbuf,
 				    gint       y_hotspot);
 gboolean _gdk_win32_pixbuf_to_hicon_supports_alpha (void);
 
+/* GdkDisplay member functions */
+GdkNativeWindow _gdk_win32_display_get_drag_protocol (GdkDisplay      *display,
+						      GdkNativeWindow  xid,
+						      GdkDragProtocol *protocol,
+						      guint           *version);
+
+GdkCursor *_gdk_win32_display_get_cursor_for_type (GdkDisplay   *display,
+						   GdkCursorType cursor_type);
+GdkCursor *_gdk_win32_display_get_cursor_for_name (GdkDisplay  *display,
+						   const gchar *name);
+GdkCursor *_gdk_win32_display_get_cursor_for_pixbuf (GdkDisplay *display, 
+						     GdkPixbuf  *pixbuf,
+						     gint        x,
+						     gint        y);
+void     _gdk_win32_display_get_default_cursor_size (GdkDisplay  *display,
+						     guint       *width,
+						     guint       *height);
+void     _gdk_win32_display_get_maximal_cursor_size (GdkDisplay  *display,
+						     guint       *width,
+						     guint       *height);
+gboolean _gdk_win32_display_supports_cursor_alpha (GdkDisplay    *display);
+gboolean _gdk_win32_display_supports_cursor_color (GdkDisplay    *display);
+
+GList *_gdk_win32_display_list_devices (GdkDisplay *dpy);
+
+gboolean _gdk_win32_display_send_client_message   (GdkDisplay     *display,
+						   GdkEvent       *event,
+						   GdkNativeWindow winid);
+void _gdk_win32_display_add_client_message_filter (GdkDisplay   *display,
+						   GdkAtom       message_type,
+						   GdkFilterFunc func,
+						   gpointer      data);
+void _gdk_win32_display_sync (GdkDisplay * display);
+gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
+void _gdk_win32_display_queue_events (GdkDisplay *display);
+
+gboolean _gdk_win32_selection_owner_set_for_display (GdkDisplay *display,
+						     GdkWindow  *owner,
+						     GdkAtom     selection,
+						     guint32     time,
+						     gboolean    send_event);
+GdkWindow *_gdk_win32_display_get_selection_owner   (GdkDisplay *display,
+						     GdkAtom     selection);
+gboolean   _gdk_win32_display_set_selection_owner   (GdkDisplay *display,
+						     GdkWindow  *owner,
+						     GdkAtom     selection,
+						     guint32     time,
+						     gboolean    send_event);
+void       _gdk_win32_display_send_selection_notify (GdkDisplay      *display,
+						     GdkNativeWindow  requestor,
+						     GdkAtom   	      selection,
+						     GdkAtom          target,
+						     GdkAtom          property,
+						     guint32          time);
+gint      _gdk_win32_display_get_selection_property (GdkDisplay *display,
+						     GdkWindow  *requestor,
+						     guchar    **data,
+						     GdkAtom    *ret_type,
+						     gint       *ret_format);
+void      _gdk_win32_display_convert_selection (GdkDisplay *display,
+						GdkWindow *requestor,
+						GdkAtom    selection,
+						GdkAtom    target,
+						guint32    time);
+gint      _gdk_win32_display_text_property_to_utf8_list (GdkDisplay    *display,
+							 GdkAtom        encoding,
+							 gint           format,
+							 const guchar  *text,
+							 gint           length,
+							 gchar       ***list);
+gchar     *_gdk_win32_display_utf8_to_string_target (GdkDisplay *display, const gchar *str);
+
+GdkKeymap *_gdk_win32_display_get_keymap (GdkDisplay *display);
+
+void       _gdk_win32_display_create_window_impl   (GdkDisplay    *display,
+                                                    GdkWindow     *window,
+                                                    GdkWindow     *real_parent,
+                                                    GdkScreen     *screen,
+                                                    GdkEventMask   event_mask,
+                                                    GdkWindowAttr *attributes,
+                                                    gint           attributes_mask);
+
+/* stray GdkWindowImplWin32 members */
+void _gdk_win32_window_register_dnd (GdkWindow *window);
+GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window, GdkDevice *device, GList *targets);
+gboolean _gdk_win32_window_simulate_key (GdkWindow      *window,
+				  gint            x,
+				  gint            y,
+				  guint           keyval,
+				  GdkModifierType modifiers,
+				  GdkEventType    key_pressrelease);
+gboolean _gdk_win32_window_simulate_button (GdkWindow      *window,
+				     gint            x,
+				     gint            y,
+				     guint           button, /*1..3*/
+				     GdkModifierType modifiers,
+				     GdkEventType    button_pressrelease);
+
+gint _gdk_win32_window_get_property (GdkWindow   *window,
+				     GdkAtom      property,
+				     GdkAtom      type,
+				     gulong       offset,
+				     gulong       length,
+				     gint         pdelete,
+				     GdkAtom     *actual_property_type,
+				     gint        *actual_format_type,
+				     gint        *actual_length,
+				     guchar     **data);
+void _gdk_win32_window_change_property (GdkWindow    *window,
+					GdkAtom       property,
+					GdkAtom       type,
+					gint          format,
+					GdkPropMode   mode,
+					const guchar *data,
+					gint          nelements);
+void _gdk_win32_window_delete_property (GdkWindow *window, GdkAtom    property);
+
+/* Stray GdkWin32Screen members */
+GdkVisual *_gdk_win32_screen_get_system_visual (GdkScreen *screen);
+void _gdk_win32_screen_broadcast_client_message (GdkScreen *screen, GdkEvent  *event);
+gboolean _gdk_win32_screen_get_setting (GdkScreen   *screen, const gchar *name, GValue *value);
+gint _gdk_win32_screen_visual_get_best_depth (GdkScreen *screen);
+GdkVisualType _gdk_win32_screen_visual_get_best_type (GdkScreen *screen);
+GdkVisual *_gdk_win32_screen_visual_get_best (GdkScreen *screen);
+GdkVisual *_gdk_win32_screen_visual_get_best_with_depth (GdkScreen *screen, gint depth);
+GdkVisual *_gdk_win32_screen_visual_get_best_with_type (GdkScreen *screen, GdkVisualType visual_type);
+GdkVisual *_gdk_win32_screen_visual_get_best_with_both (GdkScreen *screen, gint depth, GdkVisualType visual_type);
+void _gdk_win32_screen_query_depths  (GdkScreen *screen, gint **depths, gint  *count);
+void _gdk_win32_screen_query_visual_types (GdkScreen      *screen,
+				           GdkVisualType **visual_types,
+				           gint           *count);
+GList *_gdk_win32_screen_list_visuals (GdkScreen *screen);
+
+/* Distributed display manager implementation */
+GdkDisplay *_gdk_win32_display_open (const gchar *display_name);
+GdkAtom _gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
+						const gchar *atom_name,
+						gint         only_if_exists);
+gchar *_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager, 
+					         GdkAtom            atom);
+
 /* Initialization */
+void _gdk_win32_windowing_init (void);
 void _gdk_windowing_window_init (GdkScreen *screen);
 void _gdk_root_window_size_init (void);
 void _gdk_monitor_init(void);
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index 542f83a..b8882bc 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -34,10 +34,12 @@
 #include "gdkproperty.h"
 #include "gdkselection.h"
 #include "gdkprivate-win32.h"
+#include "gdkwin32.h"
 
 GdkAtom
-gdk_atom_intern (const gchar *atom_name,
-		 gint         only_if_exists)
+_gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
+					const gchar *atom_name,
+					gint         only_if_exists)
 {
   ATOM win32_atom;
   GdkAtom retval;
@@ -84,17 +86,9 @@ gdk_atom_intern (const gchar *atom_name,
   return retval;
 }
 
-GdkAtom
-gdk_atom_intern_static_string (const gchar *atom_name)
-{
-  /* on X11 this is supposed to save memory. On win32 there seems to be
-   * no way to make a difference ?
-   */
-  return gdk_atom_intern (atom_name, FALSE);
-}
-
 gchar *
-gdk_atom_name (GdkAtom atom)
+_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager, 
+					  GdkAtom            atom)
 {
   ATOM win32_atom;
   gchar name[256];
@@ -122,7 +116,7 @@ gdk_atom_name (GdkAtom atom)
 }
 
 gint
-gdk_property_get (GdkWindow   *window,
+_gdk_win32_window_get_property (GdkWindow   *window,
 		  GdkAtom      property,
 		  GdkAtom      type,
 		  gulong       offset,
@@ -145,7 +139,7 @@ gdk_property_get (GdkWindow   *window,
 }
 
 void
-gdk_property_change (GdkWindow    *window,
+_gdk_win32_window_change_property (GdkWindow    *window,
 		     GdkAtom       property,
 		     GdkAtom       type,
 		     gint          format,
@@ -268,8 +262,8 @@ gdk_property_change (GdkWindow    *window,
 }
 
 void
-gdk_property_delete (GdkWindow *window,
-		     GdkAtom    property)
+_gdk_win32_window_delete_property (GdkWindow *window,
+				   GdkAtom    property)
 {
   gchar *prop_name;
 
@@ -354,7 +348,7 @@ gdk_property_delete (GdkWindow *window,
 
 */
 gboolean
-gdk_screen_get_setting (GdkScreen   *screen,
+_gdk_win32_screen_get_setting (GdkScreen   *screen,
                         const gchar *name,
                         GValue      *value)
 {
diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c
index 047e948..12b18d5 100644
--- a/gdk/win32/gdkscreen-win32.c
+++ b/gdk/win32/gdkscreen-win32.c
@@ -20,37 +20,77 @@
 #include "config.h"
 #include "gdk.h"
 #include "gdkprivate-win32.h"
+#include "gdkscreenprivate.h"
+#include "gdkwin32screen.h"
 
-GdkDisplay *
-gdk_screen_get_display (GdkScreen *screen)
+struct _GdkWin32Screen
+{
+  GdkScreen parent_instance;
+};
+struct _GdkWin32ScreenClass
+{
+  GdkScreenClass parent_class;
+};
+G_DEFINE_TYPE (GdkWin32Screen, gdk_win32_screen, GDK_TYPE_SCREEN)
+static void
+gdk_win32_screen_init(GdkWin32Screen *display)
+{
+}
+
+static GdkDisplay *
+gdk_win32_screen_get_display (GdkScreen *screen)
 {
   return _gdk_display;
 }
 
-GdkWindow *
-gdk_screen_get_root_window (GdkScreen *screen)
+static gint
+gdk_win32_screen_get_width (GdkScreen *screen)
+{
+  return GDK_WINDOW (_gdk_root)->width;
+}
+
+static gint
+gdk_win32_screen_get_height (GdkScreen *screen)
+{
+  return GDK_WINDOW (_gdk_root)->height;
+}
+
+static gint
+gdk_win32_screen_get_width_mm (GdkScreen *screen)
+{
+  return (double) gdk_screen_get_width (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSX) * 25.4;
+}
+
+static gint
+gdk_win32_screen_get_height_mm (GdkScreen *screen)
+{
+  return (double) gdk_screen_get_height (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSY) * 25.4;
+}
+
+static GdkWindow *
+gdk_win32_screen_get_root_window (GdkScreen *screen)
 {
   return _gdk_root;
 }
 
-gint
-gdk_screen_get_n_monitors (GdkScreen *screen)
+static gint
+gdk_win32_screen_get_n_monitors (GdkScreen *screen)
 {
   g_return_val_if_fail (screen == _gdk_screen, 0);
 
   return _gdk_num_monitors;
 }
 
-gint
-gdk_screen_get_primary_monitor (GdkScreen *screen)
+static gint
+gdk_win32_screen_get_primary_monitor (GdkScreen *screen)
 {
   g_return_val_if_fail (screen == _gdk_screen, 0);
 
   return 0;
 }
 
-gint
-gdk_screen_get_monitor_width_mm (GdkScreen *screen,
+static gint
+gdk_win32_screen_get_monitor_width_mm (GdkScreen *screen,
                                  gint       num_monitor)
 {
   g_return_val_if_fail (screen == _gdk_screen, 0);
@@ -60,8 +100,8 @@ gdk_screen_get_monitor_width_mm (GdkScreen *screen,
   return _gdk_monitors[num_monitor].width_mm;
 }
 
-gint
-gdk_screen_get_monitor_height_mm (GdkScreen *screen,
+static gint
+gdk_win32_screen_get_monitor_height_mm (GdkScreen *screen,
                                   gint       num_monitor)
 {
   g_return_val_if_fail (screen == _gdk_screen, 0);
@@ -71,8 +111,8 @@ gdk_screen_get_monitor_height_mm (GdkScreen *screen,
   return _gdk_monitors[num_monitor].height_mm;
 }
 
-gchar *
-gdk_screen_get_monitor_plug_name (GdkScreen *screen,
+static gchar *
+gdk_win32_screen_get_monitor_plug_name (GdkScreen *screen,
                                   gint       num_monitor)
 {
   g_return_val_if_fail (screen == _gdk_screen, 0);
@@ -82,8 +122,8 @@ gdk_screen_get_monitor_plug_name (GdkScreen *screen,
   return g_strdup (_gdk_monitors[num_monitor].name);
 }
 
-void
-gdk_screen_get_monitor_geometry (GdkScreen    *screen, 
+static void
+gdk_win32_screen_get_monitor_geometry (GdkScreen    *screen, 
 				 gint          num_monitor,
 				 GdkRectangle *dest)
 {
@@ -94,16 +134,16 @@ gdk_screen_get_monitor_geometry (GdkScreen    *screen,
   *dest = _gdk_monitors[num_monitor].rect;
 }
 
-GdkVisual *
-gdk_screen_get_rgba_visual (GdkScreen *screen)
+static GdkVisual *
+gdk_win32_screen_get_rgba_visual (GdkScreen *screen)
 {
   g_return_val_if_fail (screen == _gdk_screen, NULL);
 
   return NULL;
 }
   
-gint
-gdk_screen_get_number (GdkScreen *screen)
+static gint
+gdk_win32_screen_get_number (GdkScreen *screen)
 {
   g_return_val_if_fail (screen == _gdk_screen, 0);  
   
@@ -120,32 +160,83 @@ _gdk_windowing_substitute_screen_number (const gchar *display_name,
   return g_strdup (display_name);
 }
 
-gchar *
-gdk_screen_make_display_name (GdkScreen *screen)
+static gchar *
+gdk_win32_screen_make_display_name (GdkScreen *screen)
 {
   return g_strdup (gdk_display_get_name (_gdk_display));
 }
 
-GdkWindow *
-gdk_screen_get_active_window (GdkScreen *screen)
+static GdkWindow *
+gdk_win32_screen_get_active_window (GdkScreen *screen)
 {
   g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
 
   return NULL;
 }
 
-GList *
-gdk_screen_get_window_stack (GdkScreen *screen)
+static GList *
+gdk_win32_screen_get_window_stack (GdkScreen *screen)
 {
   g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
 
   return NULL;
 }
 
-gboolean
-gdk_screen_is_composited (GdkScreen *screen)
+static gboolean
+gdk_win32_screen_is_composited (GdkScreen *screen)
 {
   g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
 
   return FALSE;
 }
+
+static void
+gdk_win32_screen_finalize (GObject *object)
+{
+}
+
+static void
+gdk_win32_screen_dispose (GObject *object)
+{
+}
+
+static void
+gdk_win32_screen_class_init (GdkWin32ScreenClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass);
+
+  object_class->dispose = gdk_win32_screen_dispose;
+  object_class->finalize = gdk_win32_screen_finalize;
+
+  screen_class->get_display = gdk_win32_screen_get_display;
+  screen_class->get_width = gdk_win32_screen_get_width;
+  screen_class->get_height = gdk_win32_screen_get_height;
+  screen_class->get_width_mm = gdk_win32_screen_get_width_mm;
+  screen_class->get_height_mm = gdk_win32_screen_get_height_mm;
+  screen_class->get_number = gdk_win32_screen_get_number;
+  screen_class->get_root_window = gdk_win32_screen_get_root_window;
+  screen_class->get_n_monitors = gdk_win32_screen_get_n_monitors;
+  screen_class->get_primary_monitor = gdk_win32_screen_get_primary_monitor;
+  screen_class->get_monitor_width_mm = gdk_win32_screen_get_monitor_width_mm;
+  screen_class->get_monitor_height_mm = gdk_win32_screen_get_monitor_height_mm;
+  screen_class->get_monitor_plug_name = gdk_win32_screen_get_monitor_plug_name;
+  screen_class->get_monitor_geometry = gdk_win32_screen_get_monitor_geometry;
+  screen_class->get_system_visual = _gdk_win32_screen_get_system_visual;
+  screen_class->get_rgba_visual = gdk_win32_screen_get_rgba_visual;
+  screen_class->is_composited = gdk_win32_screen_is_composited;
+  screen_class->make_display_name = gdk_win32_screen_make_display_name;
+  screen_class->get_active_window = gdk_win32_screen_get_active_window;
+  screen_class->get_window_stack = gdk_win32_screen_get_window_stack;
+  screen_class->broadcast_client_message = _gdk_win32_screen_broadcast_client_message;
+  screen_class->get_setting = _gdk_win32_screen_get_setting;
+  screen_class->visual_get_best_depth = _gdk_win32_screen_visual_get_best_depth;
+  screen_class->visual_get_best_type = _gdk_win32_screen_visual_get_best_type;
+  screen_class->visual_get_best = _gdk_win32_screen_visual_get_best;
+  screen_class->visual_get_best_with_depth = _gdk_win32_screen_visual_get_best_with_depth;
+  screen_class->visual_get_best_with_type = _gdk_win32_screen_visual_get_best_with_type;
+  screen_class->visual_get_best_with_both = _gdk_win32_screen_visual_get_best_with_both;
+  screen_class->query_depths = _gdk_win32_screen_query_depths;
+  screen_class->query_visual_types = _gdk_win32_screen_query_visual_types;
+  screen_class->list_visuals = _gdk_win32_screen_list_visuals;
+}
\ No newline at end of file
diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c
index e3936a9..5b56321 100644
--- a/gdk/win32/gdkselection-win32.c
+++ b/gdk/win32/gdkselection-win32.c
@@ -33,6 +33,7 @@
 #include "gdkselection.h"
 #include "gdkdisplay.h"
 #include "gdkprivate-win32.h"
+#include "gdkwin32.h"
 
 /* We emulate the GDK_SELECTION window properties of windows (as used
  * in the X11 backend) by using a hash table from window handles to
@@ -253,11 +254,11 @@ get_mapped_gdk_atom_name (GdkAtom gdk_target)
 }
 
 gboolean
-gdk_selection_owner_set_for_display (GdkDisplay *display,
-                                     GdkWindow  *owner,
-                                     GdkAtom     selection,
-                                     guint32     time,
-                                     gboolean    send_event)
+_gdk_win32_display_set_selection_owner (GdkDisplay *display,
+					GdkWindow  *owner,
+					GdkAtom     selection,
+					guint32     time,
+					gboolean    send_event)
 {
   HWND hwnd;
   GdkEvent tmp_event;
@@ -333,8 +334,8 @@ gdk_selection_owner_set_for_display (GdkDisplay *display,
 }
 
 GdkWindow*
-gdk_selection_owner_get_for_display (GdkDisplay *display,
-                                     GdkAtom     selection)
+_gdk_win32_display_get_selection_owner (GdkDisplay *display,
+                                        GdkAtom     selection)
 {
   GdkWindow *window;
 
@@ -351,7 +352,8 @@ gdk_selection_owner_get_for_display (GdkDisplay *display,
       return gdk_win32_handle_table_lookup ((GdkNativeWindow) owner);
     }
 
-  window = gdk_window_lookup ((GdkNativeWindow) g_hash_table_lookup (sel_owner_table, selection));
+  window = gdk_win32_window_lookup_for_display (display,
+                                                (GdkNativeWindow) g_hash_table_lookup (sel_owner_table, selection));
 
   GDK_NOTE (DND, {
       gchar *sel_name = gdk_atom_name (selection);
@@ -387,10 +389,11 @@ generate_selection_notify (GdkWindow *requestor,
 }
 
 void
-gdk_selection_convert (GdkWindow *requestor,
-		       GdkAtom    selection,
-		       GdkAtom    target,
-		       guint32    time)
+_gdk_win32_display_convert_selection (GdkDisplay *display,
+				      GdkWindow *requestor,
+				      GdkAtom    selection,
+				      GdkAtom    target,
+				      guint32    time)
 {
   HGLOBAL hdata;
   GdkAtom property = _gdk_selection;
@@ -804,10 +807,11 @@ gdk_selection_convert (GdkWindow *requestor,
 }
 
 gint
-gdk_selection_property_get (GdkWindow  *requestor,
-			    guchar    **data,
-			    GdkAtom    *ret_type,
-			    gint       *ret_format)
+_gdk_win32_display_get_selection_property (GdkDisplay *display,
+					   GdkWindow  *requestor,
+					   guchar    **data,
+					   GdkAtom    *ret_type,
+					   gint       *ret_format)
 {
   GdkSelProp *prop;
 
@@ -869,12 +873,12 @@ _gdk_selection_property_delete (GdkWindow *window)
 }
 
 void
-gdk_selection_send_notify_for_display (GdkDisplay      *display,
-                                       GdkNativeWindow  requestor,
-                                       GdkAtom     	selection,
-                                       GdkAtom     	target,
-                                       GdkAtom     	property,
-                                       guint32     	time)
+_gdk_win32_display_send_selection_notify (GdkDisplay      *display,
+					  GdkNativeWindow  requestor,
+					  GdkAtom     	selection,
+					  GdkAtom     	target,
+					  GdkAtom     	property,
+					  guint32     	time)
 {
   g_return_if_fail (display == _gdk_display);
 
@@ -1020,13 +1024,13 @@ make_list (const gchar  *text,
   return n_strings;
 }
 
-gint 
-gdk_text_property_to_utf8_list_for_display (GdkDisplay    *display,
-                                            GdkAtom        encoding,
-                                            gint           format,
-                                            const guchar  *text,
-                                            gint           length,
-                                            gchar       ***list)
+gint
+_gdk_win32_display_text_property_to_utf8_list (GdkDisplay    *display,
+					       GdkAtom        encoding,
+					       gint           format,
+					       const guchar  *text,
+					       gint           length,
+					       gchar       ***list)
 {
   g_return_val_if_fail (text != NULL, 0);
   g_return_val_if_fail (length >= 0, 0);
@@ -1086,7 +1090,8 @@ gdk_string_to_compound_text_for_display (GdkDisplay  *display,
 }
 
 gchar *
-gdk_utf8_to_string_target (const gchar *str)
+_gdk_win32_display_utf8_to_string_target (GdkDisplay *display,
+					  const gchar *str)
 {
   return _gdk_utf8_to_string_target_internal (str, strlen (str));
 }
diff --git a/gdk/win32/gdktestutils-win32.c b/gdk/win32/gdktestutils-win32.c
index ed9faa7..062d09b 100644
--- a/gdk/win32/gdktestutils-win32.c
+++ b/gdk/win32/gdktestutils-win32.c
@@ -22,13 +22,8 @@
 #include <win32/gdkwin32.h>
 
 
-void
-gdk_test_render_sync (GdkWindow *window)
-{
-}
-
 gboolean
-gdk_test_simulate_key (GdkWindow      *window,
+_gdk_win32_window_simulate_key (GdkWindow      *window,
                        gint            x,
                        gint            y,
                        guint           keyval,
@@ -41,7 +36,7 @@ gdk_test_simulate_key (GdkWindow      *window,
 }
 
 gboolean
-gdk_test_simulate_button (GdkWindow      *window,
+_gdk_win32_window_simulate_button (GdkWindow      *window,
                           gint            x,
                           gint            y,
                           guint           button, /*1..3*/
diff --git a/gdk/win32/gdkvisual-win32.c b/gdk/win32/gdkvisual-win32.c
index b3d20b7..b1f9a79 100644
--- a/gdk/win32/gdkvisual-win32.c
+++ b/gdk/win32/gdkvisual-win32.c
@@ -31,6 +31,7 @@
 #include "gdkvisual.h"
 #include "gdkscreen.h" /* gdk_screen_get_default() */
 #include "gdkprivate-win32.h"
+#include "gdkvisualprivate.h"
 
 static void  gdk_visual_decompose_mask (gulong     mask,
 					gint      *shift,
@@ -42,46 +43,6 @@ static gint available_depths[1];
 
 static GdkVisualType available_types[1];
 
-static void
-gdk_visual_finalize (GObject *object)
-{
-  g_error ("A GdkVisual object was finalized. This should not happen");
-}
-
-static void
-gdk_visual_class_init (GObjectClass *class)
-{
-  class->finalize = gdk_visual_finalize;
-}
-
-GType
-gdk_visual_get_type (void)
-{
-  static GType object_type = 0;
-
-  if (!object_type)
-    {
-      const GTypeInfo object_info =
-      {
-        sizeof (GdkVisualClass),
-        (GBaseInitFunc) NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc) gdk_visual_class_init,
-        NULL,           /* class_finalize */
-        NULL,           /* class_data */
-        sizeof (GdkVisual),
-        0,              /* n_preallocs */
-        (GInstanceInitFunc) NULL,
-      };
-      
-      object_type = g_type_register_static (G_TYPE_OBJECT,
-                                            "GdkVisual",
-                                            &object_info, 0);
-    }
-  
-  return object_type;
-}
-
 void
 _gdk_visual_init (void)
 {
@@ -102,6 +63,7 @@ _gdk_visual_init (void)
   gint map_entries = 0;
 
   system_visual = g_object_new (GDK_TYPE_VISUAL, NULL);
+  system_visual->screen = gdk_screen_get_default();
 
   GDK_NOTE (COLORMAP, g_print ("BITSPIXEL=%d NUMCOLORS=%d\n",
 			       bitspixel, numcolors));
@@ -290,31 +252,31 @@ _gdk_visual_init (void)
 }
 
 gint
-gdk_visual_get_best_depth (void)
+_gdk_win32_screen_visual_get_best_depth (GdkScreen *screen)
 {
   return available_depths[0];
 }
 
 GdkVisualType
-gdk_visual_get_best_type (void)
+_gdk_win32_screen_visual_get_best_type (GdkScreen *screen)
 {
   return available_types[0];
 }
 
 GdkVisual*
-gdk_screen_get_system_visual (GdkScreen *screen)
+_gdk_win32_screen_get_system_visual (GdkScreen *screen)
 {
   return system_visual;
 }
 
 GdkVisual*
-gdk_visual_get_best (void)
+_gdk_win32_screen_visual_get_best (GdkScreen *screen)
 {
   return ((GdkVisual*) system_visual);
 }
 
 GdkVisual*
-gdk_visual_get_best_with_depth (gint depth)
+_gdk_win32_screen_visual_get_best_with_depth (GdkScreen *screen, gint depth)
 {
   if (depth == system_visual->depth)
     return (GdkVisual*) system_visual;
@@ -323,7 +285,7 @@ gdk_visual_get_best_with_depth (gint depth)
 }
 
 GdkVisual*
-gdk_visual_get_best_with_type (GdkVisualType visual_type)
+_gdk_win32_screen_visual_get_best_with_type (GdkScreen *screen, GdkVisualType visual_type)
 {
   if (visual_type == system_visual->type)
     return system_visual;
@@ -332,8 +294,9 @@ gdk_visual_get_best_with_type (GdkVisualType visual_type)
 }
 
 GdkVisual*
-gdk_visual_get_best_with_both (gint          depth,
-			       GdkVisualType visual_type)
+_gdk_win32_screen_visual_get_best_with_both (GdkScreen    *screen,
+					     gint          depth,
+					     GdkVisualType visual_type)
 {
   if ((depth == system_visual->depth) && (visual_type == system_visual->type))
     return system_visual;
@@ -342,35 +305,29 @@ gdk_visual_get_best_with_both (gint          depth,
 }
 
 void
-gdk_query_depths  (gint **depths,
-		   gint  *count)
+_gdk_win32_screen_query_depths  (GdkScreen *screen,
+				 gint **depths,
+				 gint  *count)
 {
   *count = 1;
   *depths = available_depths;
 }
 
 void
-gdk_query_visual_types (GdkVisualType **visual_types,
-			gint           *count)
+_gdk_win32_screen_query_visual_types (GdkScreen      *screen,
+				      GdkVisualType **visual_types,
+				      gint           *count)
 {
   *count = 1;
   *visual_types = available_types;
 }
 
 GList*
-gdk_screen_list_visuals (GdkScreen *screen)
+_gdk_win32_screen_list_visuals (GdkScreen *screen)
 {
   return g_list_append (NULL, (gpointer) system_visual);
 }
 
-GdkScreen *
-gdk_visual_get_screen (GdkVisual *visual)
-{
-  g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL);
-
-  return gdk_screen_get_default ();
-}
-
 static void
 gdk_visual_decompose_mask (gulong  mask,
 			   gint   *shift,
diff --git a/gdk/win32/gdkwin32.h b/gdk/win32/gdkwin32.h
index 9d7d983..276d37c 100644
--- a/gdk/win32/gdkwin32.h
+++ b/gdk/win32/gdkwin32.h
@@ -27,6 +27,18 @@
 #ifndef __GDK_WIN32_H__
 #define __GDK_WIN32_H__
 
+#define __GDKWIN32_H_INSIDE__
+
+#include <gdk/win32/gdkwin32cursor.h>
+#include <gdk/win32/gdkwin32display.h>
+#include <gdk/win32/gdkwin32displaymanager.h>
+#include <gdk/win32/gdkwin32dnd.h>
+#include <gdk/win32/gdkwin32keys.h>
+#include <gdk/win32/gdkwin32screen.h>
+#include <gdk/win32/gdkwin32window.h>
+
+#undef __GDKWIN32_H_INSIDE__
+
 #include <gdk/gdkprivate.h>
 
 #ifndef STRICT
@@ -41,19 +53,13 @@ G_BEGIN_DECLS
 
 #include "gdkprivate-win32.h"
 
-#define GDK_WINDOW_HWND(win)          (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)win)->impl)->handle)
-#define GDK_DRAWABLE_IMPL_WIN32_HANDLE(d) (((GdkDrawableImplWin32 *) d)->handle)
-#define GDK_DRAWABLE_HANDLE(win)      (GDK_IS_WINDOW (win) ? GDK_WINDOW_HWND (win) : (GDK_IS_DRAWABLE_IMPL_WIN32 (win) ? GDK_DRAWABLE_IMPL_WIN32_HANDLE (win) : 0))
+#define GDK_WINDOW_HWND(win)          (GDK_WINDOW_IMPL_WIN32(win->impl)->handle)
 #else
 /* definition for exported 'internals' go here */
-#define GDK_WINDOW_HWND(d) (gdk_win32_drawable_get_handle (d))
+#define GDK_WINDOW_HWND(d) (gdk_win32_window_get_handle (d))
 
 #endif
 
-#define GDK_ROOT_WINDOW()             ((guint32) HWND_DESKTOP)
-#define GDK_DISPLAY()                 NULL
-
-
 /* These need to be here so gtkstatusicon.c can pick them up if needed. */
 #ifndef WM_XBUTTONDOWN
 #define WM_XBUTTONDOWN 0x020B
@@ -77,9 +83,8 @@ gboolean      gdk_win32_window_is_win32 (GdkWindow *window);
 
 /* Return the Gdk* for a particular HANDLE */
 gpointer      gdk_win32_handle_table_lookup (GdkNativeWindow handle);
-
-/* Translate from drawable to Windows handle */
-HGDIOBJ       gdk_win32_drawable_get_handle (GdkDrawable *drawable);
+/* Translate from window to Windows handle */
+HGDIOBJ       gdk_win32_window_get_handle (GdkWindow *window);
 
 void          gdk_win32_selection_add_targets (GdkWindow  *owner,
 					       GdkAtom     selection,
diff --git a/gdk/win32/gdkwin32cursor.h b/gdk/win32/gdkwin32cursor.h
new file mode 100644
index 0000000..6146f32
--- /dev/null
+++ b/gdk/win32/gdkwin32cursor.h
@@ -0,0 +1,56 @@
+/* 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 Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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-2000.  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/. 
+ */
+
+#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdkwin32.h> can be included directly."
+#endif
+
+#ifndef __GDK_WIN32_CURSOR_H__
+#define __GDK_WIN32_CURSOR_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_WIN32_CURSOR              (gdk_win32_cursor_get_type ())
+#define GDK_WIN32_CURSOR(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_CURSOR, GdkWin32Cursor))
+#define GDK_WIN32_CURSOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_CURSOR, GdkWin32CursorClass))
+#define GDK_IS_WIN32_CURSOR(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_CURSOR))
+#define GDK_IS_WIN32_CURSOR_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_CURSOR))
+#define GDK_WIN32_CURSOR_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_CURSOR, GdkWin32CursorClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkWin32Cursor GdkWin32Cursor;
+#else
+typedef GdkCursor GdkWin32Cursor;
+#endif
+typedef struct _GdkWin32CursorClass GdkWin32CursorClass;
+
+GType    gdk_win32_cursor_get_type          (void);
+
+G_END_DECLS
+
+#endif /* __GDK_WIN32_CURSOR_H__ */
diff --git a/gdk/win32/gdkwin32display.h b/gdk/win32/gdkwin32display.h
new file mode 100644
index 0000000..9ff9a9d
--- /dev/null
+++ b/gdk/win32/gdkwin32display.h
@@ -0,0 +1,56 @@
+/* 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 Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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-2000.  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/. 
+ */
+
+#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdkwin32.h> can be included directly."
+#endif
+
+#ifndef __GDK_WIN32_DISPLAY_H__
+#define __GDK_WIN32_DISPLAY_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkWin32Display GdkWin32Display;
+#else
+typedef GdkDisplay GdkWin32Display;
+#endif
+typedef struct _GdkWin32DisplayClass GdkWin32DisplayClass;
+
+#define GDK_TYPE_WIN32_DISPLAY              (gdk_win32_display_get_type())
+#define GDK_WIN32_DISPLAY(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DISPLAY, GdkWin32Display))
+#define GDK_WIN32_DISPLAY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DISPLAY, GdkWin32DisplayClass))
+#define GDK_IS_WIN32_DISPLAY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DISPLAY))
+#define GDK_IS_WIN32_DISPLAY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DISPLAY))
+#define GDK_WIN32_DISPLAY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DISPLAY, GdkWin32DisplayClass))
+
+GType      gdk_win32_display_get_type            (void);
+
+G_END_DECLS
+
+#endif /* __GDK_WIN32_DISPLAY_H__ */
diff --git a/gdk/win32/gdkwin32displaymanager.h b/gdk/win32/gdkwin32displaymanager.h
new file mode 100644
index 0000000..61c1ce4
--- /dev/null
+++ b/gdk/win32/gdkwin32displaymanager.h
@@ -0,0 +1,49 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ */
+
+#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdkwin32.h> can be included directly."
+#endif
+
+#ifndef __GDK_WIN32_DISPLAY_MANAGER_H__
+#define __GDK_WIN32_DISPLAY_MANAGER_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkWin32DisplayManager GdkWin32DisplayManager;
+#else
+typedef GdkDisplayManager GdkWin32DisplayManager;
+#endif
+typedef struct _GdkWin32DisplayManagerClass GdkWin32DisplayManagerClass;
+
+#define GDK_TYPE_WIN32_DISPLAY_MANAGER              (gdk_win32_display_manager_get_type())
+#define GDK_WIN32_DISPLAY_MANAGER(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DISPLAY_MANAGER, GdkWin32DisplayManager))
+#define GDK_WIN32_DISPLAY_MANAGER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DISPLAY_MANAGER, GdkWin32DisplayManagerClass))
+#define GDK_IS_WIN32_DISPLAY_MANAGER(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DISPLAY_MANAGER))
+#define GDK_IS_WIN32_DISPLAY_MANAGER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DISPLAY_MANAGER))
+#define GDK_WIN32_DISPLAY_MANAGER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DISPLAY_MANAGER, GdkWin32DisplayManagerClass))
+
+GType      gdk_win32_display_manager_get_type            (void);
+
+G_END_DECLS
+
+#endif /* __GDK_WIN32_DISPLAY_MANAGER_H__ */
diff --git a/gdk/win32/gdkwin32dnd.h b/gdk/win32/gdkwin32dnd.h
new file mode 100644
index 0000000..1632d76
--- /dev/null
+++ b/gdk/win32/gdkwin32dnd.h
@@ -0,0 +1,49 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ */
+
+#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdkwin32.h> can be included directly."
+#endif
+
+#ifndef __GDK_WIN32_DND_H__
+#define __GDK_WIN32_DND_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_WIN32_DRAG_CONTEXT              (gdk_win32_drag_context_get_type ())
+#define GDK_WIN32_DRAG_CONTEXT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContext))
+#define GDK_WIN32_DRAG_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass))
+#define GDK_IS_WIN32_DRAG_CONTEXT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_DRAG_CONTEXT))
+#define GDK_IS_WIN32_DRAG_CONTEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_DRAG_CONTEXT))
+#define GDK_WIN32_DRAG_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_DRAG_CONTEXT, GdkWin32DragContextClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkWin32DragContext GdkWin32DragContext;
+#else
+typedef GdkDragContext GdkWin32DragContext;
+#endif
+typedef struct _GdkWin32DragContextClass GdkWin32DragContextClass;
+
+GType    gdk_win32_drag_context_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_WIN32_DRAG_CONTEXT_H__ */
diff --git a/gdk/win32/gdkwin32keys.h b/gdk/win32/gdkwin32keys.h
new file mode 100644
index 0000000..1d7a589
--- /dev/null
+++ b/gdk/win32/gdkwin32keys.h
@@ -0,0 +1,49 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ */
+
+#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdkwin32.h> can be included directly."
+#endif
+
+#ifndef __GDK_WIN32_KEYS_H__
+#define __GDK_WIN32_KEYS_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkWin32Keymap GdkWin32Keymap;
+#else
+typedef GdkKeymap GdkWin32Keymap;
+#endif
+typedef struct _GdkWin32KeymapClass GdkWin32KeymapClass;
+
+#define GDK_TYPE_WIN32_KEYMAP              (gdk_win32_keymap_get_type())
+#define GDK_WIN32_KEYMAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_KEYMAP, GdkWin32Keymap))
+#define GDK_WIN32_KEYMAP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_KEYMAP, GdkWin32KeymapClass))
+#define GDK_IS_WIN32_KEYMAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_KEYMAP))
+#define GDK_IS_WIN32_KEYMAP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_KEYMAP))
+#define GDK_WIN32_KEYMAP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_KEYMAP, GdkWin32KeymapClass))
+
+GType gdk_win32_keymap_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_WIN32_KEYMAP_H__ */
diff --git a/gdk/win32/gdkwin32screen.h b/gdk/win32/gdkwin32screen.h
new file mode 100644
index 0000000..594f604
--- /dev/null
+++ b/gdk/win32/gdkwin32screen.h
@@ -0,0 +1,56 @@
+/* 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 Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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-2000.  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/. 
+ */
+
+#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdkwin32.h> can be included directly."
+#endif
+
+#ifndef __GDK_WIN32_SCREEN_H__
+#define __GDK_WIN32_SCREEN_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_WIN32_SCREEN              (gdk_win32_screen_get_type ())
+#define GDK_WIN32_SCREEN(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_SCREEN, GdkWin32Screen))
+#define GDK_WIN32_SCREEN_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_SCREEN, GdkWin32ScreenClass))
+#define GDK_IS_WIN32_SCREEN(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_SCREEN))
+#define GDK_IS_WIN32_SCREEN_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_SCREEN))
+#define GDK_WIN32_SCREEN_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_SCREEN, GdkWin32ScreenClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkWin32Screen GdkWin32Screen;
+#else
+typedef GdkScreen GdkWin32Screen;
+#endif
+typedef struct _GdkWin32ScreenClass GdkWin32ScreenClass;
+
+GType    gdk_win32_screen_get_type          (void);
+
+G_END_DECLS
+
+#endif /* __GDK_WIN32_SCREEN_H__ */
diff --git a/gdk/win32/gdkwin32window.h b/gdk/win32/gdkwin32window.h
new file mode 100644
index 0000000..22e8f4c
--- /dev/null
+++ b/gdk/win32/gdkwin32window.h
@@ -0,0 +1,56 @@
+/* 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 Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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-2000.  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/. 
+ */
+
+#if !defined (__GDKWIN32_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdkwin32.h> can be included directly."
+#endif
+
+#ifndef __GDK_WIN32_WINDOW_H__
+#define __GDK_WIN32_WINDOW_H__
+
+#include <gdk/gdk.h>
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_WIN32_WINDOW              (gdk_win32_window_get_type ())
+#define GDK_WIN32_WINDOW(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WIN32_WINDOW, GdkWin32Window))
+#define GDK_WIN32_WINDOW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WIN32_WINDOW, GdkWin32WindowClass))
+#define GDK_IS_WIN32_WINDOW(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WIN32_WINDOW))
+#define GDK_IS_WIN32_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_WINDOW))
+#define GDK_WIN32_WINDOW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_WINDOW, GdkWin32WindowClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkWin32Window GdkWin32Window;
+#else
+typedef GdkWindow GdkWin32Window;
+#endif
+typedef struct _GdkWin32WindowClass GdkWin32WindowClass;
+
+GType    gdk_win32_window_get_type          (void);
+
+G_END_DECLS
+
+#endif /* __GDK_X11_WINDOW_H__ */
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index c9130bc..01a17ab 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -1,7 +1,7 @@
 /* GDK - The GIMP Drawing Kit
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  * Copyright (C) 1998-2004 Tor Lillqvist
- * Copyright (C) 2001-2009 Hans Breuer
+ * Copyright (C) 2001-2011 Hans Breuer
  * Copyright (C) 2007-2009 Cody Russell
  *
  * This library is free software; you can redistribute it and/or
@@ -36,6 +36,12 @@
 #include "gdkdeviceprivate.h"
 #include "gdkdevicemanager-win32.h"
 #include "gdkenumtypes.h"
+#include "gdkwin32.h"
+#include "gdkdisplayprivate.h"
+#include "gdkvisualprivate.h"
+#include "gdkwin32window.h"
+
+#include <cairo-win32.h>
 
 static void gdk_window_impl_win32_init       (GdkWindowImplWin32      *window);
 static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass);
@@ -44,6 +50,8 @@ static void gdk_window_impl_win32_finalize   (GObject                 *object);
 static gpointer parent_class = NULL;
 static GSList *modal_window_stack = NULL;
 
+static const cairo_user_data_key_t gdk_win32_cairo_key;
+
 static void     update_style_bits         (GdkWindow         *window);
 static gboolean _gdk_window_get_functions (GdkWindow         *window,
                                            GdkWMFunction     *functions);
@@ -53,14 +61,35 @@ static gboolean _gdk_window_get_functions (GdkWindow         *window,
    GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
    GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
 
-static void gdk_window_impl_iface_init (GdkWindowImplIface *iface);
-
 GdkScreen *
 GDK_WINDOW_SCREEN (GObject *win)
 {
   return _gdk_screen;
 }
 
+struct _GdkWin32Window {
+  GdkWindow parent;
+};
+
+struct _GdkWin32WindowClass {
+  GdkWindowClass parent_class;
+};
+
+G_DEFINE_TYPE (GdkWin32Window, gdk_win32_window, GDK_TYPE_WINDOW)
+
+static void
+gdk_win32_window_class_init (GdkWin32WindowClass *window_class)
+{
+}
+
+static void
+gdk_win32_window_init (GdkWin32Window *window)
+{
+}
+
+
+G_DEFINE_TYPE (GdkWindowImplWin32, gdk_window_impl_win32, GDK_TYPE_WINDOW_IMPL)
+
 GType
 _gdk_window_impl_win32_get_type (void)
 {
@@ -81,19 +110,9 @@ _gdk_window_impl_win32_get_type (void)
         (GInstanceInitFunc) gdk_window_impl_win32_init,
       };
 
-      const GInterfaceInfo window_impl_info =
-      {
-	(GInterfaceInitFunc) gdk_window_impl_iface_init,
-	NULL,
-	NULL
-      };
-      
-      object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_WIN32,
+      object_type = g_type_register_static (GDK_TYPE_WINDOW_IMPL,
                                             "GdkWindowImplWin32",
                                             &object_info, 0);
-      g_type_add_interface_static (object_type,
-				   GDK_TYPE_WINDOW_IMPL,
-				   &window_impl_info);
     }
   
   return object_type;
@@ -116,32 +135,20 @@ gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
 }
 
 static void
-gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  
-  parent_class = g_type_class_peek_parent (klass);
-
-  object_class->finalize = gdk_window_impl_win32_finalize;
-}
-
-static void
 gdk_window_impl_win32_finalize (GObject *object)
 {
-  GdkWindowObject *wrapper;
-  GdkDrawableImplWin32 *draw_impl;
+  GdkWindow *wrapper;
   GdkWindowImplWin32 *window_impl;
   
   g_return_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (object));
 
-  draw_impl = GDK_DRAWABLE_IMPL_WIN32 (object);
   window_impl = GDK_WINDOW_IMPL_WIN32 (object);
   
-  wrapper = (GdkWindowObject*) draw_impl->wrapper;
+  wrapper = window_impl->wrapper;
 
   if (!GDK_WINDOW_DESTROYED (wrapper))
     {
-      gdk_win32_handle_table_remove (draw_impl->handle);
+      gdk_win32_handle_table_remove (window_impl->handle);
     }
 
   if (window_impl->hcursor != NULL)
@@ -182,52 +189,50 @@ _gdk_win32_adjust_client_rect (GdkWindow *window,
 void
 _gdk_root_window_size_init (void)
 {
-  GdkWindowObject *window_object;
+  GdkWindow *window;
   GdkRectangle rect;
   int i;
 
-  window_object = GDK_WINDOW_OBJECT (_gdk_root);
+  window = GDK_WINDOW (_gdk_root);
   rect = _gdk_monitors[0].rect;
   for (i = 1; i < _gdk_num_monitors; i++)
     gdk_rectangle_union (&rect, &_gdk_monitors[i].rect, &rect);
 
-  window_object->width = rect.width;
-  window_object->height = rect.height;
+  window->width = rect.width;
+  window->height = rect.height;
 }
 
 void
 _gdk_windowing_window_init (GdkScreen *screen)
 {
-  GdkWindowObject *private;
-  GdkDrawableImplWin32 *draw_impl;
+  GdkWindow *window;
+  GdkWindowImplWin32 *impl_win32;
 
   g_assert (_gdk_root == NULL);
   
   _gdk_root = _gdk_display_create_window (_gdk_display);
 
-  private = (GdkWindowObject *)_gdk_root;
-  private->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
-  private->impl_window = private;
-  private->visual = gdk_screen_get_system_visual (screen);
+  window = (GdkWindow *)_gdk_root;
+  window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
+  impl_win32 = GDK_WINDOW_IMPL_WIN32 (window->impl);
+  impl_win32->wrapper = window;
 
-  draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
-  
-  draw_impl->handle = GetDesktopWindow ();
-  draw_impl->wrapper = GDK_DRAWABLE (private);
-  
-  private->window_type = GDK_WINDOW_ROOT;
-  private->depth = gdk_visual_get_system ()->depth;
+  window->impl_window = window;
+  window->visual = gdk_screen_get_system_visual (screen);
+
+  window->window_type = GDK_WINDOW_ROOT;
+  window->depth = gdk_visual_get_system ()->depth;
 
   _gdk_root_window_size_init ();
 
-  private->x = 0;
-  private->y = 0;
-  private->abs_x = 0;
-  private->abs_y = 0;
+  window->x = 0;
+  window->y = 0;
+  window->abs_x = 0;
+  window->abs_y = 0;
   /* width and height already initialised in _gdk_root_window_size_init() */
-  private->viewable = TRUE;
+  window->viewable = TRUE;
 
-  gdk_win32_handle_table_insert ((HANDLE *) &draw_impl->handle, _gdk_root);
+  gdk_win32_handle_table_insert ((HANDLE *) &impl_win32->handle, _gdk_root);
 
   GDK_NOTE (MISC, g_print ("_gdk_root=%p\n", GDK_WINDOW_HWND (_gdk_root)));
 }
@@ -395,67 +400,93 @@ RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
   return klass;
 }
 
+/*
+ * Create native windows.
+ *
+ * With the default Gdk the created windows are mostly toplevel windows.
+ * A lot of child windows are only created for GDK_NATIVE_WINDOWS.
+ *
+ * Placement of the window is derived from the passed in window,
+ * except for toplevel window where OS/Window Manager placement
+ * is used.
+ *
+ * The visual parameter, is based on GDK_WA_VISUAL if set already.
+ * From attributes the only things used is: colormap, title, 
+ * wmclass and type_hint. [1]. We are checking redundant information
+ * and complain if that changes, which would break this implementation
+ * again.
+ *
+ * [1] http://mail.gnome.org/archives/gtk-devel-list/2010-August/msg00214.html
+ */
 void
-_gdk_window_impl_new (GdkWindow     *window,
-		      GdkWindow     *real_parent,
-		      GdkScreen     *screen,
-		      GdkEventMask   event_mask,
-		      GdkWindowAttr *attributes,
-		      gint           attributes_mask)
+_gdk_win32_display_create_window_impl (GdkDisplay    *display,
+				       GdkWindow     *window,
+				       GdkWindow     *real_parent,
+				       GdkScreen     *screen,
+				       GdkEventMask   event_mask,
+				       GdkWindowAttr *attributes,
+				       gint           attributes_mask)
 {
   HWND hwndNew;
   HANDLE hparent;
   ATOM klass = 0;
   DWORD dwStyle = 0, dwExStyle;
   RECT rect;
-  GdkWindow *orig_parent;
-  GdkWindowObject *private;
   GdkWindowImplWin32 *impl;
-  GdkDrawableImplWin32 *draw_impl;
   const gchar *title;
   wchar_t *wtitle;
   gint window_width, window_height;
   gint offset_x = 0, offset_y = 0;
+  gint x, y;
+  /* check consistency of redundant information */
+  guint remaining_mask = attributes_mask;
 
-  private = (GdkWindowObject *)window;
+  GDK_NOTE (MISC,
+	    g_print ("_gdk_window_impl_new: %s %s\n",
+		     (window->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
+		      (window->window_type == GDK_WINDOW_CHILD ? "CHILD" :
+		       (window->window_type == GDK_WINDOW_TEMP ? "TEMP" :
+			"???"))),
+		     (attributes->wclass == GDK_INPUT_OUTPUT ? "" : "input-only"))
+			   );
 
-  orig_parent = real_parent;
+  /* to ensure to not miss important information some additional check against
+   * attributes which may silently work on X11 */
+  if ((attributes_mask & GDK_WA_X) != 0)
+    {
+      g_assert (attributes->x == window->x);
+      remaining_mask &= ~GDK_WA_X;
+    }
+  if ((attributes_mask & GDK_WA_Y) != 0)
+    {
+      g_assert (attributes->y == window->y);
+      remaining_mask &= ~GDK_WA_Y;
+    }
+  if ((attributes_mask & GDK_WA_NOREDIR) != 0)
+    remaining_mask &= ~GDK_WA_NOREDIR;
 
-  GDK_NOTE (MISC,
-	    g_print ("_gdk_window_impl_new: %s\n",
-		     (attributes->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
-		      (attributes->window_type == GDK_WINDOW_CHILD ? "CHILD" :
-			(attributes->window_type == GDK_WINDOW_TEMP ? "TEMP" :
-			 "???")))));
+  if ((remaining_mask & ~(GDK_WA_WMCLASS|GDK_WA_VISUAL|GDK_WA_CURSOR|GDK_WA_TITLE|GDK_WA_TYPE_HINT)) != 0)
+    g_warning ("_gdk_window_impl_new: uexpected attribute 0x%X",
+               remaining_mask & ~(GDK_WA_WMCLASS|GDK_WA_VISUAL|GDK_WA_CURSOR|GDK_WA_TITLE|GDK_WA_TYPE_HINT));
 
   hparent = GDK_WINDOW_HWND (real_parent);
 
   impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
-  private->impl = (GdkDrawable *)impl;
-  draw_impl = GDK_DRAWABLE_IMPL_WIN32 (impl);
-  draw_impl->wrapper = GDK_DRAWABLE (window);
-
-  // XXX: xattributes_mask = 0
+  impl->wrapper = GDK_WINDOW (window);
+  window->impl = GDK_WINDOW_IMPL (impl);
 
-#if 0
   if (attributes_mask & GDK_WA_VISUAL)
-    visual = attributes->visual;
-  else
-    visual = gdk_visual_get_system ();
-#endif
+    g_assert (gdk_screen_get_system_visual (screen) == attributes->visual);
 
-#if 0
-  impl->width = (attributes->width > 1) ? (attributes->width) : (1);
-  impl->height = (attributes->height > 1) ? (attributes->height) : (1);
-#endif
   impl->extension_events_selected = FALSE;
 
-  // XXX ?
-  if (attributes->wclass == GDK_INPUT_OUTPUT)
+  /* wclass is not any longer set always, but if is ... */
+  if ((attributes_mask & GDK_WA_WMCLASS) == GDK_WA_WMCLASS)
+    g_assert ((attributes->wclass == GDK_INPUT_OUTPUT) == !window->input_only);
+
+  if (!window->input_only)
     {
       dwExStyle = 0;
-
-      private->input_only = FALSE;
     }
   else
     {
@@ -464,27 +495,25 @@ _gdk_window_impl_new (GdkWindow     *window,
        * to work well enough for the actual use cases in gtk.
        */
       dwExStyle = WS_EX_TRANSPARENT;
-      private->depth = 0;
-      private->input_only = TRUE;
       GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY\n"));
     }
 
-  switch (private->window_type)
+  switch (window->window_type)
     {
     case GDK_WINDOW_TOPLEVEL:
-      if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
+      if (GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT)
 	{
 	  /* The common code warns for this case. */
 	  hparent = GetDesktopWindow ();
 	}
       /* Children of foreign windows aren't toplevel windows */
-      if (GDK_WINDOW_TYPE (orig_parent) == GDK_WINDOW_FOREIGN)
+      if (GDK_WINDOW_TYPE (real_parent) == GDK_WINDOW_FOREIGN)
 	{
 	  dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN;
 	}
       else
 	{
-	  if (private->window_type == GDK_WINDOW_TOPLEVEL)
+	  if (window->window_type == GDK_WINDOW_TOPLEVEL)
 	    dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
 	  else
 	    dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
@@ -511,21 +540,29 @@ _gdk_window_impl_new (GdkWindow     *window,
       g_assert_not_reached ();
     }
 
-  if (private->window_type != GDK_WINDOW_CHILD)
+  if (window->window_type != GDK_WINDOW_CHILD)
     {
-      rect.left = rect.top = 0;
-      rect.right = private->width;
-      rect.bottom = private->height;
+      rect.left = window->x;
+      rect.top = window->y;
+      rect.right = window->width;
+      rect.bottom = window->height;
 
       AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
 
+      /* non child windows are placed by the OS/window manager */
+      x = y = CW_USEDEFAULT;
+
       window_width = rect.right - rect.left;
       window_height = rect.bottom - rect.top;
     }
   else
     {
-      window_width = private->width;
-      window_height = private->height;
+      /* adjust position relative to real_parent */
+      window_width = window->width;
+      window_height = window->height;
+      /* use given position for initial placement, native coordinates */
+      x = window->x + window->parent->abs_x - offset_x;
+      y = window->y + window->parent->abs_y - offset_y;
     }
 
   if (attributes_mask & GDK_WA_TITLE)
@@ -535,20 +572,15 @@ _gdk_window_impl_new (GdkWindow     *window,
   if (!title || !*title)
     title = "";
 
-  private->event_mask = GDK_STRUCTURE_MASK | attributes->event_mask;
+  window->event_mask = GDK_STRUCTURE_MASK | event_mask;
       
   if (attributes_mask & GDK_WA_TYPE_HINT)
-    impl->type_hint = attributes->type_hint;
-  else
-    impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
+    gdk_window_set_type_hint (window, attributes->type_hint);
 
   if (impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY)
     dwExStyle |= WS_EX_TOOLWINDOW;
 
-  if (private->parent)
-    private->parent->children = g_list_prepend (private->parent->children, window);
-
-  klass = RegisterGdkClass (private->window_type, impl->type_hint);
+  klass = RegisterGdkClass (window->window_type, impl->type_hint);
 
   wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
   
@@ -556,9 +588,8 @@ _gdk_window_impl_new (GdkWindow     *window,
 			     MAKEINTRESOURCEW (klass),
 			     wtitle,
 			     dwStyle,
-			     ((attributes_mask & GDK_WA_X) ?
-			       private->x - offset_x : CW_USEDEFAULT),
-			     private->y - offset_y,
+			     x,
+			     y,
 			     window_width, window_height,
 			     hparent,
 			     NULL,
@@ -581,7 +612,7 @@ _gdk_window_impl_new (GdkWindow     *window,
       gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
 # else
       /* the old behaviour, but with warning */
-      draw_impl->handle = hwndNew;
+      impl->handle = hwndNew;
 # endif
 
     }
@@ -592,9 +623,8 @@ _gdk_window_impl_new (GdkWindow     *window,
   GDK_NOTE (MISC, g_print ("... \"%s\" %dx%d %+d%+d %p = %p\n",
 			   title,
 			   window_width, window_height,
-			   ((attributes_mask & GDK_WA_X) ?
-			    private->x - offset_x: CW_USEDEFAULT),
-			   private->y - offset_y, 
+			   window->x - offset_x,
+			   window->y - offset_y, 
 			   hparent,
 			   GDK_WINDOW_HWND (window)));
 
@@ -603,19 +633,18 @@ _gdk_window_impl_new (GdkWindow     *window,
 
   g_free (wtitle);
 
-  if (draw_impl->handle == NULL)
+  if (impl->handle == NULL)
     {
       WIN32_API_FAILED ("CreateWindowExW");
       g_object_unref (window);
       return;
     }
 
-//  if (!from_set_skip_taskbar_hint && private->window_type == GDK_WINDOW_TEMP)
+//  if (!from_set_skip_taskbar_hint && window->window_type == GDK_WINDOW_TEMP)
 //    gdk_window_set_skip_taskbar_hint (window, TRUE);
 
-  gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
-				  (attributes->cursor) :
-				  NULL));
+  if (attributes_mask & GDK_WA_CURSOR)
+    gdk_window_set_cursor (window, attributes->cursor);
 }
 
 GdkWindow *
@@ -623,9 +652,7 @@ gdk_win32_window_foreign_new_for_display (GdkDisplay      *display,
                                           GdkNativeWindow  anid)
 {
   GdkWindow *window;
-  GdkWindowObject *private;
   GdkWindowImplWin32 *impl;
-  GdkDrawableImplWin32 *draw_impl;
 
   HANDLE parent;
   RECT rect;
@@ -634,54 +661,51 @@ gdk_win32_window_foreign_new_for_display (GdkDisplay      *display,
   g_return_val_if_fail (display == _gdk_display, NULL);
 
   window = _gdk_display_create_window (display);
-  private = (GdkWindowObject *)window;
-  private->visual = gdk_screen_get_system_visual (_gdk_screen);
-  private->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
-  impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
-  draw_impl = GDK_DRAWABLE_IMPL_WIN32 (private->impl);
-  draw_impl->wrapper = GDK_DRAWABLE (window);
+  window->visual = gdk_screen_get_system_visual (_gdk_screen);
+  window->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WIN32, NULL);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
+  impl->wrapper = window;
   parent = GetParent ((HWND)anid);
   
-  private->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent);
-  if (!private->parent || GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_FOREIGN)
-    private->parent = (GdkWindowObject *)_gdk_root;
+  window->parent = gdk_win32_handle_table_lookup ((GdkNativeWindow) parent);
+  if (!window->parent || GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_FOREIGN)
+    window->parent = _gdk_root;
   
-  private->parent->children = g_list_prepend (private->parent->children, window);
+  window->parent->children = g_list_prepend (window->parent->children, window);
 
-  draw_impl->handle = (HWND) anid;
   GetClientRect ((HWND) anid, &rect);
   point.x = rect.left;
   point.y = rect.right;
   ClientToScreen ((HWND) anid, &point);
   if (parent != GetDesktopWindow ())
     ScreenToClient (parent, &point);
-  private->x = point.x;
-  private->y = point.y;
-  private->width = rect.right - rect.left;
-  private->height = rect.bottom - rect.top;
-  private->window_type = GDK_WINDOW_FOREIGN;
-  private->destroyed = FALSE;
-  private->event_mask = GDK_ALL_EVENTS_MASK; /* XXX */
+  window->x = point.x;
+  window->y = point.y;
+  window->width = rect.right - rect.left;
+  window->height = rect.bottom - rect.top;
+  window->window_type = GDK_WINDOW_FOREIGN;
+  window->destroyed = FALSE;
+  window->event_mask = GDK_ALL_EVENTS_MASK; /* XXX */
   if (IsWindowVisible ((HWND) anid))
-    private->state &= (~GDK_WINDOW_STATE_WITHDRAWN);
+    window->state &= (~GDK_WINDOW_STATE_WITHDRAWN);
   else
-    private->state |= GDK_WINDOW_STATE_WITHDRAWN;
+    window->state |= GDK_WINDOW_STATE_WITHDRAWN;
   if (GetWindowLong ((HWND)anid, GWL_EXSTYLE) & WS_EX_TOPMOST)
-    private->state |= GDK_WINDOW_STATE_ABOVE;
+    window->state |= GDK_WINDOW_STATE_ABOVE;
   else
-    private->state &= (~GDK_WINDOW_STATE_ABOVE);
-  private->state &= (~GDK_WINDOW_STATE_BELOW);
-  private->viewable = TRUE;
+    window->state &= (~GDK_WINDOW_STATE_ABOVE);
+  window->state &= (~GDK_WINDOW_STATE_BELOW);
+  window->viewable = TRUE;
 
-  private->depth = gdk_visual_get_system ()->depth;
+  window->depth = gdk_visual_get_system ()->depth;
 
   g_object_ref (window);
   gdk_win32_handle_table_insert (&GDK_WINDOW_HWND (window), window);
 
   GDK_NOTE (MISC, g_print ("gdk_win32_window_foreign_new_for_display: %p: %s %+d%+d\n",
 			   (HWND) anid,
-			   _gdk_win32_drawable_description (window),
-			   private->x, private->y));
+			   _gdk_win32_window_description (window),
+			   window->x, window->y));
 
   return window;
 }
@@ -691,8 +715,7 @@ gdk_win32_window_destroy (GdkWindow *window,
 			  gboolean   recursing,
 			  gboolean   foreign_destroy)
 {
-  GdkWindowObject *private = (GdkWindowObject *)window;
-  GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+  GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
   GSList *tmp;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -708,7 +731,7 @@ gdk_win32_window_destroy (GdkWindow *window,
   while (tmp != NULL)
     {
       GdkWindow *child = tmp->data;
-      GdkWindowImplWin32 *child_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (child)->impl);
+      GdkWindowImplWin32 *child_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW (child)->impl);
 
       child_impl->transient_owner = NULL;
       tmp = g_slist_next (tmp);
@@ -724,9 +747,7 @@ gdk_win32_window_destroy (GdkWindow *window,
 
   if (!recursing && !foreign_destroy)
     {
-      _gdk_win32_drawable_finish (private->impl);
-
-      private->destroyed = TRUE;
+      window->destroyed = TRUE;
       DestroyWindow (GDK_WINDOW_HWND (window));
     }
 
@@ -759,8 +780,8 @@ gdk_win32_window_destroy_foreign (GdkWindow *window)
 
 /* This function is called when the window really gone.
  */
-void
-gdk_window_destroy_notify (GdkWindow *window)
+static void
+gdk_win32_window_destroy_notify (GdkWindow *window)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -801,11 +822,9 @@ adjust_for_gravity_hints (GdkWindow *window,
 			  gint		*x,
 			  gint		*y)
 {
-	GdkWindowObject *obj;
-	GdkWindowImplWin32 *impl;
+  GdkWindowImplWin32 *impl;
 
-	obj = GDK_WINDOW_OBJECT (window);
-	impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   if (impl->hint_flags & GDK_HINT_WIN_GRAVITY)
     {
@@ -817,14 +836,14 @@ adjust_for_gravity_hints (GdkWindow *window,
 	case GDK_GRAVITY_CENTER:
 	case GDK_GRAVITY_SOUTH:
 	  *x -= (outer_rect->right - outer_rect->left) / 2;
-	  *x += obj->width / 2;
+	  *x += window->width / 2;
 	  break;
 	      
 	case GDK_GRAVITY_SOUTH_EAST:
 	case GDK_GRAVITY_EAST:
 	case GDK_GRAVITY_NORTH_EAST:
 	  *x -= outer_rect->right - outer_rect->left;
-	  *x += obj->width;
+	  *x += window->width;
 	  break;
 
 	case GDK_GRAVITY_STATIC:
@@ -841,14 +860,14 @@ adjust_for_gravity_hints (GdkWindow *window,
 	case GDK_GRAVITY_CENTER:
 	case GDK_GRAVITY_EAST:
 	  *y -= (outer_rect->bottom - outer_rect->top) / 2;
-	  *y += obj->height / 2;
+	  *y += window->height / 2;
 	  break;
 
 	case GDK_GRAVITY_SOUTH_WEST:
 	case GDK_GRAVITY_SOUTH:
 	case GDK_GRAVITY_SOUTH_EAST:
 	  *y -= outer_rect->bottom - outer_rect->top;
-	  *y += obj->height;
+	  *y += window->height;
 	  break;
 
 	case GDK_GRAVITY_STATIC:
@@ -871,20 +890,17 @@ show_window_internal (GdkWindow *window,
                       gboolean   raise,
 		      gboolean   deiconify)
 {
-  GdkWindowObject *private;
   HWND old_active_window;
   gboolean focus_on_map = TRUE;
   DWORD exstyle;
   HWND top;
 
-  private = (GdkWindowObject *) window;
-
-  if (private->destroyed)
+  if (window->destroyed)
     return;
 
   GDK_NOTE (MISC, g_print ("show_window_internal: %p: %s%s%s\n",
 			   GDK_WINDOW_HWND (window),
-			   _gdk_win32_window_state_to_string (private->state),
+			   _gdk_win32_window_state_to_string (window->state),
 			   (raise ? " raise" : ""),
 			   (deiconify ? " deiconify" : "")));
   
@@ -893,21 +909,21 @@ show_window_internal (GdkWindow *window,
    */
   if (!deiconify &&
       !GDK_WINDOW_IS_MAPPED (window) &&
-      (private->state & GDK_WINDOW_STATE_ICONIFIED))
+      (window->state & GDK_WINDOW_STATE_ICONIFIED))
     {	
       ShowWindow (GDK_WINDOW_HWND (window), SW_MINIMIZE);
       return;
     }
   
   /* If asked to just show an iconified window, do nothing. */
-  if (!deiconify && (private->state & GDK_WINDOW_STATE_ICONIFIED))
+  if (!deiconify && (window->state & GDK_WINDOW_STATE_ICONIFIED))
     return;
   
   /* If asked to deiconify an already noniconified window, do
    * nothing. (Especially, don't cause the window to rise and
    * activate. There are different calls for that.)
    */
-  if (deiconify && !(private->state & GDK_WINDOW_STATE_ICONIFIED))
+  if (deiconify && !(window->state & GDK_WINDOW_STATE_ICONIFIED))
     return;
   
   /* If asked to show (but not raise) a window that is already
@@ -923,15 +939,15 @@ show_window_internal (GdkWindow *window,
       gdk_synthesize_window_state (window,
 				   GDK_WINDOW_STATE_WITHDRAWN,
 				   0);
-      focus_on_map = private->focus_on_map;
+      focus_on_map = window->focus_on_map;
     }
 
   exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
 
-  if (private->state & GDK_WINDOW_STATE_BELOW)
+  if (window->state & GDK_WINDOW_STATE_BELOW)
     exstyle &= (~WS_EX_TOPMOST);
 
-  if (private->state & GDK_WINDOW_STATE_ABOVE)
+  if (window->state & GDK_WINDOW_STATE_ABOVE)
     exstyle |= WS_EX_TOPMOST;
 
   if (exstyle & WS_EX_TOPMOST)
@@ -958,15 +974,15 @@ show_window_internal (GdkWindow *window,
 
   old_active_window = GetActiveWindow ();
 
-  if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
+  if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
     {
       gdk_window_fullscreen (window);
     }
-  else if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
+  else if (window->state & GDK_WINDOW_STATE_MAXIMIZED)
     {
       ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
     }
-  else if (private->state & GDK_WINDOW_STATE_ICONIFIED)
+  else if (window->state & GDK_WINDOW_STATE_ICONIFIED)
     {
       ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
     }
@@ -987,7 +1003,7 @@ show_window_internal (GdkWindow *window,
 		      SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
       else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_TOPLEVEL)
 	{
-          if (focus_on_map && private->accept_focus)
+          if (focus_on_map && window->accept_focus)
 	    {
 	      SetForegroundWindow (GDK_WINDOW_HWND (window));
 	      if (top == HWND_TOPMOST)
@@ -1023,15 +1039,12 @@ gdk_win32_window_show (GdkWindow *window,
 static void
 gdk_win32_window_hide (GdkWindow *window)
 {
-  GdkWindowObject *private;
-  
-  private = (GdkWindowObject*) window;
-  if (private->destroyed)
+  if (window->destroyed)
     return;
 
   GDK_NOTE (MISC, g_print ("gdk_win32_window_hide: %p: %s\n",
 			   GDK_WINDOW_HWND (window),
-			   _gdk_win32_window_state_to_string (private->state)));
+			   _gdk_win32_window_state_to_string (window->state)));
   
   if (GDK_WINDOW_IS_MAPPED (window))
     gdk_synthesize_window_state (window,
@@ -1058,16 +1071,13 @@ gdk_win32_window_hide (GdkWindow *window)
 static void
 gdk_win32_window_withdraw (GdkWindow *window)
 {
-  GdkWindowObject *private;
-  
-  private = (GdkWindowObject*) window;
-  if (private->destroyed)
+  if (window->destroyed)
     return;
 
   GDK_NOTE (MISC, g_print ("gdk_win32_window_withdraw: %p: %s\n",
 			   GDK_WINDOW_HWND (window),
-			   _gdk_win32_window_state_to_string (private->state)));
-  
+			   _gdk_win32_window_state_to_string (window->state)));
+
   gdk_window_hide (window);	/* ??? */
 }
 
@@ -1075,7 +1085,6 @@ static void
 gdk_win32_window_move (GdkWindow *window,
 		       gint x, gint y)
 {
-  GdkWindowObject *private = (GdkWindowObject *)window;
   GdkWindowImplWin32 *impl;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1086,24 +1095,24 @@ gdk_win32_window_move (GdkWindow *window,
   GDK_NOTE (MISC, g_print ("gdk_win32_window_move: %p: %+d%+d\n",
                            GDK_WINDOW_HWND (window), x, y));
 
-  impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
-  if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
+  if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
     return;
 
-  /* Don't check GDK_WINDOW_TYPE (private) == GDK_WINDOW_CHILD.
+  /* Don't check GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD.
    * Foreign windows (another app's windows) might be children of our
    * windows! Especially in the case of gtkplug/socket.
    */
   if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
     {
-      _gdk_window_move_resize_child (window, x, y, private->width, private->height);
+      _gdk_window_move_resize_child (window, x, y, window->width, window->height);
     }
   else
     {
       RECT outer_rect;
 
-      get_outer_rect (window, private->width, private->height, &outer_rect);
+      get_outer_rect (window, window->width, window->height, &outer_rect);
 
       adjust_for_gravity_hints (window, &outer_rect, &x, &y);
 
@@ -1122,7 +1131,6 @@ static void
 gdk_win32_window_resize (GdkWindow *window,
 			 gint width, gint height)
 {
-  GdkWindowObject *private = (GdkWindowObject*) window;
   GdkWindowImplWin32 *impl;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1138,14 +1146,14 @@ gdk_win32_window_resize (GdkWindow *window,
   GDK_NOTE (MISC, g_print ("gdk_win32_window_resize: %p: %dx%d\n",
                            GDK_WINDOW_HWND (window), width, height));
 
-  impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
-  if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
+  if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
     return;
 
   if (GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) != GetDesktopWindow ())
     {
-      _gdk_window_move_resize_child (window, private->x, private->y, width, height);
+      _gdk_window_move_resize_child (window, window->x, window->y, width, height);
     }
   else
     {
@@ -1164,7 +1172,7 @@ gdk_win32_window_resize (GdkWindow *window,
                                outer_rect.right - outer_rect.left,
                                outer_rect.bottom - outer_rect.top,
                                SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER));
-      private->resize_count += 1;
+      window->resize_count += 1;
     }
 }
 
@@ -1175,7 +1183,6 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
 				       gint       width,
 				       gint       height)
 {
-  GdkWindowObject *private;
   GdkWindowImplWin32 *impl;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1188,10 +1195,9 @@ gdk_win32_window_move_resize_internal (GdkWindow *window,
   if (height < 1)
     height = 1;
 
-  private = GDK_WINDOW_OBJECT (window);
-  impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
-  if (private->state & GDK_WINDOW_STATE_FULLSCREEN)
+  if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
     return;
 
   GDK_NOTE (MISC, g_print ("gdk_win32_window_move_resize: %p: %dx%d %+d%+d\n",
@@ -1256,9 +1262,8 @@ gdk_win32_window_reparent (GdkWindow *window,
 			   gint       x,
 			   gint       y)
 {
-  GdkWindowObject *window_private;
-  GdkWindowObject *parent_private;
-  GdkWindowObject *old_parent_private;
+  GdkWindow *parent;
+  GdkWindow *old_parent;
   GdkWindowImplWin32 *impl;
   gboolean was_toplevel;
   LONG style;
@@ -1266,10 +1271,9 @@ gdk_win32_window_reparent (GdkWindow *window,
   if (!new_parent)
     new_parent = _gdk_root;
 
-  window_private = (GdkWindowObject*) window;
-  old_parent_private = (GdkWindowObject *) window_private->parent;
-  parent_private = (GdkWindowObject*) new_parent;
-  impl = GDK_WINDOW_IMPL_WIN32 (window_private->impl);
+  old_parent = window->parent;
+  parent = new_parent;
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   GDK_NOTE (MISC, g_print ("gdk_win32_window_reparent: %p: %p\n",
 			   GDK_WINDOW_HWND (window),
@@ -1299,7 +1303,7 @@ gdk_win32_window_reparent (GdkWindow *window,
 			GDK_WINDOW_HWND (new_parent)));
   
   API_CALL (MoveWindow, (GDK_WINDOW_HWND (window),
-			 x, y, window_private->width, window_private->height, TRUE));
+			 x, y, window->width, window->height, TRUE));
 
   /* From here on, we treat parents of type GDK_WINDOW_FOREIGN like
    * the root window
@@ -1307,7 +1311,7 @@ gdk_win32_window_reparent (GdkWindow *window,
   if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
     new_parent = _gdk_root;
   
-  window_private->parent = (GdkWindowObject *)new_parent;
+  window->parent = new_parent;
 
   /* Switch the window type as appropriate */
 
@@ -1333,11 +1337,11 @@ gdk_win32_window_reparent (GdkWindow *window,
 	}
     }
 
-  if (old_parent_private)
-    old_parent_private->children =
-      g_list_remove (old_parent_private->children, window);
+  if (old_parent)
+    old_parent->children =
+      g_list_remove (old_parent->children, window);
 
-  parent_private->children = g_list_prepend (parent_private->children, window);
+  parent->children = g_list_prepend (parent->children, window);
 
   return FALSE;
 }
@@ -1354,7 +1358,7 @@ gdk_win32_window_raise (GdkWindow *window)
         API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOPMOST,
 	                         0, 0, 0, 0,
 				 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE));
-      else if (((GdkWindowObject *)window)->accept_focus)
+      else if (window->accept_focus)
         API_CALL (BringWindowToTop, (GDK_WINDOW_HWND (window)));
       else
         API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), HWND_TOP,
@@ -1380,8 +1384,8 @@ gdk_win32_window_lower (GdkWindow *window)
     }
 }
 
-void
-gdk_window_set_urgency_hint (GdkWindow *window,
+static void
+gdk_win32_window_set_urgency_hint (GdkWindow *window,
 			     gboolean   urgent)
 {
   FLASHWINFO flashwinfo;
@@ -1421,12 +1425,12 @@ get_effective_window_decorations (GdkWindow       *window,
 {
   GdkWindowImplWin32 *impl;
 
-  impl = (GdkWindowImplWin32 *)((GdkWindowObject *)window)->impl;
+  impl = (GdkWindowImplWin32 *)window->impl;
 
   if (gdk_window_get_decorations (window, decoration))
     return TRUE;
     
-  if (((GdkWindowObject *) window)->window_type != GDK_WINDOW_TOPLEVEL) 
+  if (window->window_type != GDK_WINDOW_TOPLEVEL) 
     {
       return FALSE;
     }
@@ -1504,8 +1508,8 @@ get_effective_window_decorations (GdkWindow       *window,
   return FALSE;
 }
 
-void 
-gdk_window_set_geometry_hints (GdkWindow         *window,
+static void
+gdk_win32_window_set_geometry_hints (GdkWindow         *window,
 			       const GdkGeometry *geometry,
 			       GdkWindowHints     geom_mask)
 {
@@ -1519,7 +1523,7 @@ gdk_window_set_geometry_hints (GdkWindow         *window,
   GDK_NOTE (MISC, g_print ("gdk_window_set_geometry_hints: %p\n",
 			   GDK_WINDOW_HWND (window)));
 
-  impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   impl->hint_flags = geom_mask;
   impl->hints = *geometry;
@@ -1565,8 +1569,8 @@ gdk_window_set_geometry_hints (GdkWindow         *window,
   update_style_bits (window);
 }
 
-void
-gdk_window_set_title (GdkWindow   *window,
+static void
+gdk_win32_window_set_title (GdkWindow   *window,
 		      const gchar *title)
 {
   wchar_t *wtitle;
@@ -1593,8 +1597,8 @@ gdk_window_set_title (GdkWindow   *window,
   GDK_NOTE (MISC_OR_EVENTS, g_free ((char *) title));
 }
 
-void          
-gdk_window_set_role (GdkWindow   *window,
+static void
+gdk_win32_window_set_role (GdkWindow   *window,
 		     const gchar *role)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -1605,12 +1609,12 @@ gdk_window_set_role (GdkWindow   *window,
   /* XXX */
 }
 
-void
-gdk_window_set_transient_for (GdkWindow *window, 
+static void
+gdk_win32_window_set_transient_for (GdkWindow *window, 
 			      GdkWindow *parent)
 {
   HWND window_id, parent_id;
-  GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+  GdkWindowImplWin32 *window_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
   GdkWindowImplWin32 *parent_impl = NULL;
   GSList *item;
 
@@ -1631,7 +1635,7 @@ gdk_window_set_transient_for (GdkWindow *window,
       return;
     }
 
-  if (((GdkWindowObject *) window)->window_type == GDK_WINDOW_CHILD)
+  if (window->window_type == GDK_WINDOW_CHILD)
     {
       GDK_NOTE (MISC, g_print ("... a child window!\n"));
       return;
@@ -1639,7 +1643,7 @@ gdk_window_set_transient_for (GdkWindow *window,
 
   if (parent == NULL)
     {
-      GdkWindowImplWin32 *trans_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window_impl->transient_owner)->impl);
+      GdkWindowImplWin32 *trans_impl = GDK_WINDOW_IMPL_WIN32 (window_impl->transient_owner->impl);
       if (trans_impl->transient_children != NULL)
         {
           item = g_slist_find (trans_impl->transient_children, window);
@@ -1659,7 +1663,7 @@ gdk_window_set_transient_for (GdkWindow *window,
     }
   else
     {
-      parent_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (parent)->impl);
+      parent_impl = GDK_WINDOW_IMPL_WIN32 (parent->impl);
 
       parent_impl->transient_children = g_slist_append (parent_impl->transient_children, window);
       g_object_ref (G_OBJECT (window));
@@ -1714,7 +1718,7 @@ _gdk_modal_current (void)
     {
       GSList *tmp = modal_window_stack;
 
-      while (tmp != NULL && !GDK_WINDOW_IS_MAPPED (tmp->data))
+      while (tmp != NULL && !GDK_WINDOW_IS_MAPPED (GDK_WINDOW (tmp->data)))
 	{
 	  tmp = g_slist_next (tmp);
 	}
@@ -1739,12 +1743,12 @@ gdk_win32_window_set_device_cursor (GdkWindow *window,
                                     GdkCursor *cursor)
 {
   GdkWindowImplWin32 *impl;
-  GdkCursorPrivate *cursor_private;
+  GdkWin32Cursor *cursor_private;
   HCURSOR hcursor;
   HCURSOR hprevcursor;
   
-  impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
-  cursor_private = (GdkCursorPrivate*) cursor;
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
+  cursor_private = (GdkWin32Cursor*) cursor;
   
   if (GDK_WINDOW_DESTROYED (window))
     return;
@@ -1895,8 +1899,8 @@ gdk_win32_window_restack_toplevel (GdkWindow *window,
 	// ### TODO
 }
 
-void
-gdk_window_get_root_origin (GdkWindow *window,
+static void
+gdk_win32_window_get_root_origin (GdkWindow *window,
 			    gint      *x,
 			    gint      *y)
 {
@@ -1916,19 +1920,16 @@ gdk_window_get_root_origin (GdkWindow *window,
 			   GDK_WINDOW_HWND (window), rect.x, rect.y));
 }
 
-void
-gdk_window_get_frame_extents (GdkWindow    *window,
+static void
+gdk_win32_window_get_frame_extents (GdkWindow    *window,
                               GdkRectangle *rect)
 {
-  GdkWindowObject *private;
   HWND hwnd;
   RECT r;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
   g_return_if_fail (rect != NULL);
 
-  private = GDK_WINDOW_OBJECT (window);
-
   rect->x = 0;
   rect->y = 0;
   rect->width = 1;
@@ -1940,8 +1941,8 @@ gdk_window_get_frame_extents (GdkWindow    *window,
   /* FIXME: window is documented to be a toplevel GdkWindow, so is it really
    * necessary to walk its parent chain?
    */
-  while (private->parent && ((GdkWindowObject*) private->parent)->parent)
-    private = (GdkWindowObject*) private->parent;
+  while (window->parent && window->parent->parent)
+    window = window->parent;
 
   hwnd = GDK_WINDOW_HWND (window);
   API_CALL (GetWindowRect, (hwnd, &r));
@@ -1997,22 +1998,6 @@ _gdk_windowing_get_device_state (GdkDisplay       *display,
 }
 
 void
-gdk_display_warp_pointer (GdkDisplay *display,
-			  GdkScreen  *screen,
-			  gint        x,
-			  gint        y)
-{
-  GdkDeviceManagerWin32 *device_manager;
-
-  g_return_if_fail (display == _gdk_display);
-  g_return_if_fail (screen == _gdk_screen);
-
-  device_manager = GDK_DEVICE_MANAGER_WIN32 (gdk_display_get_device_manager (display));
-  GDK_DEVICE_GET_CLASS (device_manager->core_pointer)->warp (device_manager->core_pointer,
-                                                             screen, x, y);
-}
-
-void
 gdk_display_warp_device (GdkDisplay *display,
                          GdkDevice  *device,
                          GdkScreen  *screen,
@@ -2044,7 +2029,7 @@ gdk_win32_window_get_events (GdkWindow *window)
   if (GDK_WINDOW_DESTROYED (window))
     return 0;
 
-  return GDK_WINDOW_OBJECT (window)->event_mask;
+  return window->event_mask;
 }
 
 static void          
@@ -2055,7 +2040,7 @@ gdk_win32_window_set_events (GdkWindow   *window,
    * set it here, too. Not that I know or remember why it is
    * necessary, will have to test some day.
    */
-  GDK_WINDOW_OBJECT (window)->event_mask = GDK_STRUCTURE_MASK | event_mask;
+  window->event_mask = GDK_STRUCTURE_MASK | event_mask;
 }
 
 static void
@@ -2082,8 +2067,8 @@ do_shape_combine_region (GdkWindow *window,
   SetWindowRgn (GDK_WINDOW_HWND (window), hrgn, TRUE);
 }
 
-void
-gdk_window_set_override_redirect (GdkWindow *window,
+static void
+gdk_win32_window_set_override_redirect (GdkWindow *window,
 				  gboolean   override_redirect)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2091,40 +2076,32 @@ gdk_window_set_override_redirect (GdkWindow *window,
   g_warning ("gdk_window_set_override_redirect not implemented");
 }
 
-void
-gdk_window_set_accept_focus (GdkWindow *window,
+static void
+gdk_win32_window_set_accept_focus (GdkWindow *window,
 			     gboolean accept_focus)
 {
-  GdkWindowObject *private;
-
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  private = (GdkWindowObject *)window;  
-  
   accept_focus = accept_focus != FALSE;
 
-  if (private->accept_focus != accept_focus)
-    private->accept_focus = accept_focus;
+  if (window->accept_focus != accept_focus)
+    window->accept_focus = accept_focus;
 }
 
-void
-gdk_window_set_focus_on_map (GdkWindow *window,
+static void
+gdk_win32_window_set_focus_on_map (GdkWindow *window,
 			     gboolean focus_on_map)
 {
-  GdkWindowObject *private;
-
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  private = (GdkWindowObject *)window;  
-  
   focus_on_map = focus_on_map != FALSE;
 
-  if (private->focus_on_map != focus_on_map)
-    private->focus_on_map = focus_on_map;
+  if (window->focus_on_map != focus_on_map)
+    window->focus_on_map = focus_on_map;
 }
 
-void          
-gdk_window_set_icon_list (GdkWindow *window,
+static void
+gdk_win32_window_set_icon_list (GdkWindow *window,
 			  GList     *pixbufs)
 {
   GdkPixbuf *pixbuf, *big_pixbuf, *small_pixbuf;
@@ -2141,7 +2118,7 @@ gdk_window_set_icon_list (GdkWindow *window,
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+  impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
   /* ideal sizes for small and large icons */
   big_w = GetSystemMetrics (SM_CXICON);
@@ -2204,8 +2181,8 @@ gdk_window_set_icon_list (GdkWindow *window,
   impl->hicon_small = small_hicon;
 }
 
-void
-gdk_window_set_icon_name (GdkWindow   *window, 
+static void
+gdk_win32_window_set_icon_name (GdkWindow   *window, 
 			  const gchar *name)
 {
   /* In case I manage to confuse this again (or somebody else does):
@@ -2233,8 +2210,8 @@ gdk_window_set_icon_name (GdkWindow   *window,
 #endif
 }
 
-GdkWindow *
-gdk_window_get_group (GdkWindow *window)
+static GdkWindow *
+gdk_win32_window_get_group (GdkWindow *window)
 {
   g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
   g_return_val_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD, NULL);
@@ -2247,8 +2224,8 @@ gdk_window_get_group (GdkWindow *window)
   return NULL;
 }
 
-void          
-gdk_window_set_group (GdkWindow *window, 
+static void
+gdk_win32_window_set_group (GdkWindow *window, 
 		      GdkWindow *leader)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2280,8 +2257,7 @@ update_single_bit (LONG    *style,
 static void
 update_style_bits (GdkWindow *window)
 {
-  GdkWindowObject *private = (GdkWindowObject *)window;
-  GdkWindowImplWin32 *impl = (GdkWindowImplWin32 *)private->impl;
+  GdkWindowImplWin32 *impl = (GdkWindowImplWin32 *)window->impl;
   GdkWMDecoration decorations;
   LONG old_style, new_style, old_exstyle, new_exstyle;
   gboolean all;
@@ -2297,7 +2273,7 @@ update_style_bits (GdkWindow *window)
   new_style = old_style;
   new_exstyle = old_exstyle;
 
-  if (private->window_type == GDK_WINDOW_TEMP ||
+  if (window->window_type == GDK_WINDOW_TEMP ||
       impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY)
     new_exstyle |= WS_EX_TOOLWINDOW;
   else
@@ -2403,8 +2379,8 @@ get_decorations_quark ()
   return quark;
 }
 
-void
-gdk_window_set_decorations (GdkWindow      *window,
+static void
+gdk_win32_window_set_decorations (GdkWindow      *window,
 			    GdkWMDecoration decorations)
 {
   GdkWMDecoration* decorations_copy;
@@ -2428,8 +2404,8 @@ gdk_window_set_decorations (GdkWindow      *window,
   update_style_bits (window);
 }
 
-gboolean
-gdk_window_get_decorations (GdkWindow       *window,
+static gboolean
+gdk_win32_window_get_decorations (GdkWindow       *window,
 			    GdkWMDecoration *decorations)
 {
   GdkWMDecoration* decorations_set;
@@ -2454,8 +2430,8 @@ get_functions_quark ()
   return quark;
 }
 
-void
-gdk_window_set_functions (GdkWindow    *window,
+static void
+gdk_win32_window_set_functions (GdkWindow    *window,
 			  GdkWMFunction functions)
 {
   GdkWMFunction* functions_copy;
@@ -2500,8 +2476,8 @@ gdk_win32_window_set_static_gravities (GdkWindow *window,
   return !use_static;
 }
 
-void
-gdk_window_begin_resize_drag (GdkWindow     *window,
+static void
+gdk_win32_window_begin_resize_drag (GdkWindow     *window,
                               GdkWindowEdge  edge,
                               gint           button,
                               gint           root_x,
@@ -2569,8 +2545,8 @@ gdk_window_begin_resize_drag (GdkWindow     *window,
 		  MAKELPARAM (root_x - _gdk_offset_x, root_y - _gdk_offset_y));
 }
 
-void
-gdk_window_begin_move_drag (GdkWindow *window,
+static void
+gdk_win32_window_begin_move_drag (GdkWindow *window,
                             gint       button,
                             gint       root_x,
                             gint       root_y,
@@ -2603,8 +2579,8 @@ gdk_window_begin_move_drag (GdkWindow *window,
 /*
  * Setting window states
  */
-void
-gdk_window_iconify (GdkWindow *window)
+static void
+gdk_win32_window_iconify (GdkWindow *window)
 {
   HWND old_active_window;
 
@@ -2615,7 +2591,7 @@ gdk_window_iconify (GdkWindow *window)
 
   GDK_NOTE (MISC, g_print ("gdk_window_iconify: %p: %s\n",
 			   GDK_WINDOW_HWND (window),
-			   _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+			   _gdk_win32_window_state_to_string (window->state)));
 
   if (GDK_WINDOW_IS_MAPPED (window))
     {
@@ -2632,8 +2608,8 @@ gdk_window_iconify (GdkWindow *window)
     }
 }
 
-void
-gdk_window_deiconify (GdkWindow *window)
+static void
+gdk_win32_window_deiconify (GdkWindow *window)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -2642,7 +2618,7 @@ gdk_window_deiconify (GdkWindow *window)
 
   GDK_NOTE (MISC, g_print ("gdk_window_deiconify: %p: %s\n",
 			   GDK_WINDOW_HWND (window),
-			   _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+			   _gdk_win32_window_state_to_string (window->state)));
 
   if (GDK_WINDOW_IS_MAPPED (window))
     {  
@@ -2656,8 +2632,8 @@ gdk_window_deiconify (GdkWindow *window)
     }
 }
 
-void
-gdk_window_stick (GdkWindow *window)
+static void
+gdk_win32_window_stick (GdkWindow *window)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -2667,8 +2643,8 @@ gdk_window_stick (GdkWindow *window)
   /* FIXME: Do something? */
 }
 
-void
-gdk_window_unstick (GdkWindow *window)
+static void
+gdk_win32_window_unstick (GdkWindow *window)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -2678,8 +2654,8 @@ gdk_window_unstick (GdkWindow *window)
   /* FIXME: Do something? */
 }
 
-void
-gdk_window_maximize (GdkWindow *window)
+static void
+gdk_win32_window_maximize (GdkWindow *window)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -2688,7 +2664,7 @@ gdk_window_maximize (GdkWindow *window)
 
   GDK_NOTE (MISC, g_print ("gdk_window_maximize: %p: %s\n",
 			   GDK_WINDOW_HWND (window),
-			   _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+			   _gdk_win32_window_state_to_string (window->state)));
 
   if (GDK_WINDOW_IS_MAPPED (window))
     ShowWindow (GDK_WINDOW_HWND (window), SW_MAXIMIZE);
@@ -2698,8 +2674,8 @@ gdk_window_maximize (GdkWindow *window)
 				 GDK_WINDOW_STATE_MAXIMIZED);
 }
 
-void
-gdk_window_unmaximize (GdkWindow *window)
+static void
+gdk_win32_window_unmaximize (GdkWindow *window)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -2708,7 +2684,7 @@ gdk_window_unmaximize (GdkWindow *window)
 
   GDK_NOTE (MISC, g_print ("gdk_window_unmaximize: %p: %s\n",
 			   GDK_WINDOW_HWND (window),
-			   _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+			   _gdk_win32_window_state_to_string (window->state)));
 
   if (GDK_WINDOW_IS_MAPPED (window))
     ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
@@ -2727,12 +2703,11 @@ struct _FullscreenInfo
   LONG  style;
 };
 
-void
-gdk_window_fullscreen (GdkWindow *window)
+static void
+gdk_win32_window_fullscreen (GdkWindow *window)
 {
   gint x, y, width, height;
   FullscreenInfo *fi;
-  GdkWindowObject *private = (GdkWindowObject *) window;
   HMONITOR monitor;
   MONITORINFO mi;
 
@@ -2744,7 +2719,7 @@ gdk_window_fullscreen (GdkWindow *window)
     g_free (fi);
   else
     {
-      GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+      GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
       monitor = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
       mi.cbSize = sizeof (mi);
@@ -2779,18 +2754,17 @@ gdk_window_fullscreen (GdkWindow *window)
     }
 }
 
-void
-gdk_window_unfullscreen (GdkWindow *window)
+static void
+gdk_win32_window_unfullscreen (GdkWindow *window)
 {
   FullscreenInfo *fi;
-  GdkWindowObject *private = (GdkWindowObject *) window;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
   fi = g_object_get_data (G_OBJECT (window), "fullscreen-info");
   if (fi)
     {
-      GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (private->impl);
+      GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
 
       impl->hint_flags = fi->hint_flags;
       SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, fi->style);
@@ -2806,8 +2780,8 @@ gdk_window_unfullscreen (GdkWindow *window)
     }
 }
 
-void
-gdk_window_set_keep_above (GdkWindow *window,
+static void
+gdk_win32_window_set_keep_above (GdkWindow *window,
 			   gboolean   setting)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2832,8 +2806,8 @@ gdk_window_set_keep_above (GdkWindow *window,
 				 setting ? GDK_WINDOW_STATE_ABOVE : 0);
 }
 
-void
-gdk_window_set_keep_below (GdkWindow *window,
+static void
+gdk_win32_window_set_keep_below (GdkWindow *window,
 			   gboolean   setting)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2858,9 +2832,9 @@ gdk_window_set_keep_below (GdkWindow *window,
 				 setting ? GDK_WINDOW_STATE_BELOW : 0);
 }
 
-void
-gdk_window_focus (GdkWindow *window,
-                  guint32    timestamp)
+static void
+gdk_win32_window_focus (GdkWindow *window,
+			guint32    timestamp)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
 
@@ -2869,21 +2843,19 @@ gdk_window_focus (GdkWindow *window,
   
   GDK_NOTE (MISC, g_print ("gdk_window_focus: %p: %s\n",
 			   GDK_WINDOW_HWND (window),
-			   _gdk_win32_window_state_to_string (((GdkWindowObject *) window)->state)));
+			   _gdk_win32_window_state_to_string (window->state)));
 
-  if (((GdkWindowObject *) window)->state & GDK_WINDOW_STATE_MAXIMIZED)
+  if (window->state & GDK_WINDOW_STATE_MAXIMIZED)
     ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
   else
     ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWNORMAL);
   SetFocus (GDK_WINDOW_HWND (window));
 }
 
-void
-gdk_window_set_modal_hint (GdkWindow *window,
+static void
+gdk_win32_window_set_modal_hint (GdkWindow *window,
 			   gboolean   modal)
 {
-  GdkWindowObject *private;
-
   g_return_if_fail (GDK_IS_WINDOW (window));
   
   if (GDK_WINDOW_DESTROYED (window))
@@ -2893,12 +2865,10 @@ gdk_window_set_modal_hint (GdkWindow *window,
 			   GDK_WINDOW_HWND (window),
 			   modal ? "YES" : "NO"));
 
-  private = (GdkWindowObject*) window;
-
-  if (modal == private->modal_hint)
+  if (modal == window->modal_hint)
     return;
 
-  private->modal_hint = modal;
+  window->modal_hint = modal;
 
 #if 0
   /* Not sure about this one.. -- Cody */
@@ -2922,8 +2892,8 @@ gdk_window_set_modal_hint (GdkWindow *window,
 #endif
 }
 
-void
-gdk_window_set_skip_taskbar_hint (GdkWindow *window,
+static void
+gdk_win32_window_set_skip_taskbar_hint (GdkWindow *window,
 				  gboolean   skips_taskbar)
 {
   static GdkWindow *owner = NULL;
@@ -2969,8 +2939,8 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window,
     }
 }
 
-void
-gdk_window_set_skip_pager_hint (GdkWindow *window,
+static void
+gdk_win32_window_set_skip_pager_hint (GdkWindow *window,
 				gboolean   skips_pager)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2980,8 +2950,8 @@ gdk_window_set_skip_pager_hint (GdkWindow *window,
 			   skips_pager ? "YES" : "NO"));
 }
 
-void
-gdk_window_set_type_hint (GdkWindow        *window,
+static void
+gdk_win32_window_set_type_hint (GdkWindow        *window,
 			  GdkWindowTypeHint hint)
 {
   g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2999,20 +2969,20 @@ gdk_window_set_type_hint (GdkWindow        *window,
 		       g_enum_get_value (class, hint)->value_name);
 	    }G_STMT_END);
 
-  ((GdkWindowImplWin32 *)((GdkWindowObject *)window)->impl)->type_hint = hint;
+  ((GdkWindowImplWin32 *)window->impl)->type_hint = hint;
 
   update_style_bits (window);
 }
 
-GdkWindowTypeHint
-gdk_window_get_type_hint (GdkWindow *window)
+static GdkWindowTypeHint
+gdk_win32_window_get_type_hint (GdkWindow *window)
 {
   g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL);
   
   if (GDK_WINDOW_DESTROYED (window))
     return GDK_WINDOW_TYPE_HINT_NORMAL;
 
-  return GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->type_hint;
+  return GDK_WINDOW_IMPL_WIN32 (window->impl)->type_hint;
 }
 
 static HRGN
@@ -3098,23 +3068,23 @@ gdk_win32_window_lookup_for_display (GdkDisplay      *display,
 {
   g_return_val_if_fail (display == _gdk_display, NULL);
 
-  return (GdkWindow*) gdk_win32_handle_table_lookup (hwnd);
+  return (GdkWindow*) gdk_win32_handle_table_lookup (anid);
 }
 
-void
-gdk_window_enable_synchronized_configure (GdkWindow *window)
+static void
+gdk_win32_window_enable_synchronized_configure (GdkWindow *window)
 {
-  g_return_if_fail (GDK_IS_WINDOW (window));
+  /* nothing - no window manager to cooperate with */
 }
 
-void
-gdk_window_configure_finished (GdkWindow *window)
+static void
+gdk_win32_window_configure_finished (GdkWindow *window)
 {
-  g_return_if_fail (GDK_IS_WINDOW (window));
+  /* nothing - no window manager to cooperate with */
 }
 
-void
-gdk_window_set_opacity (GdkWindow *window,
+static void
+gdk_win32_window_set_opacity (GdkWindow *window,
 			gdouble    opacity)
 {
   LONG exstyle;
@@ -3168,13 +3138,6 @@ gdk_win32_window_get_shape (GdkWindow *window)
   return NULL;
 }
 
-static cairo_region_t *
-_gdk_win32_window_get_input_shape (GdkWindow *window)
-{
-  /* CHECK: are these really supposed to be the same? */
-  return _gdk_windowing_window_get_shape (window);
-}
-
 static gboolean
 _gdk_win32_window_queue_antiexpose (GdkWindow *window,
 				    cairo_region_t *area)
@@ -3192,44 +3155,30 @@ _gdk_win32_window_queue_antiexpose (GdkWindow *window,
   return FALSE;
 }
 
-/* FIXME: Tis function has never been compiled.
- * Please make it work. */
+/* Gets called from gdwindow.c(do_move_region_bits_on_impl)
+ * and got tested with testgtk::big_window. Given the previous,
+ * untested implementation this one looks much too simple ;)
+ */
 static void
 _gdk_win32_window_translate (GdkWindow *window,
-                             cairo_region_t *area,
+                             cairo_region_t *area, /* In impl window coords */
                              gint       dx,
                              gint       dy)
 {
-  HRGN hrgn = CreateRectRgn (0, 0, 0, 0);
-  HDC hdc;
-  int ret;
   GdkRectangle extents;
+  RECT rect;
 
   cairo_region_get_extents (area, &extents);
-  hdc = _gdk_win32_drawable_acquire_dc (GDK_DRAWABLE (window));
-  GDI_CALL (BitBlt, (hdc, extents.x, extents.y, extents.width, extents.height,
-		     hdc, extents.x + dx, extents.y + dy, SRCCOPY));
-
-  /* XXX: We probably need to get invalidations for the whole extents and not
-   * just the area as we BitBlt */
-  ret = GetUpdateRgn (GDK_WINDOW_HWND (window), hrgn, FALSE);
-  if (ret == ERROR)
-    WIN32_API_FAILED ("GetUpdateRgn");
-  else if (ret != NULLREGION)
-    {
-      /* Get current updateregion, move any part of it that intersects area by dx,dy */
-      HRGN update = cairo_region_to_hrgn (area, 0, 0);
-      ret = CombineRgn (update, hrgn, update, RGN_AND);
-      if (ret == ERROR)
-        WIN32_API_FAILED ("CombineRgn");
-      else if (ret != NULLREGION)
-	{
-	  OffsetRgn (update, dx, dy);
-          API_CALL (InvalidateRgn, (GDK_WINDOW_HWND (window), update, TRUE));
-	}
-      DeleteObject (update);
-    }
-  DeleteObject (hrgn);
+  rect.left = extents.x - dx;
+  rect.top = extents.y - dy;
+  rect.right = rect.left + extents.width;
+  rect.bottom = rect.top + extents.height;
+
+  API_CALL (ScrollWindowEx, (GDK_WINDOW_HWND (window), 
+			     dx, dy, &rect, 
+			     NULL, NULL, NULL, 
+			     SW_INVALIDATE));
+
 }
 
 static void
@@ -3244,57 +3193,216 @@ gdk_win32_input_shape_combine_region (GdkWindow *window,
   gdk_win32_window_shape_combine_region (window, shape_region, offset_x, offset_y);
 }
 
-void
-_gdk_windowing_window_process_updates_recurse (GdkWindow *window,
+static void
+gdk_win32_window_process_updates_recurse (GdkWindow *window,
 					       cairo_region_t *region)
 {
   _gdk_window_process_updates_recurse (window, region);
 }
 
-void
-_gdk_windowing_before_process_all_updates (void)
+gboolean
+gdk_win32_window_is_win32 (GdkWindow *window)
 {
+  return GDK_WINDOW_IS_WIN32 (window);
 }
 
-void
-_gdk_windowing_after_process_all_updates (void)
-{
-}
-
-static void
-gdk_window_impl_iface_init (GdkWindowImplIface *iface)
-{
-  iface->show = gdk_win32_window_show;
-  iface->hide = gdk_win32_window_hide;
-  iface->withdraw = gdk_win32_window_withdraw;
-  iface->set_events = gdk_win32_window_set_events;
-  iface->get_events = gdk_win32_window_get_events;
-  iface->raise = gdk_win32_window_raise;
-  iface->lower = gdk_win32_window_lower;
-  iface->restack_under = gdk_win32_window_restack_under;
-  iface->restack_toplevel = gdk_win32_window_restack_toplevel;
-  iface->move_resize = gdk_win32_window_move_resize;
-  iface->set_background = gdk_win32_window_set_background;
-  iface->reparent = gdk_win32_window_reparent;
-  iface->set_device_cursor = gdk_win32_window_set_device_cursor;
-  iface->get_geometry = gdk_win32_window_get_geometry;
-  iface->get_device_state = gdk_window_win32_get_device_state;
-  iface->get_root_coords = gdk_win32_window_get_root_coords;
-  iface->shape_combine_region = gdk_win32_window_shape_combine_region;
-  iface->input_shape_combine_region = gdk_win32_input_shape_combine_region;
-  iface->set_static_gravities = gdk_win32_window_set_static_gravities;
-  iface->queue_antiexpose = _gdk_win32_window_queue_antiexpose;
-  iface->translate = _gdk_win32_window_translate;
-  iface->destroy = gdk_win32_window_destroy;
-  iface->destroy_foreign = gdk_win32_window_destroy_foreign;
-  iface->resize_cairo_surface = gdk_win32_window_resize_cairo_surface;
-  iface->get_shape = gdk_win32_window_get_shape;
-  iface->get_input_shape = gdk_win32_window_get_input_shape;
+/**
+ * _gdk_win32_acquire_dc
+ * @impl: a Win32 #GdkWindowImplWin32 implementation
+ * 
+ * Gets a DC with the given drawable selected into it.
+ *
+ * Return value: The DC, on success. Otherwise
+ *  %NULL. If this function succeeded
+ *  _gdk_win32_impl_release_dc()  must be called
+ *  release the DC when you are done using it.
+ **/
+static HDC 
+_gdk_win32_impl_acquire_dc (GdkWindowImplWin32 *impl)
+{
+  if (GDK_IS_WINDOW_IMPL_WIN32 (impl) &&
+      GDK_WINDOW_DESTROYED (impl->wrapper))
+    return NULL;
+
+  if (!impl->hdc)
+    {
+      impl->hdc = GetDC (impl->handle);
+      if (!impl->hdc)
+	WIN32_GDI_FAILED ("GetDC");
+    }
+
+  if (impl->hdc)
+    {
+      impl->hdc_count++;
+      return impl->hdc;
+    }
+  else
+    {
+      return NULL;
+    }
 }
 
-gboolean
-gdk_win32_window_is_win32 (GdkWindow *window)
+/**
+ * _gdk_win32_impl_release_dc
+ * @impl: a Win32 #GdkWindowImplWin32 implementation
+ * 
+ * Releases the reference count for the DC
+ * from _gdk_win32_impl_acquire_dc()
+ **/
+static void
+_gdk_win32_impl_release_dc (GdkWindowImplWin32 *impl)
 {
-  return GDK_WINDOW_IS_WIN32 (window);
+  g_return_if_fail (impl->hdc_count > 0);
+
+  impl->hdc_count--;
+  if (impl->hdc_count == 0)
+    {
+      if (impl->saved_dc_bitmap)
+	{
+	  GDI_CALL (SelectObject, (impl->hdc, impl->saved_dc_bitmap));
+	  impl->saved_dc_bitmap = NULL;
+	}
+      
+      if (impl->hdc)
+	{
+	  GDI_CALL (ReleaseDC, (impl->handle, impl->hdc));
+	  impl->hdc = NULL;
+	}
+    }
 }
 
+static void
+gdk_win32_cairo_surface_destroy (void *data)
+{
+  GdkWindowImplWin32 *impl = data;
+
+  _gdk_win32_impl_release_dc (impl);
+  impl->cairo_surface = NULL;
+}
+
+static cairo_surface_t *
+gdk_win32_ref_cairo_surface (GdkWindow *window)
+{
+  GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
+
+  if (GDK_IS_WINDOW_IMPL_WIN32 (impl) &&
+      GDK_WINDOW_DESTROYED (impl->wrapper))
+    return NULL;
+
+  if (!impl->cairo_surface)
+    {
+      HDC hdc = _gdk_win32_impl_acquire_dc (impl);
+      if (!hdc)
+	return NULL;
+
+      impl->cairo_surface = cairo_win32_surface_create (hdc);
+
+      cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key,
+				   impl, gdk_win32_cairo_surface_destroy);
+    }
+  else
+    cairo_surface_reference (impl->cairo_surface);
+
+  return impl->cairo_surface;
+}
+
+static void
+gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
+
+  parent_class = g_type_class_peek_parent (klass);
+
+  object_class->finalize = gdk_window_impl_win32_finalize;
+  
+  impl_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
+
+  impl_class->show = gdk_win32_window_show;
+  impl_class->hide = gdk_win32_window_hide;
+  impl_class->withdraw = gdk_win32_window_withdraw;
+  impl_class->set_events = gdk_win32_window_set_events;
+  impl_class->get_events = gdk_win32_window_get_events;
+  impl_class->raise = gdk_win32_window_raise;
+  impl_class->lower = gdk_win32_window_lower;
+  impl_class->restack_under = gdk_win32_window_restack_under;
+  impl_class->restack_toplevel = gdk_win32_window_restack_toplevel;
+  impl_class->move_resize = gdk_win32_window_move_resize;
+  impl_class->set_background = gdk_win32_window_set_background;
+  impl_class->reparent = gdk_win32_window_reparent;
+  impl_class->set_device_cursor = gdk_win32_window_set_device_cursor;
+  impl_class->get_geometry = gdk_win32_window_get_geometry;
+  impl_class->get_device_state = gdk_window_win32_get_device_state;
+  impl_class->get_root_coords = gdk_win32_window_get_root_coords;
+
+  impl_class->shape_combine_region = gdk_win32_window_shape_combine_region;
+  impl_class->input_shape_combine_region = gdk_win32_input_shape_combine_region;
+  impl_class->set_static_gravities = gdk_win32_window_set_static_gravities;
+  impl_class->queue_antiexpose = _gdk_win32_window_queue_antiexpose;
+  impl_class->translate = _gdk_win32_window_translate;
+  impl_class->destroy = gdk_win32_window_destroy;
+  impl_class->destroy_foreign = gdk_win32_window_destroy_foreign;
+  impl_class->resize_cairo_surface = gdk_win32_window_resize_cairo_surface;
+  impl_class->get_shape = gdk_win32_window_get_shape;
+  //FIXME?: impl_class->get_input_shape = gdk_win32_window_get_input_shape;
+
+  //impl_class->beep = gdk_x11_window_beep;
+
+  impl_class->focus = gdk_win32_window_focus;
+  impl_class->set_type_hint = gdk_win32_window_set_type_hint;
+  impl_class->get_type_hint = gdk_win32_window_get_type_hint;
+  impl_class->set_modal_hint = gdk_win32_window_set_modal_hint;
+  impl_class->set_skip_taskbar_hint = gdk_win32_window_set_skip_taskbar_hint;
+  impl_class->set_skip_pager_hint = gdk_win32_window_set_skip_pager_hint;
+  impl_class->set_urgency_hint = gdk_win32_window_set_urgency_hint;
+  impl_class->set_geometry_hints = gdk_win32_window_set_geometry_hints;
+  impl_class->set_title = gdk_win32_window_set_title;
+  impl_class->set_role = gdk_win32_window_set_role;
+  //impl_class->set_startup_id = gdk_x11_window_set_startup_id;
+  impl_class->set_transient_for = gdk_win32_window_set_transient_for;
+  impl_class->get_root_origin = gdk_win32_window_get_root_origin;
+  impl_class->get_frame_extents = gdk_win32_window_get_frame_extents;
+  impl_class->set_override_redirect = gdk_win32_window_set_override_redirect;
+  impl_class->set_accept_focus = gdk_win32_window_set_accept_focus;
+  impl_class->set_focus_on_map = gdk_win32_window_set_focus_on_map;
+  impl_class->set_icon_list = gdk_win32_window_set_icon_list;
+  impl_class->set_icon_name = gdk_win32_window_set_icon_name;
+  impl_class->iconify = gdk_win32_window_iconify;
+  impl_class->deiconify = gdk_win32_window_deiconify;
+  impl_class->stick = gdk_win32_window_stick;
+  impl_class->unstick = gdk_win32_window_unstick;
+  impl_class->maximize = gdk_win32_window_maximize;
+  impl_class->unmaximize = gdk_win32_window_unmaximize;
+  impl_class->fullscreen = gdk_win32_window_fullscreen;
+  impl_class->unfullscreen = gdk_win32_window_unfullscreen;
+  impl_class->set_keep_above = gdk_win32_window_set_keep_above;
+  impl_class->set_keep_below = gdk_win32_window_set_keep_below;
+  impl_class->get_group = gdk_win32_window_get_group;
+  impl_class->set_group = gdk_win32_window_set_group;
+  impl_class->set_decorations = gdk_win32_window_set_decorations;
+  impl_class->get_decorations = gdk_win32_window_get_decorations;
+  impl_class->set_functions = gdk_win32_window_set_functions;
+
+  impl_class->begin_resize_drag = gdk_win32_window_begin_resize_drag;
+  impl_class->begin_move_drag = gdk_win32_window_begin_move_drag;
+  impl_class->enable_synchronized_configure = gdk_win32_window_enable_synchronized_configure;
+  impl_class->configure_finished = gdk_win32_window_configure_finished;
+  impl_class->set_opacity = gdk_win32_window_set_opacity;
+  //impl_class->set_composited = gdk_win32_window_set_composited;
+  impl_class->destroy_notify = gdk_win32_window_destroy_notify;
+  impl_class->register_dnd = _gdk_win32_window_register_dnd;
+  impl_class->drag_begin = _gdk_win32_window_drag_begin;
+  impl_class->process_updates_recurse = gdk_win32_window_process_updates_recurse;
+  //? impl_class->sync_rendering = _gdk_win32_window_sync_rendering;
+  impl_class->simulate_key = _gdk_win32_window_simulate_key;
+  impl_class->simulate_button = _gdk_win32_window_simulate_button;
+  impl_class->get_property = _gdk_win32_window_get_property;
+  impl_class->change_property = _gdk_win32_window_change_property;
+  impl_class->delete_property = _gdk_win32_window_delete_property;
+}
+
+HGDIOBJ
+gdk_win32_window_get_handle (GdkWindow *window)
+{
+  return GDK_WINDOW_HWND (window);
+}
diff --git a/gdk/win32/gdkwindow-win32.h b/gdk/win32/gdkwindow-win32.h
index f488e59..910d735 100644
--- a/gdk/win32/gdkwindow-win32.h
+++ b/gdk/win32/gdkwindow-win32.h
@@ -27,31 +27,13 @@
 #ifndef __GDK_WINDOW_WIN32_H__
 #define __GDK_WINDOW_WIN32_H__
 
-#include <gdk/win32/gdkdrawable-win32.h>
+#include "gdk/win32/gdkprivate-win32.h"
+#include "gdk/gdkwindowimpl.h"
+#include "gdk/gdkcursor.h"
 
-G_BEGIN_DECLS
-
-typedef struct _GdkWin32PositionInfo    GdkWin32PositionInfo;
-
-#if 0
-struct _GdkWin32PositionInfo
-{
-  gint x;
-  gint y;
-  gint width;
-  gint height;
-  gint x_offset;		/* Offsets to add to Win32 coordinates */
-  gint y_offset;		/* within window to get GDK coodinates */
-  guint big : 1;
-  guint mapped : 1;
-  guint no_bg : 1;	        /* Set when the window background
-				 * is temporarily unset during resizing
-				 * and scaling
-				 */
-  GdkRectangle clip_rect;	/* visible rectangle of window */
-};
-#endif
+#include <windows.h>
 
+G_BEGIN_DECLS
 
 /* Window implementation for Win32
  */
@@ -68,7 +50,10 @@ typedef struct _GdkWindowImplWin32Class GdkWindowImplWin32Class;
 
 struct _GdkWindowImplWin32
 {
-  GdkDrawableImplWin32 parent_instance;
+  GdkWindowImpl parent_instance;
+
+  GdkWindow *wrapper;
+  HANDLE handle;
 
   gint8 toplevel_window_type;
 
@@ -90,11 +75,16 @@ struct _GdkWindowImplWin32
   gboolean   changing_state;
 
   guint no_bg : 1;
+
+  cairo_surface_t *cairo_surface;
+  HDC              hdc;
+  int              hdc_count;
+  HBITMAP          saved_dc_bitmap; /* Original bitmap for dc */
 };
  
 struct _GdkWindowImplWin32Class 
 {
-  GdkDrawableImplWin32Class parent_class;
+  GdkWindowImplClass parent_class;
 };
 
 GType _gdk_window_impl_win32_get_type (void);
diff --git a/gdk/win32/makefile.msc b/gdk/win32/makefile.msc
index 3dac7c6..fbe7dca 100644
--- a/gdk/win32/makefile.msc
+++ b/gdk/win32/makefile.msc
@@ -14,7 +14,7 @@ TOP = ../../..
 WTKIT = $(TOP)\wtkit126
 !ENDIF
 
-GTK_VER=2.0
+GTK_VER=3.0
 
 DEFINES = \
 	-DHAVE_CONFIG_H -DINSIDE_GDK_WIN32 -DGDK_VERSION=\"$(GTK_VER)\" \
@@ -22,7 +22,7 @@ DEFINES = \
 
 INCLUDES = -FImsvc_recommended_pragmas.h \
 	-I. -I.. -I..\.. $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CAIRO_CFLAGS) \
-	-I$(WTKIT)\include -I$(GLIB) \
+	$(GDK_PIXBUF_CFLAGS) -I$(WTKIT)\include -I$(GLIB) \
 
 all: \
 	..\..\config.h	\
@@ -31,25 +31,22 @@ all: \
 	gdk.res
 
 gdk_win32_OBJECTS = \
-	gdkapplaunchcontext-win32.obj \
 	gdkcursor-win32.obj \
+	gdkdevice-win32.obj \
+	gdkdevice-wintab.obj \
+	gdkdevicemanager-win32.obj \
 	gdkdnd-win32.obj \
 	gdkdisplay-win32.obj \
-	gdkdrawable-win32.obj \
+	gdkdisplaymanager-win32.obj \
 	gdkevents-win32.obj \
-	gdkgc-win32.obj \
 	gdkgeometry-win32.obj \
 	gdkglobals-win32.obj \
-	gdkim-win32.obj \
 	gdkinput.obj \
-	gdkinput-win32.obj \
 	gdkkeys-win32.obj \
 	gdkmain-win32.obj \
 	gdkproperty-win32.obj \
-#	gdkregion-win32.obj \
 	gdkscreen-win32.obj \
 	gdkselection-win32.obj \
-	gdkspawn-win32.obj \
 	gdktestutils-win32.obj \
 	gdkvisual-win32.obj \
 	gdkwin32id.obj \



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