summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-12-02 16:04:08 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-12-03 10:03:10 (GMT)
commit4a58e7f64e5922e7815a98244c4b8dda1689ff26 (patch)
tree1ebe902bb7ce7e7901eebd75575fc1856c649b57 /src/gui
parent3efae3272151f0abf55af742c2618be2a35455a5 (diff)
downloadQt-4a58e7f64e5922e7815a98244c4b8dda1689ff26.zip
Qt-4a58e7f64e5922e7815a98244c4b8dda1689ff26.tar.gz
Qt-4a58e7f64e5922e7815a98244c4b8dda1689ff26.tar.bz2
Improved mouse wheel event delivery on Mac.
When a popup is open we should not deliver wheel events to widget outside of the popup - native Cocoa applications don't do that. Reviewed-by: Richard
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index a4da25f..000f223 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -777,12 +777,19 @@ extern "C" {
NSPoint windowPoint = [theEvent locationInWindow];
NSPoint globalPoint = [[theEvent window] convertBaseToScreen:windowPoint];
NSPoint localPoint = [self convertPoint:windowPoint fromView:nil];
- QPoint qlocal = QPoint(localPoint.x, localPoint.y);
- QPoint qglobal = QPoint(globalPoint.x, globalPoint.y);
+ QPoint qlocal = QPoint(localPoint.x, flipYCoordinate(localPoint.y));
+ QPoint qglobal = QPoint(globalPoint.x, flipYCoordinate(globalPoint.y));
Qt::MouseButton buttons = cocoaButton2QtButton([theEvent buttonNumber]);
bool wheelOK = false;
Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]);
QWidget *widgetToGetMouse = qwidget;
+ // if popup is open it should get wheel events if the cursor is over the popup,
+ // otherwise the event should be ignored.
+ if (QWidget *popup = qAppInstance()->activePopupWidget()) {
+ if (!popup->geometry().contains(qglobal))
+ return;
+ }
+
int deltaX = 0;
int deltaY = 0;
int deltaZ = 0;