device-map: Add meta_device_map_list_devices()

This function returns a list of the devices currently handled by
the device map.
This commit is contained in:
Carlos Garnacho 2011-07-04 20:23:04 +02:00
parent 855095ad1a
commit 1dd50cf006
2 changed files with 23 additions and 0 deletions

View File

@ -291,6 +291,28 @@ meta_device_map_get_display (MetaDeviceMap *device_map)
return priv->display; 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 gboolean
meta_device_map_grab_key (MetaDeviceMap *device_map, meta_device_map_grab_key (MetaDeviceMap *device_map,
Window xwindow, Window xwindow,

View File

@ -41,5 +41,6 @@ MetaDevice * meta_device_map_lookup (MetaDeviceMap *device_map,
gint device_id); gint device_id);
MetaDisplay * meta_device_map_get_display (MetaDeviceMap *device_map); MetaDisplay * meta_device_map_get_display (MetaDeviceMap *device_map);
GList * meta_device_map_list_devices (MetaDeviceMap *device_map);
#endif #endif