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

Fixed issue with GDI controls not always being visible

Reverted an earlier optimization that tried to handle WM_ERASEBKGND and
WM_PAINT events in a single update cycle for reduced flickering.
It caused some child controls to not display properly.

Fixes an issue reported in #15.
This commit is contained in:
narzoul 2017-07-16 22:39:56 +02:00
parent d2adc5c811
commit c63d36d831

View File

@ -156,36 +156,24 @@ namespace
LRESULT onEraseBackground(HWND hwnd, HDC dc, WNDPROC origWndProc)
{
if (!hwnd || !Gdi::beginGdiRendering())
if (hwnd && Gdi::beginGdiRendering())
{
return CallWindowProc(origWndProc, hwnd, WM_ERASEBKGND, reinterpret_cast<WPARAM>(dc), 0);
}
LRESULT result = 0;
HDC compatDc = Gdi::Dc::getDc(dc);
if (compatDc)
{
result = CallWindowProc(origWndProc, hwnd, WM_ERASEBKGND, reinterpret_cast<WPARAM>(compatDc), 0);
Gdi::Dc::releaseDc(dc);
if (result)
LRESULT result = 0;
HDC compatDc = Gdi::Dc::getDc(dc);
if (compatDc)
{
DDraw::RealPrimarySurface::disableUpdates();
result = CallWindowProc(origWndProc, hwnd, WM_ERASEBKGND, reinterpret_cast<WPARAM>(compatDc), 0);
Gdi::Dc::releaseDc(dc);
}
Gdi::endGdiRendering();
if (compatDc)
{
return result;
}
}
else
{
result = CallWindowProc(origWndProc, hwnd, WM_ERASEBKGND, reinterpret_cast<WPARAM>(dc), 0);
}
Gdi::endGdiRendering();
if (result && compatDc)
{
UpdateWindow(hwnd);
DDraw::RealPrimarySurface::enableUpdates();
}
return result;
return CallWindowProc(origWndProc, hwnd, WM_ERASEBKGND, reinterpret_cast<WPARAM>(dc), 0);
}
LRESULT onMenuPaint(HWND hwnd, WNDPROC origWndProc)