keyboard bindings should never take caps/num lock into account

This commit is contained in:
Mitchell Hashimoto
2023-08-08 10:58:05 -07:00
parent a295d1e872
commit bfe6cfeb1a

View File

@ -953,12 +953,19 @@ pub fn keyCallback(
self.ignore_char = false; self.ignore_char = false;
if (action == .press or action == .repeat) { if (action == .press or action == .repeat) {
// Mods for bindings never include caps/num lock.
const binding_mods = mods: {
var binding_mods = mods;
binding_mods.caps_lock = false;
binding_mods.num_lock = false;
break :mods binding_mods;
};
const binding_action_: ?input.Binding.Action = action: { const binding_action_: ?input.Binding.Action = action: {
var trigger: input.Binding.Trigger = .{ var trigger: input.Binding.Trigger = .{
.mods = mods, .mods = binding_mods,
.key = key, .key = key,
}; };
//log.warn("BINDING TRIGGER={}", .{trigger});
const set = self.config.keybind.set; const set = self.config.keybind.set;
if (set.get(trigger)) |v| break :action v; if (set.get(trigger)) |v| break :action v;
@ -983,7 +990,7 @@ pub fn keyCallback(
// Handle non-printables // Handle non-printables
const char: u8 = char: { const char: u8 = char: {
const mods_int: u8 = @bitCast(mods); const mods_int: u8 = @bitCast(binding_mods);
const ctrl_only: u8 = @bitCast(input.Mods{ .ctrl = true }); const ctrl_only: u8 = @bitCast(input.Mods{ .ctrl = true });
// If we're only pressing control, check if this is a character // If we're only pressing control, check if this is a character