[gnome-settings-daemon] mouse: Use new disable/enable device code
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] mouse: Use new disable/enable device code
- Date: Thu, 2 Jun 2011 14:39:11 +0000 (UTC)
commit 7e3db417d713bbbb7823ff06c209ca6175bb6b84
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jun 2 15:38:21 2011 +0100
mouse: Use new disable/enable device code
plugins/mouse/gsd-mouse-manager.c | 26 +++-----------------------
1 files changed, 3 insertions(+), 23 deletions(-)
---
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index 09c0eb5..8d81562 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -730,31 +730,11 @@ static void
set_touchpad_enabled (GdkDevice *device,
gboolean state)
{
- XDevice *xdevice;
- Atom prop_enabled;
- unsigned char data = state;
-
- prop_enabled = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Device Enabled", False);
-
- if (!prop_enabled)
- return;
-
- xdevice = open_gdk_device (device);
-
- if (!device_is_touchpad (xdevice)) {
- XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice);
- return;
- }
-
- gdk_error_trap_push ();
- XChangeDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice,
- prop_enabled, XA_INTEGER, 8,
- PropModeReplace, &data, 1);
+ int id;
- if (gdk_error_trap_pop ())
+ g_object_get (G_OBJECT (device), "device-id", &id, NULL);
+ 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]