[gnome-settings-daemon] mouse: Check device is a touchpad before enabling/disabling it
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] mouse: Check device is a touchpad before enabling/disabling it
- Date: Tue, 28 Jun 2011 10:07:26 +0000 (UTC)
commit 56b28027af448403fd2ba496f11b4ce0c4c844d8
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Tue Jun 28 12:01:30 2011 +0200
mouse: Check device is a touchpad before enabling/disabling it
plugins/mouse/gsd-mouse-manager.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index 8d81562..fbf6374 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -731,10 +731,23 @@ set_touchpad_enabled (GdkDevice *device,
gboolean state)
{
int id;
+ XDevice *xdevice;
g_object_get (G_OBJECT (device), "device-id", &id, NULL);
+
+ xdevice = open_gdk_device (device);
+ if (xdevice == NULL)
+ return;
+
+ if (!device_is_touchpad (xdevice)) {
+ XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice);
+ return;
+ }
+
if (set_device_enabled (id, state) == FALSE)
g_warning ("Error %s device \"%s\"", (state) ? "enabling" : "disabling", gdk_device_get_name (device));
+
+ XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]