mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Added invalidation of non-client area on WM_ACTIVATE
This commit is contained in:
parent
f12b95ec9f
commit
1a3cb2be4d
@ -18,6 +18,7 @@ namespace
|
||||
std::unordered_map<HWND, RECT> g_prevWindowRect;
|
||||
|
||||
void disableDwmAttributes(HWND hwnd);
|
||||
void onActivate(HWND hwnd);
|
||||
void onMenuSelect();
|
||||
void onWindowPosChanged(HWND hwnd);
|
||||
void removeDropShadow(HWND hwnd);
|
||||
@ -43,6 +44,10 @@ namespace
|
||||
{
|
||||
onWindowPosChanged(ret->hwnd);
|
||||
}
|
||||
else if (WM_ACTIVATE == ret->message)
|
||||
{
|
||||
onActivate(ret->hwnd);
|
||||
}
|
||||
else if (WM_COMMAND == ret->message)
|
||||
{
|
||||
auto notifCode = HIWORD(ret->wParam);
|
||||
@ -95,7 +100,7 @@ namespace
|
||||
{
|
||||
if (OBJID_TITLEBAR == idObject)
|
||||
{
|
||||
CompatGdi::TitleBar(hwnd, compatDc).drawAll();
|
||||
CompatGdi::TitleBar(hwnd, compatDc).drawButtons();
|
||||
}
|
||||
else if (OBJID_HSCROLL == idObject)
|
||||
{
|
||||
@ -113,6 +118,24 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void onActivate(HWND hwnd)
|
||||
{
|
||||
RECT windowRect = {};
|
||||
GetWindowRect(hwnd, &windowRect);
|
||||
RECT clientRect = {};
|
||||
GetClientRect(hwnd, &clientRect);
|
||||
POINT clientOrigin = {};
|
||||
ClientToScreen(hwnd, &clientOrigin);
|
||||
OffsetRect(&windowRect, -clientOrigin.x, -clientOrigin.y);
|
||||
|
||||
HRGN ncRgn = CreateRectRgnIndirect(&windowRect);
|
||||
HRGN clientRgn = CreateRectRgnIndirect(&clientRect);
|
||||
CombineRgn(ncRgn, ncRgn, clientRgn, RGN_DIFF);
|
||||
RedrawWindow(hwnd, nullptr, ncRgn, RDW_FRAME | RDW_INVALIDATE);
|
||||
DeleteObject(clientRgn);
|
||||
DeleteObject(ncRgn);
|
||||
}
|
||||
|
||||
void onMenuSelect()
|
||||
{
|
||||
HWND menuWindow = FindWindow(reinterpret_cast<LPCSTR>(0x8000), nullptr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user