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

Fixed scrollbars not updating when scrolling

The nonclient area is now also invalidated when scrolling.
Added similar handling for WM_MOUSEWHEEL messages.
This commit is contained in:
narzoul 2016-01-23 20:40:01 +01:00
parent 3007169592
commit 7555fb02d2

View File

@ -10,7 +10,8 @@
namespace
{
void eraseBackground(HWND hwnd, HDC dc);
void ncPaint(HWND wnd);
void ncPaint(HWND hwnd);
void updateScrolledWindow(HWND hwnd);
LRESULT CALLBACK callWndRetProc(int nCode, WPARAM wParam, LPARAM lParam)
{
@ -37,7 +38,7 @@ namespace
}
else if (WM_VSCROLL == ret->message || WM_HSCROLL == ret->message)
{
InvalidateRect(ret->hwnd, nullptr, TRUE);
updateScrolledWindow(ret->hwnd);
}
}
@ -58,6 +59,20 @@ namespace
}
}
LRESULT CALLBACK mouseProc(int nCode, WPARAM wParam, LPARAM lParam)
{
if (HC_ACTION == nCode)
{
auto mhs = reinterpret_cast<MOUSEHOOKSTRUCT*>(lParam);
if (WM_MOUSEWHEEL == wParam)
{
updateScrolledWindow(mhs->hwnd);
}
}
return CallNextHookEx(nullptr, nCode, wParam, lParam);
}
void ncPaint(HWND hwnd)
{
if (!CompatGdi::beginGdiRendering())
@ -88,6 +103,11 @@ namespace
ReleaseDC(hwnd, windowDc);
CompatGdi::endGdiRendering();
}
void updateScrolledWindow(HWND hwnd)
{
RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE);
}
}
namespace CompatGdiWinProc
@ -96,5 +116,6 @@ namespace CompatGdiWinProc
{
const DWORD threadId = GetCurrentThreadId();
SetWindowsHookEx(WH_CALLWNDPROCRET, callWndRetProc, nullptr, threadId);
SetWindowsHookEx(WH_MOUSE, &mouseProc, nullptr, threadId);
}
}