summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2011-01-28 15:11:44 +0100
committerBenjamin Otte <otte@redhat.com>2011-01-28 17:06:07 +0100
commitbd4ef49af9eb68fea7fb2f87fdb01198287da099 (patch)
treea1a40a792926cd5b4f8ad4cf76880ee2018737d5
parente1f6a24da9f9a41f3857c6c7090812a9cbd82406 (diff)
downloadgtk+-bd4ef49af9eb68fea7fb2f87fdb01198287da099.tar.gz
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.
-rw-r--r--docs/reference/gdk/gdk3-sections.txt2
-rw-r--r--gdk/x11/gdkx11utils.h17
2 files changed, 19 insertions, 0 deletions
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 459c1c242c..a0627079df 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 f00ee5b653..de7ffd36cf 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);