Open tonsky opened 9 months ago
I'm working on this now as part of #286 -- it might take me some days to get the PR ready, but this local code seems to work.
RECT jwm::WindowWin32::_getWindowRectSimple() const {
RECT rect;
// TODO: continue using old implementation if "OS major version is < 6" (Vista)
// GetWindowRect(_hWnd, &rect);
DwmGetWindowAttribute(_hWnd, DWMWA_EXTENDED_FRAME_BOUNDS, &rect, sizeof(rect));
return rect;
}
jwm::IRect jwm::WindowWin32::getWindowRect() const {
RECT rect = _getWindowRectSimple();
return IRect{rect.left, rect.top, rect.right, rect.bottom};
}
I've replaced all calls to winAPI GetWindowRect
with the internal getWindowRectSimple
& this is working so far.
They shouldn’t. We want window bounds excluding the drop shadow, both for getting and setting window position and size.
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowrect#return-value