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

@@ -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.