Keyboard: don't add virtual keyboards to group

Also don't set their keymap, the client handles that.

This is the first step towards fixing a regression with fcitx5.
This commit is contained in:
Isaac Freund
2025-06-25 23:21:01 +02:00
parent fcf8b1e442
commit fe759d2d8a
3 changed files with 16 additions and 14 deletions
+8 -6
View File
@@ -88,7 +88,7 @@ pressed: Pressed = .{},
key: wl.Listener(*wlr.Keyboard.event.Key) = wl.Listener(*wlr.Keyboard.event.Key).init(handleKey),
modifiers: wl.Listener(*wlr.Keyboard) = wl.Listener(*wlr.Keyboard).init(handleModifiers),
pub fn init(keyboard: *Keyboard, seat: *Seat, wlr_device: *wlr.InputDevice) !void {
pub fn init(keyboard: *Keyboard, seat: *Seat, wlr_device: *wlr.InputDevice, virtual: bool) !void {
keyboard.* = .{
.device = undefined,
};
@@ -98,12 +98,14 @@ pub fn init(keyboard: *Keyboard, seat: *Seat, wlr_device: *wlr.InputDevice) !voi
const wlr_keyboard = keyboard.device.wlr_device.toKeyboard();
wlr_keyboard.data = keyboard;
// wlroots will log a more detailed error if this fails.
if (!wlr_keyboard.setKeymap(server.config.keymap)) return error.OutOfMemory;
if (!virtual) {
// wlroots will log a more detailed error if this fails.
if (!wlr_keyboard.setKeymap(server.config.keymap)) return error.OutOfMemory;
if (wlr.KeyboardGroup.fromKeyboard(wlr_keyboard) == null) {
// wlroots will log an error on failure
_ = seat.keyboard_group.addKeyboard(wlr_keyboard);
if (wlr.KeyboardGroup.fromKeyboard(wlr_keyboard) == null) {
// wlroots will log an error on failure
_ = seat.keyboard_group.addKeyboard(wlr_keyboard);
}
}
wlr_keyboard.setRepeatInfo(server.config.repeat_rate, server.config.repeat_delay);