ime: revert workarounds for wlroots 0.18.2

The workarounds added in #2498 and #2437 fixed stuck key/modifier bug
caused by wlroots commit e218990. But now that the commit was reverted in
0.19, the workarounds are no longer needed.

Removing the workarounds also fixes a minor regression with Fcitx5+Firefox
that pressing Ctrl+Enter in an input box causes stuck modifier.
This commit is contained in:
tokyo4j 2025-06-24 04:32:40 +09:00 committed by Hiroaki Yamamoto
parent db7c72ef39
commit e5a236eef4
2 changed files with 1 additions and 36 deletions

View file

@ -22,9 +22,6 @@ struct input_method_relay {
struct wlr_input_method_v2 *input_method;
struct wlr_surface *focused_surface;
struct lab_set forwarded_pressed_keys;
struct wlr_keyboard_modifiers forwarded_modifiers;
/*
* Text-input which is enabled by the client and communicating with
* input-method.

View file

@ -59,24 +59,11 @@ input_method_keyboard_grab_forward_modifiers(struct keyboard *keyboard)
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab =
get_keyboard_grab(keyboard);
struct wlr_keyboard_modifiers *forwarded_modifiers =
&keyboard->base.seat->input_method_relay->forwarded_modifiers;
struct wlr_keyboard_modifiers *modifiers =
&keyboard->wlr_keyboard->modifiers;
if (forwarded_modifiers->depressed == modifiers->depressed
&& forwarded_modifiers->latched == modifiers->latched
&& forwarded_modifiers->locked == modifiers->locked
&& forwarded_modifiers->group == modifiers->group) {
return false;
}
if (keyboard_grab) {
*forwarded_modifiers = keyboard->wlr_keyboard->modifiers;
wlr_input_method_keyboard_grab_v2_set_keyboard(keyboard_grab,
keyboard->wlr_keyboard);
wlr_input_method_keyboard_grab_v2_send_modifiers(keyboard_grab,
modifiers);
&keyboard->wlr_keyboard->modifiers);
return true;
} else {
return false;
@ -87,25 +74,9 @@ bool
input_method_keyboard_grab_forward_key(struct keyboard *keyboard,
struct wlr_keyboard_key_event *event)
{
/*
* We should not forward key-release events without corresponding
* key-press events forwarded
*/
struct lab_set *pressed_keys =
&keyboard->base.seat->input_method_relay->forwarded_pressed_keys;
if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED
&& !lab_set_contains(pressed_keys, event->keycode)) {
return false;
}
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab =
get_keyboard_grab(keyboard);
if (keyboard_grab) {
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
lab_set_add(pressed_keys, event->keycode);
} else {
lab_set_remove(pressed_keys, event->keycode);
}
wlr_input_method_keyboard_grab_v2_set_keyboard(keyboard_grab,
keyboard->wlr_keyboard);
wlr_input_method_keyboard_grab_v2_send_key(keyboard_grab,
@ -357,9 +328,6 @@ handle_input_method_grab_keyboard(struct wl_listener *listener, void *data)
keyboard_grab, active_keyboard);
}
relay->forwarded_pressed_keys = (struct lab_set){0};
relay->forwarded_modifiers = (struct wlr_keyboard_modifiers){0};
relay->keyboard_grab_destroy.notify = handle_keyboard_grab_destroy;
wl_signal_add(&keyboard_grab->events.destroy,
&relay->keyboard_grab_destroy);