libghostty: add API for getting commands
parent
a34134e643
commit
8615dfb73d
|
|
@ -730,6 +730,7 @@ void ghostty_surface_set_color_scheme(ghostty_surface_t,
|
||||||
ghostty_color_scheme_e);
|
ghostty_color_scheme_e);
|
||||||
ghostty_input_mods_e ghostty_surface_key_translation_mods(ghostty_surface_t,
|
ghostty_input_mods_e ghostty_surface_key_translation_mods(ghostty_surface_t,
|
||||||
ghostty_input_mods_e);
|
ghostty_input_mods_e);
|
||||||
|
void ghostty_surface_commands(ghostty_surface_t, ghostty_command_s**, size_t*);
|
||||||
bool ghostty_surface_key(ghostty_surface_t, ghostty_input_key_s);
|
bool ghostty_surface_key(ghostty_surface_t, ghostty_input_key_s);
|
||||||
bool ghostty_surface_key_is_binding(ghostty_surface_t, ghostty_input_key_s);
|
bool ghostty_surface_key_is_binding(ghostty_surface_t, ghostty_input_key_s);
|
||||||
void ghostty_surface_text(ghostty_surface_t, const char*, uintptr_t);
|
void ghostty_surface_text(ghostty_surface_t, const char*, uintptr_t);
|
||||||
|
|
|
||||||
|
|
@ -1487,6 +1487,23 @@ pub const CAPI = struct {
|
||||||
return @intCast(@as(input.Mods.Backing, @bitCast(result)));
|
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).
|
/// Send this for raw keypresses (i.e. the keyDown event on macOS).
|
||||||
/// This will handle the keymap translation and send the appropriate
|
/// This will handle the keymap translation and send the appropriate
|
||||||
/// key and char events.
|
/// key and char events.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue