aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2024-01-06 20:36:53 -0600
committerIsaac Freund <mail@isaacfreund.com>2024-01-06 20:36:53 -0600
commit540ca043df650568bdee4d00b933ed6a13b5de70 (patch)
tree2e37964dbd76c9af4748de647e5313e2a891047d
parentafbc84c994ee72f05362f25b28837c2f3ed0d980 (diff)
downloadriver-540ca043df650568bdee4d00b933ed6a13b5de70.tar.gz
river-540ca043df650568bdee4d00b933ed6a13b5de70.tar.xz
Keyboard: fix mapping XF86ScreenSaver
m---------deps/zig-xkbcommon0
-rw-r--r--river/command/map.zig20
2 files changed, 20 insertions, 0 deletions
diff --git a/deps/zig-xkbcommon b/deps/zig-xkbcommon
-Subproject e93ceb0436c66a7e4c727fdb59020e889519e48
+Subproject 7b188de0ba794b52eb70340abf2469b85863081
diff --git a/river/command/map.zig b/river/command/map.zig
index 2892636..3ba5af6 100644
--- a/river/command/map.zig
+++ b/river/command/map.zig
@@ -257,6 +257,26 @@ fn parseKeysym(name: [:0]const u8, out: *?[]const u8) !xkb.Keysym {
out.* = try fmt.allocPrint(util.gpa, "invalid keysym '{s}'", .{name});
return Error.Other;
}
+
+ // The case insensitive matching done by xkbcommon returns the first
+ // lowercase match found if there are multiple matches that differ only in
+ // case. This works great for alphabetic keys for example but there is one
+ // problematic exception we handle specially here. For some reason there
+ // exist both uppercase and lowercase versions of XF86ScreenSaver with
+ // different keysym values for example. Switching to a case-sensitive match
+ // would be too much of a breaking change at this point so fix this by
+ // special-casing this exception.
+ if (@intFromEnum(keysym) == xkb.Keysym.XF86Screensaver) {
+ if (mem.eql(u8, name, "XF86Screensaver")) {
+ return keysym;
+ } else if (mem.eql(u8, name, "XF86ScreenSaver")) {
+ return @enumFromInt(xkb.Keysym.XF86ScreenSaver);
+ } else {
+ out.* = try fmt.allocPrint(util.gpa, "ambiguous keysym name '{s}'", .{name});
+ return Error.Other;
+ }
+ }
+
return keysym;
}