[gnome-control-center/wip/garnacho/wayland-tablet: 10/31] common: Implement lookup vfunc in GsdDeviceManagerUdev
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/garnacho/wayland-tablet: 10/31] common: Implement lookup vfunc in GsdDeviceManagerUdev
- Date: Fri, 24 Jun 2016 18:02:39 +0000 (UTC)
commit 3f9efcf5f05cb6fe0f2abdf5a51838e40143270c
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jun 6 14:29:16 2016 +0200
common: Implement lookup vfunc in GsdDeviceManagerUdev
panels/common/gsd-device-manager-udev.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/panels/common/gsd-device-manager-udev.c b/panels/common/gsd-device-manager-udev.c
index 6289f55..1522f40 100644
--- a/panels/common/gsd-device-manager-udev.c
+++ b/panels/common/gsd-device-manager-udev.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <gudev/gudev.h>
+#include <gdk/gdkwayland.h>
#include "gsd-device-manager-udev.h"
struct _GsdUdevDeviceManager
@@ -221,6 +222,30 @@ gsd_udev_device_manager_list_devices (GsdDeviceManager *manager,
return devices;
}
+static GsdDevice *
+gsd_udev_device_manager_lookup_device (GsdDeviceManager *manager,
+ GdkDevice *gdk_device)
+{
+ const gchar *node_path;
+ GHashTableIter iter;
+ GsdDevice *device;
+
+ node_path = gdk_wayland_device_get_node_path (gdk_device);
+ if (!node_path)
+ return NULL;
+
+ g_hash_table_iter_init (&iter, GSD_UDEV_DEVICE_MANAGER (manager)->devices);
+
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &device)) {
+ if (g_strcmp0 (node_path,
+ gsd_device_get_device_file (device)) == 0) {
+ return device;
+ }
+ }
+
+ return NULL;
+}
+
static void
gsd_udev_device_manager_class_init (GsdUdevDeviceManagerClass *klass)
{
@@ -229,4 +254,5 @@ gsd_udev_device_manager_class_init (GsdUdevDeviceManagerClass *klass)
object_class->finalize = gsd_udev_device_manager_finalize;
manager_class->list_devices = gsd_udev_device_manager_list_devices;
+ manager_class->lookup_device = gsd_udev_device_manager_lookup_device;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]