[gnome-control-center] common: Add generic API to map GdkDevices to GsdDevices
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] common: Add generic API to map GdkDevices to GsdDevices
- Date: Fri, 4 Nov 2016 22:40:21 +0000 (UTC)
commit 3db9203dd28eaccb68e315daf46e1625d7aaa51f
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Jun 6 14:06:57 2016 +0200
common: Add generic API to map GdkDevices to GsdDevices
Now that we have tablet support in wayland, we can kind of honor
that in the places we're interested. The inverse (looking up the
GdkDevices that a single GsdDevice represents) is unneeded.
panels/common/gsd-device-manager.c | 16 ++++++++++++++++
panels/common/gsd-device-manager.h | 8 ++++----
2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/panels/common/gsd-device-manager.c b/panels/common/gsd-device-manager.c
index 1737bf3..541f294 100644
--- a/panels/common/gsd-device-manager.c
+++ b/panels/common/gsd-device-manager.c
@@ -415,3 +415,19 @@ gsd_device_get_dimensions (GsdDevice *device,
return priv->width > 0 && priv->height > 0;
}
+
+GsdDevice *
+gsd_device_manager_lookup_gdk_device (GsdDeviceManager *manager,
+ GdkDevice *gdk_device)
+{
+ GsdDeviceManagerClass *klass;
+
+ g_return_val_if_fail (GSD_IS_DEVICE_MANAGER (manager), NULL);
+ g_return_val_if_fail (GDK_IS_DEVICE (gdk_device), NULL);
+
+ klass = GSD_DEVICE_MANAGER_GET_CLASS (manager);
+ if (!klass->lookup_device)
+ return NULL;
+
+ return klass->lookup_device (manager, gdk_device);
+}
diff --git a/panels/common/gsd-device-manager.h b/panels/common/gsd-device-manager.h
index baf46a8..f0f5df7 100644
--- a/panels/common/gsd-device-manager.h
+++ b/panels/common/gsd-device-manager.h
@@ -20,6 +20,7 @@
#ifndef __GSD_DEVICE_MANAGER_H__
#define __GSD_DEVICE_MANAGER_H__
+#include <gdk/gdk.h>
#include <glib-object.h>
#include <gio/gio.h>
@@ -78,6 +79,9 @@ struct _GsdDeviceManagerClass
GsdDevice *device);
void (* device_changed) (GsdDeviceManager *manager,
GsdDevice *device);
+
+ GsdDevice * (* lookup_device) (GsdDeviceManager *manager,
+ GdkDevice *gdk_device);
};
GType gsd_device_get_type (void) G_GNUC_CONST;
@@ -98,12 +102,8 @@ gboolean gsd_device_get_dimensions (GsdDevice *device,
guint *width,
guint *height);
-#ifdef GDK_WINDOWING_X11
-GdkDevice ** gsd_device_get_gdk_devices (GsdDevice *device,
- guint *n_gdk_devices);
GsdDevice * gsd_device_manager_lookup_gdk_device (GsdDeviceManager *manager,
GdkDevice *gdk_device);
-#endif
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]