[gtk+] wayland: Add call to get types available for the selection as atoms



commit 9d90a17a7c2a581c22cf80eb84360636b0215ec2
Author: Rob Bradford <rob linux intel com>
Date:   Fri Jan 13 13:33:53 2012 +0000

    wayland: Add call to get types available for the selection as atoms

 gdk/wayland/gdkdevice-wayland.c |   35 +++++++++++++++++++++++++++++++++++
 gdk/wayland/gdkwayland.h        |    6 ++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 246baca..73601db 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -921,3 +921,38 @@ _gdk_wayland_device_manager_new (GdkDisplay *display)
                        "display", display,
                        NULL);
 }
+
+gint
+gdk_wayland_device_get_selection_type_atoms (GdkDevice  *gdk_device,
+                                             GdkAtom   **atoms_out)
+{
+  gint i;
+  GdkAtom *atoms;
+  GdkWaylandDevice *device;
+
+  g_return_val_if_fail (GDK_IS_DEVICE_CORE (gdk_device), 0);
+  g_return_val_if_fail (atoms_out != NULL, 0);
+
+  device = GDK_DEVICE_CORE (gdk_device)->device;
+
+  if (device->selection_offer->types->len == 0)
+    {
+      *atoms_out = NULL;
+      return 0;
+    }
+
+  atoms = g_new0 (GdkAtom, device->selection_offer->types->len);
+
+  /* Convert list of targets to atoms */
+  for (i = 0; i < device->selection_offer->types->len; i++)
+    {
+      atoms[i] = gdk_atom_intern (device->selection_offer->types->pdata[i],
+                                  FALSE);
+      GDK_NOTE (MISC,
+                g_message (G_STRLOC ": Adding atom for %s",
+                           (char *)device->selection_offer->types->pdata[i]));
+    }
+
+  *atoms_out = atoms;
+  return device->selection_offer->types->len;
+}
diff --git a/gdk/wayland/gdkwayland.h b/gdk/wayland/gdkwayland.h
index c9e9f6e..d4616cd 100644
--- a/gdk/wayland/gdkwayland.h
+++ b/gdk/wayland/gdkwayland.h
@@ -33,6 +33,12 @@ G_BEGIN_DECLS
 
 GType      gdk_wayland_display_manager_get_type   (void);
 
+#if defined (GTK_COMPILATION) || defined (GDK_COMPILATION)
+#define gdk_wayland_device_get_selection_type_atoms gdk_wayland_device_get_selection_type_atoms_libgtk_only
+int
+gdk_wayland_device_get_selection_type_atoms (GdkDevice  *device,
+                                                         GdkAtom   **atoms_out);
+#endif
 G_END_DECLS
 
 #endif /* __GDK_WAYLAND_H__ */



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