mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
Don't crash when fn key pressed on mac (workaround upstream issue)
This commit is contained in:
10
src/main.zig
10
src/main.zig
@ -194,6 +194,16 @@ pub fn log(
|
||||
|
||||
fn glfwErrorCallback(code: glfw.Error, desc: [:0]const u8) void {
|
||||
std.log.warn("glfw error={} message={s}", .{ code, desc });
|
||||
|
||||
// Workaround for: https://github.com/ocornut/imgui/issues/5908
|
||||
// If we get an invalid value with "scancode" in the message we assume
|
||||
// it is from the glfw key callback that imgui sets and we clear the
|
||||
// error so that our future code doesn't crash.
|
||||
if (code == glfw.Error.InvalidValue and
|
||||
std.mem.indexOf(u8, desc, "scancode") != null)
|
||||
{
|
||||
glfw.errors.getError() catch {};
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
|
Reference in New Issue
Block a user