[mutter/wip/multitouchr: 45/73] device-map: Add meta_device_map_list_devices()



commit 25dc04440b70f8093ca3c7d9288d03006e2cc4c4
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jul 4 20:23:04 2011 +0200

    device-map: Add meta_device_map_list_devices()
    
    This function returns a list of the devices currently handled by
    the device map.

 src/core/device-map.c |   22 ++++++++++++++++++++++
 src/meta/device-map.h |    1 +
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/core/device-map.c b/src/core/device-map.c
index d719c31..8ae537a 100644
--- a/src/core/device-map.c
+++ b/src/core/device-map.c
@@ -291,6 +291,28 @@ meta_device_map_get_display (MetaDeviceMap *device_map)
   return priv->display;
 }
 
+/**
+ * meta_device_map_list_devices:
+ * @device_map: a #MetaDeviceMap
+ *
+ * Returns the list of devices that @device_map holds.
+ *
+ * Returns: (element-type Meta.Device) (transfer container): the list
+ *          of devices, the contained objects are owned by @device_map
+ *          and should not be unref'ed. The list must be freed with
+ *          g_list_free().
+ **/
+GList *
+meta_device_map_list_devices (MetaDeviceMap *device_map)
+{
+  MetaDeviceMapPrivate *priv;
+
+  g_return_val_if_fail (META_IS_DEVICE_MAP (device_map), NULL);
+
+  priv = device_map->priv;
+  return g_hash_table_get_values (priv->devices);
+}
+
 gboolean
 meta_device_map_grab_key (MetaDeviceMap *device_map,
                           Window         xwindow,
diff --git a/src/meta/device-map.h b/src/meta/device-map.h
index 102980f..cc40426 100644
--- a/src/meta/device-map.h
+++ b/src/meta/device-map.h
@@ -41,5 +41,6 @@ MetaDevice *    meta_device_map_lookup      (MetaDeviceMap *device_map,
 					     gint           device_id);
 
 MetaDisplay *   meta_device_map_get_display (MetaDeviceMap *device_map);
+GList *         meta_device_map_list_devices (MetaDeviceMap *device_map);
 
 #endif



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