mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
Revert "wlr_keyboard: don't emit key event for duplicated keycodes"
This reverts commit 86eaa44a3a.
That commit caused a regression for IME users in many compositors:
when a input_method is activated while a key is pressed, and a virtual
keyboard is created by IME, the following key-release event via the
virtual keyboard is missed since the key in the virtual keyboard haven't
been pressed. For example, pressing and releasing Ctrl+F in Firefox with
fcitx5 running triggered repeated keys (ffffff...) in the opened input
box.
This commit is contained in:
parent
d981860314
commit
ff55f91055
2 changed files with 4 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
#include <wlr/types/wlr_keyboard.h>
|
#include <wlr/types/wlr_keyboard.h>
|
||||||
|
|
||||||
bool keyboard_key_update(struct wlr_keyboard *keyboard,
|
void keyboard_key_update(struct wlr_keyboard *keyboard,
|
||||||
struct wlr_keyboard_key_event *event);
|
struct wlr_keyboard_key_event *event);
|
||||||
|
|
||||||
bool keyboard_modifier_update(struct wlr_keyboard *keyboard);
|
bool keyboard_modifier_update(struct wlr_keyboard *keyboard);
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,8 @@ bool keyboard_modifier_update(struct wlr_keyboard *keyboard) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool keyboard_key_update(struct wlr_keyboard *keyboard,
|
void keyboard_key_update(struct wlr_keyboard *keyboard,
|
||||||
struct wlr_keyboard_key_event *event) {
|
struct wlr_keyboard_key_event *event) {
|
||||||
size_t old_num_keycodes = keyboard->num_keycodes;
|
|
||||||
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
set_add(keyboard->keycodes, &keyboard->num_keycodes,
|
set_add(keyboard->keycodes, &keyboard->num_keycodes,
|
||||||
WLR_KEYBOARD_KEYS_CAP, event->keycode);
|
WLR_KEYBOARD_KEYS_CAP, event->keycode);
|
||||||
|
|
@ -78,8 +77,6 @@ bool keyboard_key_update(struct wlr_keyboard *keyboard,
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(keyboard->num_keycodes <= WLR_KEYBOARD_KEYS_CAP);
|
assert(keyboard->num_keycodes <= WLR_KEYBOARD_KEYS_CAP);
|
||||||
|
|
||||||
return old_num_keycodes != keyboard->num_keycodes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
|
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
|
||||||
|
|
@ -101,9 +98,8 @@ void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
|
||||||
|
|
||||||
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
|
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
|
||||||
struct wlr_keyboard_key_event *event) {
|
struct wlr_keyboard_key_event *event) {
|
||||||
if (keyboard_key_update(keyboard, event)) {
|
keyboard_key_update(keyboard, event);
|
||||||
wl_signal_emit_mutable(&keyboard->events.key, event);
|
wl_signal_emit_mutable(&keyboard->events.key, event);
|
||||||
}
|
|
||||||
|
|
||||||
if (keyboard->xkb_state == NULL) {
|
if (keyboard->xkb_state == NULL) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue