mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 15:10:26 +01:00
touchpad: use a two-stage timeout for disable-while-typing
Hitting a single key triggers a short timeout, just enough to cover the time to the next key event. Hitting more than one key triggers the longer timeout. This should improve responsiveness after single key events when the touchpad is still the main interaction mode and a key needs to be pressed to advance in the UI. When typing the hands require physical movement to get back to the touchpad anyway so a longer timeout is acceptable and more reliable. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
d02b670e37
commit
c2f8b508b9
1 changed files with 13 additions and 2 deletions
|
|
@ -34,7 +34,8 @@
|
|||
#define DEFAULT_ACCEL_NUMERATOR 3000.0
|
||||
#define DEFAULT_HYSTERESIS_MARGIN_DENOMINATOR 700.0
|
||||
#define DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT 500 /* ms */
|
||||
#define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT 500 /* ms */
|
||||
#define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1 200 /* ms */
|
||||
#define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2 500 /* ms */
|
||||
#define FAKE_FINGER_OVERFLOW (1 << 7)
|
||||
|
||||
static inline int
|
||||
|
|
@ -910,11 +911,18 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
|
|||
{
|
||||
struct tp_dispatch *tp = data;
|
||||
struct libinput_event_keyboard *kbdev;
|
||||
unsigned int timeout;
|
||||
|
||||
if (event->type != LIBINPUT_EVENT_KEYBOARD_KEY)
|
||||
return;
|
||||
|
||||
kbdev = libinput_event_get_keyboard_event(event);
|
||||
|
||||
/* Only trigger the timer on key down. */
|
||||
if (libinput_event_keyboard_get_key_state(kbdev) !=
|
||||
LIBINPUT_KEY_STATE_PRESSED)
|
||||
return;
|
||||
|
||||
/* modifier keys don't trigger disable-while-typing so things like
|
||||
* ctrl+zoom or ctrl+click are possible */
|
||||
switch (libinput_event_keyboard_get_key(kbdev)) {
|
||||
|
|
@ -935,10 +943,13 @@ tp_keyboard_event(uint64_t time, struct libinput_event *event, void *data)
|
|||
tp_gesture_stop(tp, time);
|
||||
tp_tap_suspend(tp, time);
|
||||
tp->sendevents.keyboard_active = true;
|
||||
timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1;
|
||||
} else {
|
||||
timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2;
|
||||
}
|
||||
|
||||
libinput_timer_set(&tp->sendevents.keyboard_timer,
|
||||
time + DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT);
|
||||
time + timeout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue