qt6-declarative/0001-Fix-PointHandler-rejecting-click-events-near-window-.patch
Christophe Marin b37019679f Accepting request 1158450 from home:fusionfuture:branches:KDE:Qt6
- Add patch to help fix PointHandler with HiDPI (kde#482580)
  - 0001-Fix-PointHandler-rejecting-click-events-near-window-.patch

OBS-URL: https://build.opensuse.org/request/show/1158450
OBS-URL: https://build.opensuse.org/package/show/KDE:Qt6/qt6-declarative?expand=0&rev=63
2024-03-16 11:15:24 +00:00

40 lines
1.9 KiB
Diff

From 9089292c495970b00728398f49e8f66bab1f4f32 Mon Sep 17 00:00:00 2001
From: Fushan Wen <qydwhotmail@gmail.com>
Date: Sat, 16 Mar 2024 02:58:08 +0800
Subject: [PATCH] Fix PointHandler rejecting click events near window edge with
HiDPI
When using HiDPI and a click happens near the window edge, the global
position might have fractional parts, but after the global position is
converted to QPoint, the position can be rounded so it happens to stay
at the window edge, so the window geometry will not contain the rounded
position.
Related bugreport: https://bugs.kde.org/show_bug.cgi?id=482580
Pick-to: 6.6 6.7
Change-Id: I51a26f955fd58f2a135c64ceb32ee881a03fcaf8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
---
src/quick/handlers/qquickpointerhandler.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp
index c01cbd039fd..a29c8ae2d32 100644
--- a/src/quick/handlers/qquickpointerhandler.cpp
+++ b/src/quick/handlers/qquickpointerhandler.cpp
@@ -560,10 +560,10 @@ bool QQuickPointerHandler::parentContains(const QPointF &scenePosition) const
{
if (QQuickItem *par = parentItem()) {
if (par->window()) {
- QRect windowGeometry = par->window()->geometry();
+ QRectF windowGeometry = par->window()->geometry();
if (!par->window()->isTopLevel())
- windowGeometry = QRect(QWindowPrivate::get(par->window())->globalPosition(), par->window()->size());
- QPoint screenPosition = par->window()->mapToGlobal(scenePosition.toPoint());
+ windowGeometry = QRectF(QWindowPrivate::get(par->window())->globalPosition(), par->window()->size());
+ QPointF screenPosition = par->window()->mapToGlobal(scenePosition);
if (!windowGeometry.contains(screenPosition))
return false;
}