summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication.cpp
diff options
context:
space:
mode:
authorAndreas Hartmetz <andreas@ixgreen.de>2020-08-29 10:59:16 +0200
committerAndreas Hartmetz <andreas@ixgreen.de>2020-09-01 10:16:15 +0200
commit7f878c6217754dd2b63401bf1c006476e5dc27eb (patch)
tree2b62609826b7b921d2fdea9ce726c7d56ab7b2b5 /src/gui/kernel/qguiapplication.cpp
parent98f41552e4c3d0e70b56bc8fc37005d438c185ae (diff)
Remove "fallback session management"
With the Qt6 compatibility break, it can finally be removed. Closing windows (which might quit the application with quitOnLastWindowClosed() true, the default) acted contrary to the documentation of the commitDataRequest() signal, which could have been a hint. This removes the workaround API from the fix for QTBUG-49667 and also removes the problematic feature that it worked around. Change-Id: I672be58864ef062df7fb7f2a81658b92c4feedd2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/gui/kernel/qguiapplication.cpp')
-rw-r--r--src/gui/kernel/qguiapplication.cpp88
1 files changed, 1 insertions, 87 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index d3e97ebe5c..b8acf5c396 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -162,10 +162,6 @@ QPlatformTheme *QGuiApplicationPrivate::platform_theme = nullptr;
QList<QObject *> QGuiApplicationPrivate::generic_plugin_list;
-#ifndef QT_NO_SESSIONMANAGER
-bool QGuiApplicationPrivate::is_fallback_session_management_enabled = true;
-#endif
-
enum ApplicationResourceFlags
{
ApplicationFontExplicitlySet = 0x2
@@ -721,9 +717,6 @@ QGuiApplication::~QGuiApplication()
QGuiApplicationPrivate::highDpiScalingUpdated = false;
QGuiApplicationPrivate::currentDragWindow = nullptr;
QGuiApplicationPrivate::tabletDevicePoints.clear();
-#ifndef QT_NO_SESSIONMANAGER
- QGuiApplicationPrivate::is_fallback_session_management_enabled = true;
-#endif
QGuiApplicationPrivate::mousePressTime = 0;
QGuiApplicationPrivate::mousePressX = QGuiApplicationPrivate::mousePressY = 0;
}
@@ -3649,27 +3642,6 @@ bool QGuiApplicationPrivate::shouldQuitInternal(const QWindowList &processedWind
return true;
}
-bool QGuiApplicationPrivate::tryCloseAllWindows()
-{
- return tryCloseRemainingWindows(QWindowList());
-}
-
-bool QGuiApplicationPrivate::tryCloseRemainingWindows(QWindowList processedWindows)
-{
- QWindowList list = QGuiApplication::topLevelWindows();
- for (int i = 0; i < list.size(); ++i) {
- QWindow *w = list.at(i);
- if (w->isVisible() && !processedWindows.contains(w)) {
- if (!w->close())
- return false;
- processedWindows.append(w);
- list = QGuiApplication::topLevelWindows();
- i = -1;
- }
- }
- return true;
-}
-
void QGuiApplicationPrivate::processApplicationTermination(QWindowSystemInterfacePrivate::WindowSystemEvent *windowSystemEvent)
{
QEvent event(QEvent::Quit);
@@ -3771,57 +3743,6 @@ void QGuiApplicationPrivate::setApplicationState(Qt::ApplicationState state, boo
emit qApp->applicationStateChanged(applicationState);
}
-#ifndef QT_NO_SESSIONMANAGER
-// ### Qt6: consider removing the feature or making it less intrusive
-/*!
- \since 5.6
-
- Returns whether QGuiApplication will use fallback session management.
-
- The default is \c true.
-
- If this is \c true and the session manager allows user interaction,
- QGuiApplication will try to close toplevel windows after
- commitDataRequest() has been emitted. If a window cannot be closed, session
- shutdown will be canceled and the application will keep running.
-
- Fallback session management only benefits applications that have an
- "are you sure you want to close this window?" feature or other logic that
- prevents closing a toplevel window depending on certain conditions, and
- that do nothing to explicitly implement session management. In applications
- that \e do implement session management using the proper session management
- API, fallback session management interferes and may break session
- management logic.
-
- \warning If all windows \e are closed due to fallback session management
- and quitOnLastWindowClosed() is \c true, the application will quit before
- it is explicitly instructed to quit through the platform's session
- management protocol. That violation of protocol may prevent the platform
- session manager from saving application state.
-
- \sa setFallbackSessionManagementEnabled(),
- QSessionManager::allowsInteraction(), saveStateRequest(),
- commitDataRequest(), {Session Management}
-*/
-bool QGuiApplication::isFallbackSessionManagementEnabled()
-{
- return QGuiApplicationPrivate::is_fallback_session_management_enabled;
-}
-
-/*!
- \since 5.6
-
- Sets whether QGuiApplication will use fallback session management to
- \a enabled.
-
- \sa isFallbackSessionManagementEnabled()
-*/
-void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled)
-{
- QGuiApplicationPrivate::is_fallback_session_management_enabled = enabled;
-}
-#endif // QT_NO_SESSIONMANAGER
-
/*!
\since 4.2
\fn void QGuiApplication::commitDataRequest(QSessionManager &manager)
@@ -3846,8 +3767,7 @@ void QGuiApplication::setFallbackSessionManagementEnabled(bool enabled)
\note You should use Qt::DirectConnection when connecting to this signal.
- \sa setFallbackSessionManagementEnabled(), isSessionRestored(),
- sessionId(), saveStateRequest(), {Session Management}
+ \sa isSessionRestored(), sessionId(), saveStateRequest(), {Session Management}
*/
/*!
@@ -3955,13 +3875,7 @@ void QGuiApplicationPrivate::commitData()
{
Q_Q(QGuiApplication);
is_saving_session = true;
-
emit q->commitDataRequest(*session_manager);
- if (is_fallback_session_management_enabled && session_manager->allowsInteraction()
- && !tryCloseAllWindows()) {
- session_manager->cancel();
- }
-
is_saving_session = false;
}