Blob Blame History Raw
From b097ceeb19cee5f3e49311b8f03cf9463caea628 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 9 Sep 2009 11:59:21 +0100
Subject: [PATCH] =?utf-8?q?Bug=C2=A0594617=20-=20Touchpad=20left-handed=20bug=20fixes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

1) Don't swap mouse buttons for left-handers on the touchpad (otherwise
a tap would be a right-click)
2) If XInput is supported, don't switch the core pointer to left-handed,
as it would cancel our other settings
---
 plugins/mouse/gsd-mouse-manager.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index b5c96a1..e09d38c 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -84,6 +84,7 @@ static void     gsd_mouse_manager_class_init  (GsdMouseManagerClass *klass);
 static void     gsd_mouse_manager_init        (GsdMouseManager      *mouse_manager);
 static void     gsd_mouse_manager_finalize    (GObject             *object);
 static void     set_mouse_settings            (GsdMouseManager      *manager);
+static XDevice* device_is_touchpad            (XDeviceInfo deviceinfo);
 
 G_DEFINE_TYPE (GsdMouseManager, gsd_mouse_manager, G_TYPE_OBJECT)
 
@@ -284,6 +285,14 @@ set_xinput_devices_left_handed (gboolean left_handed)
                     (!xinput_device_has_buttons (&device_info[i])))
                         continue;
 
+		/* If the device is a touchpad, don't swap buttons
+		 * around */
+		device = device_is_touchpad (device_info[i]);
+		if (device != NULL) {
+			XCloseDevice (GDK_DISPLAY (), device);
+			continue;
+		}
+
                 gdk_error_trap_push ();
 
                 device = XOpenDevice (GDK_DISPLAY (), device_info[i].id);
@@ -371,7 +380,10 @@ set_left_handed (GsdMouseManager *manager,
 
 #ifdef HAVE_X11_EXTENSIONS_XINPUT_H
         if (supports_xinput_devices ()) {
+        	/* When XInput support is available, never set the
+        	 * button ordering on the core pointer */
                 set_xinput_devices_left_handed (left_handed);
+                return;
         }
 #endif
 
-- 
1.6.2.5