Keyboard: fix redundant leave/enter on creation

Currently if a second keyboard input device is created river will send
a wl_keyboard.leave event immediately followed by a wl_keyboard.enter
event. This serves no purpose and can confuse clients, in particular due
to fctix creating/destroying virtual keyboards on focus change.

Fixes: https://codeberg.org/river/river/issues/1062
References: https://github.com/fcitx/fcitx5/issues/1044
This commit is contained in:
Isaac Freund 2024-05-12 09:58:14 +02:00
parent f66eec9248
commit 1e3ef88bd5
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -489,7 +489,6 @@ fn tryAddDevice(seat: *Seat, wlr_device: *wlr.InputDevice) !void {
seat.wlr_seat.setKeyboard(keyboard.device.wlr_device.toKeyboard()); seat.wlr_seat.setKeyboard(keyboard.device.wlr_device.toKeyboard());
if (seat.wlr_seat.keyboard_state.focused_surface) |wlr_surface| { if (seat.wlr_seat.keyboard_state.focused_surface) |wlr_surface| {
seat.wlr_seat.keyboardNotifyClearFocus();
seat.keyboardNotifyEnter(wlr_surface); seat.keyboardNotifyEnter(wlr_surface);
} }
}, },