[gtk+] API: x11: Add GDK_POINTER_TO_XID() and GDK_XID_TO_POINTER()



commit bd4ef49af9eb68fea7fb2f87fdb01198287da099
Author: Benjamin Otte <otte redhat com>
Date:   Fri Jan 28 15:11:44 2011 +0100

    API: x11: Add GDK_POINTER_TO_XID() and GDK_XID_TO_POINTER()
    
    Previously people used GDK_GPOINTER_TO_NATIVE_WINDOW() for this, but
    native windows are going away, so we need a replacement.

 docs/reference/gdk/gdk3-sections.txt |    2 ++
 gdk/x11/gdkx11utils.h                |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 459c1c2..a062707 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -934,6 +934,8 @@ GDK_SCREEN_XNUMBER
 GDK_SCREEN_XSCREEN
 GDK_CURSOR_XCURSOR
 GDK_CURSOR_XDISPLAY
+GDK_POINTER_TO_XID
+GDK_XID_TO_POINTER
 gdk_x11_lookup_xdisplay
 gdk_x11_get_server_time
 gdk_x11_display_get_user_time
diff --git a/gdk/x11/gdkx11utils.h b/gdk/x11/gdkx11utils.h
index f00ee5b..de7ffd3 100644
--- a/gdk/x11/gdkx11utils.h
+++ b/gdk/x11/gdkx11utils.h
@@ -52,6 +52,23 @@ Display *gdk_x11_get_default_xdisplay     (void);
 #define GDK_ROOT_WINDOW()             (gdk_x11_get_default_root_xwindow ())
 #endif
 
+/**
+ * GDK_XID_TO_POINTER:
+ *
+ * Converts an XID into a @gpointer. This is useful with data structures
+ * that use pointer arguments such as #GHashTable. Use GDK_POINTER_TO_XID()
+ * to convert the argument back to an XID.
+ */
+#define GDK_XID_TO_POINTER(pointer) GUINT_TO_POINTER(pointer)
+
+/**
+ * GDK_POINTER_TO_XID:
+ *
+ * Converts a @gpointer back to an XID that was previously converted
+ * using GDK_XID_TO_POINTER().
+ */
+#define GDK_POINTER_TO_XID(pointer) GPOINTER_TO_UINT(pointer)
+
 #ifndef GDK_MULTIHEAD_SAFE
 void          gdk_x11_grab_server    (void);
 void          gdk_x11_ungrab_server  (void);



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