Skip to content

Commit

Permalink
Merge pull request #2041 from jcollie/quit-delay-fix
Browse files Browse the repository at this point in the history
Fix quit-after-last-window-closed=true, quit-after-last-window-closed-delay=null
  • Loading branch information
mitchellh authored Aug 5, 2024
2 parents 5f0371c + 656c720 commit 1b386fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/apprt/gtk/App.zig
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,18 @@ pub fn startQuitTimer(self: *App) void {
// This is a no-op unless we are configured to quit after last window is closed.
if (!self.config.@"quit-after-last-window-closed") return;

// If a delay is configured, set a timeout function to quit after the delay.
if (self.config.@"quit-after-last-window-closed-delay") |v| {
// If a delay is configured, set a timeout function to quit after the delay.
const ms: u64 = std.math.divTrunc(
u64,
v.duration,
std.time.ns_per_ms,
) catch std.math.maxInt(c.guint);
const t = std.math.cast(c.guint, ms) orelse std.math.maxInt(c.guint);
self.quit_timer = .{ .active = c.g_timeout_add(t, gtkQuitTimerExpired, self) };
} else {
// If no delay is configured, treat it as expired.
self.quit_timer = .{ .expired = {} };
}
}

Expand Down

0 comments on commit 1b386fa

Please sign in to comment.