41 lines
1.2 KiB
Diff
41 lines
1.2 KiB
Diff
Don't quit the program if the last window gets closed.
|
|
|
|
From: Christian Prochaska <christian.prochaska@genode-labs.com>
|
|
|
|
|
|
---
|
|
src/gui/kernel/qwidget.cpp | 20 ++++++++++++++++++++
|
|
1 file changed, 20 insertions(+)
|
|
|
|
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
|
|
index 3a0261e..8667688 100644
|
|
--- a/src/gui/kernel/qwidget.cpp
|
|
+++ b/src/gui/kernel/qwidget.cpp
|
|
@@ -7929,6 +7929,26 @@ bool QWidgetPrivate::close_helper(CloseMode mode)
|
|
QPointer<QWidget> that = q;
|
|
QPointer<QWidget> parentWidget = q->parentWidget();
|
|
|
|
+#ifdef Q_OS_GENODE
|
|
+ /* prevent closing of the last window in the demo */
|
|
+ if (parentWidget.isNull() || !parentWidget->isVisible() || parentWidget->testAttribute(Qt::WA_DontShowOnScreen)) {
|
|
+ QWidgetList list = QApplication::topLevelWidgets();
|
|
+ bool lastWindowClosed = true;
|
|
+ for (int i = 0; i < list.size(); ++i) {
|
|
+ QWidget *w = list.at(i);
|
|
+ if ((w != q) && (w->isVisible() && !w->testAttribute(Qt::WA_DontShowOnScreen))
|
|
+ && !w->parentWidget()) {
|
|
+ lastWindowClosed = false;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ if (lastWindowClosed) {
|
|
+ data.is_closing = 0;
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
+
|
|
#ifdef QT3_SUPPORT
|
|
bool isMain = (QApplicationPrivate::main_widget == q);
|
|
#endif
|