6f51df7154
left-handed, not tapping though (#498249)
116 lines
6.0 KiB
Diff
116 lines
6.0 KiB
Diff
From ca4c9a0d9c269e51b8f6955277553f61ece9899a Mon Sep 17 00:00:00 2001
|
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Date: Mon, 26 Oct 2009 15:24:48 +1000
|
|
Subject: [PATCH] mouse: allow left-handed setting for touchpads.
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Button mapping is handled in the server, tapping is handled in the driver.
|
|
Thus, if the tapping is enabled and the device is left-handed, the tapping
|
|
order must be reversed to counter the effect of the left-handed button
|
|
mapping.
|
|
|
|
For right-handed setup:
|
|
phys. button 1 → logical button 1
|
|
one-finger tapping → phys button 1
|
|
|
|
For left-handed setup:
|
|
phys. button 3 → logical button 1
|
|
one-finger-tapping → phys. button 3
|
|
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
---
|
|
plugins/mouse/gsd-mouse-manager.c | 27 ++++++++++++++++++---------
|
|
1 files changed, 18 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
|
|
index 4c463eb..21acca6 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 int set_tap_to_click (gboolean state, gboolean left_handed);
|
|
static XDevice* device_is_touchpad (XDeviceInfo deviceinfo);
|
|
|
|
G_DEFINE_TYPE (GsdMouseManager, gsd_mouse_manager, G_TYPE_OBJECT)
|
|
@@ -289,8 +290,12 @@ set_xinput_devices_left_handed (gboolean left_handed)
|
|
* around, otherwise a tap would be a right-click */
|
|
device = device_is_touchpad (device_info[i]);
|
|
if (device != NULL) {
|
|
+ GConfClient *client = gconf_client_get_default ();
|
|
+ gboolean tap = gconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL);
|
|
+
|
|
+ if (tap)
|
|
+ set_tap_to_click (tap, left_handed);
|
|
XCloseDevice (GDK_DISPLAY (), device);
|
|
- continue;
|
|
}
|
|
|
|
gdk_error_trap_push ();
|
|
@@ -540,7 +545,7 @@ set_disable_w_typing (GsdMouseManager *manager, gboolean state)
|
|
}
|
|
|
|
static int
|
|
-set_tap_to_click (gboolean state)
|
|
+set_tap_to_click (gboolean state, gboolean left_handed)
|
|
{
|
|
int numdevices, i, format, rc;
|
|
unsigned long nitems, bytes_after;
|
|
@@ -567,8 +572,8 @@ set_tap_to_click (gboolean state)
|
|
if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 7)
|
|
{
|
|
/* Set RLM mapping for 1/2/3 fingers*/
|
|
- data[4] = (state) ? 1 : 0;
|
|
- data[5] = (state) ? 3 : 0;
|
|
+ data[4] = (state) ? ((left_handed) ? 3 : 1) : 0;
|
|
+ data[5] = (state) ? ((left_handed) ? 1 : 3) : 0;
|
|
data[6] = (state) ? 2 : 0;
|
|
XChangeDeviceProperty (GDK_DISPLAY (), device, prop, XA_INTEGER, 8,
|
|
PropModeReplace, data, nitems);
|
|
@@ -812,13 +817,14 @@ static void
|
|
set_mouse_settings (GsdMouseManager *manager)
|
|
{
|
|
GConfClient *client = gconf_client_get_default ();
|
|
+ gboolean left_handed = gconf_client_get_bool (client, KEY_LEFT_HANDED, NULL);
|
|
|
|
- set_left_handed (manager, gconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
|
|
+ set_left_handed (manager, left_handed);
|
|
set_motion_acceleration (manager, gconf_client_get_float (client, KEY_MOTION_ACCELERATION , NULL));
|
|
set_motion_threshold (manager, gconf_client_get_int (client, KEY_MOTION_THRESHOLD, NULL));
|
|
|
|
set_disable_w_typing (manager, gconf_client_get_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, NULL));
|
|
- set_tap_to_click (gconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL));
|
|
+ set_tap_to_click (gconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL), left_handed);
|
|
set_edge_scroll (gconf_client_get_int (client, KEY_SCROLL_METHOD, NULL));
|
|
set_horiz_scroll (gconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
|
|
|
|
@@ -847,8 +853,10 @@ mouse_callback (GConfClient *client,
|
|
if (entry->value->type == GCONF_VALUE_BOOL)
|
|
set_disable_w_typing (manager, gconf_value_get_bool (entry->value));
|
|
} else if (! strcmp (entry->key, KEY_TAP_TO_CLICK)) {
|
|
- if (entry->value->type == GCONF_VALUE_BOOL)
|
|
- set_tap_to_click (gconf_value_get_bool (entry->value));
|
|
+ if (entry->value->type == GCONF_VALUE_BOOL) {
|
|
+ set_tap_to_click (gconf_value_get_bool (entry->value),
|
|
+ gconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
|
|
+ }
|
|
} else if (! strcmp (entry->key, KEY_SCROLL_METHOD)) {
|
|
if (entry->value->type == GCONF_VALUE_INT) {
|
|
set_edge_scroll (gconf_value_get_int (entry->value));
|
|
@@ -928,7 +936,8 @@ gsd_mouse_manager_idle_cb (GsdMouseManager *manager)
|
|
gconf_client_get_bool (client, KEY_DELAY_ENABLE, NULL));
|
|
|
|
set_disable_w_typing (manager, gconf_client_get_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, NULL));
|
|
- set_tap_to_click (gconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL));
|
|
+ set_tap_to_click (gconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL),
|
|
+ gconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
|
|
set_edge_scroll (gconf_client_get_int (client, KEY_SCROLL_METHOD, NULL));
|
|
set_horiz_scroll (gconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
|
|
|
|
--
|
|
1.6.5.rc2
|
|
|