summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2022-01-05 23:10:33 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-12 02:17:56 +0000
commit42bae30da4b11b27ca34ca7bce9e5ded07f7b300 (patch)
treefd478fda52c7f377db921820c9c9244337069b24 /src/gui/kernel
parent90be5ed39e31bae6a41a3c856b1af925e1c73cee (diff)
Make QCursor::setPos() use the correct screen
setPos() takes a screen argument, however this argument indicates which cursor should be moved only and is not usable as an argument to toNativePixels() since the position may be on a sibling screen. Add call to QScreen::virtualSiblingAt to get the target screen. Task-number: QTBUG-99009 Change-Id: I8714ebc93a283c58bc67911315f787c484fb0dd8 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit eef865cdc594c20b6f468d206475ddab48e2819a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qcursor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 20511ef8e6..876cf40bdf 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -251,7 +251,8 @@ void QCursor::setPos(QScreen *screen, int x, int y)
{
if (screen) {
if (QPlatformCursor *cursor = screen->handle()->cursor()) {
- const QPoint devicePos = QHighDpi::toNativePixels(QPoint(x, y), screen);
+ const QPoint pos(x, y);
+ const QPoint devicePos = QHighDpi::toNativePixels(pos, screen->virtualSiblingAt(pos));
// Need to check, since some X servers generate null mouse move
// events, causing looping in applications which call setPos() on
// every mouse move event.