diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index c71c9f0680..3caed80e38 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -613,7 +613,7 @@ QT_WARNING_POP - (BOOL)becomeFirstResponder { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return NO; if (!m_platformWindow->windowIsPopupType()) QWindowSystemInterface::handleWindowActivated([self topLevelWindow]); @@ -624,7 +624,7 @@ QT_WARNING_POP { if (m_platformWindow->shouldRefuseKeyWindowAndFirstResponder()) return NO; - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return NO; if ((m_window->flags() & Qt::ToolTip) == Qt::ToolTip) return NO; @@ -634,7 +634,7 @@ QT_WARNING_POP - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { Q_UNUSED(theEvent) - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return NO; return YES; } @@ -773,7 +773,7 @@ QT_WARNING_POP - (void)mouseDown:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super mouseDown:theEvent]; m_sendUpAsRightButton = false; @@ -824,7 +824,7 @@ QT_WARNING_POP - (void)mouseDragged:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super mouseDragged:theEvent]; if (!(m_buttons & (m_sendUpAsRightButton ? Qt::RightButton : Qt::LeftButton))) qWarning("QNSView mouseDragged: Internal mouse button tracking invalid (missing Qt::LeftButton)"); @@ -833,7 +833,7 @@ QT_WARNING_POP - (void)mouseUp:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super mouseUp:theEvent]; if (m_sendUpAsRightButton) { m_buttons &= ~Qt::RightButton; @@ -889,7 +889,7 @@ QT_WARNING_POP - (void)mouseMovedImpl:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return; QPointF windowPoint; @@ -922,7 +922,7 @@ QT_WARNING_POP Q_UNUSED(theEvent) m_platformWindow->m_windowUnderMouse = true; - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return; // Top-level windows generate enter events for sub-windows. @@ -941,7 +941,7 @@ QT_WARNING_POP Q_UNUSED(theEvent); m_platformWindow->m_windowUnderMouse = false; - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return; // Top-level windows generate leave events for sub-windows. @@ -954,7 +954,7 @@ QT_WARNING_POP - (void)rightMouseDown:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super rightMouseDown:theEvent]; m_buttons |= Qt::RightButton; m_sendUpAsRightButton = true; @@ -963,7 +963,7 @@ QT_WARNING_POP - (void)rightMouseDragged:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super rightMouseDragged:theEvent]; if (!(m_buttons & Qt::RightButton)) qWarning("QNSView rightMouseDragged: Internal mouse button tracking invalid (missing Qt::RightButton)"); @@ -972,7 +972,7 @@ QT_WARNING_POP - (void)rightMouseUp:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super rightMouseUp:theEvent]; m_buttons &= ~Qt::RightButton; m_sendUpAsRightButton = false; @@ -981,7 +981,7 @@ QT_WARNING_POP - (void)otherMouseDown:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super otherMouseDown:theEvent]; m_buttons |= cocoaButton2QtButton([theEvent buttonNumber]); [self handleMouseEvent:theEvent]; @@ -989,7 +989,7 @@ QT_WARNING_POP - (void)otherMouseDragged:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super otherMouseDragged:theEvent]; if (!(m_buttons & ~(Qt::LeftButton | Qt::RightButton))) qWarning("QNSView otherMouseDragged: Internal mouse button tracking invalid (missing Qt::MiddleButton or Qt::ExtraButton*)"); @@ -998,7 +998,7 @@ QT_WARNING_POP - (void)otherMouseUp:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super otherMouseUp:theEvent]; m_buttons &= ~cocoaButton2QtButton([theEvent buttonNumber]); [self handleMouseEvent:theEvent]; @@ -1077,7 +1077,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) - (void)tabletPoint: (NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super tabletPoint:theEvent]; [self handleTabletEvent: theEvent]; @@ -1125,7 +1125,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)tabletProximity: (NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super tabletProximity:theEvent]; ulong timestamp = [theEvent timestamp] * 1000; @@ -1297,7 +1297,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) #ifndef QT_NO_WHEELEVENT - (void)scrollWheel:(NSEvent *)theEvent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super scrollWheel:theEvent]; QPoint angleDelta; @@ -1470,14 +1470,14 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)keyDown:(NSEvent *)nsevent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super keyDown:nsevent]; [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)]; } - (void)keyUp:(NSEvent *)nsevent { - if (m_window->flags() & Qt::WindowTransparentForInput) + if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) return [super keyUp:nsevent]; [self handleKeyEvent:nsevent eventType:int(QEvent::KeyRelease)]; } @@ -1918,8 +1918,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers: [[NSApp currentEvent] modifierFlags]]; QPlatformDragQtResponse response(false, Qt::IgnoreAction, QRect()); - if ([sender draggingSource] != nil) { - QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + if (nativeDrag->currentDrag()) { + // The drag was started from within the application response = QWindowSystemInterface::handleDrag(target, nativeDrag->platformDropData(), mapWindowCoordinates(m_window, target, qt_windowPoint), qtAllowed); [self updateCursorFromDragResponse:response drag:nativeDrag]; } else { @@ -1955,8 +1956,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations([sender draggingSourceOperationMask]); QPlatformDropQtResponse response(false, Qt::IgnoreAction); - if ([sender draggingSource] != nil) { - QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + if (nativeDrag->currentDrag()) { + // The drag was started from within the application response = QWindowSystemInterface::handleDrop(target, nativeDrag->platformDropData(), mapWindowCoordinates(m_window, target, qt_windowPoint), qtAllowed); } else { QCocoaDropData mimeData([sender draggingPasteboard]); |