From c87f3b22920b43347354ccf9e67f8b4cb6ea8c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 5 Nov 2015 12:00:18 +0100 Subject: Call QPlatformCursor::pointerEvent with native coordinates. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's a QPlatform* class and works in the native (platform) coordinate system. Change-Id: Ibf36bc68d84ecd668b35e0c22e1fa35cfc456a5d Reviewed-by: Friedemann Kleint Reviewed-by: J-P Nurmi Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qguiapplication.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c5762fe1ee..00bad52432 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1821,16 +1821,23 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo if (!window) return; - QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers, e->source); - ev.setTimestamp(e->timestamp); #ifndef QT_NO_CURSOR if (!e->synthetic()) { if (const QScreen *screen = window->screen()) - if (QPlatformCursor *cursor = screen->handle()->cursor()) + if (QPlatformCursor *cursor = screen->handle()->cursor()) { + const QPointF nativeLocalPoint = QHighDpi::toNativePixels(localPoint, screen); + const QPointF nativeGlobalPoint = QHighDpi::toNativePixels(globalPoint, screen); + QMouseEvent ev(type, nativeLocalPoint, nativeLocalPoint, nativeGlobalPoint, + button, buttons, e->modifiers, e->source); + ev.setTimestamp(e->timestamp); cursor->pointerEvent(ev); + } } #endif + QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers, e->source); + ev.setTimestamp(e->timestamp); + if (window->d_func()->blockedByModalWindow) { // a modal window is blocking this window, don't allow mouse events through return; -- cgit v1.2.3