From b7952b1cb8c57ce3d70edcb65125f5d4c7ffb205 Mon Sep 17 00:00:00 2001 From: Alec Murphy Date: Fri, 28 Mar 2025 19:07:39 -0400 Subject: [PATCH] Applicatiosn/OS/ShutDown.app: Update MessageBox API --- Applications/OS/ShutDown.app/Run.HC | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/Applications/OS/ShutDown.app/Run.HC b/Applications/OS/ShutDown.app/Run.HC index 219f294..963f806 100644 --- a/Applications/OS/ShutDown.app/Run.HC +++ b/Applications/OS/ShutDown.app/Run.HC @@ -2,24 +2,18 @@ Gui.App(); U0 @shutdown_callback(U64 o) { - if (!o) - return; + Window* win = NULL; if (o(Window*)->signature == WIN_SIGNATURE) { - Compositor.DestroyWindow(o(Window*)); - Gui.Window.SetFocus(Compositor.GetWindowByTitle("Wallpaper")); - return; - } - switch (o(Widget*)->tag) { - case TRUE: - System.PowerOff(); - break; - default: - Compositor.DestroyWindow(o(Widget*)->parent_win); - Gui.Window.SetFocus(Compositor.GetWindowByTitle("Wallpaper")); - return; - break; + win = o; + } else { + if (o(Widget*)->tag) { + System.PowerOff(); + } else { + win = o(Widget*)->parent_win; + } } + Compositor.DestroyWindow(win); + Gui.Window.SetFocus(Compositor.GetWindowByTitle("Wallpaper")); } -MessageBox.Alert("Do you want to shut down this computer?", - "[\"OK\",\"Cancel\"]", &@shutdown_callback); \ No newline at end of file +MessageBox.Confirm("Do you want to shut down this computer?", &@shutdown_callback); \ No newline at end of file