summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qsimpledrag.cpp
diff options
context:
space:
mode:
authorÀlex Fiestas <afiestas@kde.org>2017-01-15 00:54:43 +0100
committerAleix Pol <aleixpol@codereview.qt-project.org>2017-09-04 14:35:18 +0000
commit7d323397628e808f49ee9477515a35d743afd131 (patch)
treea28e6d534349d1071aff4ec834c51b7d41a6e25a /src/gui/kernel/qsimpledrag.cpp
parent52bda430af2749da1a0467b71d9cca5208f22402 (diff)
Pass m_drag_icon_window to getNativeMousePos instead of Event QObject
The QWindow passed to eventFilter is static so it might be in a different screen when we call getNativeMousePos, resulting in negative position and all sorts of glitches. Change-Id: Ibc848c6d85d8b6932ee379aa77851094212a0db2 Reviewed-by: David Edmundson <davidedmundson@kde.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui/kernel/qsimpledrag.cpp')
-rw-r--r--src/gui/kernel/qsimpledrag.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index fc62273325..a1e25dc53c 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -117,9 +117,9 @@ void QBasicDrag::disableEventFilter()
}
-static inline QPoint getNativeMousePos(QEvent *e, QObject *o)
+static inline QPoint getNativeMousePos(QEvent *e, QWindow *window)
{
- return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPos(), qobject_cast<QWindow*>(o));
+ return QHighDpi::toNativePixels(static_cast<QMouseEvent *>(e)->globalPos(), window);
}
bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
@@ -156,14 +156,14 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e)
case QEvent::MouseMove:
{
- QPoint nativePosition = getNativeMousePos(e, o);
+ QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window);
move(nativePosition);
return true; // Eat all mouse move events
}
case QEvent::MouseButtonRelease:
disableEventFilter();
if (canDrop()) {
- QPoint nativePosition = getNativeMousePos(e, o);
+ QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window);
drop(nativePosition);
} else {
cancel();