mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Hooked PolyPatBlt
Makes the button highlight workaround unnecessary.
This commit is contained in:
parent
8c286d21bd
commit
71586cc994
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
BOOL WINAPI PolyPatBlt(HDC, DWORD, DWORD, DWORD, DWORD) { return FALSE; }
|
||||||
|
|
||||||
template <typename Result, typename... Params>
|
template <typename Result, typename... Params>
|
||||||
using FuncPtr = Result(WINAPI *)(Params...);
|
using FuncPtr = Result(WINAPI *)(Params...);
|
||||||
|
|
||||||
@ -208,6 +210,9 @@ namespace CompatGdiDcFunctions
|
|||||||
// Scroll bar functions
|
// Scroll bar functions
|
||||||
HOOK_GDI_DC_FUNCTION(user32, ScrollDC);
|
HOOK_GDI_DC_FUNCTION(user32, ScrollDC);
|
||||||
|
|
||||||
|
// Undocumented functions
|
||||||
|
HOOK_GDI_DC_FUNCTION(gdi32, PolyPatBlt);
|
||||||
|
|
||||||
DetourTransactionCommit();
|
DetourTransactionCommit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,19 +93,6 @@ namespace
|
|||||||
&disableTransitions, sizeof(disableTransitions));
|
&disableTransitions, sizeof(disableTransitions));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool drawButtonHighlight(HWND hwnd, const RECT& windowRect, HDC compatDc)
|
|
||||||
{
|
|
||||||
if (SendMessage(hwnd, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
|
|
||||||
{
|
|
||||||
RECT rect = {};
|
|
||||||
SetRect(&rect, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top);
|
|
||||||
FrameRect(compatDc, &rect, GetSysColorBrush(COLOR_WINDOWFRAME));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void eraseBackground(HWND hwnd, HDC dc)
|
void eraseBackground(HWND hwnd, HDC dc)
|
||||||
{
|
{
|
||||||
if (CompatGdi::beginGdiRendering())
|
if (CompatGdi::beginGdiRendering())
|
||||||
@ -149,26 +136,23 @@ namespace
|
|||||||
RECT windowRect = {};
|
RECT windowRect = {};
|
||||||
GetWindowRect(hwnd, &windowRect);
|
GetWindowRect(hwnd, &windowRect);
|
||||||
|
|
||||||
if (!drawButtonHighlight(hwnd, windowRect, compatDc))
|
CompatGdi::TitleBar titleBar(hwnd, compatDc);
|
||||||
{
|
titleBar.drawAll();
|
||||||
CompatGdi::TitleBar titleBar(hwnd, compatDc);
|
titleBar.excludeFromClipRegion();
|
||||||
titleBar.drawAll();
|
|
||||||
titleBar.excludeFromClipRegion();
|
|
||||||
|
|
||||||
CompatGdi::ScrollBar scrollBar(hwnd, compatDc);
|
CompatGdi::ScrollBar scrollBar(hwnd, compatDc);
|
||||||
scrollBar.drawAll();
|
scrollBar.drawAll();
|
||||||
scrollBar.excludeFromClipRegion();
|
scrollBar.excludeFromClipRegion();
|
||||||
|
|
||||||
RECT clientRect = {};
|
RECT clientRect = {};
|
||||||
GetClientRect(hwnd, &clientRect);
|
GetClientRect(hwnd, &clientRect);
|
||||||
POINT clientOrigin = {};
|
POINT clientOrigin = {};
|
||||||
ClientToScreen(hwnd, &clientOrigin);
|
ClientToScreen(hwnd, &clientOrigin);
|
||||||
|
|
||||||
OffsetRect(&clientRect, clientOrigin.x - windowRect.left, clientOrigin.y - windowRect.top);
|
OffsetRect(&clientRect, clientOrigin.x - windowRect.left, clientOrigin.y - windowRect.top);
|
||||||
ExcludeClipRect(compatDc, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom);
|
ExcludeClipRect(compatDc, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom);
|
||||||
CALL_ORIG_GDI(BitBlt)(compatDc, 0, 0,
|
CALL_ORIG_GDI(BitBlt)(compatDc, 0, 0,
|
||||||
windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, windowDc, 0, 0, SRCCOPY);
|
windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, windowDc, 0, 0, SRCCOPY);
|
||||||
}
|
|
||||||
|
|
||||||
CompatGdiDc::releaseDc(windowDc);
|
CompatGdiDc::releaseDc(windowDc);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user