diff options
| m--------- | deps/zig-xkbcommon | 0 | ||||
| -rw-r--r-- | river/command/map.zig | 20 |
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; } |
