commit 774e146d8b1405feecefc061bded348fa395aa38
Author: Tilman Sauerbeck <tilman@code-monkey.de>
Date:   Wed Apr 25 19:39:10 2007 +0200

    Added wrappers for XMapWindow()/XUnmapWindow().

diff --git a/gdk/x11/gdkgeometry-x11.c b/gdk/x11/gdkgeometry-x11.c
index dbb66a1..e1e013b 100644
--- a/gdk/x11/gdkgeometry-x11.c
+++ b/gdk/x11/gdkgeometry-x11.c
@@ -611,6 +611,26 @@ reset_backgrounds (GdkWindow *window)
     _gdk_x11_window_tmp_reset_bg ((GdkWindow *)obj->parent, FALSE);
 }
 
+static void
+map_if_needed (GdkWindow *window, GdkXPositionInfo *pos_info)
+{
+  GdkWindowObject *obj = (GdkWindowObject *) window;
+  GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (obj->impl);
+
+  if (!impl->position_info.mapped && pos_info->mapped && GDK_WINDOW_IS_MAPPED (obj))
+    XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+}
+
+static void
+unmap_if_needed (GdkWindow *window, GdkXPositionInfo *pos_info)
+{
+  GdkWindowObject *obj = (GdkWindowObject *) window;
+  GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (obj->impl);
+
+  if (impl->position_info.mapped && !pos_info->mapped)
+    XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+}
+
 void
 _gdk_window_move_resize_child (GdkWindow *window,
 			       gint       x,
@@ -690,8 +710,7 @@ _gdk_window_move_resize_child (GdkWindow *window,
 
       reset_backgrounds (window);
 
-      if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
-	XMapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
+      map_if_needed (window, &new_info);
       
       impl->position_info = new_info;
       
@@ -702,8 +721,7 @@ _gdk_window_move_resize_child (GdkWindow *window,
       if (is_move && is_resize)
 	gdk_window_set_static_gravities (window, FALSE);
 
-      if (impl->position_info.mapped && !new_info.mapped)
-	XUnmapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
+      unmap_if_needed (window, &new_info);
       
       g_list_foreach (obj->children, (GFunc) gdk_window_premove, &parent_pos);
 
@@ -716,8 +734,7 @@ _gdk_window_move_resize_child (GdkWindow *window,
 
       reset_backgrounds (window);
       
-      if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
-	XMapWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
+      map_if_needed (window, &new_info);
 
       impl->position_info = new_info;
     }
@@ -902,8 +919,7 @@ gdk_window_premove (GdkWindow          *window,
 
   translate_pos (parent_pos, &this_pos, obj, &new_info, TRUE);
 
-  if (impl->position_info.mapped && !new_info.mapped)
-    XUnmapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+  unmap_if_needed (window, &new_info);
 
   d_xoffset = new_info.x_offset - impl->position_info.x_offset;
   d_yoffset = new_info.y_offset - impl->position_info.y_offset;
@@ -952,8 +968,7 @@ gdk_window_postmove (GdkWindow          *window,
       xmove_resize2 (window, &new_info);
     }
 
-  if (!impl->position_info.mapped && new_info.mapped && GDK_WINDOW_IS_MAPPED (obj))
-    XMapWindow (GDK_DRAWABLE_XDISPLAY (window), GDK_DRAWABLE_XID (window));
+  map_if_needed (window, &new_info);
 
   reset_backgrounds (window);
 
