win32 gui: make an effort to bring window to the top/foreground

This commit is contained in:
Jonathan Marler 2025-01-09 12:41:08 -07:00 committed by CJ van den Berg
parent a21f0e6ac5
commit a0cee00f66

View file

@ -542,6 +542,13 @@ fn entry(pid: thespian.pid) !void {
if (0 == win32.UpdateWindow(hwnd)) fatalWin32("UpdateWindow", win32.GetLastError());
_ = win32.ShowWindow(hwnd, win32.SW_SHOWNORMAL);
// try some things to bring our window to the top
const HWND_TOP: ?win32.HWND = null;
_ = win32.SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, .{ .NOMOVE = 1, .NOSIZE = 1 });
_ = win32.SetForegroundWindow(hwnd);
_ = win32.BringWindowToTop(hwnd);
var msg: win32.MSG = undefined;
while (win32.GetMessageW(&msg, null, 0, 0) != 0) {
_ = win32.TranslateMessage(&msg);