Always round down point coords inside the window.

Or 3839 rounds to 1920 and the point falls outside of Qt window.
This commit is contained in:
John Preston 2023-02-06 12:40:06 +04:00
parent 6e81116513
commit e053e04607

View file

@ -548,8 +548,10 @@ bool WindowHelper::handleNativeEvent(
POINT p{ GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
ScreenToClient(_handle, &p);
const auto mapped = QPoint(p.x, p.y)
/ window()->windowHandle()->devicePixelRatio();
const auto ratio = window()->windowHandle()->devicePixelRatio();
const auto mapped = QPoint(
int(std::floor(p.x / ratio)),
int(std::floor(p.y / ratio)));
*result = [&] {
if (!window()->rect().contains(mapped)) {
return HTTRANSPARENT;