From 4a58e7f64e5922e7815a98244c4b8dda1689ff26 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 2 Dec 2009 17:04:08 +0100 Subject: 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 --- src/gui/kernel/qcocoaview_mac.mm | 11 +++++++++-- 1 file 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; -- cgit v0.12