From 6880b6319c833eef4911be603abd14d3537224f1 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 15 Sep 2021 10:11:27 +0200 Subject: [PATCH] macOS: Use QGuiApplication popup APIs in Cocoa plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This removes more dependencies to the Cocoa plugin managing its own popup stack. Task-number: QTBUG-96450 Change-Id: Id01577739af525a34728f27b790b9aaac29705f2 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnswindow.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index 82daccc68c..bdd2c07f02 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -374,7 +374,7 @@ OSStatus CGSClearWindowTags(const CGSConnectionID, const CGSWindowID, int *, int // close open popups. Presses within the window's content are handled to do that in the // NSView::mouseDown implementation. if (theEvent.type == NSEventTypeLeftMouseDown && mouseEventInFrameStrut) - [qnsview_cast(m_platformWindow->view()) closePopups:theEvent]; + QGuiApplicationPrivate::instance()->closeAllPopups(); [super sendEvent:theEvent]; @@ -385,11 +385,10 @@ OSStatus CGSClearWindowTags(const CGSConnectionID, const CGSWindowID, int *, int // not Qt). However, an active popup is expected to grab any mouse event within the // application, so we need to handle those explicitly and trust Qt's isWindowBlocked // implementation to eat events that shouldn't be delivered anyway. - if (isMouseEvent(theEvent) && QCocoaIntegration::instance()->activePopupWindow() + if (isMouseEvent(theEvent) && QGuiApplicationPrivate::instance()->popupActive() && QGuiApplicationPrivate::instance()->isWindowBlocked(m_platformWindow->window(), nullptr)) { qCDebug(lcQpaWindow) << "Mouse event over modally blocked window" << m_platformWindow->window() - << "while popup" << QCocoaIntegration::instance()->activePopupWindow() - << "is open - redirecting"; + << "while popup is open - redirecting"; [qnsview_cast(m_platformWindow->view()) handleMouseEvent:theEvent]; } if (m_platformWindow->frameStrutEventsEnabled() && mouseEventInFrameStrut)