summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2016-03-30 15:31:07 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-04-01 07:34:32 +1000
commit1ecf6d7a607c5f481eb9b3b6365d7b55a0f18c53 (patch)
tree44c8d99622d9ca47b72d74223ce4be1e063701ca /src
parent455498e9d720c00b2d92d3dcf603a62dbc122a8e (diff)
touchpad: fix left-handed top software trackpoint buttons
The previous code would swap the top software buttons depending on the touchpad's left-handed setting, not the trackpoint setting. Changing both devices to left-handed resulted in a double-swap, i.e. the trackpoint was always right-handed. https://bugs.freedesktop.org/show_bug.cgi?id=94733 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad-buttons.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 82c99c76..076eab00 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -963,6 +963,7 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
uint32_t current, old, button, is_top;
enum libinput_button_state state;
enum { AREA = 0x01, LEFT = 0x02, MIDDLE = 0x04, RIGHT = 0x08 };
+ bool want_left_handed = true;
current = tp->buttons.state;
old = tp->buttons.old_state;
@@ -1008,14 +1009,22 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
return 0;
}
- if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT)))
- button = evdev_to_left_handed(tp->device, BTN_MIDDLE);
- else if (area & RIGHT)
- button = evdev_to_left_handed(tp->device, BTN_RIGHT);
- else if (area & LEFT)
- button = evdev_to_left_handed(tp->device, BTN_LEFT);
- else /* main or no area (for clickfinger) is always BTN_LEFT */
+ if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT))) {
+ button = BTN_MIDDLE;
+ } else if (area & RIGHT) {
+ button = BTN_RIGHT;
+ } else if (area & LEFT) {
button = BTN_LEFT;
+ } else { /* main or no area (for clickfinger) is always BTN_LEFT */
+ button = BTN_LEFT;
+ want_left_handed = false;
+ }
+
+ if (is_top)
+ want_left_handed = false;
+
+ if (want_left_handed)
+ button = evdev_to_left_handed(tp->device, button);
tp->buttons.active = button;
tp->buttons.active_is_topbutton = is_top;