[gnome-settings-daemon] wacom: Split getting the device ID of a device



commit d4a59712135f2a5202dc98d07b879d1f1101856d
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 13 14:00:42 2012 +0000

    wacom: Split getting the device ID of a device

 plugins/wacom/gsd-wacom-manager.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 901f2e2..eebe48d 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -109,17 +109,28 @@ gsd_wacom_manager_class_init (GsdWacomManagerClass *klass)
         g_type_class_add_private (klass, sizeof (GsdWacomManagerPrivate));
 }
 
-static XDevice *
-open_device (GsdWacomDevice *device)
+static int
+get_device_id (GsdWacomDevice *device)
 {
-	XDevice *xdev;
 	GdkDevice *gdk_device;
 	int id;
 
 	g_object_get (device, "gdk-device", &gdk_device, NULL);
 	if (gdk_device == NULL)
-		return NULL;
+		return -1;
 	g_object_get (gdk_device, "device-id", &id, NULL);
+	return id;
+}
+
+static XDevice *
+open_device (GsdWacomDevice *device)
+{
+	XDevice *xdev;
+	int id;
+
+	id = get_device_id (device);
+	if (id < 0)
+		return NULL;
 
 	gdk_error_trap_push ();
 	xdev = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), id);



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