diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 66c3b6fad4..e42fbad00e 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -71,8 +71,6 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet") static QTouchDevice *touchDevice = 0; -static bool _q_dontOverrideCtrlLMB = false; - @interface NSEvent (Qt_Compile_Leopard_DeviceDelta) - (CGFloat)deviceDeltaX; - (CGFloat)deviceDeltaY; @@ -133,11 +131,6 @@ static bool _q_dontOverrideCtrlLMB = false; @implementation QT_MANGLE_NAMESPACE(QNSView) -+ (void)initialize -{ - _q_dontOverrideCtrlLMB = qt_mac_resolveOption(false, "QT_MAC_DONT_OVERRIDE_CTRL_LMB"); -} - - (id) init { if (self = [super initWithFrame:NSZeroRect]) { @@ -153,6 +146,7 @@ static bool _q_dontOverrideCtrlLMB = false; m_shouldSetGLContextinDrawRect = false; #endif currentCustomDragTypes = 0; + m_dontOverrideCtrlLMB = false; m_sendUpAsRightButton = false; m_inputSource = 0; m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self]; @@ -199,6 +193,7 @@ static bool _q_dontOverrideCtrlLMB = false; m_platformWindow = platformWindow; m_sendKeyEvent = false; + m_dontOverrideCtrlLMB = qt_mac_resolveOption(false, platformWindow->window(), "_q_platform_MacDontOverrideCtrlLMB", "QT_MAC_DONT_OVERRIDE_CTRL_LMB"); m_trackingArea = nil; #ifdef QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR @@ -291,7 +286,7 @@ static bool _q_dontOverrideCtrlLMB = false; #if 0 //geometry = QRectF::fromCGRect([self frame]).toRect(); qDebug() << "nsview updateGeometry" << m_platformWindow->window(); - QRect screenRect = QRectF::fromCGRect([m_platformWindow->m_nsWindow convertRectToScreen:[self frame]]).toRect(); + QRect screenRect = QRectF::fromCGRect([m_platformWindow->nativeWindow() convertRectToScreen:[self frame]]).toRect(); qDebug() << "screenRect" << screenRect; screenRect.moveTop(qt_mac_flipYCoordinate(screenRect.y() + screenRect.height())); @@ -299,7 +294,7 @@ static bool _q_dontOverrideCtrlLMB = false; qDebug() << "geometry" << geometry; #endif //geometry = QRect(screenRect.origin.x, qt_mac_flipYCoordinate(screenRect.origin.y + screenRect.size.height), screenRect.size.width, screenRect.size.height); - } else if (m_platformWindow->m_nsWindow) { + } else if (m_platformWindow->isContentView()) { // top level window, get window rect and flip y. NSRect rect = [self frame]; NSRect windowRect = [[self window] frame]; @@ -312,7 +307,7 @@ static bool _q_dontOverrideCtrlLMB = false; geometry = QRectF::fromCGRect(NSRectToCGRect([self frame])).toRect(); } - if (m_platformWindow->m_nsWindow && geometry == m_platformWindow->geometry()) + if (m_platformWindow->isContentView() && geometry == m_platformWindow->geometry()) return; const bool isResize = geometry.size() != m_platformWindow->geometry().size(); @@ -434,8 +429,8 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)invalidateWindowShadowIfNeeded { - if (m_shouldInvalidateWindowShadow && m_platformWindow->m_nsWindow) { - [m_platformWindow->m_nsWindow invalidateShadow]; + if (m_shouldInvalidateWindowShadow && m_platformWindow->isContentView()) { + [m_platformWindow->nativeWindow() invalidateShadow]; m_shouldInvalidateWindowShadow = false; } } @@ -513,7 +508,7 @@ static bool _q_dontOverrideCtrlLMB = false; // Optimization: Copy frame buffer content instead of blending for // top-level windows where Qt fills the entire window content area. // (But don't overpaint the title-bar gradient) - if (m_platformWindow->m_nsWindow && !m_platformWindow->m_drawContentBorderGradient) + if (m_platformWindow->isContentView() && !m_platformWindow->m_drawContentBorderGradient) CGContextSetBlendMode(cgContext, kCGBlendModeCopy); CGContextDrawImage(cgContext, dirtyWindowRect, cleanImg); @@ -858,7 +853,7 @@ static bool _q_dontOverrideCtrlLMB = false; if ([self hasMarkedText]) { [[NSTextInputContext currentInputContext] handleEvent:theEvent]; } else { - if (!_q_dontOverrideCtrlLMB && [QNSView convertKeyModifiers:[theEvent modifierFlags]] & Qt::MetaModifier) { + if (!m_dontOverrideCtrlLMB && [QNSView convertKeyModifiers:[theEvent modifierFlags]] & Qt::MetaModifier) { m_buttons |= Qt::RightButton; m_sendUpAsRightButton = true; } else { @@ -977,7 +972,7 @@ static bool _q_dontOverrideCtrlLMB = false; // the time of the leave. This is dificult to accomplish by // handling mouseEnter and mouseLeave envents, since they are sent // individually to different views. - if (m_platformWindow->m_nsWindow && childWindow) { + if (m_platformWindow->isContentView() && childWindow) { if (childWindow != m_platformWindow->m_enterLeaveTargetWindow) { QWindowSystemInterface::handleEnterLeaveEvent(childWindow, m_platformWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint); m_platformWindow->m_enterLeaveTargetWindow = childWindow; @@ -1004,7 +999,7 @@ static bool _q_dontOverrideCtrlLMB = false; return; // Top-level windows generate enter events for sub-windows. - if (!m_platformWindow->m_nsWindow) + if (!m_platformWindow->isContentView()) return; QPointF windowPoint; @@ -1026,7 +1021,7 @@ static bool _q_dontOverrideCtrlLMB = false; return; // Top-level windows generate leave events for sub-windows. - if (!m_platformWindow->m_nsWindow) + if (!m_platformWindow->isContentView()) return; QWindowSystemInterface::handleLeaveEvent(m_platformWindow->m_enterLeaveTargetWindow); @@ -2077,7 +2072,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); if (nativeDrag->currentDrag()) { // The drag was started from within the application - response = QWindowSystemInterface::handleDrag(target, nativeDrag->platformDropData(), mapWindowCoordinates(m_platformWindow->window(), target, qt_windowPoint), qtAllowed); + response = QWindowSystemInterface::handleDrag(target, nativeDrag->dragMimeData(), mapWindowCoordinates(m_platformWindow->window(), target, qt_windowPoint), qtAllowed); [self updateCursorFromDragResponse:response drag:nativeDrag]; } else { QCocoaDropData mimeData([sender draggingPasteboard]); @@ -2121,7 +2116,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); if (nativeDrag->currentDrag()) { // The drag was started from within the application - response = QWindowSystemInterface::handleDrop(target, nativeDrag->platformDropData(), mapWindowCoordinates(m_platformWindow->window(), target, qt_windowPoint), qtAllowed); + response = QWindowSystemInterface::handleDrop(target, nativeDrag->dragMimeData(), mapWindowCoordinates(m_platformWindow->window(), target, qt_windowPoint), qtAllowed); } else { QCocoaDropData mimeData([sender draggingPasteboard]); response = QWindowSystemInterface::handleDrop(target, &mimeData, mapWindowCoordinates(m_platformWindow->window(), target, qt_windowPoint), qtAllowed); |