diff --git a/pkg/ant.window/main.lua b/pkg/ant.window/main.lua index 63737373fa..f0268a12c1 100644 --- a/pkg/ant.window/main.lua +++ b/pkg/ant.window/main.lua @@ -38,6 +38,10 @@ end local function newproxy(t, k) local ServiceWindow = ltask.queryservice "ant.window|window" + local function close() + ltask.send(ServiceWindow, "close") + end + local function reboot(initargs) ltask.send(ServiceWindow, "reboot", initargs) end @@ -58,6 +62,7 @@ local function newproxy(t, k) ltask.call(ServiceWindow, "set_fullscreen", fullscreen) end + t.close = close t.reboot = reboot t.set_cursor = set_cursor t.show_cursor = show_cursor diff --git a/pkg/ant.window/service/window.lua b/pkg/ant.window/service/window.lua index 1e9669bf8a..d05978915e 100644 --- a/pkg/ant.window/service/window.lua +++ b/pkg/ant.window/service/window.lua @@ -182,6 +182,10 @@ function S.msg(messages) end end +function S.close() + window.close() +end + function S.set_cursor(cursor) window.set_cursor(cursor) end diff --git a/pkg/ant.window/src/platform/windows/win32_window.cpp b/pkg/ant.window/src/platform/windows/win32_window.cpp index 028799a97e..f26954ef63 100644 --- a/pkg/ant.window/src/platform/windows/win32_window.cpp +++ b/pkg/ant.window/src/platform/windows/win32_window.cpp @@ -592,6 +592,7 @@ void window_close() { if (!G.ShowCursor) { ::ShowCursor(TRUE); } + ::SendMessage(G.hWnd, WM_SYSCOMMAND, SC_CLOSE, 1); } bool window_peek_message() {