mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00:00
keyboard: simplify releasing keys on finish
This commit is contained in:
parent
310a5eb61c
commit
e88988e364
@ -153,12 +153,11 @@ static void keyboard_unset_keymap(struct wlr_keyboard *kb) {
|
|||||||
|
|
||||||
void wlr_keyboard_finish(struct wlr_keyboard *kb) {
|
void wlr_keyboard_finish(struct wlr_keyboard *kb) {
|
||||||
/* Release pressed keys */
|
/* Release pressed keys */
|
||||||
size_t orig_num_keycodes = kb->num_keycodes;
|
int64_t time_msec = get_current_time_msec();
|
||||||
for (size_t i = 0; i < orig_num_keycodes; ++i) {
|
while (kb->num_keycodes > 0) {
|
||||||
assert(kb->num_keycodes == orig_num_keycodes - i);
|
|
||||||
struct wlr_keyboard_key_event event = {
|
struct wlr_keyboard_key_event event = {
|
||||||
.time_msec = get_current_time_msec(),
|
.time_msec = time_msec,
|
||||||
.keycode = kb->keycodes[orig_num_keycodes - i - 1],
|
.keycode = kb->keycodes[kb->num_keycodes - 1],
|
||||||
.update_state = false,
|
.update_state = false,
|
||||||
.state = WL_KEYBOARD_KEY_STATE_RELEASED,
|
.state = WL_KEYBOARD_KEY_STATE_RELEASED,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user