diff options
| author | Mitchell Hashimoto <m@mitchellh.com> | 2025-04-19 13:22:36 -0700 |
|---|---|---|
| committer | Mitchell Hashimoto <m@mitchellh.com> | 2025-04-21 08:32:05 -0700 |
| commit | 8615dfb73de79cb8e31d8217ea1cf8fe2e5bc7bb (patch) | |
| tree | 8476d4cc02450ed60447c4e6a25a02b39a960fe1 /src/apprt/embedded.zig | |
| parent | a34134e643abe2a9ccc1c79b84a5b0fe6e5b2095 (diff) | |
libghostty: add API for getting commands
Diffstat (limited to 'src/apprt/embedded.zig')
| -rw-r--r-- | src/apprt/embedded.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/apprt/embedded.zig b/src/apprt/embedded.zig index e8da8612c..22ae6e488 100644 --- a/src/apprt/embedded.zig +++ b/src/apprt/embedded.zig @@ -1487,6 +1487,23 @@ pub const CAPI = struct { return @intCast(@as(input.Mods.Backing, @bitCast(result))); } + /// Returns the current possible commands for a surface + /// in the output parameter. The memory is owned by libghostty + /// and doesn't need to be freed. + export fn ghostty_surface_commands( + surface: *Surface, + out: *[*]const input.Command.C, + len: *usize, + ) void { + // In the future we may use this information to filter + // some commands. + _ = surface; + + const commands = input.command.defaultsC; + out.* = commands.ptr; + len.* = commands.len; + } + /// Send this for raw keypresses (i.e. the keyDown event on macOS). /// This will handle the keymap translation and send the appropriate /// key and char events. |
