[gtk/wip/matthiasc/popup5] win32: Build fixes



commit 6e8ba006894e753c1ef1d3a74c4cfe7714afc40c
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 19 03:09:05 2019 +0000

    win32: Build fixes

 gdk/win32/gdkcairocontext-win32.c |   8 +-
 gdk/win32/gdkdevice-virtual.c     |   2 +-
 gdk/win32/gdkdevice-win32.c       |   6 +-
 gdk/win32/gdkdevice-wintab.c      |   2 +-
 gdk/win32/gdkdisplay-win32.c      |   3 +-
 gdk/win32/gdkdrop-win32.c         |  16 +-
 gdk/win32/gdkevents-win32.c       | 109 +++++------
 gdk/win32/gdkgeometry-win32.c     |  20 +-
 gdk/win32/gdkglcontext-win32.c    |  10 +-
 gdk/win32/gdkprivate-win32.h      |  13 +-
 gdk/win32/gdksurface-win32.c      | 398 ++++++++++++++++----------------------
 gdk/win32/gdksurface-win32.h      |  26 +--
 gdk/win32/gdkwin32misc.h          |   2 +-
 13 files changed, 269 insertions(+), 346 deletions(-)
---
diff --git a/gdk/win32/gdkcairocontext-win32.c b/gdk/win32/gdkcairocontext-win32.c
index c0bc2bb602..5ccc640774 100644
--- a/gdk/win32/gdkcairocontext-win32.c
+++ b/gdk/win32/gdkcairocontext-win32.c
@@ -37,7 +37,7 @@ gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
                                           RECT       *return_window_rect)
 {
   RECT window_rect;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (surface->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
 
   _gdk_win32_get_window_client_area_rect (surface, scale, &window_rect);
 
@@ -78,7 +78,7 @@ gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
 }
 
 static cairo_surface_t *
-create_cairo_surface_for_layered_window (GdkSurfaceImplWin32  *impl,
+create_cairo_surface_for_layered_window (GdkWin32Surface  *impl,
                                          gint                  width,
                                          gint                  height,
                                          gint                  scale)
@@ -143,14 +143,14 @@ gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
 {
   GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);
   GdkSurface *surface;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   int scale;
   cairo_t *cr;
   gint width, height;
   RECT queued_window_rect;
 
   surface = gdk_draw_context_get_surface (draw_context);
-  impl = GDK_SURFACE_IMPL_WIN32 (surface->impl);
+  impl = GDK_WIN32_SURFACE (surface);
   scale = gdk_surface_get_scale_factor (surface);
 
   self->layered = impl->layered;
diff --git a/gdk/win32/gdkdevice-virtual.c b/gdk/win32/gdkdevice-virtual.c
index c7e7bdb20e..3910f0bd39 100644
--- a/gdk/win32/gdkdevice-virtual.c
+++ b/gdk/win32/gdkdevice-virtual.c
@@ -109,7 +109,7 @@ gdk_device_virtual_set_surface_cursor (GdkDevice  *device,
   if (win32_hcursor != NULL)
     SetCursor (gdk_win32_hcursor_get_handle (win32_hcursor));
 
-  g_set_object (&GDK_SURFACE_IMPL_WIN32 (window->impl)->cursor, win32_hcursor);
+  g_set_object (&GDK_WIN32_SURFACE (window)->cursor, win32_hcursor);
 }
 
 static void
diff --git a/gdk/win32/gdkdevice-win32.c b/gdk/win32/gdkdevice-win32.c
index bea82f991f..573eb8ce10 100644
--- a/gdk/win32/gdkdevice-win32.c
+++ b/gdk/win32/gdkdevice-win32.c
@@ -106,7 +106,7 @@ gdk_device_win32_query_state (GdkDevice        *device,
 
   if (window)
     {
-      scale = GDK_SURFACE_IMPL_WIN32 (window->impl)->surface_scale;
+      scale = GDK_WIN32_SURFACE (window)->surface_scale;
       hwnd = GDK_SURFACE_HWND (window);
     }
   else
@@ -197,7 +197,7 @@ _gdk_device_win32_surface_at_position (GdkDevice       *device,
                                       gboolean         get_toplevel)
 {
   GdkSurface *window = NULL;
-  GdkSurfaceImplWin32 *impl = NULL;
+  GdkWin32Surface *impl = NULL;
   POINT screen_pt, client_pt;
   HWND hwnd, hwndc;
   RECT rect;
@@ -261,7 +261,7 @@ _gdk_device_win32_surface_at_position (GdkDevice       *device,
 
   if (window && (win_x || win_y))
     {
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
 
       if (win_x)
         *win_x = client_pt.x / impl->surface_scale;
diff --git a/gdk/win32/gdkdevice-wintab.c b/gdk/win32/gdkdevice-wintab.c
index 873c05c21a..b5f03e3e76 100644
--- a/gdk/win32/gdkdevice-wintab.c
+++ b/gdk/win32/gdkdevice-wintab.c
@@ -117,7 +117,7 @@ gdk_device_wintab_query_state (GdkDevice        *device,
   device_wintab = GDK_DEVICE_WINTAB (device);
   if (window)
     {
-      scale = GDK_SURFACE_IMPL_WIN32 (window->impl)->surface_scale;
+      scale = GDK_WIN32_SURFACE (window)->surface_scale;
       hwnd = GDK_SURFACE_HWND (window);
     }
   else
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index bbfda32729..9cd080012c 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -1098,7 +1098,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
   object_class->dispose = gdk_win32_display_dispose;
   object_class->finalize = gdk_win32_display_finalize;
 
-  display_class->surface_type = GDK_TYPE_WIN32_SURFACE;
   display_class->cairo_context_type = GDK_TYPE_WIN32_CAIRO_CONTEXT;
 
   display_class->get_name = gdk_win32_display_get_name;
@@ -1116,7 +1115,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
 
   display_class->get_next_serial = gdk_win32_display_get_next_serial;
   display_class->notify_startup_complete = gdk_win32_display_notify_startup_complete;
-  display_class->create_surface_impl = _gdk_win32_display_create_surface_impl;
+  display_class->create_surface = _gdk_win32_display_create_surface;
 
   display_class->get_keymap = _gdk_win32_display_get_keymap;
   display_class->text_property_to_utf8_list = _gdk_win32_display_text_property_to_utf8_list;
diff --git a/gdk/win32/gdkdrop-win32.c b/gdk/win32/gdkdrop-win32.c
index 44dab15c19..6ad6615442 100644
--- a/gdk/win32/gdkdrop-win32.c
+++ b/gdk/win32/gdkdrop-win32.c
@@ -129,7 +129,7 @@ struct _drop_target_context
    * this surface remains the same.
    * This is not a reference, as drop_target_context must not
    * outlive the surface it's attached to.
-   * drop_target_context is not folded into GdkSurfaceImplWin32
+   * drop_target_context is not folded into GdkWin32Surface
    * only because it's easier to present it to COM as a separate
    * object when it's allocated separately.
    */
@@ -206,12 +206,12 @@ gdk_drop_new (GdkDisplay        *display,
 GdkDrop *
 _gdk_win32_get_drop_for_dest_surface (GdkSurface *dest)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
   if (dest == NULL)
     return NULL;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (dest->impl);
+  impl = GDK_WIN32_SURFACE (dest);
 
   if (impl->drop_target != NULL)
     return impl->drop_target->drop;
@@ -465,7 +465,7 @@ _gdk_win32_local_drop_target_dragenter (GdkDrag        *drag,
   GdkWin32Drop *drop_win32;
   GdkDisplay *display;
   GdkDragAction source_actions;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (dest_surface->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (dest_surface);
 
   GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragenter %p @ %d : %d"
                           " for dest window 0x%p"
@@ -685,7 +685,7 @@ void
 _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
                                         guint32  time_)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (gdk_drop_get_surface (drop)->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (gdk_drop_get_surface (drop));
   GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragleave %p\n", drop));
 
   gdk_drop_emit_leave_event (drop, TRUE, time_);
@@ -1156,7 +1156,7 @@ _gdk_win32_surface_register_dnd (GdkSurface *window)
     }
   else
     {
-      GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
       /* Return if window is already setup for DND. */
       if (impl->drop_target != NULL)
@@ -1188,7 +1188,7 @@ _gdk_win32_surface_register_dnd (GdkSurface *window)
 void
 _gdk_win32_surface_unregister_dnd (GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   if (impl->drop_target)
     idroptarget_release (&impl->drop_target->idt);
@@ -1289,7 +1289,7 @@ gdk_win32_drop_read_async (GdkDrop             *drop,
       return;
     }
 
-  tctx = GDK_SURFACE_IMPL_WIN32 (gdk_drop_get_surface (drop)->impl)->drop_target;
+  tctx = GDK_WIN32_SURFACE (gdk_drop_get_surface (drop))->drop_target;
 
   if (tctx == NULL)
     {
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 5e1910534c..1da2701c45 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -991,7 +991,7 @@ apply_message_filters (GdkDisplay *display,
 static void
 show_window_recurse (GdkSurface *window, gboolean hide_window)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
   GSList *children = impl->transient_children;
   GdkSurface *child = NULL;
 
@@ -1040,7 +1040,7 @@ static void
 do_show_window (GdkSurface *window, gboolean hide_window)
 {
   GdkSurface *tmp_window = NULL;
-  GdkSurfaceImplWin32 *tmp_impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *tmp_impl = GDK_WIN32_SURFACE (window);
 
   if (!tmp_impl->changing_state)
     {
@@ -1048,7 +1048,7 @@ do_show_window (GdkSurface *window, gboolean hide_window)
       while (tmp_impl->transient_owner != NULL)
        {
          tmp_window = tmp_impl->transient_owner;
-         tmp_impl = GDK_SURFACE_IMPL_WIN32 (tmp_window->impl);
+         tmp_impl = GDK_WIN32_SURFACE (tmp_window);
        }
 
       /* If we couldn't find one, use the window provided. */
@@ -1080,7 +1080,7 @@ send_crossing_event (GdkDisplay                 *display,
   GdkDeviceGrabInfo *grab;
   GdkDeviceManagerWin32 *device_manager;
   POINT pt;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   device_manager = _gdk_device_manager;
 
@@ -1294,16 +1294,13 @@ synthesize_crossing_events (GdkDisplay                 *display,
  * TRUE otherwise.
  */
 gboolean
-_gdk_win32_get_window_rect (GdkSurface *window,
+_gdk_win32_get_window_rect (GdkSurface *surface,
                             RECT      *rect)
 {
-  GdkSurfaceImplWin32 *surface_impl;
   RECT client_rect;
   POINT point;
   HWND hwnd;
 
-  surface_impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
-
   hwnd = GDK_SURFACE_HWND (window);
 
   GetClientRect (hwnd, &client_rect);
@@ -1314,8 +1311,8 @@ _gdk_win32_get_window_rect (GdkSurface *window,
   if (gdk_surface_get_parent (window) == NULL)
     {
       ClientToScreen (hwnd, &point);
-      point.x += _gdk_offset_x * surface_impl->surface_scale;
-      point.y += _gdk_offset_y * surface_impl->surface_scale;
+      point.x += _gdk_offset_x * surface->surface_scale;
+      point.y += _gdk_offset_y * surface->surface_scale;
     }
 
   rect->left = point.x;
@@ -1323,36 +1320,34 @@ _gdk_win32_get_window_rect (GdkSurface *window,
   rect->right = point.x + client_rect.right - client_rect.left;
   rect->bottom = point.y + client_rect.bottom - client_rect.top;
 
-  return !surface_impl->inhibit_configure;
+  return !surface->inhibit_configure;
 }
 
 void
-_gdk_win32_do_emit_configure_event (GdkSurface *window,
+_gdk_win32_do_emit_configure_event (GdkSurface *surface,
                                     RECT       rect)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
-
-  impl->unscaled_width = rect.right - rect.left;
-  impl->unscaled_height = rect.bottom - rect.top;
-  window->width = (impl->unscaled_width + impl->surface_scale - 1) / impl->surface_scale;
-  window->height = (impl->unscaled_height + impl->surface_scale - 1) / impl->surface_scale;
-  window->x = rect.left / impl->surface_scale;
-  window->y = rect.top / impl->surface_scale;
+  surface->unscaled_width = rect.right - rect.left;
+  surface->unscaled_height = rect.bottom - rect.top;
+  surface->width = (surface->unscaled_width + surface->surface_scale - 1) / surface->surface_scale;
+  surface->height = (surface->unscaled_height + surface->surface_scale - 1) / surface->surface_scale;
+  surface->x = rect.left / surface->surface_scale;
+  surface->y = rect.top / surface->surface_scale;
 
-  _gdk_surface_update_size (window);
+  _gdk_surface_update_size (surface);
 
-  g_signal_emit_by_name (window, "size-changed", window->width, window->height);
+  g_signal_emit_by_name (surface, "size-changed", surface->width, surface->height);
 }
 
 void
-_gdk_win32_emit_configure_event (GdkSurface *window)
+_gdk_win32_emit_configure_event (GdkSurface *surface)
 {
   RECT rect;
 
-  if (!_gdk_win32_get_window_rect (window, &rect))
+  if (!_gdk_win32_get_window_rect (surface, &rect))
     return;
 
-  _gdk_win32_do_emit_configure_event (window, rect);
+  _gdk_win32_do_emit_configure_event (surface, rect);
 }
 
 cairo_region_t *
@@ -1418,7 +1413,7 @@ handle_wm_paint (MSG        *msg,
   HDC hdc;
   PAINTSTRUCT paintstruct;
   cairo_region_t *update_region;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   if (GetUpdateRgn (msg->hwnd, hrgn, FALSE) == ERROR)
     {
@@ -1523,7 +1518,7 @@ handle_nchittest (HWND hwnd,
                   gint *ret_valp)
 {
   RECT rect;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
   if (window == NULL || window->input_shape == NULL)
     return FALSE;
@@ -1537,7 +1532,7 @@ handle_nchittest (HWND hwnd,
   if (!GetWindowRect (hwnd, &rect))
     return FALSE;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
   rect.left = screen_x - rect.left;
   rect.top = screen_y - rect.top;
 
@@ -1558,7 +1553,7 @@ static void
 handle_dpi_changed (GdkSurface *window,
                     MSG       *msg)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
   GdkDisplay *display = gdk_display_get_default ();
   GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
   RECT *rect = (RECT *)msg->lParam;
@@ -1611,7 +1606,7 @@ generate_button_event (GdkEventType      type,
 {
   GdkEvent *event = gdk_event_new (type);
   GdkDeviceManagerWin32 *device_manager;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   if (_gdk_input_ignore_core > 0)
     return;
@@ -1674,7 +1669,7 @@ ensure_stacking_on_unminimize (MSG *msg)
        rover = GetNextWindow (rover, GW_HWNDNEXT))
     {
       GdkSurface *rover_gdkw = gdk_win32_handle_table_lookup (rover);
-      GdkSurfaceImplWin32 *rover_impl;
+      GdkWin32Surface *rover_impl;
       gboolean rover_ontop;
 
       /* Checking window group not implemented yet */
@@ -1682,7 +1677,7 @@ ensure_stacking_on_unminimize (MSG *msg)
         continue;
 
       rover_ontop = should_window_be_always_on_top (rover_gdkw);
-      rover_impl = GDK_SURFACE_IMPL_WIN32 (rover_gdkw->impl);
+      rover_impl = GDK_WIN32_SURFACE (rover_gdkw);
 
       if (GDK_SURFACE_IS_MAPPED (rover_gdkw) &&
           (rover_impl->type_hint == GDK_SURFACE_TYPE_HINT_UTILITY ||
@@ -1708,7 +1703,7 @@ static gboolean
 ensure_stacking_on_window_pos_changing (MSG       *msg,
                                        GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
   WINDOWPOS *windowpos = (WINDOWPOS *) msg->lParam;
   HWND rover;
   gboolean restacking;
@@ -1735,7 +1730,7 @@ ensure_stacking_on_window_pos_changing (MSG       *msg,
        rover = GetNextWindow (rover, GW_HWNDNEXT))
     {
       GdkSurface *rover_gdkw = gdk_win32_handle_table_lookup (rover);
-      GdkSurfaceImplWin32 *rover_impl;
+      GdkWin32Surface *rover_impl;
       gboolean rover_ontop;
 
       /* Checking window group not implemented yet */
@@ -1744,7 +1739,7 @@ ensure_stacking_on_window_pos_changing (MSG       *msg,
        continue;
 
       rover_ontop = should_window_be_always_on_top (rover_gdkw);
-      rover_impl = GDK_SURFACE_IMPL_WIN32 (rover_gdkw->impl);
+      rover_impl = GDK_WIN32_SURFACE (rover_gdkw);
 
       if (GDK_SURFACE_IS_MAPPED (rover_gdkw) &&
           (rover_impl->type_hint == GDK_SURFACE_TYPE_HINT_UTILITY ||
@@ -1772,7 +1767,7 @@ static void
 ensure_stacking_on_activate_app (MSG       *msg,
                                 GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
   HWND rover;
   gboolean window_ontop;
 
@@ -1803,7 +1798,7 @@ ensure_stacking_on_activate_app (MSG       *msg,
        rover = GetNextWindow (rover, GW_HWNDPREV))
     {
       GdkSurface *rover_gdkw = gdk_win32_handle_table_lookup (rover);
-      GdkSurfaceImplWin32 *rover_impl;
+      GdkWin32Surface *rover_impl;
       gboolean rover_ontop;
 
       /* Checking window group not implemented yet */
@@ -1811,7 +1806,7 @@ ensure_stacking_on_activate_app (MSG       *msg,
         continue;
 
       rover_ontop = should_window_be_always_on_top (rover_gdkw);
-      rover_impl = GDK_SURFACE_IMPL_WIN32 (rover_gdkw->impl);
+      rover_impl = GDK_WIN32_SURFACE (rover_gdkw);
 
       if (GDK_SURFACE_IS_MAPPED (rover_gdkw) &&
           (rover_impl->type_hint == GDK_SURFACE_TYPE_HINT_UTILITY ||
@@ -1832,11 +1827,11 @@ ensure_stacking_on_activate_app (MSG       *msg,
 static gboolean
 handle_wm_sysmenu (GdkSurface *window, MSG *msg, gint *ret_valp)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   LONG_PTR style, tmp_style;
   LONG_PTR additional_styles;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   style = GetWindowLongPtr (msg->hwnd, GWL_STYLE);
 
@@ -1907,13 +1902,13 @@ gboolean
 _gdk_win32_surface_fill_min_max_info (GdkSurface  *window,
                                      MINMAXINFO *mmi)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   RECT rect;
 
   if (GDK_SURFACE_DESTROYED (window))
     return FALSE;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   if (impl->hint_flags & GDK_HINT_MIN_SIZE)
     {
@@ -2035,7 +2030,7 @@ gdk_event_translate (MSG  *msg,
 
   GdkDisplay *display;
   GdkSurface *window = NULL;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   GdkWin32Display *win32_display;
 
   GdkSurface *new_window;
@@ -2190,7 +2185,7 @@ gdk_event_translate (MSG  *msg,
       if (GDK_SURFACE_DESTROYED (window))
        break;
 
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
 
       API_CALL (GetKeyboardState, (key_state));
 
@@ -2517,7 +2512,7 @@ gdk_event_translate (MSG  *msg,
       generate_button_event (GDK_BUTTON_RELEASE, button,
                             window, msg);
 
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
 
       /* End a drag op when the same button that started it is released */
       if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE &&
@@ -2586,7 +2581,7 @@ gdk_event_translate (MSG  *msg,
        }
 
       g_set_object (&window, find_window_for_mouse_event (window, msg));
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
 
       /* If we haven't moved, don't create any GDK event. Windows
        * sends WM_MOUSEMOVE messages after a new window is shows under
@@ -2720,7 +2715,7 @@ gdk_event_translate (MSG  *msg,
          g_set_object (&window, new_window);
        }
 
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
       ScreenToClient (msg->hwnd, &point);
 
       event = gdk_event_new (GDK_SCROLL);
@@ -2892,11 +2887,11 @@ gdk_event_translate (MSG  *msg,
 
       if (!return_val &&
           !GDK_SURFACE_DESTROYED (window) &&
-          GDK_SURFACE_IMPL_WIN32 (window->impl)->cursor != NULL)
+          GDK_WIN32_SURFACE (window)->cursor != NULL)
         {
           win32_display = GDK_WIN32_DISPLAY (gdk_surface_get_display (window));
-          GDK_NOTE (EVENTS, g_print (" (window SetCursor(%p)", gdk_win32_hcursor_get_handle 
(GDK_SURFACE_IMPL_WIN32 (window->impl)->cursor)));
-          SetCursor (gdk_win32_hcursor_get_handle (GDK_SURFACE_IMPL_WIN32 (window->impl)->cursor));
+          GDK_NOTE (EVENTS, g_print (" (window SetCursor(%p)", gdk_win32_hcursor_get_handle 
(GDK_WIN32_SURFACE (window)->cursor)));
+          SetCursor (gdk_win32_hcursor_get_handle (GDK_WIN32_SURFACE (window)->cursor));
           return_val = TRUE;
           *ret_valp = TRUE;
         }
@@ -2908,7 +2903,7 @@ gdk_event_translate (MSG  *msg,
       break;
 
     case WM_INITMENU:
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
 
       if (impl->have_temp_styles)
         {
@@ -2935,7 +2930,7 @@ gdk_event_translate (MSG  *msg,
          do_show_window (window, msg->wParam == SC_MINIMIZE ? TRUE : FALSE);
          break;
         case SC_MAXIMIZE:
-          impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+          impl = GDK_WIN32_SURFACE (window);
           impl->maximizing = TRUE;
          break;
        }
@@ -2993,7 +2988,7 @@ gdk_event_translate (MSG  *msg,
          _gdk_win32_end_modal_call (GDK_WIN32_MODAL_OP_SIZEMOVE_MASK);
        }
 
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
 
       if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
         gdk_win32_surface_end_move_resize_drag (window);
@@ -3016,7 +3011,7 @@ gdk_event_translate (MSG  *msg,
         {
          return_val = ensure_stacking_on_window_pos_changing (msg, window);
 
-          impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+          impl = GDK_WIN32_SURFACE (window);
 
           if (impl->maximizing)
             {
@@ -3117,7 +3112,7 @@ gdk_event_translate (MSG  *msg,
          !GDK_SURFACE_DESTROYED (window))
        {
          /* Make transient parent the forground window when window unmaps */
-         impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+         impl = GDK_WIN32_SURFACE (window);
 
          if (impl->transient_owner &&
              GetForegroundWindow () == GDK_SURFACE_HWND (window))
@@ -3156,7 +3151,7 @@ gdk_event_translate (MSG  *msg,
                                 _gdk_win32_rect_to_string (&rect),
                                 _gdk_win32_rect_to_string (drag)));
 
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
       orig_drag = *drag;
       if (impl->hint_flags & GDK_HINT_RESIZE_INC)
        {
@@ -3390,7 +3385,7 @@ gdk_event_translate (MSG  *msg,
 
       _gdk_win32_append_event (event);
 
-      impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      impl = GDK_WIN32_SURFACE (window);
 
       if (impl->transient_owner && GetForegroundWindow() == GDK_SURFACE_HWND (window))
        {
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index 7b386e66c3..60844f7c20 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -49,9 +49,9 @@ typedef struct _GdkSurfaceParentPos GdkSurfaceParentPos;
 static void
 tmp_unset_bg (GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   impl->no_bg = TRUE;
 }
@@ -59,9 +59,9 @@ tmp_unset_bg (GdkSurface *window)
 static void
 tmp_reset_bg (GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   impl->no_bg = FALSE;
 }
@@ -73,12 +73,12 @@ _gdk_surface_move_resize_child (GdkSurface *window,
                               gint       width,
                               gint       height)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_SURFACE (window));
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
   GDK_NOTE (MISC, g_print ("_gdk_surface_move_resize_child: %s@%+d%+d %dx%d@%+d%+d\n",
                           _gdk_win32_surface_description (window),
                           window->x, window->y, width, height, x, y));
@@ -106,14 +106,14 @@ _gdk_surface_move_resize_child (GdkSurface *window,
   GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
                           "NOACTIVATE|NOZORDER)\n",
                           GDK_SURFACE_HWND (window),
-                          (window->x + window->parent->abs_x) * impl->surface_scale,
-                          (window->y + window->parent->abs_y) * impl->surface_scale,
+                          window->x * impl->surface_scale,
+                          window->y * impl->surface_scale,
                           impl->unscaled_width,
                           impl->unscaled_height));
 
   API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), NULL,
-                          (window->x + window->parent->abs_x) * impl->surface_scale,
-                          (window->y + window->parent->abs_y) * impl->surface_scale,
+                          window->x * impl->surface_scale,
+                          window->y * impl->surface_scale,
                           impl->unscaled_width,
                           impl->unscaled_height,
                           SWP_NOACTIVATE | SWP_NOZORDER));
diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c
index f97dc67fc3..965f04a46a 100644
--- a/gdk/win32/gdkglcontext-win32.c
+++ b/gdk/win32/gdkglcontext-win32.c
@@ -64,9 +64,9 @@ _gdk_win32_gl_context_dispose (GObject *gobject)
       ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
     }
 
-  if (surface != NULL && surface->impl != NULL)
+  if (surface != NULL)
     {
-      GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (surface->impl);
+      GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
 
       if (impl->suppress_layered > 0)
         impl->suppress_layered--;
@@ -166,11 +166,11 @@ gdk_win32_gl_context_begin_frame (GdkDrawContext *draw_context,
 {
   GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
   GdkSurface *surface;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   RECT queued_window_rect;
 
   surface = gdk_gl_context_get_surface (context);
-  impl = GDK_SURFACE_IMPL_WIN32 (surface->impl);
+  impl = GDK_WIN32_SURFACE (surface);
 
   gdk_win32_surface_get_queued_window_rect (surface,
                                             gdk_surface_get_scale_factor (surface),
@@ -667,7 +667,7 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
   gint glver_minor = 0;
 
   GdkSurface *surface = gdk_gl_context_get_surface (context);
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (surface->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
   GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (gdk_surface_get_display (surface));
 
   if (!_set_pixformat_for_hdc (context_win32->gl_hdc,
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index 4f8a3e2f30..e40b7867f2 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -126,8 +126,6 @@
 
 GdkWin32Screen *GDK_SURFACE_SCREEN(GObject *win);
 
-#define GDK_SURFACE_IS_WIN32(win)        (GDK_IS_SURFACE_IMPL_WIN32 (win->impl))
-
 /* Use this for hWndInsertAfter (2nd argument to SetWindowPos()) if
  * SWP_NOZORDER flag is used. Otherwise it's unobvious why a particular
  * argument is used. Using NULL is misleading, because
@@ -414,10 +412,13 @@ void       _gdk_win32_keymap_set_active_layout   (GdkWin32Keymap *keymap,
 
 GdkKeymap *_gdk_win32_display_get_keymap (GdkDisplay *display);
 
-void       _gdk_win32_display_create_surface_impl   (GdkDisplay    *display,
-                                                     GdkSurface     *window,
-                                                     GdkSurface     *real_parent,
-                                                     GdkSurfaceAttr *attributes);
+GdkSurface *_gdk_win32_display_create_surface  (GdkDisplay    *display,
+                                                GdkSurfaceType surface_type,
+                                                GdkSurface     *parent,
+                                                int             x,
+                                                int             y,
+                                                int             width,
+                                                int             height);
 
 /* stray GdkSurfaceImplWin32 members */
 void _gdk_win32_surface_register_dnd (GdkSurface *window);
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 9b62a34f38..468df76a25 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 
 #include "gdk.h"
-#include "gdksurfaceimpl.h"
+#include "gdksurfaceprivate.h"
 #include "gdkprivate-win32.h"
 #include "gdkdeviceprivate.h"
 #include "gdkdevicemanager-win32.h"
@@ -48,9 +48,7 @@
 #include <math.h>
 #include "fallback-c89.c"
 
-static void gdk_surface_impl_win32_init       (GdkSurfaceImplWin32      *window);
-static void gdk_surface_impl_win32_class_init (GdkSurfaceImplWin32Class *klass);
-static void gdk_surface_impl_win32_finalize   (GObject                 *object);
+static void gdk_surface_win32_finalize (GObject *object);
 
 static gpointer parent_class = NULL;
 static GSList *modal_window_stack = NULL;
@@ -147,38 +145,10 @@ gdk_win32_surface_init (GdkWin32Surface *window)
 }
 
 
-G_DEFINE_TYPE (GdkSurfaceImplWin32, gdk_surface_impl_win32, GDK_TYPE_SURFACE_IMPL)
-
-GType
-_gdk_surface_impl_win32_get_type (void)
-{
-  static GType object_type = 0;
-
-  if (!object_type)
-    {
-      const GTypeInfo object_info =
-      {
-        sizeof (GdkSurfaceImplWin32Class),
-        (GBaseInitFunc) NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc) gdk_surface_impl_win32_class_init,
-        NULL,           /* class_finalize */
-        NULL,           /* class_data */
-        sizeof (GdkSurfaceImplWin32),
-        0,              /* n_preallocs */
-        (GInstanceInitFunc) gdk_surface_impl_win32_init,
-      };
-
-      object_type = g_type_register_static (GDK_TYPE_SURFACE_IMPL,
-                                            "GdkSurfaceImplWin32",
-                                            &object_info, 0);
-    }
-
-  return object_type;
-}
+G_DEFINE_TYPE (GdkSurfaceWin32, gdk_surface_win32, GDK_TYPE_SURFACE)
 
 static void
-gdk_surface_impl_win32_init (GdkSurfaceImplWin32 *impl)
+gdk_surface_win32_init (GdkSurfaceWin32 *impl)
 {
   impl->hicon_big = NULL;
   impl->hicon_small = NULL;
@@ -193,65 +163,65 @@ gdk_surface_impl_win32_init (GdkSurfaceImplWin32 *impl)
 
 
 static void
-gdk_surface_impl_win32_dispose (GObject *object)
+gdk_surface_win32_dispose (GObject *object)
 {
-  GdkSurfaceImplWin32 *surface_impl;
+  GdkSurfaceWin32 *surface;
 
-  g_return_if_fail (GDK_IS_SURFACE_IMPL_WIN32 (object));
+  g_return_if_fail (GDK_IS_SURFACE_WIN32 (object));
 
-  surface_impl = GDK_SURFACE_IMPL_WIN32 (object);
+  surface = GDK_SURFACE_WIN32 (object);
 
-  g_clear_object (&surface_impl->cursor);
+  g_clear_object (&surface->cursor);
 
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
 
 static void
-gdk_surface_impl_win32_finalize (GObject *object)
+gdk_surface_win32_finalize (GObject *object)
 {
   GdkSurface *wrapper;
-  GdkSurfaceImplWin32 *surface_impl;
+  GdkSurfaceWin32 *surface;
 
-  g_return_if_fail (GDK_IS_SURFACE_IMPL_WIN32 (object));
+  g_return_if_fail (GDK_IS_SURFACE_WIN32 (object));
 
-  surface_impl = GDK_SURFACE_IMPL_WIN32 (object);
+  surface = GDK_SURFACE_WIN32 (object);
 
-  wrapper = surface_impl->wrapper;
+  wrapper = surface->wrapper;
 
   if (!GDK_SURFACE_DESTROYED (wrapper))
     {
-      gdk_win32_handle_table_remove (surface_impl->handle);
+      gdk_win32_handle_table_remove (surface->handle);
     }
 
-  g_clear_pointer (&surface_impl->snap_stash, g_free);
-  g_clear_pointer (&surface_impl->snap_stash_int, g_free);
+  g_clear_pointer (&surface->snap_stash, g_free);
+  g_clear_pointer (&surface->snap_stash_int, g_free);
 
-  if (surface_impl->hicon_big != NULL)
+  if (surface->hicon_big != NULL)
     {
-      GDI_CALL (DestroyIcon, (surface_impl->hicon_big));
-      surface_impl->hicon_big = NULL;
+      GDI_CALL (DestroyIcon, (surface->hicon_big));
+      surface->hicon_big = NULL;
     }
 
-  if (surface_impl->hicon_small != NULL)
+  if (surface->hicon_small != NULL)
     {
-      GDI_CALL (DestroyIcon, (surface_impl->hicon_small));
-      surface_impl->hicon_small = NULL;
+      GDI_CALL (DestroyIcon, (surface->hicon_small));
+      surface->hicon_small = NULL;
     }
 
-  g_free (surface_impl->decorations);
+  g_free (surface->decorations);
 
-  if (surface_impl->cache_surface)
+  if (surface->cache_surface)
     {
-      cairo_surface_destroy (surface_impl->cache_surface);
-      surface_impl->cache_surface = NULL;
+      cairo_surface_destroy (surface->cache_surface);
+      surface->cache_surface = NULL;
     }
 
   _gdk_win32_surface_unregister_dnd (wrapper);
-  g_clear_object (&surface_impl->drop);
+  g_clear_object (&surface->drop);
 
-  g_assert (surface_impl->transient_owner == NULL);
-  g_assert (surface_impl->transient_children == NULL);
+  g_assert (surface->transient_owner == NULL);
+  g_assert (surface->transient_children == NULL);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -319,7 +289,7 @@ _gdk_win32_adjust_client_rect (GdkSurface *window,
 gboolean
 _gdk_win32_surface_enable_transparency (GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   DWM_BLURBEHIND blur_behind;
   HRGN empty_region;
   HRESULT call_result;
@@ -328,7 +298,7 @@ _gdk_win32_surface_enable_transparency (GdkSurface *window)
   if (window == NULL || GDK_SURFACE_HWND (window) == NULL)
     return FALSE;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   /* layered windows don't need blurbehind for transparency */
   if (impl->layered)
@@ -523,17 +493,21 @@ RegisterGdkClass (GdkSurfaceType wtype, GdkSurfaceTypeHint wtype_hint)
  *
  * [1] http://mail.gnome.org/archives/gtk-devel-list/2010-August/msg00214.html
  */
-void
-_gdk_win32_display_create_surface_impl (GdkDisplay    *display,
-                                      GdkSurface     *window,
-                                      GdkSurface     *real_parent)
+GdkSurface *
+_gdk_win32_display_create_surface (GdkDisplay     *display,
+                                   GdkSurfaceType  surface_type,
+                                   GdkSurface     *parent,
+                                   int             x,
+                                   int             y,
+                                   int             width,
+                                   int             height)
 {
   HWND hwndNew;
   HANDLE hparent;
   ATOM klass = 0;
   DWORD dwStyle = 0, dwExStyle;
   RECT rect;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   GdkWin32Display *display_win32;
   const gchar *title;
   wchar_t *wtitle;
@@ -545,14 +519,12 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
   g_return_if_fail (display == _gdk_display);
 
   GDK_NOTE (MISC,
-            g_print ("_gdk_surface_impl_new: %s\n", (window->surface_type == GDK_SURFACE_TOPLEVEL ? 
"TOPLEVEL" :
-                                                       (window->surface_type == GDK_SURFACE_TEMP ? "TEMP" : 
"???")));
+            g_print ("_gdk_surface_new: %s\n", (surface_type == GDK_SURFACE_TOPLEVEL ? "TOPLEVEL" :
+                                                       (surface_type == GDK_SURFACE_TEMP ? "TEMP" : "???")));
 
-  hparent = (real_parent != NULL) ? GDK_SURFACE_HWND (real_parent) : NULL;
+  hparent = (parent != NULL) ? GDK_SURFACE_HWND (parent) : NULL;
 
-  impl = g_object_new (GDK_TYPE_SURFACE_IMPL_WIN32, NULL);
-  impl->wrapper = GDK_SURFACE (window);
-  window->impl = GDK_SURFACE_IMPL (impl);
+  impl = g_object_new (GDK_TYPE_WIN32_SURFACE, NULL);
 
   impl->layered = FALSE;
   impl->layered_opacity = 1.0;
@@ -567,13 +539,13 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
   switch (window->surface_type)
     {
     case GDK_SURFACE_TOPLEVEL:
-      if (window->parent)
+      if (parent)
        {
          /* The common code warns for this case. */
          hparent = GetDesktopWindow ();
        }
       /* MSDN: We need WS_CLIPCHILDREN and WS_CLIPSIBLINGS for GL Context Creation */
-      if (window->surface_type == GDK_SURFACE_TOPLEVEL)
+      if (surface_type == GDK_SURFACE_TOPLEVEL)
         dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
       else
         dwStyle = WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_CLIPCHILDREN;
@@ -582,29 +554,29 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
       offset_y = _gdk_offset_y;
       break;
 
+    case GDK_SURFACE_POPUP:
     case GDK_SURFACE_TEMP:
       /* A temp window is not necessarily a top level window */
-      dwStyle = real_parent == NULL ? WS_POPUP : WS_CHILDWINDOW;
+      dwStyle = parent == NULL ? WS_POPUP : WS_CHILDWINDOW;
       dwStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
       dwExStyle |= WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
       offset_x = _gdk_offset_x;
       offset_y = _gdk_offset_y;
       break;
 
-
     default:
       g_assert_not_reached ();
     }
 
-  rect.left = window->x * impl->surface_scale;
-  rect.top = window->y * impl->surface_scale;
-  rect.right = rect.left + window->width * impl->surface_scale;
-  rect.bottom = rect.top + window->height * impl->surface_scale;
+  rect.left = x * impl->surface_scale;
+  rect.top = y * impl->surface_scale;
+  rect.right = rect.left + width * impl->surface_scale;
+  rect.bottom = rect.top + height * impl->surface_scale;
 
   AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
 
-  real_x = (window->x - offset_x) * impl->surface_scale;
-  real_y = (window->y - offset_y) * impl->surface_scale;
+  real_x = (x - offset_x) * impl->surface_scale;
+  real_y = (y - offset_y) * impl->surface_scale;
 
   if (window->surface_type == GDK_SURFACE_TOPLEVEL)
     {
@@ -637,7 +609,7 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
   if (impl->type_hint == GDK_SURFACE_TYPE_HINT_DND)
     dwExStyle |= WS_EX_TRANSPARENT;
 
-  klass = RegisterGdkClass (window->surface_type, impl->type_hint);
+  klass = RegisterGdkClass (surface_type, impl->type_hint);
 
   wtitle = g_utf8_to_utf16 (title, -1, NULL, NULL, NULL);
 
@@ -651,44 +623,24 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
                             hparent,
                             NULL,
                             _gdk_dll_hinstance,
-                            window);
-  if (GDK_SURFACE_HWND (window) != hwndNew)
-    {
-      g_warning ("gdk_surface_new: gdk_event_translate::WM_CREATE (%p, %p) HWND mismatch.",
-                GDK_SURFACE_HWND (window),
-                hwndNew);
-
-      /* HB: IHMO due to a race condition the handle was increased by
-       * one, which causes much trouble. Because I can't find the
-       * real bug, try to workaround it ...
-       * To reproduce: compile with MSVC 5, DEBUG=1
-       */
-# if 0
-      gdk_win32_handle_table_remove (GDK_SURFACE_HWND (window));
-      GDK_SURFACE_HWND (window) = hwndNew;
-      gdk_win32_handle_table_insert (&GDK_SURFACE_HWND (window), window);
-# else
-      /* the old behaviour, but with warning */
-      impl->handle = hwndNew;
-# endif
-
-    }
+                            NULL);
+  impl->handle = hwndNew;
 
-  GetWindowRect (GDK_SURFACE_HWND (window), &rect);
+  GetWindowRect (hwndNew, &rect);
   impl->initial_x = rect.left;
   impl->initial_y = rect.top;
 
   /* Now we know the initial position, move to actually specified position */
   if (real_x != x || real_y != y)
     {
-      API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window),
+      API_CALL (SetWindowPos, (hwndNew,
                 SWP_NOZORDER_SPECIFIED,
                 real_x, real_y, 0, 0,
                 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
     }
 
   g_object_ref (window);
-  gdk_win32_handle_table_insert (&GDK_SURFACE_HWND (window), window);
+  gdk_win32_handle_table_insert (&hwndNew, window);
 
   GDK_NOTE (MISC, g_print ("... \"%s\" %dx%d@%+d%+d %p = %p\n",
                           title,
@@ -696,27 +648,26 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
                           window->x - offset_x,
                           window->y - offset_y,
                           hparent,
-                          GDK_SURFACE_HWND (window)));
-
-  /* Add window handle to title */
-  GDK_NOTE (MISC_OR_EVENTS, gdk_surface_set_title (window, title));
+                          hwndNew))
 
   g_free (wtitle);
 
   if (impl->handle == NULL)
     {
       WIN32_API_FAILED ("CreateWindowExW");
-      g_object_unref (window);
-      return;
+      g_object_unref (impl);
+      return NULL;
     }
 
-  _gdk_win32_surface_enable_transparency (window);
+  _gdk_win32_surface_enable_transparency (impl);
 
-  frame_clock = gdk_surface_get_frame_clock (window);
+  frame_clock = gdk_surface_get_frame_clock (impl);
   g_signal_connect (frame_clock,
                     "after-paint",
                     G_CALLBACK (gdk_win32_impl_frame_clock_after_paint),
-                    window);
+                    impl);
+
+  return impl;
 }
 
 static void
@@ -724,7 +675,7 @@ gdk_win32_surface_destroy (GdkSurface *window,
                          gboolean   recursing,
                          gboolean   foreign_destroy)
 {
-  GdkSurfaceImplWin32 *surface_impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *surface = GDK_WIN32_SURFACE (window);
   GSList *tmp;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
@@ -736,14 +687,14 @@ gdk_win32_surface_destroy (GdkSurface *window,
   _gdk_remove_modal_window (window);
 
   /* Remove all our transient children */
-  while (surface_impl->transient_children != NULL)
+  while (surface->transient_children != NULL)
     {
-      GdkSurface *child = surface_impl->transient_children->data;
+      GdkSurface *child = surface->transient_children->data;
       gdk_surface_set_transient_for (child, NULL);
     }
 
   /* Remove ourself from our transient owner */
-  if (surface_impl->transient_owner != NULL)
+  if (surface->transient_owner != NULL)
     {
       gdk_surface_set_transient_for (window, NULL);
     }
@@ -785,7 +736,7 @@ get_outer_rect (GdkSurface *window,
                gint       height,
                RECT      *rect)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   rect->left = rect->top = 0;
   rect->right = width * impl->surface_scale;
@@ -800,7 +751,7 @@ adjust_for_gravity_hints (GdkSurface *window,
                          gint          *x,
                          gint          *y)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   if (impl->hint_flags & GDK_HINT_WIN_GRAVITY)
     {
@@ -868,7 +819,7 @@ show_window_internal (GdkSurface *window,
                       gboolean   already_mapped,
                      gboolean   deiconify)
 {
-  GdkSurfaceImplWin32 *surface_impl;
+  GdkSurfaceWin32 *surface;
   gboolean focus_on_map = FALSE;
   DWORD exstyle;
 
@@ -940,19 +891,19 @@ show_window_internal (GdkSurface *window,
    * + Certain window types and hints have more elaborate positioning
    *   schemes.
    */
-  surface_impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  surface = GDK_WIN32_SURFACE (window);
   if (!already_mapped &&
       GDK_SURFACE_TYPE (window) == GDK_SURFACE_TOPLEVEL &&
-      (surface_impl->hint_flags & (GDK_HINT_POS | GDK_HINT_USER_POS)) == 0)
+      (surface->hint_flags & (GDK_HINT_POS | GDK_HINT_USER_POS)) == 0)
     {
       gboolean center = FALSE;
       RECT window_rect, center_on_rect;
       int x, y;
 
-      x = surface_impl->initial_x;
-      y = surface_impl->initial_y;
+      x = surface->initial_x;
+      y = surface->initial_y;
 
-      if (surface_impl->type_hint == GDK_SURFACE_TYPE_HINT_SPLASHSCREEN)
+      if (surface->type_hint == GDK_SURFACE_TYPE_HINT_SPLASHSCREEN)
        {
          HMONITOR monitor;
          MONITORINFO mi;
@@ -970,15 +921,15 @@ show_window_internal (GdkSurface *window,
            }
          center = TRUE;
        }
-      else if (surface_impl->transient_owner != NULL &&
-              GDK_SURFACE_IS_MAPPED (surface_impl->transient_owner))
+      else if (surface->transient_owner != NULL &&
+              GDK_SURFACE_IS_MAPPED (surface->transient_owner))
        {
-         GdkSurface *owner = surface_impl->transient_owner;
+         GdkSurface *owner = surface->transient_owner;
          /* Center on transient parent */
-         center_on_rect.left = (owner->x - _gdk_offset_x) * surface_impl->surface_scale;
-         center_on_rect.top = (owner->y - _gdk_offset_y) * surface_impl->surface_scale;
-         center_on_rect.right = center_on_rect.left + owner->width * surface_impl->surface_scale;
-         center_on_rect.bottom = center_on_rect.top + owner->height * surface_impl->surface_scale;
+         center_on_rect.left = (owner->x - _gdk_offset_x) * surface->surface_scale;
+         center_on_rect.top = (owner->y - _gdk_offset_y) * surface->surface_scale;
+         center_on_rect.right = center_on_rect.left + owner->width * surface->surface_scale;
+         center_on_rect.bottom = center_on_rect.top + owner->height * surface->surface_scale;
 
          _gdk_win32_adjust_client_rect (GDK_SURFACE (owner), &center_on_rect);
          center = TRUE;
@@ -988,8 +939,8 @@ show_window_internal (GdkSurface *window,
        {
          window_rect.left = 0;
          window_rect.top = 0;
-         window_rect.right = window->width * surface_impl->surface_scale;
-         window_rect.bottom = window->height * surface_impl->surface_scale;
+         window_rect.right = window->width * surface->surface_scale;
+         window_rect.bottom = window->height * surface->surface_scale;
          _gdk_win32_adjust_client_rect (window, &window_rect);
 
          x = center_on_rect.left + ((center_on_rect.right - center_on_rect.left) - (window_rect.right - 
window_rect.left)) / 2;
@@ -1175,7 +1126,7 @@ gdk_win32_surface_move (GdkSurface *window,
   else
     {
       RECT outer_rect;
-      GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      GdkSurfaceWin32 *impl = GDK_SURFACE_WIN32 (window->impl);
 
       get_outer_rect (window, window->width, window->height, &outer_rect);
 
@@ -1273,7 +1224,7 @@ gdk_win32_surface_move_resize_internal (GdkSurface *window,
   else
     {
       RECT outer_rect;
-      GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      GdkSurfaceWin32 *impl = GDK_WIN32_SURFACE (window);
 
       get_outer_rect (window, width, height, &outer_rect);
 
@@ -1305,10 +1256,9 @@ gdk_win32_surface_move_resize (GdkSurface *window,
                              gint       width,
                              gint       height)
 {
-  GdkSurfaceImplWin32 *surface_impl;
+  GdkWin32Surface *surface = GDK_WIN32_SURFACE (window);
 
-  surface_impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
-  surface_impl->inhibit_configure = TRUE;
+  surface->inhibit_configure = TRUE;
 
   /* We ignore changes to the window being moved or resized by the
      user, as we don't want to fight the user */
@@ -1332,7 +1282,7 @@ gdk_win32_surface_move_resize (GdkSurface *window,
     }
 
  out:
-  surface_impl->inhibit_configure = FALSE;
+  surface->inhibit_configure = FALSE;
 
   _gdk_win32_emit_configure_event (window);
 }
@@ -1417,9 +1367,7 @@ static gboolean
 get_effective_window_decorations (GdkSurface       *window,
                                   GdkWMDecoration *decoration)
 {
-  GdkSurfaceImplWin32 *impl;
-
-  impl = (GdkSurfaceImplWin32 *)window->impl;
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   if (gdk_surface_get_decorations (window, decoration))
     return TRUE;
@@ -1505,7 +1453,7 @@ gdk_win32_surface_set_geometry_hints (GdkSurface         *window,
                               const GdkGeometry *geometry,
                               GdkSurfaceHints     geom_mask)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
   FullscreenInfo *fi;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
@@ -1516,8 +1464,6 @@ gdk_win32_surface_set_geometry_hints (GdkSurface         *window,
   GDK_NOTE (MISC, g_print ("gdk_surface_set_geometry_hints: %p\n",
                           GDK_SURFACE_HWND (window)));
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
-
   fi = g_object_get_data (G_OBJECT (window), "fullscreen-info");
   if (fi)
     fi->hint_flags = geom_mask;
@@ -1603,8 +1549,8 @@ gdk_win32_surface_set_transient_for (GdkSurface *window,
   HWND window_id, parent_id;
   LONG_PTR old_ptr;
   DWORD w32_error;
-  GdkSurfaceImplWin32 *surface_impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
-  GdkSurfaceImplWin32 *parent_impl = NULL;
+  GdkWin32Surface *surface = GDK_WIN32_SURFACE (window);
+  GdkWin32Surface *parent_impl = NULL;
   GSList *item;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
@@ -1624,12 +1570,12 @@ gdk_win32_surface_set_transient_for (GdkSurface *window,
       return;
     }
 
-  if (surface_impl->transient_owner == parent)
+  if (surface->transient_owner == parent)
     return;
 
-  if (GDK_IS_SURFACE (surface_impl->transient_owner))
+  if (GDK_IS_SURFACE (surface->transient_owner))
     {
-      GdkSurfaceImplWin32 *trans_impl = GDK_SURFACE_IMPL_WIN32 (surface_impl->transient_owner->impl);
+      GdkWin32Surface *trans_impl = GDK_WIN32_SURFACE (surface->transient_owner);
       item = g_slist_find (trans_impl->transient_children, window);
       item->data = NULL;
       trans_impl->transient_children = g_slist_delete_link (trans_impl->transient_children, item);
@@ -1640,20 +1586,20 @@ gdk_win32_surface_set_transient_for (GdkSurface *window,
           trans_impl->transient_children = NULL;
         }
 
-      g_object_unref (G_OBJECT (surface_impl->transient_owner));
+      g_object_unref (G_OBJECT (surface->transient_owner));
       g_object_unref (G_OBJECT (window));
 
-      surface_impl->transient_owner = NULL;
+      surface->transient_owner = NULL;
     }
 
   if (parent)
     {
-      parent_impl = GDK_SURFACE_IMPL_WIN32 (parent->impl);
+      parent_impl = GDK_WIN32_SURFACE (parent);
 
       parent_impl->transient_children = g_slist_append (parent_impl->transient_children, window);
       g_object_ref (G_OBJECT (window));
       parent_impl->num_transients++;
-      surface_impl->transient_owner = parent;
+      surface->transient_owner = parent;
       g_object_ref (G_OBJECT (parent));
     }
 
@@ -1685,8 +1631,7 @@ gdk_win32_surface_set_transient_for (GdkSurface *window,
 void
 _gdk_push_modal_window (GdkSurface *window)
 {
-  modal_window_stack = g_slist_prepend (modal_window_stack,
-                                        window);
+  modal_window_stack = g_slist_prepend (modal_window_stack, window);
 }
 
 void
@@ -1756,7 +1701,7 @@ gdk_win32_surface_get_geometry (GdkSurface *window,
   if (!GDK_SURFACE_DESTROYED (window))
     {
       RECT rect;
-      GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
       API_CALL (GetClientRect, (GDK_SURFACE_HWND (window), &rect));
 
@@ -1814,7 +1759,7 @@ gdk_win32_surface_get_root_coords (GdkSurface *window,
   gint tx;
   gint ty;
   POINT pt;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkSurfaceWin32 *impl = GDK_SURFACE_WIN32 (window->impl);
 
   pt.x = x * impl->surface_scale;
   pt.y = y * impl->surface_scale;
@@ -1849,7 +1794,7 @@ gdk_win32_surface_get_frame_extents (GdkSurface    *window,
 {
   HWND hwnd;
   RECT r;
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
   g_return_if_fail (rect != NULL);
@@ -1868,7 +1813,7 @@ gdk_win32_surface_get_frame_extents (GdkSurface    *window,
   while (window->parent && window->parent->parent)
     window = window->parent;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
   hwnd = GDK_SURFACE_HWND (window);
   API_CALL (GetWindowRect, (hwnd, &r));
 
@@ -1945,14 +1890,14 @@ gdk_win32_surface_set_icon_list (GdkSurface *window,
   gint w, h;
   gint dw, dh, diff;
   HICON small_hicon, big_hicon;
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
 
   if (GDK_SURFACE_DESTROYED (window) || textures == NULL)
     return;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   /* ideal sizes for small and large icons */
   big_w = GetSystemMetrics (SM_CXICON);
@@ -2070,14 +2015,14 @@ update_single_bit (LONG    *style,
 gboolean
 _gdk_win32_surface_lacks_wm_decorations (GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
   LONG style;
   gboolean has_any_decorations;
 
   if (GDK_SURFACE_DESTROYED (window))
     return FALSE;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   /* This is because GTK calls gdk_surface_set_decorations (window, 0),
    * even though GdkWMDecoration docs indicate that 0 does NOT mean
@@ -2122,7 +2067,7 @@ _gdk_win32_surface_lacks_wm_decorations (GdkSurface *window)
 void
 _gdk_win32_surface_update_style_bits (GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl = (GdkSurfaceImplWin32 *)window->impl;
+  GdkSurfaceWin32 *impl = (GdkSurfaceWin32 *)window->impl;
   GdkWMDecoration decorations;
   LONG old_style, new_style, old_exstyle, new_exstyle;
   gboolean all;
@@ -2293,11 +2238,11 @@ static void
 gdk_win32_surface_set_decorations (GdkSurface      *window,
                                  GdkWMDecoration decorations)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   GDK_NOTE (MISC, g_print ("gdk_surface_set_decorations: %p: %s %s%s%s%s%s%s\n",
                           GDK_SURFACE_HWND (window),
@@ -2321,11 +2266,11 @@ static gboolean
 gdk_win32_surface_get_decorations (GdkSurface       *window,
                                  GdkWMDecoration *decorations)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
 
   g_return_val_if_fail (GDK_IS_SURFACE (window), FALSE);
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   if (impl->decorations == NULL)
     return FALSE;
@@ -2407,7 +2352,7 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
 {
   GdkDisplay *display;
   gint n_monitors, monitor_idx, other_monitor_idx;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (context->window->impl);
+  GdkSurfaceWin32 *impl = GDK_SURFACE_WIN32 (context->window->impl);
 #if defined(MORE_AEROSNAP_DEBUGGING)
   gint i;
 #endif
@@ -2565,9 +2510,9 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
 static void
 discard_snapinfo (GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   impl->snap_state = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
 
@@ -2582,10 +2527,10 @@ static void
 unsnap (GdkSurface  *window,
         GdkMonitor *monitor)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
   GdkRectangle rect;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   impl->snap_state = GDK_WIN32_AEROSNAP_STATE_UNDETERMINED;
 
@@ -2657,7 +2602,7 @@ unsnap (GdkSurface  *window,
 
 static void
 stash_window (GdkSurface          *window,
-              GdkSurfaceImplWin32 *impl)
+              GdkSurfaceWin32 *impl)
 {
   gint x, y;
   gint width, wwidth;
@@ -2734,9 +2679,9 @@ snap_up (GdkSurface *window)
   SHORT maxysize;
   gint x, y;
   gint width, height;
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   impl->snap_state = GDK_WIN32_AEROSNAP_STATE_FULLUP;
 
@@ -2763,9 +2708,9 @@ snap_left (GdkSurface  *window,
            GdkMonitor *snap_monitor)
 {
   GdkRectangle rect;
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   impl->snap_state = GDK_WIN32_AEROSNAP_STATE_HALFLEFT;
 
@@ -2789,9 +2734,9 @@ snap_right (GdkSurface  *window,
             GdkMonitor *snap_monitor)
 {
   GdkRectangle rect;
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
 
   impl->snap_state = GDK_WIN32_AEROSNAP_STATE_HALFRIGHT;
 
@@ -2814,7 +2759,7 @@ void
 _gdk_win32_surface_handle_aerosnap (GdkSurface            *window,
                                    GdkWin32AeroSnapCombo combo)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkSurfaceWin32 *impl;
   GdkDisplay *display;
   gint n_monitors;
   GdkSurfaceState surface_state = gdk_surface_get_state (window);
@@ -2823,7 +2768,7 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface            *window,
   gboolean halfsnapped;
   GdkMonitor *monitor;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_SURFACE_WIN32 (window->impl);
   display = gdk_surface_get_display (window);
   n_monitors = gdk_display_get_n_monitors (display);
   monitor = gdk_display_get_monitor_at_surface (display, window);
@@ -3157,7 +3102,7 @@ draw_indicator (GdkW32DragMoveResizeContext *context,
   gdouble line_width;
   gdouble corner_radius;
   gint64 animation_duration;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (context->window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (context->window);
 
   line_width = AEROSNAP_INDICATOR_LINE_WIDTH * impl->surface_scale;
   corner_radius = AEROSNAP_INDICATOR_CORNER_RADIUS;
@@ -3258,7 +3203,7 @@ redraw_indicator (gpointer user_data)
   POINT source_point = { 0, 0 };
   gboolean last_draw;
   gdouble indicator_opacity;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   gboolean do_source_remove = FALSE;
 
   indicator_opacity = AEROSNAP_INDICATOR_OPACITY;
@@ -3269,7 +3214,7 @@ redraw_indicator (gpointer user_data)
       do_source_remove = TRUE;
     }
 
-  impl = GDK_SURFACE_IMPL_WIN32 (context->window->impl);
+  impl = GDK_WIN32_SURFACE (context->window);
 
   if (!ensure_snap_indicator_surface (context,
                                       context->indicator_window_rect.width,
@@ -3408,7 +3353,7 @@ update_fullup_indicator (GdkSurface                   *window,
   SHORT maxysize;
   GdkRectangle from, to;
   GdkRectangle to_adjusted, from_adjusted, from_or_to;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
   GDK_NOTE (MISC, g_print ("Update fullup indicator\n"));
 
@@ -3418,7 +3363,7 @@ update_fullup_indicator (GdkSurface                   *window,
   if (context->shape_indicator == NULL)
     return;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
   maxysize = GetSystemMetrics (SM_CYVIRTUALSCREEN);
   gdk_surface_get_position (window, &to.x, &to.y);
   to.width = gdk_surface_get_width (window);
@@ -3470,7 +3415,7 @@ start_indicator (GdkSurface                   *window,
   SHORT maxysize;
   GdkRectangle start_size, end_size;
   GdkDisplay *display;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   display = gdk_surface_get_display (window);
   monitor = gdk_display_get_monitor_at_point (display, x, y);
@@ -3816,7 +3761,7 @@ setup_drag_move_resize_context (GdkSurface                   *window,
   RECT rect;
   const gchar *cursor_name;
   GdkSurface *pointer_window;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
   gboolean maximized = gdk_surface_get_state (window) & GDK_SURFACE_STATE_MAXIMIZED;
   gint root_x, root_y;
 
@@ -4102,7 +4047,7 @@ setup_drag_move_resize_context (GdkSurface                   *window,
 void
 gdk_win32_surface_end_move_resize_drag (GdkSurface *window)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
   GdkW32DragMoveResizeContext *context = &impl->drag_move_resize_context;
 
   context->op = GDK_WIN32_DRAGOP_NONE;
@@ -4160,9 +4105,7 @@ gdk_win32_get_window_size_and_position_from_client_rect (GdkSurface *window,
                                                          SIZE      *window_size,
                                                          POINT     *window_position)
 {
-  GdkSurfaceImplWin32 *impl;
-
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   /* Turn client area into window area */
   _gdk_win32_adjust_client_rect (window, window_rect);
@@ -4193,9 +4136,7 @@ _gdk_win32_update_layered_window_from_cache (GdkSurface *surface,
   SIZE *window_size_ptr;
   POINT source_point = { 0, 0 };
   POINT *source_point_ptr;
-  GdkSurfaceImplWin32 *impl;
-
-  impl = GDK_SURFACE_IMPL_WIN32 (surface->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
 
   gdk_win32_get_window_size_and_position_from_client_rect (surface,
                                                            client_rect,
@@ -4251,12 +4192,12 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
   RECT new_rect;
   gint diffy, diffx;
   MINMAXINFO mmi;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
   GdkW32DragMoveResizeContext *context;
   gint width;
   gint height;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
   context = &impl->drag_move_resize_context;
 
   if (!_gdk_win32_get_window_rect (window, &rect))
@@ -4458,7 +4399,7 @@ gdk_win32_surface_begin_resize_drag (GdkSurface     *window,
                                     gint           y,
                                     guint32        timestamp)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
 
@@ -4476,7 +4417,7 @@ gdk_win32_surface_begin_resize_drag (GdkSurface     *window,
   if (button != 1)
     return;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
     gdk_win32_surface_end_move_resize_drag (window);
@@ -4494,7 +4435,7 @@ gdk_win32_surface_begin_move_drag (GdkSurface *window,
                                   gint       y,
                                   guint32    timestamp)
 {
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
 
@@ -4511,7 +4452,7 @@ gdk_win32_surface_begin_move_drag (GdkSurface *window,
   if (button != 1)
     return;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
     gdk_win32_surface_end_move_resize_drag (window);
@@ -4657,7 +4598,7 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
     g_free (fi);
   else
     {
-      GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
       monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
       mi.cbSize = sizeof (mi);
@@ -4703,7 +4644,7 @@ gdk_win32_surface_unfullscreen (GdkSurface *window)
   fi = g_object_get_data (G_OBJECT (window), "fullscreen-info");
   if (fi)
     {
-      GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+      GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
       gdk_synthesize_surface_state (window, GDK_SURFACE_STATE_FULLSCREEN, 0);
 
@@ -4856,7 +4797,7 @@ gdk_win32_surface_set_type_hint (GdkSurface        *window,
                       g_enum_get_value (class, hint)->value_name);
            }G_STMT_END);
 
-  ((GdkSurfaceImplWin32 *)window->impl)->type_hint = hint;
+  GDK_WIN32_SURFACE (window)->type_hint = hint;
 
   _gdk_win32_surface_update_style_bits (window);
 }
@@ -4869,7 +4810,7 @@ gdk_win32_surface_get_type_hint (GdkSurface *window)
   if (GDK_SURFACE_DESTROYED (window))
     return GDK_SURFACE_TYPE_HINT_NORMAL;
 
-  return GDK_SURFACE_IMPL_WIN32 (window->impl)->type_hint;
+  return GDK_SURFACE_WIN32 (window->impl)->type_hint;
 }
 
 GdkSurface *
@@ -4888,7 +4829,7 @@ gdk_win32_surface_set_opacity (GdkSurface *window,
   LONG exstyle;
   typedef BOOL (WINAPI *PFN_SetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
   PFN_SetLayeredWindowAttributes setLayeredWindowAttributes = NULL;
-  GdkSurfaceImplWin32 *impl;
+  GdkWin32Surface *impl;
 
   g_return_if_fail (GDK_IS_SURFACE (window));
 
@@ -4900,7 +4841,7 @@ gdk_win32_surface_set_opacity (GdkSurface *window,
   else if (opacity > 1)
     opacity = 1;
 
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   if (impl->layered)
     {
@@ -4939,7 +4880,7 @@ gdk_win32_surface_set_opacity (GdkSurface *window,
 gboolean
 gdk_win32_surface_is_win32 (GdkSurface *window)
 {
-  return GDK_SURFACE_IS_WIN32 (window);
+  return GDK_IS_WIN32_SURFACE (window);
 }
 
 static gboolean
@@ -4948,7 +4889,7 @@ gdk_win32_surface_show_window_menu (GdkSurface *window,
 {
   double event_x, event_y;
   gint x, y;
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   switch (event->any.type)
     {
@@ -4976,7 +4917,7 @@ gdk_win32_surface_show_window_menu (GdkSurface *window,
 HWND
 gdk_win32_surface_get_impl_hwnd (GdkSurface *window)
 {
-  if (GDK_SURFACE_IS_WIN32 (window))
+  if (GDK_IS_WIN32_SURFACE (window))
     return GDK_SURFACE_HWND (window);
   return NULL;
 }
@@ -4995,7 +4936,7 @@ GtkShowWindow (GdkSurface *window,
   BLENDFUNCTION blender;
 
   HWND hwnd = GDK_SURFACE_HWND (window);
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   switch (cmd_show)
     {
@@ -5073,7 +5014,7 @@ gdk_win32_surface_set_shadow_width (GdkSurface *window,
                                    gint       top,
                                    gint       bottom)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   if (GDK_SURFACE_DESTROYED (window))
     return;
@@ -5100,8 +5041,7 @@ gint
 _gdk_win32_surface_get_scale_factor (GdkSurface *window)
 {
   GdkDisplay *display;
-  GdkSurfaceImplWin32 *impl;
-
+  GdkWin32Surface *impl;
   GdkWin32Display *win32_display;
 
   if (GDK_SURFACE_DESTROYED (window))
@@ -5110,7 +5050,7 @@ _gdk_win32_surface_get_scale_factor (GdkSurface *window)
   g_return_val_if_fail (window != NULL, 1);
 
   display = gdk_surface_get_display (window);
-  impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  impl = GDK_WIN32_SURFACE (window);
 
   win32_display = GDK_WIN32_DISPLAY (display);
 
@@ -5149,7 +5089,7 @@ _gdk_win32_surface_get_unscaled_size (GdkSurface *window,
                                     gint      *unscaled_width,
                                     gint      *unscaled_height)
 {
-  GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl);
+  GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
 
   if (unscaled_width)
     *unscaled_width = impl->unscaled_width;
@@ -5169,15 +5109,15 @@ gdk_win32_input_shape_combine_region (GdkSurface            *window,
 }
 
 static void
-gdk_surface_impl_win32_class_init (GdkSurfaceImplWin32Class *klass)
+gdk_surface_win32_class_init (GdkWin32SurfaceClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  GdkSurfaceImplClass *impl_class = GDK_SURFACE_IMPL_CLASS (klass);
+  GdkSurfaceClass *impl_class = GDK_SURFACE_CLASS (klass);
 
   parent_class = g_type_class_peek_parent (klass);
 
-  object_class->dispose = gdk_surface_impl_win32_dispose;
-  object_class->finalize = gdk_surface_impl_win32_finalize;
+  object_class->dispose = gdk_surface_win32_dispose;
+  object_class->finalize = gdk_surface_win32_finalize;
 
   impl_class->show = gdk_win32_surface_show;
   impl_class->hide = gdk_win32_surface_hide;
@@ -5239,7 +5179,7 @@ gdk_surface_impl_win32_class_init (GdkSurfaceImplWin32Class *klass)
 HGDIOBJ
 gdk_win32_surface_get_handle (GdkSurface *window)
 {
-  if (!GDK_SURFACE_IS_WIN32 (window))
+  if (!GDK_IS_WIN32_SURFACE (window))
     {
       g_warning (G_STRLOC " window is not a native Win32 window");
       return NULL;
diff --git a/gdk/win32/gdksurface-win32.h b/gdk/win32/gdksurface-win32.h
index 6caa0d2f25..7f774668e1 100644
--- a/gdk/win32/gdksurface-win32.h
+++ b/gdk/win32/gdksurface-win32.h
@@ -27,26 +27,14 @@
 
 #include "gdk/win32/gdkprivate-win32.h"
 #include "gdk/win32/gdkwin32cursor.h"
-#include "gdk/gdksurfaceimpl.h"
+#include "gdk/win32/gdkwin32surface.h"
+#include "gdk/gdksurfaceprivate.h"
 #include "gdk/gdkcursor.h"
 
 #include <windows.h>
 
 G_BEGIN_DECLS
 
-/* Window implementation for Win32
- */
-
-typedef struct _GdkSurfaceImplWin32 GdkSurfaceImplWin32;
-typedef struct _GdkSurfaceImplWin32Class GdkSurfaceImplWin32Class;
-
-#define GDK_TYPE_SURFACE_IMPL_WIN32              (_gdk_surface_impl_win32_get_type ())
-#define GDK_SURFACE_IMPL_WIN32(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), 
GDK_TYPE_SURFACE_IMPL_WIN32, GdkSurfaceImplWin32))
-#define GDK_SURFACE_IMPL_WIN32_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), 
GDK_TYPE_SURFACE_IMPL_WIN32, GdkSurfaceImplWin32Class))
-#define GDK_IS_SURFACE_IMPL_WIN32(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), 
GDK_TYPE_SURFACE_IMPL_WIN32))
-#define GDK_IS_SURFACE_IMPL_WIN32_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GDK_TYPE_SURFACE_IMPL_WIN32))
-#define GDK_SURFACE_IMPL_WIN32_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GDK_TYPE_SURFACE_IMPL_WIN32, GdkSurfaceImplWin32Class))
-
 enum _GdkWin32AeroSnapCombo
 {
   GDK_WIN32_AEROSNAP_COMBO_NOTHING = 0,
@@ -219,9 +207,9 @@ typedef struct _GdkW32DragMoveResizeContext GdkW32DragMoveResizeContext;
 /* defined in gdkdrop-win32.c */
 typedef struct _drop_target_context drop_target_context;
 
-struct _GdkSurfaceImplWin32
+struct _GdkWin32Surface
 {
-  GdkSurfaceImpl parent_instance;
+  GdkSurface parent_instance;
 
   GdkSurface *wrapper;
   HANDLE handle;
@@ -355,12 +343,12 @@ struct _GdkSurfaceImplWin32
   gint unscaled_height;
 };
 
-struct _GdkSurfaceImplWin32Class
+struct _GdkWin32SurfaceClass
 {
-  GdkSurfaceImplClass parent_class;
+  GdkSurfaceClass parent_class;
 };
 
-GType _gdk_surface_impl_win32_get_type (void);
+GType _gdk_win32_surface_get_type (void);
 
 void  _gdk_win32_surface_tmp_unset_bg  (GdkSurface *window,
                                         gboolean   recurse);
diff --git a/gdk/win32/gdkwin32misc.h b/gdk/win32/gdkwin32misc.h
index e8133f0748..5410c8edda 100644
--- a/gdk/win32/gdkwin32misc.h
+++ b/gdk/win32/gdkwin32misc.h
@@ -44,7 +44,7 @@ G_BEGIN_DECLS
 
 #include "gdkprivate-win32.h"
 
-#define GDK_SURFACE_HWND(win)          (GDK_SURFACE_IMPL_WIN32(win->impl)->handle)
+#define GDK_SURFACE_HWND(win)          (GDK_WIN32_SURFACE(win)->handle)
 #else
 /* definition for exported 'internals' go here */
 #define GDK_SURFACE_HWND(d) (gdk_win32_surface_get_handle (d))


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