mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-23 20:26:09 +03:00
apprt/gtk-ng: implement the quit_timer action to just quit
This commit is contained in:
@ -203,9 +203,16 @@ pub const Action = union(Key) {
|
||||
open_config,
|
||||
|
||||
/// Called when there are no more surfaces and the app should quit
|
||||
/// after the configured delay. This can be cancelled by sending
|
||||
/// another quit_timer action with "stop". Multiple "starts" shouldn't
|
||||
/// happen and can be ignored or cause a restart it isn't that important.
|
||||
/// after the configured delay.
|
||||
///
|
||||
/// Despite the name, this is the notification that libghostty sends
|
||||
/// when there are no more surfaces regardless of if the configuration
|
||||
/// wants to quit after close, has any delay set, etc. It's up to the
|
||||
/// apprt to implement the proper logic based on the config.
|
||||
///
|
||||
/// This can be cancelled by sending another quit_timer action with "stop".
|
||||
/// Multiple "starts" shouldn't happen and can be ignored or cause a
|
||||
/// restart it isn't that important.
|
||||
quit_timer: QuitTimer,
|
||||
|
||||
/// Set the window floating state. A floating window is one that is
|
||||
|
@ -378,6 +378,8 @@ pub const Application = extern struct {
|
||||
},
|
||||
),
|
||||
|
||||
.quit_timer => try Action.quitTimer(self, value),
|
||||
|
||||
// Unimplemented
|
||||
.quit,
|
||||
.close_window,
|
||||
@ -407,7 +409,6 @@ pub const Application = extern struct {
|
||||
.toggle_tab_overview,
|
||||
.toggle_split_zoom,
|
||||
.toggle_window_decorations,
|
||||
.quit_timer,
|
||||
.prompt_title,
|
||||
.toggle_quick_terminal,
|
||||
.secure_input,
|
||||
@ -867,6 +868,21 @@ const Action = struct {
|
||||
const win = Window.new(self);
|
||||
gtk.Window.present(win.as(gtk.Window));
|
||||
}
|
||||
|
||||
pub fn quitTimer(
|
||||
self: *Application,
|
||||
mode: apprt.action.QuitTimer,
|
||||
) !void {
|
||||
// TODO: An actual quit timer implementation. For now, we immediately
|
||||
// quit on no windows regardless of the config.
|
||||
switch (mode) {
|
||||
.start => {
|
||||
self.private().running = false;
|
||||
},
|
||||
|
||||
.stop => {},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// This sets various GTK-related environment variables as necessary
|
||||
|
@ -220,6 +220,8 @@ pub const Surface = extern struct {
|
||||
|
||||
// Deinit the surface
|
||||
v.deinit();
|
||||
const alloc = Application.default().allocator();
|
||||
alloc.destroy(v);
|
||||
}
|
||||
|
||||
gobject.Object.virtual_methods.finalize.call(
|
||||
|
Reference in New Issue
Block a user