summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qguiapplication.cpp5
-rw-r--r--src/gui/kernel/qplatformwindow.cpp4
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp10
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h5
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm13
6 files changed, 15 insertions, 24 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index fe73278c62..13de8af8b5 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2527,9 +2527,8 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
QCloseEvent event;
QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
- if (e->accepted) {
- *(e->accepted) = event.isAccepted();
- }
+
+ e->eventAccepted = event.isAccepted();
}
void QGuiApplicationPrivate::processFileOpenEvent(QWindowSystemInterfacePrivate::FileOpenEvent *e)
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 4e95751397..2a0cb1094c 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -348,9 +348,7 @@ void QPlatformWindow::setWindowIcon(const QIcon &icon) { Q_UNUSED(icon); }
*/
bool QPlatformWindow::close()
{
- bool accepted = false;
- QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(window(), &accepted);
- return accepted;
+ return QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(window());
}
/*!
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 40a298226a..03be72ca30 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -340,13 +340,11 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleExposeEvent, QWindow *window, const QReg
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
-QT_DEFINE_QPA_EVENT_HANDLER(void, handleCloseEvent, QWindow *window, bool *accepted)
+QT_DEFINE_QPA_EVENT_HANDLER(bool, handleCloseEvent, QWindow *window)
{
- if (window) {
- QWindowSystemInterfacePrivate::CloseEvent *e =
- new QWindowSystemInterfacePrivate::CloseEvent(window, accepted);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
- }
+ Q_ASSERT(window);
+ auto *event = new QWindowSystemInterfacePrivate::CloseEvent(window);
+ return QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(event);
}
/*!
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index fd70eda9ff..4a0bc858a9 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -194,7 +194,7 @@ public:
static void handleExposeEvent(QWindow *window, const QRegion &region);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleCloseEvent(QWindow *window, bool *accepted = nullptr);
+ static bool handleCloseEvent(QWindow *window);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleEnterEvent(QWindow *window, const QPointF &local = QPointF(), const QPointF& global = QPointF());
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index d6513f1836..540170f733 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -123,11 +123,10 @@ public:
class CloseEvent : public WindowSystemEvent {
public:
- explicit CloseEvent(QWindow *w, bool *a = nullptr)
- : WindowSystemEvent(Close), window(w), accepted(a)
+ explicit CloseEvent(QWindow *w)
+ : WindowSystemEvent(Close), window(w)
{ }
QPointer<QWindow> window;
- bool *accepted;
};
class GeometryChangeEvent : public WindowSystemEvent {
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 35b7162346..a744a86695 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -1275,14 +1275,11 @@ void QCocoaWindow::windowWillClose()
bool QCocoaWindow::windowShouldClose()
{
qCDebug(lcQpaWindow) << "QCocoaWindow::windowShouldClose" << window();
- // This callback should technically only determine if the window
- // should (be allowed to) close, but since our QPA API to determine
- // that also involves actually closing the window we do both at the
- // same time, instead of doing the latter in windowWillClose.
- bool accepted = false;
- QWindowSystemInterface::handleCloseEvent(window(), &accepted);
- QWindowSystemInterface::flushWindowSystemEvents();
- return accepted;
+ // This callback should technically only determine if the window
+ // should (be allowed to) close, but since our QPA API to determine
+ // that also involves actually closing the window we do both at the
+ // same time, instead of doing the latter in windowWillClose.
+ return QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(window());
}
// ----------------------------- QPA forwarding -----------------------------