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

Added child window invalidation to scroll functions

This commit is contained in:
narzoul 2016-03-19 13:38:41 +01:00
parent 53ae753ae0
commit c93da30330
3 changed files with 17 additions and 13 deletions

View File

@ -12,8 +12,9 @@ namespace
_In_ const RECT *lpRect, _In_ const RECT *lpRect,
_In_ const RECT *lpClipRect) _In_ const RECT *lpClipRect)
{ {
InvalidateRect(hWnd, nullptr, TRUE); BOOL result = CALL_ORIG_GDI(ScrollWindow)(hWnd, XAmount, YAmount, lpRect, lpClipRect);
return CALL_ORIG_GDI(ScrollWindow)(hWnd, XAmount, YAmount, lpRect, lpClipRect); CompatGdiScrollFunctions::updateScrolledWindow(hWnd);
return result;
} }
int WINAPI scrollWindowEx( int WINAPI scrollWindowEx(
@ -26,8 +27,10 @@ namespace
_Out_ LPRECT prcUpdate, _Out_ LPRECT prcUpdate,
_In_ UINT flags) _In_ UINT flags)
{ {
InvalidateRect(hWnd, nullptr, TRUE); int result = CALL_ORIG_GDI(ScrollWindowEx)(
return CALL_ORIG_GDI(ScrollWindowEx)(hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags); hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags);
CompatGdiScrollFunctions::updateScrolledWindow(hWnd);
return result;
} }
} }
@ -40,4 +43,9 @@ namespace CompatGdiScrollFunctions
HOOK_GDI_FUNCTION(user32, ScrollWindowEx, scrollWindowEx); HOOK_GDI_FUNCTION(user32, ScrollWindowEx, scrollWindowEx);
DetourTransactionCommit(); DetourTransactionCommit();
} }
void updateScrolledWindow(HWND hwnd)
{
RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
}
} }

View File

@ -3,4 +3,5 @@
namespace CompatGdiScrollFunctions namespace CompatGdiScrollFunctions
{ {
void installHooks(); void installHooks();
void updateScrolledWindow(HWND hwnd);
}; };

View File

@ -8,6 +8,7 @@
#include "CompatGdi.h" #include "CompatGdi.h"
#include "CompatGdiDc.h" #include "CompatGdiDc.h"
#include "CompatGdiScrollBar.h" #include "CompatGdiScrollBar.h"
#include "CompatGdiScrollFunctions.h"
#include "CompatGdiTitleBar.h" #include "CompatGdiTitleBar.h"
#include "CompatGdiWinProc.h" #include "CompatGdiWinProc.h"
#include "DDrawLog.h" #include "DDrawLog.h"
@ -21,7 +22,6 @@ namespace
void ncPaint(HWND hwnd); void ncPaint(HWND hwnd);
void onWindowPosChanged(HWND hwnd); void onWindowPosChanged(HWND hwnd);
void removeDropShadow(HWND hwnd); void removeDropShadow(HWND hwnd);
void updateScrolledWindow(HWND hwnd);
LRESULT CALLBACK callWndRetProc(int nCode, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK callWndRetProc(int nCode, WPARAM wParam, LPARAM lParam)
{ {
@ -60,7 +60,7 @@ namespace
} }
else if (WM_VSCROLL == ret->message || WM_HSCROLL == ret->message) else if (WM_VSCROLL == ret->message || WM_HSCROLL == ret->message)
{ {
updateScrolledWindow(ret->hwnd); CompatGdiScrollFunctions::updateScrolledWindow(ret->hwnd);
} }
else if (WM_COMMAND == ret->message) else if (WM_COMMAND == ret->message)
{ {
@ -68,7 +68,7 @@ namespace
auto notifCode = HIWORD(ret->wParam); auto notifCode = HIWORD(ret->wParam);
if (0 != msgSource && 1 != msgSource && (EN_HSCROLL == notifCode || EN_VSCROLL == notifCode)) if (0 != msgSource && 1 != msgSource && (EN_HSCROLL == notifCode || EN_VSCROLL == notifCode))
{ {
updateScrolledWindow(reinterpret_cast<HWND>(ret->lParam)); CompatGdiScrollFunctions::updateScrolledWindow(reinterpret_cast<HWND>(ret->lParam));
} }
} }
else if (BM_SETSTYLE == ret->message) else if (BM_SETSTYLE == ret->message)
@ -127,7 +127,7 @@ namespace
auto mhs = reinterpret_cast<MOUSEHOOKSTRUCT*>(lParam); auto mhs = reinterpret_cast<MOUSEHOOKSTRUCT*>(lParam);
if (WM_MOUSEWHEEL == wParam || WM_MOUSEHWHEEL == wParam) if (WM_MOUSEWHEEL == wParam || WM_MOUSEHWHEEL == wParam)
{ {
updateScrolledWindow(mhs->hwnd); CompatGdiScrollFunctions::updateScrolledWindow(mhs->hwnd);
} }
} }
@ -246,11 +246,6 @@ namespace
SetClassLongPtr(hwnd, GCL_STYLE, style ^ CS_DROPSHADOW); SetClassLongPtr(hwnd, GCL_STYLE, style ^ CS_DROPSHADOW);
} }
} }
void updateScrolledWindow(HWND hwnd)
{
RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
}
} }
namespace CompatGdiWinProc namespace CompatGdiWinProc