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

Fixed menu bar highlighting when window is not in top-left corner of desktop

This commit is contained in:
narzoul 2019-12-31 11:40:27 +01:00
parent 743d19bf25
commit 6f14ddf9ae

View File

@ -82,6 +82,16 @@ namespace
return hasDisplayDcArg(t) || hasDisplayDcArg(params...);
}
bool lpToScreen(HWND hwnd, HDC dc, POINT& p)
{
LPtoDP(dc, &p, 1);
RECT wr = {};
GetWindowRect(hwnd, &wr);
p.x += wr.left;
p.y += wr.top;
return true;
}
template <typename T>
T replaceDc(T t)
{
@ -129,7 +139,7 @@ namespace
RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE);
}
else if (GetCurrentThreadId() == GetWindowThreadProcessId(hwnd, nullptr) &&
LPtoDP(hdc, &p, 1) &&
lpToScreen(hwnd, hdc, p) &&
HTMENU == SendMessage(hwnd, WM_NCHITTEST, 0, (p.y << 16) | (p.x & 0xFFFF)))
{
WINDOWINFO wi = {};