From e7db28fa9ddb6cf165cf239836f3ee50913cd3d3 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 17 Sep 2021 17:13:36 +0200 Subject: macOS: Remove remnant of popup closing logic from Cocoa plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This monitor call back is never called when a popup is open and there's mouse action. Change-Id: I6c45b600ebea16e5fd6c5b3af66fd1242973d747 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoawindow.h | 2 -- src/plugins/platforms/cocoa/qcocoawindow.mm | 28 ---------------------------- 2 files changed, 30 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 419f07b779..fbfe20fe07 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -233,7 +233,6 @@ public: // for QNSView bool isContentView() const; bool alwaysShowToolWindow() const; - void removeMonitor(); enum HandleFlags { NoHandleFlags = 0, @@ -265,7 +264,6 @@ public: // for QNSView static const int NoAlertRequest; NSInteger m_alertRequest; - NSObject *m_monitor; bool m_drawContentBorderGradient; int m_topContentBorderThickness; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 5ffc36a895..6e9166a05a 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -149,7 +149,6 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle) , m_registerTouchCount(0) , m_resizableTransientParent(false) , m_alertRequest(NoAlertRequest) - , m_monitor(nil) , m_drawContentBorderGradient(false) , m_topContentBorderThickness(0) , m_bottomContentBorderThickness(0) @@ -197,8 +196,6 @@ QCocoaWindow::~QCocoaWindow() if ([m_view superview]) [m_view removeFromSuperview]; - removeMonitor(); - // Make sure to disconnect observer in all case if view is valid // to avoid notifications received when deleting when using Qt::AA_NativeWindows attribute if (!isForeignWindow()) @@ -382,21 +379,6 @@ void QCocoaWindow::setVisible(bool visible) } else { [m_view.window orderFront:nil]; } - - // Close popup when clicking outside it - if (window()->type() == Qt::Popup && !(parentCocoaWindow && window()->transientParent()->isActive())) { - removeMonitor(); - NSEventMask eventMask = NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown - | NSEventMaskOtherMouseDown | NSEventMaskMouseMoved; - m_monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:eventMask handler:^(NSEvent *e) { - const auto button = cocoaButton2QtButton(e); - const auto buttons = currentlyPressedMouseButtons(); - const auto eventType = cocoaEvent2QtMouseEvent(e); - const auto globalPoint = QCocoaScreen::mapFromNative(NSEvent.mouseLocation); - const auto localPoint = window()->mapFromGlobal(globalPoint.toPoint()); - QWindowSystemInterface::handleMouseEvent(window(), localPoint, globalPoint, buttons, button, eventType); - }]; - } } } @@ -438,8 +420,6 @@ void QCocoaWindow::setVisible(bool visible) [m_view setHidden:YES]; } - removeMonitor(); - if (parentCocoaWindow && window()->type() == Qt::Popup) { NSWindow *nativeParentWindow = parentCocoaWindow->nativeWindow(); if (m_resizableTransientParent @@ -1659,14 +1639,6 @@ bool QCocoaWindow::alwaysShowToolWindow() const return qt_mac_resolveOption(false, window(), "_q_macAlwaysShowToolWindow", ""); } -void QCocoaWindow::removeMonitor() -{ - if (!m_monitor) - return; - [NSEvent removeMonitor:m_monitor]; - m_monitor = nil; -} - bool QCocoaWindow::setWindowModified(bool modified) { if (!isContentView()) -- cgit v1.2.3