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