macOS: Remove duplicate code closing popups on window interaction

After 70b94eea10, all popups are closed
on mouseDown within the window frame. As with native applications, the
popup is closed on press, and before the press is delivered to the frame
(ie before the jewel is shown as depressed).

The previous notification handlers for window moving, minimizing, and
closing can now be removed, together with the alternative implementation
of closePopups that relies on the Cocoa plugin maintaining its own
popup stack.

This reverts 048e66a11d.

Task-number: QTBUG-96450
Task-number: QTBUG-77833
Change-Id: I165f3caa64bf9a7b4c4d5455ca33e87029d75f73
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
bb10
Volker Hilsheimer 2021-09-15 10:08:29 +02:00
parent 6880b6319c
commit a6279b74e2
4 changed files with 0 additions and 36 deletions

View File

@ -134,8 +134,6 @@ public:
void beep() const override;
void quit() const override;
void closePopups(QWindow *forWindow = nullptr);
private Q_SLOTS:
void focusWindowChanged(QWindow *);

View File

@ -496,19 +496,6 @@ void QCocoaIntegration::quit() const
[NSApp terminate:nil];
}
void QCocoaIntegration::closePopups(QWindow *forWindow)
{
for (auto it = m_popupWindowStack.begin(); it != m_popupWindowStack.end();) {
auto *popup = *it;
if (!forWindow || popup->window()->transientParent() == forWindow) {
it = m_popupWindowStack.erase(it);
QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(popup->window());
} else {
++it;
}
}
}
void QCocoaIntegration::focusWindowChanged(QWindow *focusWindow)
{
// Don't revert icon just because we lost focus

View File

@ -153,13 +153,11 @@ public:
Q_NOTIFICATION_HANDLER(NSViewFrameDidChangeNotification) void viewDidChangeFrame();
Q_NOTIFICATION_HANDLER(NSViewGlobalFrameDidChangeNotification) void viewDidChangeGlobalFrame();
Q_NOTIFICATION_HANDLER(NSWindowWillMoveNotification) void windowWillMove();
Q_NOTIFICATION_HANDLER(NSWindowDidMoveNotification) void windowDidMove();
Q_NOTIFICATION_HANDLER(NSWindowDidResizeNotification) void windowDidResize();
Q_NOTIFICATION_HANDLER(NSWindowDidEndLiveResizeNotification) void windowDidEndLiveResize();
Q_NOTIFICATION_HANDLER(NSWindowDidBecomeKeyNotification) void windowDidBecomeKey();
Q_NOTIFICATION_HANDLER(NSWindowDidResignKeyNotification) void windowDidResignKey();
Q_NOTIFICATION_HANDLER(NSWindowWillMiniaturizeNotification) void windowWillMiniaturize();
Q_NOTIFICATION_HANDLER(NSWindowDidMiniaturizeNotification) void windowDidMiniaturize();
Q_NOTIFICATION_HANDLER(NSWindowDidDeminiaturizeNotification) void windowDidDeminiaturize();
Q_NOTIFICATION_HANDLER(NSWindowWillEnterFullScreenNotification) void windowWillEnterFullScreen();
@ -170,7 +168,6 @@ public:
Q_NOTIFICATION_HANDLER(NSWindowDidOrderOffScreenNotification) void windowDidOrderOffScreen();
Q_NOTIFICATION_HANDLER(NSWindowDidChangeOcclusionStateNotification) void windowDidChangeOcclusionState();
Q_NOTIFICATION_HANDLER(NSWindowDidChangeScreenNotification) void windowDidChangeScreen();
Q_NOTIFICATION_HANDLER(NSWindowWillCloseNotification) void windowWillClose();
bool windowShouldClose();
bool windowIsPopupType(Qt::WindowType type = Qt::Widget) const;

View File

@ -834,11 +834,6 @@ void QCocoaWindow::windowDidExitFullScreen()
}
}
void QCocoaWindow::windowWillMiniaturize()
{
QCocoaIntegration::instance()->closePopups(window());
}
void QCocoaWindow::windowDidMiniaturize()
{
if (!isContentView())
@ -1159,12 +1154,6 @@ void QCocoaWindow::viewDidChangeGlobalFrame()
// callback should make sure to filter out notifications if they do not
// apply to that QCocoaWindow, e.g. if the window is not a content view.
void QCocoaWindow::windowWillMove()
{
// Close any open popups on window move
QCocoaIntegration::instance()->closePopups();
}
void QCocoaWindow::windowDidMove()
{
if (!isContentView())
@ -1305,13 +1294,6 @@ void QCocoaWindow::windowDidChangeScreen()
}
}
void QCocoaWindow::windowWillClose()
{
// Close any open popups on window closing.
if (window() && !windowIsPopupType(window()->type()))
QCocoaIntegration::instance()->closePopups();
}
// ----------------------- NSWindowDelegate callbacks -----------------------
bool QCocoaWindow::windowShouldClose()