From c86f460135bc3f04502561c2e6631b690859d426 Mon Sep 17 00:00:00 2001 From: Leon Henrik Plickat Date: Wed, 3 Jan 2024 20:58:04 +0100 Subject: Keyboard: Add new keyboards to groups if matched Previously new keyboards would not be added to already existing keyboard groups on (re-)connect. Only during the creation of the groups themselves were devices added to them. This meant that only keyboards connected during startup - before the init is executed - would work with groups in a typical river session. --- river/Keyboard.zig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/river/Keyboard.zig b/river/Keyboard.zig index 093b784..2aaf6fb 100644 --- a/river/Keyboard.zig +++ b/river/Keyboard.zig @@ -1,6 +1,6 @@ // This file is part of river, a dynamic tiling wayland compositor. // -// Copyright 2020 The River Developers +// Copyright 2020 - 2024 The River Developers // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -52,6 +52,16 @@ pub fn init(self: *Self, seat: *Seat, wlr_device: *wlr.InputDevice) !void { // wlroots will log a more detailed error if this fails. if (!wlr_keyboard.setKeymap(server.config.keymap)) return error.OutOfMemory; + // Add to keyboard group, if applicable. + var it = seat.keyboard_groups.first; + while (it) |node| : (it = node.next) { + if (node.data.identifiers.contains(self.device.identifier)) { + // wlroots will log an error if this fails explaining the reason. + _ = node.data.wlr_group.addKeyboard(wlr_keyboard); + break; + } + } + wlr_keyboard.setRepeatInfo(server.config.repeat_rate, server.config.repeat_delay); wlr_keyboard.events.key.add(&self.key); -- cgit v1.2.3