Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
Seat: remove repeat mappings
river/Keyboard.zig | 2 --
river/Mapping.zig | 2 --
river/Seat.zig | 41 ++---------------------------------------
3 files changed, 2 insertions(+), 43 deletions(-)
diff --git a/river/Keyboard.zig b/river/Keyboard.zig
index b0479d3..258d089 100644
--- a/river/Keyboard.zig
+++ b/river/Keyboard.zig
@@ -154,8 +154,6 @@ fn handleKey(listener: *wl.Listener(*wlr.Keyboard.event.Key), event: *wlr.Keyboa
keyboard.device.seat.handleActivity();
- keyboard.device.seat.clearRepeatingMapping();
-
// Translate libinput keycode -> xkbcommon
const keycode = event.keycode + 8;
diff --git a/river/Mapping.zig b/river/Mapping.zig
index f38e2d4..0393cb7 100644
--- a/river/Mapping.zig
+++ b/river/Mapping.zig
@@ -29,8 +29,6 @@ options: Options,
pub const Options = struct {
/// When set to true the mapping will be executed on key release rather than on press
release: bool,
- /// When set to true the mapping will be executed repeatedly while key is pressed
- repeat: bool,
// This is set for mappings with layout-pinning
// If set, the layout with this index is always used to translate the given keycode
layout_index: ?u32,
diff --git a/river/Seat.zig b/river/Seat.zig
index 7d5ec0f..7289278 100644
--- a/river/Seat.zig
+++ b/river/Seat.zig
@@ -70,12 +70,6 @@ cursor: Cursor,
/// Input Method handling
relay: InputRelay,
-/// Timer for repeating keyboard mappings
-mapping_repeat_timer: *wl.EventSource,
-
-/// Currently repeating mapping, if any
-repeating_mapping: ?*const Mapping = null,
-
keyboard_groups: std.TailQueue(KeyboardGroup) = .{},
focused: FocusTarget = .none,
@@ -97,16 +91,11 @@ request_set_primary_selection: wl.Listener(*wlr.Seat.event.RequestSetPrimarySele
wl.Listener(*wlr.Seat.event.RequestSetPrimarySelection).init(handleRequestSetPrimarySelection),
pub fn init(seat: *Seat, name: [*:0]const u8) !void {
- const event_loop = server.wl_server.getEventLoop();
- const mapping_repeat_timer = try event_loop.addTimer(*Seat, handleMappingRepeatTimeout, seat);
- errdefer mapping_repeat_timer.remove();
-
seat.* = .{
// This will be automatically destroyed when the display is destroyed
.wlr_seat = try wlr.Seat.create(server.wl_server, name),
.cursor = undefined,
.relay = undefined,
- .mapping_repeat_timer = mapping_repeat_timer,
};
seat.wlr_seat.data = @intFromPtr(seat);
@@ -126,7 +115,6 @@ pub fn deinit(seat: *Seat) void {
}
seat.cursor.deinit();
- seat.mapping_repeat_timer.remove();
while (seat.keyboard_groups.first) |node| {
node.data.destroy();
@@ -269,7 +257,7 @@ pub fn handleActivity(seat: Seat) void {
/// Handle any user-defined mapping for passed keycode, modifiers and keyboard state
/// Returns true if a mapping was run
pub fn handleMapping(
- seat: *Seat,
+ _: *Seat,
keycode: xkb.Keycode,
modifiers: wlr.Keyboard.ModifierMask,
released: bool,
@@ -316,13 +304,7 @@ pub fn handleMapping(
// The mapped command must be run outside of the loop above as it may modify
// the list of mappings we are iterating through, possibly causing it to be re-allocated.
- if (found) |mapping| {
- if (mapping.options.repeat) {
- seat.repeating_mapping = mapping;
- seat.mapping_repeat_timer.timerUpdate(server.config.repeat_delay) catch {
- log.err("failed to update mapping repeat timer", .{});
- };
- }
+ if (found) |_| {
return true;
}
@@ -342,25 +324,6 @@ pub fn handleSwitchMapping(
}
}
-pub fn clearRepeatingMapping(seat: *Seat) void {
- seat.mapping_repeat_timer.timerUpdate(0) catch {
- log.err("failed to clear mapping repeat timer", .{});
- };
- seat.repeating_mapping = null;
-}
-
-/// Repeat key mapping
-fn handleMappingRepeatTimeout(seat: *Seat) c_int {
- if (seat.repeating_mapping) |_| {
- const rate = server.config.repeat_rate;
- const ms_delay = if (rate > 0) 1000 / rate else 0;
- seat.mapping_repeat_timer.timerUpdate(ms_delay) catch {
- log.err("failed to update mapping repeat timer", .{});
- };
- }
- return 0;
-}
-
pub fn addDevice(seat: *Seat, wlr_device: *wlr.InputDevice) void {
seat.tryAddDevice(wlr_device) catch |err| switch (err) {
error.OutOfMemory => log.err("out of memory", .{}),