From e053e04607653c8a304c72ff901a8e628dd94dbf Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 6 Feb 2023 12:40:06 +0400 Subject: [PATCH] Always round down point coords inside the window. Or 3839 rounds to 1920 and the point falls outside of Qt window. --- ui/platform/win/ui_window_win.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/platform/win/ui_window_win.cpp b/ui/platform/win/ui_window_win.cpp index 73572ce..563e12c 100644 --- a/ui/platform/win/ui_window_win.cpp +++ b/ui/platform/win/ui_window_win.cpp @@ -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;