1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Fixed errors in copying valid bits of moved child windows

Fixes glitches in Mig Alley's main menu after exiting campaign (issue #12).
This commit is contained in:
narzoul 2020-12-19 13:20:16 +01:00
parent 4370990dfb
commit 9b3e900faf

View File

@ -53,6 +53,14 @@ namespace
decltype(&CallWindowProcA) callWindowProc, WNDPROC wndProc)
{
LOG_FUNC("ddcWindowProc", Compat::WindowMessageStruct(hwnd, uMsg, wParam, lParam));
switch (uMsg)
{
case WM_WINDOWPOSCHANGED:
onWindowPosChanged(hwnd);
break;
}
LRESULT result = callWindowProc(wndProc, hwnd, uMsg, wParam, lParam);
switch (uMsg)
@ -82,10 +90,6 @@ namespace
}
break;
case WM_WINDOWPOSCHANGED:
onWindowPosChanged(hwnd);
break;
case WM_WINDOWPOSCHANGING:
onWindowPosChanging(hwnd, *reinterpret_cast<WINDOWPOS*>(lParam));
break;
@ -306,12 +310,22 @@ namespace
cwi->visibleRegion.offset(rect.left - cwi->rect.left, rect.top - cwi->rect.top);
clipRegion &= cwi->visibleRegion;
HDC screenDc = GetDC(nullptr);
SelectClipRgn(screenDc, clipRegion);
BitBlt(screenDc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
screenDc, cwi->rect.left, cwi->rect.top, SRCCOPY);
SelectClipRgn(screenDc, nullptr);
CALL_ORIG_FUNC(ReleaseDC)(nullptr, screenDc);
Gdi::Region updateRegion;
GetUpdateRgn(hwnd, updateRegion, FALSE);
POINT clientPos = {};
ClientToScreen(hwnd, &clientPos);
OffsetRgn(updateRegion, clientPos.x, clientPos.y);
clipRegion -= updateRegion;
if (!clipRegion.isEmpty())
{
HDC screenDc = GetDC(nullptr);
SelectClipRgn(screenDc, clipRegion);
BitBlt(screenDc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
screenDc, cwi->rect.left, cwi->rect.top, SRCCOPY);
SelectClipRgn(screenDc, nullptr);
CALL_ORIG_FUNC(ReleaseDC)(nullptr, screenDc);
}
}
}
}