aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>2024-01-03 20:58:04 +0100
committerIsaac Freund <mail@isaacfreund.com>2024-01-04 11:00:16 -0600
commitc86f460135bc3f04502561c2e6631b690859d426 (patch)
treec9b7902ab2d50f87e2aa6932b38de638fd06c41d
parentebb6d1bdd1ce4d0a2a0f1dff275cdef8a7722bea (diff)
downloadriver-c86f460135bc3f04502561c2e6631b690859d426.tar.gz
river-c86f460135bc3f04502561c2e6631b690859d426.tar.xz
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.
-rw-r--r--river/Keyboard.zig12
1 files changed, 11 insertions, 1 deletions
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);