@@ -54,9 +54,6 @@ focused_surface: ?*Surface = null,
5454/// this is a blocking queue so if it is full you will get errors (or block).
5555mailbox : Mailbox.Queue ,
5656
57- /// Set to true once we're quitting. This never goes false again.
58- quit : bool ,
59-
6057/// The set of font GroupCache instances shared by surfaces with the
6158/// same font configuration.
6259font_grid_set : font.SharedGridSet ,
@@ -98,7 +95,6 @@ pub fn create(
9895 .alloc = alloc ,
9996 .surfaces = .{},
10097 .mailbox = .{},
101- .quit = false ,
10298 .font_grid_set = font_grid_set ,
10399 .config_conditional_state = .{},
104100 };
@@ -125,9 +121,7 @@ pub fn destroy(self: *App) void {
125121/// Tick ticks the app loop. This will drain our mailbox and process those
126122/// events. This should be called by the application runtime on every loop
127123/// tick.
128- ///
129- /// This returns whether the app should quit or not.
130- pub fn tick (self : * App , rt_app : * apprt.App ) ! bool {
124+ pub fn tick (self : * App , rt_app : * apprt.App ) ! void {
131125 // If any surfaces are closing, destroy them
132126 var i : usize = 0 ;
133127 while (i < self .surfaces .items .len ) {
@@ -142,13 +136,6 @@ pub fn tick(self: *App, rt_app: *apprt.App) !bool {
142136
143137 // Drain our mailbox
144138 try self .drainMailbox (rt_app );
145-
146- // No matter what, we reset the quit flag after a tick. If the apprt
147- // doesn't want to quit, then we can't force it to.
148- defer self .quit = false ;
149-
150- // We quit if our quit flag is on
151- return self .quit ;
152139}
153140
154141/// Update the configuration associated with the app. This can only be
@@ -272,7 +259,7 @@ fn drainMailbox(self: *App, rt_app: *apprt.App) !void {
272259 // can try to quit as quickly as possible.
273260 .quit = > {
274261 log .info ("quit message received, short circuiting mailbox drain" , .{});
275- self .setQuit ( );
262+ try self .performAction ( rt_app , .quit );
276263 return ;
277264 },
278265 }
@@ -314,12 +301,6 @@ pub fn newWindow(self: *App, rt_app: *apprt.App, msg: Message.NewWindow) !void {
314301 );
315302}
316303
317- /// Start quitting
318- pub fn setQuit (self : * App ) void {
319- if (self .quit ) return ;
320- self .quit = true ;
321- }
322-
323304/// Handle an app-level focus event. This should be called whenever
324305/// the focus state of the entire app containing Ghostty changes.
325306/// This is separate from surface focus events. See the `focused`
@@ -437,7 +418,7 @@ pub fn performAction(
437418 switch (action ) {
438419 .unbind = > unreachable ,
439420 .ignore = > {},
440- .quit = > self . setQuit ( ),
421+ .quit = > try rt_app . performAction ( .app , .quit , {} ),
441422 .new_window = > try self .newWindow (rt_app , .{ .parent = null }),
442423 .open_config = > try rt_app .performAction (.app , .open_config , {}),
443424 .reload_config = > try rt_app .performAction (.app , .reload_config , .{}),
0 commit comments