summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qt_cocoa_helpers_mac.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2011-02-18 09:35:29 +0100
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2011-02-18 09:35:29 +0100
commit45f8d9f78c8357c087a71346e0815c23997d67b4 (patch)
tree241faff1b5061e6ac5c855fcb4177a2a4da9ed87 /src/gui/kernel/qt_cocoa_helpers_mac.mm
parent8f74a64f3f2f5a6273c5e7de1591585a97dff82d (diff)
Cocoa: use mouse location from event
This is offcourse important, and the bug was revealed when calling qApp->processEvents(QEventLoop:excludeUserInputEvents), as this call would que up mouse events and dispatch them later on. And offcourse, the mouse would have changed position at that point.
Diffstat (limited to 'src/gui/kernel/qt_cocoa_helpers_mac.mm')
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index c8132e806d..af8692d67d 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1048,7 +1048,6 @@ QWidget *qt_mac_getTargetForKeyEvent(QWidget *widgetThatReceivedEvent)
// events
QWidget *qt_mac_getTargetForMouseEvent(
// You can call this function without providing an event.
- // If so, set returnGlobalPoint before the call.
NSEvent *event,
QEvent::Type eventType,
QPoint &returnLocalPoint,
@@ -1057,7 +1056,8 @@ QWidget *qt_mac_getTargetForMouseEvent(
QWidget **returnWidgetUnderMouse)
{
Q_UNUSED(event);
- returnGlobalPoint = flipPoint([NSEvent mouseLocation]).toPoint();
+ NSPoint nsglobalpoint = event ? [[event window] convertBaseToScreen:[event locationInWindow]] : [NSEvent mouseLocation];
+ returnGlobalPoint = flipPoint(nsglobalpoint).toPoint();
QWidget *mouseGrabber = QWidget::mouseGrabber();
bool buttonDownNotBlockedByModal = qt_button_down && !QApplicationPrivate::isBlockedByModal(qt_button_down);
QWidget *popup = QApplication::activePopupWidget();