summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoawindow.mm
diff options
context:
space:
mode:
authorJosh Faust <jfaust@suitabletech.com>2013-03-14 15:13:34 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-26 14:18:16 +0200
commitc90d9b697f6ef549d33047332a9c44b40ded63f5 (patch)
treeef7c7686cfbc86ba6055831a14088b3531cd3026 /src/plugins/platforms/cocoa/qcocoawindow.mm
parente12d384d7b898f949bc5ad27a473eee2ec92a711 (diff)
Fix ignoring close events on OSX
QNSWindowDelegate was not handling windowShouldClose, which is how you can tell Cocoa that your window should not close if the close button is pressed. This change moves the close handling from windowWillClose to windowShouldClose, and adds an optional "accepted" pointer to QWindowSystemInterface::handleCloseEvent so that QNSWindowDelegate can return a true/false value for whether the window should actually close Task-number: QTBUG-28965 Change-Id: I67c6296ad42cbeeb71413e05411467d4e558adb4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoawindow.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 14b9b66c92..8e9fcc443b 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -684,10 +684,12 @@ void QCocoaWindow::windowDidResize()
[m_qtView updateGeometry];
}
-void QCocoaWindow::windowWillClose()
+bool QCocoaWindow::windowShouldClose()
{
- QWindowSystemInterface::handleCloseEvent(window());
+ bool accepted = false;
+ QWindowSystemInterface::handleCloseEvent(window(), &accepted);
QWindowSystemInterface::flushWindowSystemEvents();
+ return accepted;
}
bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const