Improve quit timers.

Instead of "polling" to see if a quit timer has expired, start a single
timer that expires after the confiugred delay when no more surfaces are
open. That timer can be cancelled if necessary.
This commit is contained in:
Jeffrey C. Ollie
2024-08-01 14:49:02 -05:00
parent 3d6ca14dc6
commit ec0f90d1b6
3 changed files with 62 additions and 41 deletions

View File

@@ -107,6 +107,11 @@ pub fn main() !MainReturn {
var app_runtime = try apprt.App.init(app, .{});
defer app_runtime.terminate();
// Since - by definition - there are no surfaces when first started, the
// quit timer may need to be started. The start timer will get cancelled if/
// when the first surface is created.
if (@hasDecl(apprt.App, "startQuitTimer")) app_runtime.startQuitTimer();
// Run the GUI event loop
try app_runtime.run();
}