macOS: Remove remnant of popup closing logic from Cocoa plugin

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ø <tor.arne.vestbo@qt.io>
This commit is contained in:
Volker Hilsheimer 2021-09-17 17:13:36 +02:00
parent 0d3b395c16
commit e7db28fa9d
2 changed files with 0 additions and 30 deletions

View File

@ -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;

View File

@ -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())