mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 09:16:11 +03:00
Merge pull request #2200 from tristan957/gtk-accel-warning
gtk: silence bad accelerator warnings
This commit is contained in:
@ -20,7 +20,13 @@ pub fn accelFromTrigger(buf: []u8, trigger: input.Binding.Trigger) !?[:0]const u
|
|||||||
try writer.writeAll(std.mem.sliceTo(c.gdk_keyval_name(keyval), 0));
|
try writer.writeAll(std.mem.sliceTo(c.gdk_keyval_name(keyval), 0));
|
||||||
},
|
},
|
||||||
|
|
||||||
.unicode => |cp| try writer.print("{u}", .{cp}),
|
.unicode => |cp| {
|
||||||
|
if (c.gdk_keyval_name(cp)) |name| {
|
||||||
|
try writer.writeAll(std.mem.sliceTo(name, 0));
|
||||||
|
} else {
|
||||||
|
try writer.print("{u}", .{cp});
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to make the string null terminated.
|
// We need to make the string null terminated.
|
||||||
@ -74,6 +80,11 @@ test "accelFromTrigger" {
|
|||||||
.mods = .{ .super = true },
|
.mods = .{ .super = true },
|
||||||
.key = .{ .translated = .q },
|
.key = .{ .translated = .q },
|
||||||
})).?);
|
})).?);
|
||||||
|
|
||||||
|
try testing.expectEqualStrings("<Shift><Ctrl><Alt><Super>backslash", (try accelFromTrigger(&buf, .{
|
||||||
|
.mods = .{ .ctrl = true, .alt = true, .super = true, .shift = true },
|
||||||
|
.key = .{ .unicode = 92 },
|
||||||
|
})).?);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A raw entry in the keymap. Our keymap contains mappings between
|
/// A raw entry in the keymap. Our keymap contains mappings between
|
||||||
|
Reference in New Issue
Block a user