Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandsessionmanager.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 David Edmundson <davidedmundson@kde.org>
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qwaylandsessionmanager_p.h"
6
7
#
ifndef
QT_NO_SESSIONMANAGER
8
9
#
include
"qwaylanddisplay_p.h"
10
#
include
"qwaylandwindow_p.h"
11
12
#
include
<
private
/
qsessionmanager_p
.
h
>
13
#
include
<
private
/
qguiapplication_p
.
h
>
14
15
#
include
<
QtCore
/
QDebug
>
16
17
QT_BEGIN_NAMESPACE
18
19
namespace
QtWaylandClient
{
20
21
QWaylandSessionManager
::
QWaylandSessionManager
(
QWaylandDisplay
*
display
,
const
QString
&
id
)
22
:
QObject
(
nullptr
)
23
,
QPlatformSessionManager
(
id
,
QString
())
24
,
mDisplay
(
display
)
25
{
26
if
(!
display
->
xxSessionManager
())
27
return
;
28
29
// The protocol also exposes a way of supporting crash handling to expose later
30
startSession
();
31
}
32
33
QWaylandSession
*
QWaylandSessionManager
::
session
()
const
34
{
35
return
mSession
.
data
();
36
}
37
38
QWaylandSessionManager
*
QWaylandSessionManager
::
instance
()
39
{
40
auto
*
qGuiAppPriv
=
QGuiApplicationPrivate
::
instance
();
41
auto
*
managerPrivate
=
static_cast
<
QSessionManagerPrivate
*>(
QObjectPrivate
::
get
(
qGuiAppPriv
->
session_manager
));
42
return
static_cast
<
QWaylandSessionManager
*>(
managerPrivate
->
platformSessionManager
);
43
}
44
45
void
QWaylandSessionManager
::
setSessionId
(
const
QString
&
id
)
46
{
47
m_sessionId
=
id
;
48
}
49
50
void
QWaylandSessionManager
::
startSession
()
51
{
52
QtWayland
::
xx_session_manager_v1
::
reason
restoreReason
=
QtWayland
::
xx_session_manager_v1
::
reason_launch
;
53
if
(!
sessionId
().
isEmpty
()) {
54
restoreReason
=
QtWayland
::
xx_session_manager_v1
::
reason_session_restore
;
55
}
56
mSession
.
reset
(
new
QWaylandSession
(
this
));
57
mSession
->
init
(
mDisplay
->
xxSessionManager
()->
get_session
(
restoreReason
,
sessionId
()));
58
mDisplay
->
forceRoundTrip
();
59
}
60
61
QWaylandSession
::
QWaylandSession
(
QWaylandSessionManager
*
sessionManager
)
62
:
mSessionManager
(
sessionManager
)
63
{
64
}
65
66
QWaylandSession
::~
QWaylandSession
() {
67
// There's also remove which is another dtor
68
// depending on whether we're meant to clean up server side or not
69
// we might need to expose that later
70
destroy
();
71
}
72
73
void
QWaylandSession
::
xx_session_v1_created
(
const
QString
&
id
) {
74
qCDebug
(
lcQpaWayland
) <<
"Session created"
<<
id
;
75
mSessionManager
->
setSessionId
(
id
);
76
}
77
78
void
QWaylandSession
::
xx_session_v1_restored
() {
79
qCDebug
(
lcQpaWayland
) <<
"Session restored"
;
80
// session Id won't have change, do nothing
81
}
82
83
void
QWaylandSession
::
xx_session_v1_replaced
() {
84
qCDebug
(
lcQpaWayland
) <<
"Session replaced"
;
85
mSessionManager
->
setSessionId
(
QString
());
86
}
87
88
}
89
90
QT_END_NAMESPACE
91
92
#
endif
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
QtWaylandClient
Definition
qwaylandclientextension.h:16
qtbase
src
plugins
platforms
wayland
qwaylandsessionmanager.cpp
Generated on
for Qt by
1.16.1