Everywhere: Kill app_event_loop on window close

This commit is contained in:
Alec Murphy 2025-04-21 19:57:19 -04:00
parent ce44a8db0f
commit 49666d7ea9
6 changed files with 18 additions and 3 deletions

View file

@ -50,6 +50,7 @@ U0 window_close(Window* win)
Gui.Window.SetFocus(Compositor.GetWindowByTitle("Wallpaper"));
Compositor.UnregisterForGlobalInputEvents(win);
Compositor.DestroyWindow(win);
Kill(app_event_loop);
}
U0 Main()

View file

@ -127,6 +127,7 @@ U0 @cyberia_win_close(Window* win)
}
Compositor.UnregisterForGlobalInputEvents(win);
Compositor.DestroyWindow(win);
Kill(app_event_loop);
}
U8* @browser_tls_connection_state(@http_response* resp)

View file

@ -13,6 +13,7 @@ U0 @shutdown_callback(U64 o)
}
}
Compositor.DestroyWindow(win);
Kill(app_event_loop);
Gui.Window.SetFocus(Compositor.GetWindowByTitle("Wallpaper"));
}

View file

@ -19,6 +19,7 @@ U0 @templeos_close_callback(Window* win)
Kill(templeos_winmgr_task);
Compositor.UnregisterForGlobalInputEvents(win);
Compositor.DestroyWindow(win);
Kill(app_event_loop);
win = NULL;
Exit;
}

View file

@ -132,6 +132,7 @@ U0 window_close(Window* win)
Gui.Window.SetFocus(Compositor.GetWindowByTitle("Wallpaper"));
Compositor.UnregisterForGlobalInputEvents(win);
Compositor.DestroyWindow(win);
Kill(app_event_loop);
}
U0 @terminal_vscroll_change(Widget*)

View file

@ -1,13 +1,22 @@
#include "M:/Include/Gui";
Gui.App();
U0 window_close(Window* win) { Compositor.DestroyWindow(win); }
U0 app_window_close(Window* win)
{
Compositor.DestroyWindow(win);
Kill(app_event_loop);
}
U0 new_window_close(Window* win)
{
Compositor.DestroyWindow(win);
}
U0 btn1_click(Widget* widget)
{
no_warn widget;
Window* win = Compositor.CreateWindow(Rand * Display.Width(), Rand * Display.Height(),
320, 240, WIN_FLAGS_DEFAULT);
win->callback.close = &window_close;
Gui.Window.SetCallback(win, "close", &new_window_close);
Gui.Window.SetTitle(win, "New Window");
Gui.Window.SetFocus(win);
}
@ -30,6 +39,7 @@ U0 Main()
win->alpha = TRUE;
Gui.Window.Center(win);
Gui.Window.SetTitle(win, "Test Application");
Gui.Window.SetCallback(win, "close", &app_window_close);
TextInputWidget* label1 = Gui.CreateWidget(win, WIDGET_TYPE_LABEL, 8, 0, 192, 64);
Gui.Widget.SetText(label1,