diff options
author | Andreas Hartmetz <ahartmetz@gmail.com> | 2016-01-19 14:30:18 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@theqtcompany.com> | 2016-02-15 16:10:20 +0000 |
commit | e7bf0edfd49de9a4d8285fbe8d878f8fda910e6d (patch) | |
tree | fa51fbe7c13dc48ea0e79fd7646dbbda5b8c5e68 /src/gui/kernel/qsessionmanager.cpp | |
parent | 8c2b4266002736da499d169a0da187e5cdc5381a (diff) |
Add option to disable "session management by closing windows".
That feature is a poor man's session management for applications
that do not implement any specific session management features.
It badly interferes with proper session management support, so
applications must be able to disable it.
This enables fixing applications with
QGuiApplication::quitOnLastWindowClosed() true - the default -
dying too early, before they are enumerated for the list of
applications to restart on session restore, thus preventing them
from being restored. See
https://bugs.kde.org/show_bug.cgi?id=354724
[ChangeLog][QtGui] Qt asking to close windows on session exit as
a fallback session management mechanism has been made optional.
Disabling it fixes session management for applications that
implement full session management. See
QGuiApplication::isFallbackSessionManagementEnabled().
Task-number: QTBUG-49667
Change-Id: Ib22e58c9c64351dea8b7e2a74db91d26dd7ab7aa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/gui/kernel/qsessionmanager.cpp')
-rw-r--r-- | src/gui/kernel/qsessionmanager.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp index f4b56fd01b..c6d23f163c 100644 --- a/src/gui/kernel/qsessionmanager.cpp +++ b/src/gui/kernel/qsessionmanager.cpp @@ -64,22 +64,21 @@ QT_BEGIN_NAMESPACE settings. QSessionManager provides an interface between the application and the - session manager so that the program can work well with the session manager. - In Qt, session management requests for action are handled by the two - signals QGuiApplication::commitDataRequest() and - QGuiApplication::saveStateRequest(). Both provide a reference to a session - manager object as argument, to allow the application to communicate with - the session manager. The session manager can only be accessed through these - functions. + platform's session manager. In Qt, session management requests for action + are handled by the two signals QGuiApplication::commitDataRequest() and + QGuiApplication::saveStateRequest(). Both provide a reference to a + QSessionManager object as argument. The session manager can only be + accessed in slots invoked by these signals. + + \warning If you use QSessionManager, you should disable fallback session + management: QGuiApplication::setFallbackSessionManagementEnabled(). No user interaction is possible \e unless the application gets explicit permission from the session manager. You ask for permission by calling allowsInteraction() or, if it is really urgent, allowsErrorInteraction(). Qt does not enforce this, but the session manager may. - You can try to abort the shutdown process by calling cancel(). The default - commitData() function does this if some top-level window rejected its - closeEvent(). + You can try to abort the shutdown process by calling cancel(). For sophisticated session managers provided on Unix/X11, QSessionManager offers further possibilities to fine-tune an application's session |