mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-02 11:54:41 +00:00
macos: hook up text input
This commit is contained in:
@@ -427,4 +427,9 @@ pub const CAPI = struct {
|
||||
@bitCast(input.Mods, @truncate(u8, @bitCast(c_uint, mods))),
|
||||
);
|
||||
}
|
||||
|
||||
/// Tell the surface that it needs to schedule a render
|
||||
export fn ghostty_surface_char(win: *Window, codepoint: u32) void {
|
||||
win.window.charCallback(codepoint);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -151,9 +151,18 @@ pub const Window = struct {
|
||||
key: input.Key,
|
||||
mods: input.Mods,
|
||||
) void {
|
||||
// log.warn("key action={} key={} mods={}", .{ action, key, mods });
|
||||
self.core_win.keyCallback(action, key, mods) catch |err| {
|
||||
log.err("error in key callback err={}", .{err});
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
pub fn charCallback(self: *const Window, cp_: u32) void {
|
||||
const cp = std.math.cast(u21, cp_) orelse return;
|
||||
self.core_win.charCallback(cp) catch |err| {
|
||||
log.err("error in char callback err={}", .{err});
|
||||
return;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user