mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/embedded: add ghostty_app_set_focus
This commit is contained in:
@ -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);
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user