mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-25 20:40:23 +01:00
touchpad: save the active clickfinger button
To avoid having a button left press and a button right release if the number of fingers changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
1c0805a559
commit
2f9607a489
2 changed files with 15 additions and 10 deletions
|
|
@ -75,23 +75,27 @@ tp_post_clickfinger_buttons(struct tp_dispatch *tp, uint32_t time)
|
|||
if (current == old)
|
||||
return 0;
|
||||
|
||||
switch (tp->nfingers_down) {
|
||||
if (current) {
|
||||
switch (tp->nfingers_down) {
|
||||
case 1: button = BTN_LEFT; break;
|
||||
case 2: button = BTN_RIGHT; break;
|
||||
case 3: button = BTN_MIDDLE; break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
tp->buttons.active = button;
|
||||
state = LIBINPUT_POINTER_BUTTON_STATE_PRESSED;
|
||||
} else {
|
||||
button = tp->buttons.active;
|
||||
tp->buttons.active = 0;
|
||||
state = LIBINPUT_POINTER_BUTTON_STATE_RELEASED;
|
||||
}
|
||||
|
||||
if (current)
|
||||
state = LIBINPUT_POINTER_BUTTON_STATE_PRESSED;
|
||||
else
|
||||
state = LIBINPUT_POINTER_BUTTON_STATE_RELEASED;
|
||||
|
||||
pointer_notify_button(&tp->device->base,
|
||||
time,
|
||||
button,
|
||||
state);
|
||||
if (button)
|
||||
pointer_notify_button(&tp->device->base,
|
||||
time,
|
||||
button,
|
||||
state);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ struct tp_dispatch {
|
|||
uint32_t state;
|
||||
uint32_t old_state;
|
||||
uint32_t motion_dist; /* for pinned touches */
|
||||
unsigned int active; /* currently active button, for release event */
|
||||
} buttons; /* physical buttons */
|
||||
|
||||
struct {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue