| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<protocol name="xx_session_management_v1"> |
| 3 |
<copyright> |
| 4 |
Copyright 2018 Mike Blumenkrantz |
| 5 |
Copyright 2018 Samsung Electronics Co., Ltd |
| 6 |
Copyright 2018 Red Hat Inc. |
| 7 |
|
| 8 |
Permission is hereby granted, free of charge, to any person obtaining a |
| 9 |
copy of this software and associated documentation files (the "Software"), |
| 10 |
to deal in the Software without restriction, including without limitation |
| 11 |
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 12 |
and/or sell copies of the Software, and to permit persons to whom the |
| 13 |
Software is furnished to do so, subject to the following conditions: |
| 14 |
|
| 15 |
The above copyright notice and this permission notice (including the next |
| 16 |
paragraph) shall be included in all copies or substantial portions of the |
| 17 |
Software. |
| 18 |
|
| 19 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 22 |
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 23 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 24 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 25 |
DEALINGS IN THE SOFTWARE. |
| 26 |
</copyright> |
| 27 |
|
| 28 |
<description summary="Protocol for managing application sessions"> |
| 29 |
This description provides a high-level overview of the interplay between |
| 30 |
the interfaces defined this protocol. For details, see the protocol |
| 31 |
specification. |
| 32 |
|
| 33 |
The xx_session_manager protocol declares interfaces necessary to |
| 34 |
allow clients to restore toplevel state from previous executions. The |
| 35 |
xx_session_manager_v1.get_session request can be used to obtain a |
| 36 |
xx_session_v1 resource representing the state of a set of toplevels. |
| 37 |
|
| 38 |
Clients may obtain the session string to use in future calls through |
| 39 |
the xx_session_v1.created event. Compositors will use this string |
| 40 |
as an identifiable token for future runs, possibly storing data about |
| 41 |
the related toplevels in persistent storage. |
| 42 |
|
| 43 |
Toplevels are managed through the xx_session_v1.add_toplevel and |
| 44 |
xx_session_toplevel_v1.remove pair of requests. Clients will explicitly |
| 45 |
request a toplevel to be restored according to prior state through the |
| 46 |
xx_session_v1.restore_toplevel request before the toplevel is mapped. |
| 47 |
|
| 48 |
Warning! The protocol described in this file is currently in the testing |
| 49 |
phase. Backward compatible changes may be added together with the |
| 50 |
corresponding interface version bump. Backward incompatible changes can |
| 51 |
only be done by creating a new major version of the extension. |
| 52 |
</description> |
| 53 |
|
| 54 |
<interface name="xx_session_manager_v1" version="1"> |
| 55 |
<description summary="manage sessions for applications"> |
| 56 |
The xx_session_manager interface defines base requests for creating and |
| 57 |
managing a session for an application. Sessions persist across application |
| 58 |
and compositor restarts unless explicitly destroyed. A session is created |
| 59 |
for the purpose of maintaining an application's xdg_toplevel surfaces |
| 60 |
across compositor or application restarts. The compositor should remember |
| 61 |
as many states as possible for surfaces in a given session, but there is |
| 62 |
no requirement for which states must be remembered. |
| 63 |
</description> |
| 64 |
|
| 65 |
<enum name="error"> |
| 66 |
<entry name="in_use" summary="a requested session is already in use" |
| 67 |
value="1"/> |
| 68 |
</enum> |
| 69 |
|
| 70 |
<enum name="reason"> |
| 71 |
<description summary="reason for getting a session"> |
| 72 |
The reason may determine in what way a session restores the window |
| 73 |
management state of associated toplevels. |
| 74 |
|
| 75 |
For example newly launched applications might be launched on the active |
| 76 |
workspace with restored size and position, while a recovered |
| 77 |
applications might restore additional state such as active workspace and |
| 78 |
stacking order. |
| 79 |
</description> |
| 80 |
<entry name="launch" value="1"> |
| 81 |
<description summary="an app is newly launched"> |
| 82 |
A new app instance is launched, for example from an app launcher. |
| 83 |
</description> |
| 84 |
</entry> |
| 85 |
<entry name="recover" value="2"> |
| 86 |
<description summary="an app recovered"> |
| 87 |
A app instance is recovering from for example a compositor or app crash. |
| 88 |
</description> |
| 89 |
</entry> |
| 90 |
<entry name="session_restore" value="3"> |
| 91 |
<description summary="an app restored"> |
| 92 |
A app instance is restored, for example part of a restored session, or |
| 93 |
restored from having been temporarily terminated due to resource |
| 94 |
constraints. |
| 95 |
</description> |
| 96 |
</entry> |
| 97 |
</enum> |
| 98 |
|
| 99 |
<request name="destroy" type="destructor"> |
| 100 |
<description summary="Destroy this object"> |
| 101 |
This has no effect other than to destroy the xx_session_manager object. |
| 102 |
</description> |
| 103 |
</request> |
| 104 |
|
| 105 |
<request name="get_session"> |
| 106 |
<description summary="create or restore a session"> |
| 107 |
Create a session object corresponding to either an existing session |
| 108 |
identified by the given session identifier string or a new session. |
| 109 |
While the session object exists, the session is considered to be "in |
| 110 |
use". |
| 111 |
|
| 112 |
If a identifier string represents a session that is currently actively |
| 113 |
in use by the the same client, an 'in_use' error is raised. If some |
| 114 |
other client is currently using the same session, the new session will |
| 115 |
replace managing the associated state. |
| 116 |
|
| 117 |
NULL is passed to initiate a new session. If an id is passed which does |
| 118 |
not represent a valid session, the compositor treats it as if NULL had |
| 119 |
been passed. |
| 120 |
|
| 121 |
A client is allowed to have any number of in use sessions at the same |
| 122 |
time. |
| 123 |
</description> |
| 124 |
<arg name="id" type="new_id" interface="xx_session_v1"/> |
| 125 |
<arg name="reason" type="uint" enum="reason" |
| 126 |
summary="reason for session"/> |
| 127 |
<arg name="session" type="string" |
| 128 |
summary="the session to restore" |
| 129 |
allow-null="true"/> |
| 130 |
</request> |
| 131 |
</interface> |
| 132 |
|
| 133 |
<interface name="xx_session_v1" version="1"> |
| 134 |
<description summary="A session for an application"> |
| 135 |
A xx_session_v1 object represents a session for an application. While the |
| 136 |
object exists, all surfaces which have been added to the session will |
| 137 |
have states stored by the compositor which can be reapplied at a later |
| 138 |
time. Two sessions cannot exist for the same identifier string. |
| 139 |
|
| 140 |
States for surfaces added to a session are automatically updated by the |
| 141 |
compositor when they are changed. |
| 142 |
|
| 143 |
Surfaces which have been added to a session are automatically removed from |
| 144 |
the session if xdg_toplevel.destroy is called for the surface. |
| 145 |
</description> |
| 146 |
|
| 147 |
<enum name="error"> |
| 148 |
<entry name="invalid_restore" |
| 149 |
summary="restore cannot be performed after initial toplevel commit" |
| 150 |
value="1"/> |
| 151 |
<entry name="name_in_use" |
| 152 |
summary="toplevel name is already in used" |
| 153 |
value="2"/> |
| 154 |
<entry name="already_mapped" |
| 155 |
summary="toplevel was already mapped when restored" |
| 156 |
value="3"/> |
| 157 |
</enum> |
| 158 |
|
| 159 |
<request name="destroy" type="destructor"> |
| 160 |
<description summary="Destroy the session"> |
| 161 |
Destroy a session object, preserving the current state but not continuing |
| 162 |
to make further updates if state changes occur. This makes the associated |
| 163 |
xx_toplevel_session_v1 objects inert. |
| 164 |
</description> |
| 165 |
</request> |
| 166 |
|
| 167 |
<request name="remove" type="destructor"> |
| 168 |
<description summary="Remove the session"> |
| 169 |
Remove the session, making it no longer available for restoration. A |
| 170 |
compositor should in response to this request remove the data related to |
| 171 |
this session from its storage. |
| 172 |
</description> |
| 173 |
</request> |
| 174 |
|
| 175 |
<request name="add_toplevel"> |
| 176 |
<description summary="add a new surface to the session"> |
| 177 |
Attempt to add a given surface to the session. The passed name is used |
| 178 |
to identify what window is being restored, and may be used store window |
| 179 |
specific state within the session. |
| 180 |
|
| 181 |
Calling this with a toplevel that is already managed by the session with |
| 182 |
the same associated will raise an in_use error. |
| 183 |
</description> |
| 184 |
<arg name="id" type="new_id" interface="xx_toplevel_session_v1"/> |
| 185 |
<arg name="toplevel" type="object" interface="xdg_toplevel"/> |
| 186 |
<arg name="name" type="string"/> |
| 187 |
</request> |
| 188 |
|
| 189 |
<request name="restore_toplevel"> |
| 190 |
<description summary="restore a surface state"> |
| 191 |
Inform the compositor that the toplevel associated with the passed name |
| 192 |
should have its window management state restored. |
| 193 |
|
| 194 |
Calling this with a toplevel that is already managed by the session with |
| 195 |
the same associated will raise an in_use error. |
| 196 |
|
| 197 |
This request must be called prior to the first commit on the associated |
| 198 |
wl_surface, otherwise an already_mapped error is raised. |
| 199 |
|
| 200 |
As part of the initial configure sequence, if the toplevel was |
| 201 |
successfully restored, a xx_toplevel_session_v1.restored event is |
| 202 |
emitted. See the xx_toplevel_session_v1.restored event for further |
| 203 |
details. |
| 204 |
</description> |
| 205 |
<arg name="id" type="new_id" interface="xx_toplevel_session_v1"/> |
| 206 |
<arg name="toplevel" type="object" interface="xdg_toplevel"/> |
| 207 |
<arg name="name" type="string"/> |
| 208 |
</request> |
| 209 |
|
| 210 |
<event name="created"> |
| 211 |
<description summary="newly-created session id"> |
| 212 |
Emitted at most once some time after getting a new session object. It |
| 213 |
means that no previous state was restored, and a new session was created. |
| 214 |
The passed id can be used to restore previous sessions. |
| 215 |
</description> |
| 216 |
<arg name="id" type="string"/> |
| 217 |
</event> |
| 218 |
|
| 219 |
<event name="restored"> |
| 220 |
<description summary="the session has been restored"> |
| 221 |
Emitted at most once some time after getting a new session object. It |
| 222 |
means that previous state was at least partially restored. The same id |
| 223 |
can again be used to restore previous sessions. |
| 224 |
</description> |
| 225 |
</event> |
| 226 |
|
| 227 |
<event name="replaced"> |
| 228 |
<description summary="the session has been restored"> |
| 229 |
Emitted at most once, if the session was taken over by some other |
| 230 |
client. When this happens, the session and all its toplevel session |
| 231 |
objects become inert, and should be destroyed. |
| 232 |
</description> |
| 233 |
</event> |
| 234 |
</interface> |
| 235 |
|
| 236 |
<interface name="xx_toplevel_session_v1" version="1"> |
| 237 |
<request name="destroy" type="destructor"> |
| 238 |
<description summary="Destroy the object"> |
| 239 |
Destroy the object. This has no effect window management of the |
| 240 |
associated toplevel. |
| 241 |
</description> |
| 242 |
</request> |
| 243 |
|
| 244 |
<request name="remove" type="destructor"> |
| 245 |
<description summary="remove a surface from the session"> |
| 246 |
Remove a specified surface from the session and render any corresponding |
| 247 |
xx_toplevel_session_v1 object inert. The compositor should remove any |
| 248 |
data related to the toplevel in the corresponding session from its internal |
| 249 |
storage. |
| 250 |
</description> |
| 251 |
</request> |
| 252 |
|
| 253 |
<event name="restored"> |
| 254 |
<description summary="a toplevel's session has been restored"> |
| 255 |
The "restored" event is emitted prior to the first |
| 256 |
xdg_toplevel.configure for the toplevel. It will only be emitted after |
| 257 |
xx_session_v1.restore_toplevel, and the initial empty surface state has |
| 258 |
been applied, and it indicates that the surface's session is being |
| 259 |
restored with this configure event. |
| 260 |
</description> |
| 261 |
<arg name="surface" type="object" interface="xdg_toplevel"/> |
| 262 |
</event> |
| 263 |
</interface> |
| 264 |
</protocol> |