From 474fdb1e4580bc011157cd0819e722e3801af2ac Mon Sep 17 00:00:00 2001 From: narzoul Date: Tue, 30 Apr 2024 17:19:51 +0200 Subject: [PATCH] Fixed disappearing dialog boxes in Lego Loco See issue #179. --- DDrawCompat/DDraw/RealPrimarySurface.cpp | 3 ++- DDrawCompat/Gdi/Window.cpp | 13 +++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/DDrawCompat/DDraw/RealPrimarySurface.cpp b/DDrawCompat/DDraw/RealPrimarySurface.cpp index 47ae808..45e11bf 100644 --- a/DDrawCompat/DDraw/RealPrimarySurface.cpp +++ b/DDrawCompat/DDraw/RealPrimarySurface.cpp @@ -749,7 +749,8 @@ namespace DDraw Gdi::GuiThread::execute([&]() { CALL_ORIG_FUNC(SetWindowPos)(g_presentationWindow, HWND_TOPMOST, 0, 0, 0, 0, - SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOREDRAW | SWP_NOOWNERZORDER); + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING | SWP_NOREDRAW | SWP_NOOWNERZORDER | + (IsWindowVisible(GetWindow(g_presentationWindow, GW_OWNER)) ? SWP_SHOWWINDOW : SWP_HIDEWINDOW)); }); } } diff --git a/DDrawCompat/Gdi/Window.cpp b/DDrawCompat/Gdi/Window.cpp index b96e4a0..ebf8965 100644 --- a/DDrawCompat/Gdi/Window.cpp +++ b/DDrawCompat/Gdi/Window.cpp @@ -355,22 +355,14 @@ namespace context.invalidatedRegion |= visibleRegion - it->second.visibleRegion; } - if (it->second.presentationWindow && isVisible && + if (it->second.presentationWindow && it->second.presentationWindow != DDraw::RealPrimarySurface::getPresentationWindow()) { - Gdi::GuiThread::setWindowRgn(it->second.presentationWindow, Gdi::Window::getWindowRgn(hwnd)); Gdi::Window::updatePresentationWindowPos(it->second.presentationWindow, hwnd); } } - if (isWindowVisible) - { - g_windowZOrder.push_back(&it->second); - } - else - { - removeWindow(it); - } + g_windowZOrder.push_back(&it->second); return TRUE; } } @@ -713,6 +705,7 @@ namespace Gdi wp.flags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOSENDCHANGING; if (IsWindowVisible(owner)) { + Gdi::GuiThread::setWindowRgn(presentationWindow, getWindowRgn(owner)); wp.hwndInsertAfter = CALL_ORIG_FUNC(GetWindow)(owner, GW_HWNDPREV); if (!wp.hwndInsertAfter) {