apprt/embedded: add ghostty_app_set_focus

This commit is contained in:
Mitchell Hashimoto
2024-10-06 09:54:07 -10:00
parent bac1780c3c
commit 8dc4ebb4f7
2 changed files with 14 additions and 0 deletions

View File

@ -615,6 +615,7 @@ ghostty_app_t ghostty_app_new(const ghostty_runtime_config_s*,
void ghostty_app_free(ghostty_app_t);
bool ghostty_app_tick(ghostty_app_t);
void* ghostty_app_userdata(ghostty_app_t);
void ghostty_app_set_focus(ghostty_app_t, bool);
bool ghostty_app_key(ghostty_app_t, ghostty_input_key_s);
void ghostty_app_keyboard_changed(ghostty_app_t);
void ghostty_app_open_config(ghostty_app_t);

View File

@ -132,6 +132,11 @@ pub const App = struct {
surface: *Surface,
};
/// See CoreApp.focusEvent
pub fn focusEvent(self: *App, focused: bool) void {
self.core_app.focusEvent(focused);
}
/// See CoreApp.keyEvent.
pub fn keyEvent(
self: *App,
@ -1296,6 +1301,14 @@ pub const CAPI = struct {
core_app.destroy();
}
/// Update the focused state of the app.
export fn ghostty_app_set_focus(
app: *App,
focused: bool,
) void {
app.focusEvent(focused);
}
/// Notify the app of a global keypress capture. This will return
/// true if the key was captured by the app, in which case the caller
/// should not process the key.