mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 05:50:26 +01:00
evdev: move release_pressed_keys() up
Just a move to make the next diff easier Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
15a67e4fac
commit
58174416ca
1 changed files with 52 additions and 52 deletions
104
src/evdev.c
104
src/evdev.c
|
|
@ -760,6 +760,58 @@ fallback_process(struct evdev_dispatch *dispatch,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
release_pressed_keys(struct evdev_device *device)
|
||||
{
|
||||
struct libinput *libinput = device->base.seat->libinput;
|
||||
uint64_t time;
|
||||
int code;
|
||||
|
||||
if ((time = libinput_now(libinput)) == 0)
|
||||
return;
|
||||
|
||||
for (code = 0; code < KEY_CNT; code++) {
|
||||
int count = get_key_down_count(device, code);
|
||||
|
||||
if (count == 0)
|
||||
continue;
|
||||
|
||||
if (count > 1) {
|
||||
log_bug_libinput(libinput,
|
||||
"Key %d is down %d times.\n",
|
||||
code,
|
||||
count);
|
||||
}
|
||||
|
||||
switch (get_key_type(code)) {
|
||||
case EVDEV_KEY_TYPE_NONE:
|
||||
break;
|
||||
case EVDEV_KEY_TYPE_KEY:
|
||||
evdev_keyboard_notify_key(
|
||||
device,
|
||||
time,
|
||||
code,
|
||||
LIBINPUT_KEY_STATE_RELEASED);
|
||||
break;
|
||||
case EVDEV_KEY_TYPE_BUTTON:
|
||||
evdev_pointer_notify_physical_button(
|
||||
device,
|
||||
time,
|
||||
evdev_to_left_handed(device, code),
|
||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
break;
|
||||
}
|
||||
|
||||
count = get_key_down_count(device, code);
|
||||
if (count != 0) {
|
||||
log_bug_libinput(libinput,
|
||||
"Releasing key %d failed.\n",
|
||||
code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fallback_destroy(struct evdev_dispatch *dispatch)
|
||||
{
|
||||
|
|
@ -2317,58 +2369,6 @@ evdev_stop_scroll(struct evdev_device *device,
|
|||
device->scroll.direction = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
release_pressed_keys(struct evdev_device *device)
|
||||
{
|
||||
struct libinput *libinput = device->base.seat->libinput;
|
||||
uint64_t time;
|
||||
int code;
|
||||
|
||||
if ((time = libinput_now(libinput)) == 0)
|
||||
return;
|
||||
|
||||
for (code = 0; code < KEY_CNT; code++) {
|
||||
int count = get_key_down_count(device, code);
|
||||
|
||||
if (count == 0)
|
||||
continue;
|
||||
|
||||
if (count > 1) {
|
||||
log_bug_libinput(libinput,
|
||||
"Key %d is down %d times.\n",
|
||||
code,
|
||||
count);
|
||||
}
|
||||
|
||||
switch (get_key_type(code)) {
|
||||
case EVDEV_KEY_TYPE_NONE:
|
||||
break;
|
||||
case EVDEV_KEY_TYPE_KEY:
|
||||
evdev_keyboard_notify_key(
|
||||
device,
|
||||
time,
|
||||
code,
|
||||
LIBINPUT_KEY_STATE_RELEASED);
|
||||
break;
|
||||
case EVDEV_KEY_TYPE_BUTTON:
|
||||
evdev_pointer_notify_physical_button(
|
||||
device,
|
||||
time,
|
||||
evdev_to_left_handed(device, code),
|
||||
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
break;
|
||||
}
|
||||
|
||||
count = get_key_down_count(device, code);
|
||||
if (count != 0) {
|
||||
log_bug_libinput(libinput,
|
||||
"Releasing key %d failed.\n",
|
||||
code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
evdev_notify_suspended_device(struct evdev_device *device)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue