summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcursor.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-04 13:35:20 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-04 12:32:26 +0000
commit5098eae737c5321112ab6c6345acfa36ca483135 (patch)
tree3f9f77bd11cf5f09be6c604be1e1666fe710f58c /src/gui/kernel/qcursor.cpp
parentf5bdd92e5d0217bf3eec13395e4baa95bd8fda37 (diff)
Make QCursor::pos() actually follow the cursor pos
We need to map based on the screen where the cursor actually is. Drag and drop works on xcb now. Note that this change means that QMouseEvent::globalPos() is no longer necessarily the same as QCursor::pos(). Change-Id: I0a4aa0806a3251881890ac6daa09ac7c6c2fd74c Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel/qcursor.cpp')
-rw-r--r--src/gui/kernel/qcursor.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 236b3b0565..d52ecb7a68 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -178,9 +178,14 @@ QT_BEGIN_NAMESPACE
*/
QPoint QCursor::pos(const QScreen *screen)
{
- if (screen)
- if (const QPlatformCursor *cursor = screen->handle()->cursor())
- return QHighDpi::fromNativePixels(cursor->pos(), screen);
+ if (screen) {
+ if (const QPlatformCursor *cursor = screen->handle()->cursor()) {
+ QPlatformScreen *ps = screen->handle();
+ QPoint nativePos = cursor->pos();
+ ps = ps->screenForPosition(nativePos);
+ return QHighDpi::fromNativePixels(nativePos, ps->screen());
+ }
+ }
return QGuiApplicationPrivate::lastCursorPosition.toPoint();
}