| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <protocol name="xdg_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 xdg_session_manager protocol declares interfaces necessary to |
| 34 | allow clients to restore toplevel state from previous executions. The |
| 35 | xdg_session_manager_v1.get_session request can be used to obtain a |
| 36 | xdg_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 xdg_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. Clients that wish to |
| 42 | track sessions in multiple environments may use the $XDG_CURRENT_DESKTOP |
| 43 | environment variable. |
| 44 | |
| 45 | Toplevels are managed through the xdg_session_v1.add_toplevel and |
| 46 | xdg_session_v1.remove_toplevel pair of requests. Clients will explicitly |
| 47 | request a toplevel to be restored according to prior state through the |
| 48 | xdg_session_v1.restore_toplevel request before the toplevel is mapped. |
| 49 | |
| 50 | Compositors may store session information up to any arbitrary level, and |
| 51 | apply any limits and policies to the amount of data stored and its lifetime. |
| 52 | Clients must account for missing sessions and partial session restoration. |
| 53 | |
| 54 | Warning! The protocol described in this file is currently in the testing |
| 55 | phase. Backward compatible changes may be added together with the |
| 56 | corresponding interface version bump. Backward incompatible changes can |
| 57 | only be done by creating a new major version of the extension. |
| 58 | </description> |
| 59 | |
| 60 | <interface name="xdg_session_manager_v1" version="1"> |
| 61 | <description summary="manage sessions for applications"> |
| 62 | The xdg_session_manager_v1 interface defines base requests for creating and |
| 63 | managing a session for an application. Sessions persist across application |
| 64 | and compositor restarts unless explicitly destroyed. A session is created |
| 65 | for the purpose of maintaining an application's xdg_toplevel surfaces |
| 66 | across compositor or application restarts. The compositor should remember |
| 67 | as many states as possible for surfaces in a given session, but there is |
| 68 | no requirement for which states must be remembered. |
| 69 | |
| 70 | Policies such as cache eviction are declared an implementation detail of |
| 71 | the compositor. Clients should account for no longer existing sessions. |
| 72 | </description> |
| 73 | |
| 74 | <enum name="error"> |
| 75 | <entry name="in_use" summary="a requested session is already in use" |
| 76 | value="1"/> |
| 77 | <entry name="invalid_session_id" summary="invalid session identifier" |
| 78 | value="2"/> |
| 79 | <entry name="invalid_reason" summary="invalid reason" value="3"/> |
| 80 | </enum> |
| 81 | |
| 82 | <enum name="reason"> |
| 83 | <description summary="reason for getting a session"> |
| 84 | The reason may determine in what way a session restores the window |
| 85 | management state of associated toplevels. |
| 86 | |
| 87 | For example newly launched applications might be launched on the active |
| 88 | workspace with restored size and position, while a recovered |
| 89 | application might restore additional state such as active workspace and |
| 90 | stacking order. |
| 91 | </description> |
| 92 | <entry name="launch" value="1"> |
| 93 | <description summary="an app is newly launched"> |
| 94 | A new app instance is launched, for example from an app launcher. |
| 95 | </description> |
| 96 | </entry> |
| 97 | <entry name="recover" value="2"> |
| 98 | <description summary="an app recovered"> |
| 99 | An app instance is recovering from for example a compositor or app crash. |
| 100 | </description> |
| 101 | </entry> |
| 102 | <entry name="session_restore" value="3"> |
| 103 | <description summary="an app restored"> |
| 104 | An app instance is restored, for example part of a restored session, or |
| 105 | restored from having been temporarily terminated due to resource |
| 106 | constraints. |
| 107 | </description> |
| 108 | </entry> |
| 109 | </enum> |
| 110 | |
| 111 | <request name="destroy" type="destructor"> |
| 112 | <description summary="Destroy this object"> |
| 113 | Destroy the manager object. The existing session objects will be |
| 114 | unaffected. |
| 115 | </description> |
| 116 | </request> |
| 117 | |
| 118 | <request name="get_session"> |
| 119 | <description summary="create or restore a session"> |
| 120 | Create a session object corresponding to either an existing session |
| 121 | identified by the given session identifier string or a new session. |
| 122 | While the session object exists, the session is considered to be "in |
| 123 | use". |
| 124 | |
| 125 | If an identifier string represents a session that is currently actively |
| 126 | in use by the the same client, an 'in_use' error is raised. If some |
| 127 | other client is currently using the same session, the new session will |
| 128 | replace managing the associated state. |
| 129 | |
| 130 | If the reason is not a valid enum entry, the 'invalid_reason' protocol |
| 131 | error is raised. |
| 132 | |
| 133 | NULL is passed to initiate a new session. If a session_id is passed |
| 134 | which does not represent a valid session, the compositor treats it as if |
| 135 | NULL had been passed. |
| 136 | |
| 137 | The session id string must be UTF-8 encoded. It is also limited by the |
| 138 | maximum length of wayland messages (around 4KB). The 'invalid_session_id' |
| 139 | protocol error will be raised if an invalid string is provided. |
| 140 | |
| 141 | A client is allowed to have any number of in use sessions at the same |
| 142 | time. |
| 143 | </description> |
| 144 | <arg name="id" type="new_id" interface="xdg_session_v1"/> |
| 145 | <arg name="reason" type="uint" enum="reason" |
| 146 | summary="reason for session"/> |
| 147 | <arg name="session_id" type="string" |
| 148 | summary="the session to restore" |
| 149 | allow-null="true"/> |
| 150 | </request> |
| 151 | </interface> |
| 152 | |
| 153 | <interface name="xdg_session_v1" version="1"> |
| 154 | <description summary="A session for an application"> |
| 155 | A xdg_session_v1 object represents a session for an application. While the |
| 156 | object exists, all surfaces which have been added to the session will |
| 157 | have states stored by the compositor which can be reapplied at a later |
| 158 | time. Two sessions cannot exist for the same identifier string. |
| 159 | |
| 160 | States for surfaces added to a session are automatically updated by the |
| 161 | compositor when they are changed. |
| 162 | </description> |
| 163 | |
| 164 | <enum name="error"> |
| 165 | <entry name="name_in_use" |
| 166 | summary="toplevel name is already in use" |
| 167 | value="1"/> |
| 168 | <entry name="already_mapped" |
| 169 | summary="toplevel was already mapped when restored" |
| 170 | value="2"/> |
| 171 | <entry name="invalid_name" |
| 172 | summary="provided toplevel name is invalid" |
| 173 | value="3"/> |
| 174 | <entry name="already_added" |
| 175 | summary="toplevel already added" |
| 176 | value="4"/> |
| 177 | </enum> |
| 178 | |
| 179 | <request name="destroy" type="destructor"> |
| 180 | <description summary="Destroy the session"> |
| 181 | Destroy a session object, preserving the current state but not continuing |
| 182 | to make further updates if state changes occur. This makes the associated |
| 183 | xdg_toplevel_session_v1 objects inert. |
| 184 | </description> |
| 185 | </request> |
| 186 | |
| 187 | <request name="remove" type="destructor"> |
| 188 | <description summary="Remove the session"> |
| 189 | Remove the session, making it no longer available for restoration. A |
| 190 | compositor should in response to this request remove the data related to |
| 191 | this session from its storage. |
| 192 | </description> |
| 193 | </request> |
| 194 | |
| 195 | <request name="add_toplevel"> |
| 196 | <description summary="add a new surface to the session"> |
| 197 | Attempt to add a given surface to the session. The passed name is used |
| 198 | to identify what window is being restored, and may be used to store |
| 199 | window specific state within the session. |
| 200 | |
| 201 | The name given to the toplevel must not correspond to any previously |
| 202 | existing toplevel names in the session. If the name matches an already |
| 203 | known toplevel name in the session, a 'name_in_use' protocol error will |
| 204 | be raised. |
| 205 | |
| 206 | The toplevel object must not be added more than once to any session |
| 207 | created by the client, otherwise the 'already_added' protocol error |
| 208 | will be raised. |
| 209 | |
| 210 | This request will return a xdg_toplevel_session_v1 for later |
| 211 | manipulation. As this resource is created from an empty initial state, |
| 212 | compositors must not emit a xdg_toplevel_session_v1.restored event for |
| 213 | resources created through this request. |
| 214 | |
| 215 | The name string must be UTF-8 encoded. It is also limited by the maximum |
| 216 | length of wayland messages (around 4KB). The 'invalid_name' protocol |
| 217 | error will be raised if an invalid string is provided. |
| 218 | </description> |
| 219 | <arg name="id" type="new_id" interface="xdg_toplevel_session_v1"/> |
| 220 | <arg name="toplevel" type="object" interface="xdg_toplevel"/> |
| 221 | <arg name="name" type="string" summary="name identifying the toplevel"/> |
| 222 | </request> |
| 223 | |
| 224 | <request name="restore_toplevel"> |
| 225 | <description summary="restore a surface state"> |
| 226 | Inform the compositor that the toplevel associated with the passed name |
| 227 | should have its window management state restored. |
| 228 | |
| 229 | If the toplevel name was previously granted to another xdg_toplevel, |
| 230 | the 'name_in_use' protocol error will be raised. |
| 231 | |
| 232 | The toplevel object must not be added more than once to any session |
| 233 | created by the client, otherwise the 'already_added' protocol error |
| 234 | will be raised. |
| 235 | |
| 236 | This request must be called prior to the first commit on the associated |
| 237 | wl_surface after creating the toplevel, otherwise an 'already_mapped' |
| 238 | error is raised. |
| 239 | |
| 240 | As part of the initial configure sequence, if the toplevel was |
| 241 | successfully restored, a xdg_toplevel_session_v1.restored event is |
| 242 | emitted. If the toplevel name was not known in the session, this request |
| 243 | will be equivalent to the xdg_toplevel_session_v1.add_toplevel request, |
| 244 | and no such event will be emitted. See the xdg_toplevel_session_v1.restored |
| 245 | event for further details. |
| 246 | |
| 247 | The name string must be UTF-8 encoded. It is also limited by the maximum |
| 248 | length of wayland messages (around 4KB). The 'invalid_name' protocol |
| 249 | error will be raised if an invalid string is provided. |
| 250 | </description> |
| 251 | <arg name="id" type="new_id" interface="xdg_toplevel_session_v1"/> |
| 252 | <arg name="toplevel" type="object" interface="xdg_toplevel"/> |
| 253 | <arg name="name" type="string" summary="name identifying the toplevel"/> |
| 254 | </request> |
| 255 | |
| 256 | <request name="remove_toplevel"> |
| 257 | <description summary="remove a surface from the session"> |
| 258 | Remove a specified surface from the session and render any related |
| 259 | xdg_toplevel_session_v1 object inert. The compositor should remove any |
| 260 | data related to the toplevel in the corresponding session from its internal |
| 261 | storage. |
| 262 | |
| 263 | The window is specified by its name in the session. The name string |
| 264 | must be encoded in UTF-8, and it is limited in size by the maximum |
| 265 | length of wayland messages (around 4KB). |
| 266 | </description> |
| 267 | <arg name="name" type="string" summary="name identifying the toplevel"/> |
| 268 | </request> |
| 269 | |
| 270 | <event name="created"> |
| 271 | <description summary="newly-created session id"> |
| 272 | Emitted at most once some time after getting a new session object. It |
| 273 | means that no previous state was restored, and a new session was created. |
| 274 | The passed id can be persistently stored and used to restore previous |
| 275 | sessions. |
| 276 | </description> |
| 277 | <arg name="session_id" type="string"/> |
| 278 | </event> |
| 279 | |
| 280 | <event name="restored"> |
| 281 | <description summary="the session has been restored"> |
| 282 | Emitted at most once some time after getting a new session object. It |
| 283 | means that previous state was at least partially restored. The same id |
| 284 | can again be used to restore previous sessions. |
| 285 | </description> |
| 286 | </event> |
| 287 | |
| 288 | <event name="replaced"> |
| 289 | <description summary="the session has been replaced"> |
| 290 | Emitted at most once, if the session was taken over by some other |
| 291 | client. When this happens, the session and all its toplevel session |
| 292 | objects become inert, and should be destroyed. |
| 293 | </description> |
| 294 | </event> |
| 295 | </interface> |
| 296 | |
| 297 | <interface name="xdg_toplevel_session_v1" version="1"> |
| 298 | <description summary="A session for an application"> |
| 299 | A xdg_toplevel_session_v1 resource acts as a handle for the given |
| 300 | toplevel in the session. It allows for receiving events after a |
| 301 | toplevel state was restored, and has the requests to manage them. |
| 302 | </description> |
| 303 | |
| 304 | <request name="destroy" type="destructor"> |
| 305 | <description summary="Destroy the object"> |
| 306 | Destroy the object. This has no effect over window management of the |
| 307 | associated toplevel. |
| 308 | </description> |
| 309 | </request> |
| 310 | |
| 311 | <request name="rename"> |
| 312 | <description summary="change the name of toplevel session"> |
| 313 | Renames the toplevel session. The new name can be used in subsequent requests |
| 314 | to identify this session object. The state associated with this toplevel |
| 315 | session will be preserved. |
| 316 | |
| 317 | If the xdg_session_v1 already contains a toplevel with the specified name, |
| 318 | the 'name_in_use' protocol error will be raised. |
| 319 | </description> |
| 320 | <arg name="name" type="string" summary="new name to identify the toplevel"/> |
| 321 | </request> |
| 322 | |
| 323 | <event name="restored"> |
| 324 | <description summary="a toplevel's session has been restored"> |
| 325 | The "restored" event is emitted prior to the first |
| 326 | xdg_toplevel.configure for the toplevel. It will only be emitted after |
| 327 | xdg_session_v1.restore_toplevel, and the initial empty surface state has |
| 328 | been applied, and it indicates that the surface's session is being |
| 329 | restored with this configure event. |
| 330 | </description> |
| 331 | </event> |
| 332 | </interface> |
| 333 | </protocol> |