summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-11-07 11:02:22 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-11-07 11:03:12 +1000
commitc6052769842c2e4ab11ef9db536d7ffd3cb87481 (patch)
tree30d2ba812dfcb7cc43d36bb417182588d9376ee6 /src
parent6d781f8817b409b49eae95b1c982a0c5b75f6630 (diff)
parenta78a25e62eaec24d625a48d9d0dcd524f874ad7f (diff)
downloadlibinput-c6052769842c2e4ab11ef9db536d7ffd3cb87481.tar.gz
Merge branch 'for-peter' of git://people.freedesktop.org/~jwrdegoede/libinput
Diffstat (limited to 'src')
-rw-r--r--src/evdev-mt-touchpad-tap.c61
-rw-r--r--src/evdev-mt-touchpad.c4
-rw-r--r--src/evdev-mt-touchpad.h3
3 files changed, 44 insertions, 24 deletions
diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
index 0b72ace7..a38edbe3 100644
--- a/src/evdev-mt-touchpad-tap.c
+++ b/src/evdev-mt-touchpad-tap.c
@@ -95,16 +95,12 @@ tap_event_to_str(enum tap_event event) {
static void
tp_tap_notify(struct tp_dispatch *tp,
- struct tp_touch *t,
uint64_t time,
int nfingers,
enum libinput_button_state state)
{
int32_t button;
- if (t && t->tap.state == TAP_TOUCH_STATE_DEAD)
- return;
-
switch (nfingers) {
case 1: button = BTN_LEFT; break;
case 2: button = BTN_RIGHT; break;
@@ -174,7 +170,7 @@ tp_tap_touch_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_RELEASE:
tp->tap.state = TAP_STATE_TAPPED;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_PRESSED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED);
tp_tap_set_timer(tp, time);
break;
case TAP_EVENT_TIMEOUT:
@@ -229,11 +225,11 @@ tp_tap_tapped_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_TIMEOUT:
tp->tap.state = TAP_STATE_IDLE;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
break;
case TAP_EVENT_BUTTON:
tp->tap.state = TAP_STATE_DEAD;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
break;
}
}
@@ -251,8 +247,10 @@ tp_tap_touch2_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_RELEASE:
tp->tap.state = TAP_STATE_HOLD;
- tp_tap_notify(tp, t, time, 2, LIBINPUT_BUTTON_STATE_PRESSED);
- tp_tap_notify(tp, t, time, 2, LIBINPUT_BUTTON_STATE_RELEASED);
+ if (t->tap.state == TAP_TOUCH_STATE_TOUCH) {
+ tp_tap_notify(tp, time, 2, LIBINPUT_BUTTON_STATE_PRESSED);
+ tp_tap_notify(tp, time, 2, LIBINPUT_BUTTON_STATE_RELEASED);
+ }
tp_tap_clear_timer(tp);
break;
case TAP_EVENT_MOTION:
@@ -309,8 +307,10 @@ tp_tap_touch3_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_RELEASE:
tp->tap.state = TAP_STATE_TOUCH_2_HOLD;
- tp_tap_notify(tp, t, time, 3, LIBINPUT_BUTTON_STATE_PRESSED);
- tp_tap_notify(tp, t, time, 3, LIBINPUT_BUTTON_STATE_RELEASED);
+ if (t->tap.state == TAP_TOUCH_STATE_TOUCH) {
+ tp_tap_notify(tp, time, 3, LIBINPUT_BUTTON_STATE_PRESSED);
+ tp_tap_notify(tp, time, 3, LIBINPUT_BUTTON_STATE_RELEASED);
+ }
break;
case TAP_EVENT_BUTTON:
tp->tap.state = TAP_STATE_DEAD;
@@ -352,9 +352,9 @@ tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_RELEASE:
tp->tap.state = TAP_STATE_IDLE;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_PRESSED);
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
tp_tap_clear_timer(tp);
break;
case TAP_EVENT_MOTION:
@@ -363,7 +363,7 @@ tp_tap_dragging_or_doubletap_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_BUTTON:
tp->tap.state = TAP_STATE_DEAD;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
break;
}
}
@@ -388,7 +388,7 @@ tp_tap_dragging_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_BUTTON:
tp->tap.state = TAP_STATE_DEAD;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
break;
}
}
@@ -409,11 +409,11 @@ tp_tap_dragging_wait_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_TIMEOUT:
tp->tap.state = TAP_STATE_IDLE;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
break;
case TAP_EVENT_BUTTON:
tp->tap.state = TAP_STATE_DEAD;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
break;
}
}
@@ -430,7 +430,7 @@ tp_tap_dragging2_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_TOUCH:
tp->tap.state = TAP_STATE_DEAD;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
break;
case TAP_EVENT_MOTION:
case TAP_EVENT_TIMEOUT:
@@ -438,7 +438,7 @@ tp_tap_dragging2_handle_event(struct tp_dispatch *tp,
break;
case TAP_EVENT_BUTTON:
tp->tap.state = TAP_STATE_DEAD;
- tp_tap_notify(tp, t, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED);
break;
}
}
@@ -562,7 +562,8 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
if (!t->dirty || t->state == TOUCH_NONE)
continue;
- if (tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS)
+ if (tp->buttons.is_clickpad &&
+ tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS)
t->tap.state = TAP_TOUCH_STATE_DEAD;
if (t->state == TOUCH_BEGIN) {
@@ -570,7 +571,7 @@ tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time)
tp_tap_handle_event(tp, t, TAP_EVENT_TOUCH, time);
} else if (t->state == TOUCH_END) {
tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time);
- t->tap.state = TAP_TOUCH_STATE_DEAD;
+ t->tap.state = TAP_TOUCH_STATE_IDLE;
} else if (tp->tap.state != TAP_STATE_IDLE &&
tp_tap_exceeds_motion_threshold(tp, t)) {
struct tp_touch *tmp;
@@ -731,8 +732,7 @@ tp_release_all_taps(struct tp_dispatch *tp, uint64_t now)
for (i = 1; i <= 3; i++) {
if (tp->tap.buttons_pressed & (1 << i))
- tp_tap_notify(tp, NULL, now, i,
- LIBINPUT_BUTTON_STATE_RELEASED);
+ tp_tap_notify(tp, now, i, LIBINPUT_BUTTON_STATE_RELEASED);
}
tp->tap.state = tp->nfingers_down ? TAP_STATE_DEAD : TAP_STATE_IDLE;
@@ -749,3 +749,16 @@ tp_tap_resume(struct tp_dispatch *tp, uint64_t time)
{
tp_tap_enabled_update(tp, false, tp->tap.enabled, time);
}
+
+bool
+tp_tap_dragging(struct tp_dispatch *tp)
+{
+ switch (tp->tap.state) {
+ case TAP_STATE_DRAGGING:
+ case TAP_STATE_DRAGGING_2:
+ case TAP_STATE_DRAGGING_WAIT:
+ return true;
+ default:
+ return false;
+ }
+}
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 2a5cdaf5..3d8f414b 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -508,6 +508,10 @@ tp_post_scroll_events(struct tp_dispatch *tp, uint64_t time)
struct tp_touch *t;
int nfingers_down = 0;
+ /* No scrolling during tap-n-drag */
+ if (tp_tap_dragging(tp))
+ return 0;
+
/* Only count active touches for 2 finger scrolling */
tp_for_each_touch(tp, t) {
if (tp_touch_active(tp, t))
diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h
index 2fda4efd..91f6e4ae 100644
--- a/src/evdev-mt-touchpad.h
+++ b/src/evdev-mt-touchpad.h
@@ -291,4 +291,7 @@ tp_tap_suspend(struct tp_dispatch *tp, uint64_t time);
void
tp_tap_resume(struct tp_dispatch *tp, uint64_t time);
+bool
+tp_tap_dragging(struct tp_dispatch *tp);
+
#endif