[gtk+/rendering-cleanup: 1/41] API: x11: gdk_drawable_get_xid => gdk_window_get_xid



commit 94d1277ce0b3215b6354a53857517b1fd03de752
Author: Benjamin Otte <otte redhat com>
Date:   Wed Oct 6 00:08:25 2010 +0200

    API: x11: gdk_drawable_get_xid => gdk_window_get_xid
    
    Also moves the function implementations to gtkwindow-x11.c.

 docs/reference/gdk/gdk3-sections.txt               |    2 +-
 .../reference/gtk/migrating-ClientSideWindows.sgml |    2 +-
 docs/tools/shooter.c                               |    2 +-
 gdk/gdk.symbols                                    |    2 +-
 gdk/gdkwindow.c                                    |    2 +-
 gdk/x11/gdkdrawable-x11.c                          |   46 --------------------
 gdk/x11/gdkwindow-x11.c                            |   37 ++++++++++++++++
 gdk/x11/gdkx.h                                     |    8 ++--
 8 files changed, 46 insertions(+), 55 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 40bcaaf..811266a 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -1007,7 +1007,7 @@ gdk_x11_display_error_trap_pop_ignored
 gdk_x11_display_set_cursor_theme
 gdk_x11_register_standard_event_type
 gdk_x11_drawable_get_xdisplay
-gdk_x11_drawable_get_xid
+gdk_x11_window_get_xid
 gdk_x11_get_default_root_xwindow
 gdk_x11_get_default_screen
 gdk_x11_get_default_xdisplay
diff --git a/docs/reference/gtk/migrating-ClientSideWindows.sgml b/docs/reference/gtk/migrating-ClientSideWindows.sgml
index 845e956..54e0620 100644
--- a/docs/reference/gtk/migrating-ClientSideWindows.sgml
+++ b/docs/reference/gtk/migrating-ClientSideWindows.sgml
@@ -13,7 +13,7 @@
     longer correct to assume that each window has an associated XID.
     Code that makes this assumption can sometimes be fixed by calling
     gdk_window_ensure_native() on the windows in question.
-    Calling gdk_x11_drawable_get_xid() (or GDK_WINDOW_XID()) from the
+    Calling gdk_x11_window_get_xid() (or GDK_WINDOW_XID()) from the
     X11-specific API on a non-native window will explicitly call
     gdk_window_ensure_native(), so old code using this will continue to
     work. A small gotcha is that the GDK_WINDOW_XID() call is no longer a
diff --git a/docs/tools/shooter.c b/docs/tools/shooter.c
index 873609d..f9492f6 100644
--- a/docs/tools/shooter.c
+++ b/docs/tools/shooter.c
@@ -224,7 +224,7 @@ int main (int argc, char **argv)
 	  gtk_main_iteration ();
 	}
 
-      id = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
+      id = gdk_x11_window_get_xid (window);
       screenshot = take_window_shot (id, info->include_decorations);
       filename = g_strdup_printf ("./%s.png", info->name);
       gdk_pixbuf_save (screenshot, filename, "png", NULL, NULL);
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index 835e9e0..5445e5c 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -980,7 +980,7 @@ gdk_x11_display_error_trap_pop_ignored
 
 #if IN_FILE(__GDK_DRAWABLE_X11_C__)
 gdk_x11_drawable_get_xdisplay
-gdk_x11_drawable_get_xid
+gdk_x11_window_get_xid
 gdk_x11_window_get_drawable_impl
 #endif
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index c248598..fc742cf 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -9596,7 +9596,7 @@ gdk_window_print (GdkWindowObject *window,
   if (gdk_window_has_impl (window))
     {
 #ifdef GDK_WINDOWING_X11
-      g_print (" impl(0x%lx)", gdk_x11_drawable_get_xid (GDK_DRAWABLE (window)));
+      g_print (" impl(0x%lx)", gdk_x11_window_get_xid (window));
 #endif
     }
 
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index a35a54b..9d00d02 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -134,52 +134,6 @@ gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable)
     return GDK_SCREEN_XDISPLAY (GDK_DRAWABLE_IMPL_X11 (get_impl_drawable (drawable))->screen);
 }
 
-/**
- * gdk_x11_drawable_get_xid:
- * @drawable: a #GdkDrawable.
- * 
- * Returns the X resource (window) belonging to a #GdkDrawable.
- * 
- * Return value: the ID of @drawable's X resource.
- **/
-XID
-gdk_x11_drawable_get_xid (GdkDrawable *drawable)
-{
-  GdkDrawable *impl;
-  
-  if (GDK_IS_WINDOW (drawable))
-    {
-      GdkWindow *window = (GdkWindow *)drawable;
-      
-      /* Try to ensure the window has a native window */
-      if (!_gdk_window_has_impl (window))
-	{
-	  gdk_window_ensure_native (window);
-
-	  /* We sync here to ensure the window is created in the Xserver when
-	   * this function returns. This is required because the returned XID
-	   * for this window must be valid immediately, even with another
-	   * connection to the Xserver */
-	  gdk_display_sync (gdk_window_get_display (window));
-	}
-      
-      if (!GDK_WINDOW_IS_X11 (window))
-        {
-          g_warning (G_STRLOC " drawable is not a native X11 window");
-          return None;
-        }
-      
-      impl = ((GdkWindowObject *)drawable)->impl;
-    }
-  else
-    {
-      g_warning (G_STRLOC " drawable is not a window");
-      return None;
-    }
-
-  return ((GdkDrawableImplX11 *)impl)->xid;
-}
-
 GdkDrawable *
 gdk_x11_window_get_drawable_impl (GdkWindow *window)
 {
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index b369e2c..a619fd3 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -5584,3 +5584,40 @@ gdk_x11_get_server_time (GdkWindow *window)
 
   return xevent.xproperty.time;
 }
+
+/**
+ * gdk_x11_window_get_xid:
+ * @window: a native #GdkWindow.
+ * 
+ * Returns the X resource (window) belonging to a #GdkWindow.
+ * 
+ * Return value: the ID of @drawable's X resource.
+ **/
+XID
+gdk_x11_window_get_xid (GdkWindow *window)
+{
+  GdkDrawable *impl;
+      
+  /* Try to ensure the window has a native window */
+  if (!_gdk_window_has_impl (window))
+    {
+      gdk_window_ensure_native (window);
+
+      /* We sync here to ensure the window is created in the Xserver when
+       * this function returns. This is required because the returned XID
+       * for this window must be valid immediately, even with another
+       * connection to the Xserver */
+      gdk_display_sync (gdk_window_get_display (window));
+    }
+  
+  if (!GDK_WINDOW_IS_X11 (window))
+    {
+      g_warning (G_STRLOC " drawable is not a native X11 window");
+      return None;
+    }
+  
+  impl = ((GdkWindowObject *) window)->impl;
+
+  return ((GdkDrawableImplX11 *)impl)->xid;
+}
+
diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h
index 7fc0227..bde14d5 100644
--- a/gdk/x11/gdkx.h
+++ b/gdk/x11/gdkx.h
@@ -56,7 +56,7 @@ G_BEGIN_DECLS
 
 
 Display *gdk_x11_drawable_get_xdisplay    (GdkDrawable *drawable);
-XID      gdk_x11_drawable_get_xid         (GdkDrawable *drawable);
+Window   gdk_x11_window_get_xid           (GdkWindow   *window);
 GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window);
 Display *gdk_x11_cursor_get_xdisplay      (GdkCursor   *cursor);
 Cursor   gdk_x11_cursor_get_xcursor       (GdkCursor   *cursor);
@@ -186,16 +186,16 @@ gint     gdk_x11_get_default_screen       (void);
  *
  * Returns: the Xlib <type>Window</type> of @win.
  */
-#define GDK_WINDOW_XID(win)           (gdk_x11_drawable_get_xid (win))
+#define GDK_WINDOW_XID(win)           (gdk_x11_window_get_xid (win))
 
 /**
  * GDK_WINDOW_XWINDOW:
  *
  * Another name for GDK_DRAWABLE_XID().
  */
-#define GDK_WINDOW_XWINDOW(win)       (gdk_x11_drawable_get_xid (win))
+#define GDK_WINDOW_XWINDOW(win)       (gdk_x11_window_get_xid (win))
 #define GDK_DRAWABLE_XDISPLAY(win)    (gdk_x11_drawable_get_xdisplay (win))
-#define GDK_DRAWABLE_XID(win)         (gdk_x11_drawable_get_xid (win))
+#define GDK_DRAWABLE_XID(win)         (gdk_x11_window_get_xid (win))
 #define GDK_SCREEN_XDISPLAY(screen)   (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
 #define GDK_SCREEN_XSCREEN(screen)    (gdk_x11_screen_get_xscreen (screen))
 



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