1<?xml version="1.0" encoding="UTF-8"?>
2<protocol name="xdg_shell_unstable_v5">
3
4  <copyright>
5    Copyright © 2008-2013 Kristian Høgsberg
6    Copyright © 2013      Rafael Antognolli
7    Copyright © 2013      Jasper St. Pierre
8    Copyright © 2010-2013 Intel Corporation
9
10    Permission is hereby granted, free of charge, to any person obtaining a
11    copy of this software and associated documentation files (the "Software"),
12    to deal in the Software without restriction, including without limitation
13    the rights to use, copy, modify, merge, publish, distribute, sublicense,
14    and/or sell copies of the Software, and to permit persons to whom the
15    Software is furnished to do so, subject to the following conditions:
16
17    The above copyright notice and this permission notice (including the next
18    paragraph) shall be included in all copies or substantial portions of the
19    Software.
20
21    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27    DEALINGS IN THE SOFTWARE.
28  </copyright>
29
30  <interface name="xdg_shell" version="1">
31    <description summary="create desktop-style surfaces">
32      xdg_shell allows clients to turn a wl_surface into a "real window"
33      which can be dragged, resized, stacked, and moved around by the
34      user. Everything about this interface is suited towards traditional
35      desktop environments.
36    </description>
37
38    <enum name="version">
39      <description summary="latest protocol version">
40	The 'current' member of this enum gives the version of the
41	protocol.  Implementations can compare this to the version
42	they implement using static_assert to ensure the protocol and
43	implementation versions match.
44      </description>
45      <entry name="current" value="5" summary="Always the latest version"/>
46    </enum>
47
48    <enum name="error">
49      <entry name="role" value="0" summary="given wl_surface has another role"/>
50      <entry name="defunct_surfaces" value="1" summary="xdg_shell was destroyed before children"/>
51      <entry name="not_the_topmost_popup" value="2" summary="the client tried to map or destroy a non-topmost popup"/>
52      <entry name="invalid_popup_parent" value="3" summary="the client specified an invalid popup parent surface"/>
53    </enum>
54
55    <request name="destroy" type="destructor">
56      <description summary="destroy xdg_shell">
57        Destroy this xdg_shell object.
58
59        Destroying a bound xdg_shell object while there are surfaces
60        still alive created by this xdg_shell object instance is illegal
61        and will result in a protocol error.
62      </description>
63    </request>
64
65    <request name="use_unstable_version">
66      <description summary="enable use of this unstable version">
67	Negotiate the unstable version of the interface.  This
68	mechanism is in place to ensure client and server agree on the
69	unstable versions of the protocol that they speak or exit
70	cleanly if they don't agree.  This request will go away once
71	the xdg-shell protocol is stable.
72      </description>
73      <arg name="version" type="int"/>
74    </request>
75
76    <request name="get_xdg_surface">
77      <description summary="create a shell surface from a surface">
78	This creates an xdg_surface for the given surface and gives it the
79	xdg_surface role. A wl_surface can only be given an xdg_surface role
80	once. If get_xdg_surface is called with a wl_surface that already has
81	an active xdg_surface associated with it, or if it had any other role,
82	an error is raised.
83
84	See the documentation of xdg_surface for more details about what an
85	xdg_surface is and how it is used.
86      </description>
87      <arg name="id" type="new_id" interface="xdg_surface"/>
88      <arg name="surface" type="object" interface="wl_surface"/>
89    </request>
90
91    <request name="get_xdg_popup">
92      <description summary="create a popup for a surface">
93	This creates an xdg_popup for the given surface and gives it the
94	xdg_popup role. A wl_surface can only be given an xdg_popup role
95	once. If get_xdg_popup is called with a wl_surface that already has
96	an active xdg_popup associated with it, or if it had any other role,
97	an error is raised.
98
99	This request must be used in response to some sort of user action
100	like a button press, key press, or touch down event.
101
102	See the documentation of xdg_popup for more details about what an
103	xdg_popup is and how it is used.
104      </description>
105      <arg name="id" type="new_id" interface="xdg_popup"/>
106      <arg name="surface" type="object" interface="wl_surface"/>
107      <arg name="parent" type="object" interface="wl_surface"/>
108      <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
109      <arg name="serial" type="uint" summary="the serial of the user event"/>
110      <arg name="x" type="int"/>
111      <arg name="y" type="int"/>
112    </request>
113
114    <event name="ping">
115      <description summary="check if the client is alive">
116        The ping event asks the client if it's still alive. Pass the
117        serial specified in the event back to the compositor by sending
118        a "pong" request back with the specified serial.
119
120        Compositors can use this to determine if the client is still
121        alive. It's unspecified what will happen if the client doesn't
122        respond to the ping request, or in what timeframe. Clients should
123        try to respond in a reasonable amount of time.
124
125        A compositor is free to ping in any way it wants, but a client must
126        always respond to any xdg_shell object it created.
127      </description>
128      <arg name="serial" type="uint" summary="pass this to the pong request"/>
129    </event>
130
131    <request name="pong">
132      <description summary="respond to a ping event">
133	A client must respond to a ping event with a pong request or
134	the client may be deemed unresponsive.
135      </description>
136      <arg name="serial" type="uint" summary="serial of the ping event"/>
137    </request>
138  </interface>
139
140  <interface name="xdg_surface" version="1">
141    <description summary="A desktop window">
142      An interface that may be implemented by a wl_surface, for
143      implementations that provide a desktop-style user interface.
144
145      It provides requests to treat surfaces like windows, allowing to set
146      properties like maximized, fullscreen, minimized, and to move and resize
147      them, and associate metadata like title and app id.
148
149      The client must call wl_surface.commit on the corresponding wl_surface
150      for the xdg_surface state to take effect. Prior to committing the new
151      state, it can set up initial configuration, such as maximizing or setting
152      a window geometry.
153
154      Even without attaching a buffer the compositor must respond to initial
155      committed configuration, for instance sending a configure event with
156      expected window geometry if the client maximized its surface during
157      initialization.
158
159      For a surface to be mapped by the compositor the client must have
160      committed both an xdg_surface state and a buffer.
161    </description>
162
163    <request name="destroy" type="destructor">
164      <description summary="Destroy the xdg_surface">
165	Unmap and destroy the window. The window will be effectively
166	hidden from the user's point of view, and all state like
167	maximization, fullscreen, and so on, will be lost.
168      </description>
169    </request>
170
171    <request name="set_parent">
172      <description summary="set the parent of this surface">
173	Set the "parent" of this surface. This window should be stacked
174	above a parent. The parent surface must be mapped as long as this
175	surface is mapped.
176
177	Parent windows should be set on dialogs, toolboxes, or other
178	"auxiliary" surfaces, so that the parent is raised when the dialog
179	is raised.
180      </description>
181      <arg name="parent" type="object" interface="xdg_surface" allow-null="true"/>
182    </request>
183
184    <request name="set_title">
185      <description summary="set surface title">
186	Set a short title for the surface.
187
188	This string may be used to identify the surface in a task bar,
189	window list, or other user interface elements provided by the
190	compositor.
191
192	The string must be encoded in UTF-8.
193      </description>
194      <arg name="title" type="string"/>
195    </request>
196
197    <request name="set_app_id">
198      <description summary="set application ID">
199	Set an application identifier for the surface.
200
201	The app ID identifies the general class of applications to which
202	the surface belongs. The compositor can use this to group multiple
203	surfaces together, or to determine how to launch a new application.
204
205	For D-Bus activatable applications, the app ID is used as the D-Bus
206	service name.
207
208	The compositor shell will try to group application surfaces together
209	by their app ID.  As a best practice, it is suggested to select app
210	ID's that match the basename of the application's .desktop file.
211	For example, "org.freedesktop.FooViewer" where the .desktop file is
212	"org.freedesktop.FooViewer.desktop".
213
214	See the desktop-entry specification [0] for more details on
215	application identifiers and how they relate to well-known D-Bus
216	names and .desktop files.
217
218	[0] http://standards.freedesktop.org/desktop-entry-spec/
219      </description>
220      <arg name="app_id" type="string"/>
221    </request>
222
223    <request name="show_window_menu">
224      <description summary="show the window menu">
225        Clients implementing client-side decorations might want to show
226        a context menu when right-clicking on the decorations, giving the
227        user a menu that they can use to maximize or minimize the window.
228
229        This request asks the compositor to pop up such a window menu at
230        the given position, relative to the local surface coordinates of
231        the parent surface. There are no guarantees as to what menu items
232        the window menu contains.
233
234        This request must be used in response to some sort of user action
235        like a button press, key press, or touch down event.
236      </description>
237      <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
238      <arg name="serial" type="uint" summary="the serial of the user event"/>
239      <arg name="x" type="int" summary="the x position to pop up the window menu at"/>
240      <arg name="y" type="int" summary="the y position to pop up the window menu at"/>
241    </request>
242
243    <request name="move">
244      <description summary="start an interactive move">
245	Start an interactive, user-driven move of the surface.
246
247	This request must be used in response to some sort of user action
248	like a button press, key press, or touch down event. The passed
249	serial is used to determine the type of interactive move (touch,
250	pointer, etc).
251
252	The server may ignore move requests depending on the state of
253	the surface (e.g. fullscreen or maximized), or if the passed serial
254	is no longer valid.
255
256	If triggered, the surface will lose the focus of the device
257	(wl_pointer, wl_touch, etc) used for the move. It is up to the
258	compositor to visually indicate that the move is taking place, such as
259	updating a pointer cursor, during the move. There is no guarantee
260	that the device focus will return when the move is completed.
261      </description>
262      <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
263      <arg name="serial" type="uint" summary="the serial of the user event"/>
264    </request>
265
266    <enum name="resize_edge">
267      <description summary="edge values for resizing">
268	These values are used to indicate which edge of a surface
269	is being dragged in a resize operation.
270      </description>
271      <entry name="none" value="0"/>
272      <entry name="top" value="1"/>
273      <entry name="bottom" value="2"/>
274      <entry name="left" value="4"/>
275      <entry name="top_left" value="5"/>
276      <entry name="bottom_left" value="6"/>
277      <entry name="right" value="8"/>
278      <entry name="top_right" value="9"/>
279      <entry name="bottom_right" value="10"/>
280    </enum>
281
282    <request name="resize">
283      <description summary="start an interactive resize">
284	Start a user-driven, interactive resize of the surface.
285
286	This request must be used in response to some sort of user action
287	like a button press, key press, or touch down event. The passed
288	serial is used to determine the type of interactive resize (touch,
289	pointer, etc).
290
291	The server may ignore resize requests depending on the state of
292	the surface (e.g. fullscreen or maximized).
293
294	If triggered, the client will receive configure events with the
295	"resize" state enum value and the expected sizes. See the "resize"
296	enum value for more details about what is required. The client
297	must also acknowledge configure events using "ack_configure". After
298	the resize is completed, the client will receive another "configure"
299	event without the resize state.
300
301	If triggered, the surface also will lose the focus of the device
302	(wl_pointer, wl_touch, etc) used for the resize. It is up to the
303	compositor to visually indicate that the resize is taking place,
304	such as updating a pointer cursor, during the resize. There is no
305	guarantee that the device focus will return when the resize is
306	completed.
307
308	The edges parameter specifies how the surface should be resized,
309	and is one of the values of the resize_edge enum. The compositor
310	may use this information to update the surface position for
311	example when dragging the top left corner. The compositor may also
312	use this information to adapt its behavior, e.g. choose an
313	appropriate cursor image.
314      </description>
315      <arg name="seat" type="object" interface="wl_seat" summary="the wl_seat of the user event"/>
316      <arg name="serial" type="uint" summary="the serial of the user event"/>
317      <arg name="edges" type="uint" summary="which edge or corner is being dragged"/>
318    </request>
319
320    <enum name="state">
321      <description summary="types of state on the surface">
322        The different state values used on the surface. This is designed for
323        state values like maximized, fullscreen. It is paired with the
324        configure event to ensure that both the client and the compositor
325        setting the state can be synchronized.
326
327        States set in this way are double-buffered. They will get applied on
328        the next commit.
329
330        Desktop environments may extend this enum by taking up a range of
331        values and documenting the range they chose in this description.
332        They are not required to document the values for the range that they
333        chose. Ideally, any good extensions from a desktop environment should
334        make its way into standardization into this enum.
335
336        The current reserved ranges are:
337
338        0x0000 - 0x0FFF: xdg-shell core values, documented below.
339        0x1000 - 0x1FFF: GNOME
340        0x2000 - 0x2FFF: EFL
341      </description>
342      <entry name="maximized" value="1" summary="the surface is maximized">
343	<description summary="the surface is maximized">
344	  The surface is maximized. The window geometry specified in the configure
345	  event must be obeyed by the client.
346	</description>
347      </entry>
348      <entry name="fullscreen" value="2" summary="the surface is fullscreen">
349	<description summary="the surface is fullscreen">
350	  The surface is fullscreen. The window geometry specified in the configure
351	  event must be obeyed by the client.
352	</description>
353      </entry>
354      <entry name="resizing" value="3" summary="the surface is being resized">
355	<description summary="the surface is being resized">
356	  The surface is being resized. The window geometry specified in the
357	  configure event is a maximum; the client cannot resize beyond it.
358	  Clients that have aspect ratio or cell sizing configuration can use
359	  a smaller size, however.
360	</description>
361      </entry>
362      <entry name="activated" value="4" summary="the surface is now activated">
363	<description summary="the surface is now activated">
364	  Client window decorations should be painted as if the window is
365	  active. Do not assume this means that the window actually has
366	  keyboard or pointer focus.
367	</description>
368      </entry>
369    </enum>
370
371    <event name="configure">
372      <description summary="suggest a surface change">
373	The configure event asks the client to resize its surface or to
374	change its state.
375
376	The width and height arguments specify a hint to the window
377	about how its surface should be resized in window geometry
378	coordinates. See set_window_geometry.
379
380	If the width or height arguments are zero, it means the client
381	should decide its own window dimension. This may happen when the
382	compositor need to configure the state of the surface but doesn't
383	have any information about any previous or expected dimension.
384
385	The states listed in the event specify how the width/height
386	arguments should be interpreted, and possibly how it should be
387	drawn.
388
389	Clients should arrange their surface for the new size and
390	states, and then send a ack_configure request with the serial
391	sent in this configure event at some point before committing
392	the new surface.
393
394	If the client receives multiple configure events before it
395        can respond to one, it is free to discard all but the last
396        event it received.
397      </description>
398      <arg name="width" type="int"/>
399      <arg name="height" type="int"/>
400      <arg name="states" type="array"/>
401      <arg name="serial" type="uint"/>
402    </event>
403
404    <request name="ack_configure">
405      <description summary="ack a configure event">
406        When a configure event is received, if a client commits the
407        surface in response to the configure event, then the client
408        must make an ack_configure request sometime before the commit
409        request, passing along the serial of the configure event.
410
411        For instance, the compositor might use this information to move
412        a surface to the top left only when the client has drawn itself
413        for the maximized or fullscreen state.
414
415        If the client receives multiple configure events before it
416        can respond to one, it only has to ack the last configure event.
417
418        A client is not required to commit immediately after sending
419        an ack_configure request - it may even ack_configure several times
420        before its next surface commit.
421
422        The compositor expects that the most recently received
423        ack_configure request at the time of a commit indicates which
424        configure event the client is responding to.
425      </description>
426      <arg name="serial" type="uint" summary="the serial from the configure event"/>
427    </request>
428
429    <request name="set_window_geometry">
430      <description summary="set the new window geometry">
431        The window geometry of a window is its "visible bounds" from the
432        user's perspective. Client-side decorations often have invisible
433        portions like drop-shadows which should be ignored for the
434        purposes of aligning, placing and constraining windows.
435
436        The window geometry is double buffered, and will be applied at the
437        time wl_surface.commit of the corresponding wl_surface is called.
438
439        Once the window geometry of the surface is set once, it is not
440        possible to unset it, and it will remain the same until
441        set_window_geometry is called again, even if a new subsurface or
442        buffer is attached.
443
444        If never set, the value is the full bounds of the surface,
445        including any subsurfaces. This updates dynamically on every
446        commit. This unset mode is meant for extremely simple clients.
447
448        If responding to a configure event, the window geometry in here
449        must respect the sizing negotiations specified by the states in
450        the configure event.
451
452        The arguments are given in the surface local coordinate space of
453        the wl_surface associated with this xdg_surface.
454
455        The width and height must be greater than zero.
456      </description>
457      <arg name="x" type="int"/>
458      <arg name="y" type="int"/>
459      <arg name="width" type="int"/>
460      <arg name="height" type="int"/>
461    </request>
462
463    <request name="set_maximized">
464      <description summary="maximize the window">
465        Maximize the surface.
466
467        After requesting that the surface should be maximized, the compositor
468        will respond by emitting a configure event with the "maximized" state
469        and the required window geometry. The client should then update its
470        content, drawing it in a maximized state, i.e. without shadow or other
471        decoration outside of the window geometry. The client must also
472        acknowledge the configure when committing the new content (see
473        ack_configure).
474
475        It is up to the compositor to decide how and where to maximize the
476        surface, for example which output and what region of the screen should
477        be used.
478
479        If the surface was already maximized, the compositor will still emit
480        a configure event with the "maximized" state.
481      </description>
482    </request>
483
484    <request name="unset_maximized">
485      <description summary="unmaximize the window">
486        Unmaximize the surface.
487
488        After requesting that the surface should be unmaximized, the compositor
489        will respond by emitting a configure event without the "maximized"
490        state. If available, the compositor will include the window geometry
491        dimensions the window had prior to being maximized in the configure
492        request. The client must then update its content, drawing it in a
493        regular state, i.e. potentially with shadow, etc. The client must also
494        acknowledge the configure when committing the new content (see
495        ack_configure).
496
497        It is up to the compositor to position the surface after it was
498        unmaximized; usually the position the surface had before maximizing, if
499        applicable.
500
501        If the surface was already not maximized, the compositor will still
502        emit a configure event without the "maximized" state.
503      </description>
504    </request>
505
506    <request name="set_fullscreen">
507      <description summary="set the window as fullscreen on a monitor">
508	Make the surface fullscreen.
509
510        You can specify an output that you would prefer to be fullscreen.
511	If this value is NULL, it's up to the compositor to choose which
512        display will be used to map this surface.
513
514        If the surface doesn't cover the whole output, the compositor will
515        position the surface in the center of the output and compensate with
516        black borders filling the rest of the output.
517      </description>
518      <arg name="output" type="object" interface="wl_output" allow-null="true"/>
519    </request>
520    <request name="unset_fullscreen" />
521
522    <request name="set_minimized">
523      <description summary="set the window as minimized">
524	Request that the compositor minimize your surface. There is no
525	way to know if the surface is currently minimized, nor is there
526	any way to unset minimization on this surface.
527
528	If you are looking to throttle redrawing when minimized, please
529	instead use the wl_surface.frame event for this, as this will
530	also work with live previews on windows in Alt-Tab, Expose or
531	similar compositor features.
532      </description>
533    </request>
534
535    <event name="close">
536      <description summary="surface wants to be closed">
537        The close event is sent by the compositor when the user
538        wants the surface to be closed. This should be equivalent to
539        the user clicking the close button in client-side decorations,
540        if your application has any...
541
542        This is only a request that the user intends to close your
543        window. The client may choose to ignore this request, or show
544        a dialog to ask the user to save their data...
545      </description>
546    </event>
547  </interface>
548
549  <interface name="xdg_popup" version="1">
550    <description summary="short-lived, popup surfaces for menus">
551      A popup surface is a short-lived, temporary surface that can be
552      used to implement menus. It takes an explicit grab on the surface
553      that will be dismissed when the user dismisses the popup. This can
554      be done by the user clicking outside the surface, using the keyboard,
555      or even locking the screen through closing the lid or a timeout.
556
557      When the popup is dismissed, a popup_done event will be sent out,
558      and at the same time the surface will be unmapped. The xdg_popup
559      object is now inert and cannot be reactivated, so clients should
560      destroy it. Explicitly destroying the xdg_popup object will also
561      dismiss the popup and unmap the surface.
562
563      Clients will receive events for all their surfaces during this
564      grab (which is an "owner-events" grab in X11 parlance). This is
565      done so that users can navigate through submenus and other
566      "nested" popup windows without having to dismiss the topmost
567      popup.
568
569      Clients that want to dismiss the popup when another surface of
570      their own is clicked should dismiss the popup using the destroy
571      request.
572
573      The parent surface must have either an xdg_surface or xdg_popup
574      role.
575
576      Specifying an xdg_popup for the parent means that the popups are
577      nested, with this popup now being the topmost popup. Nested
578      popups must be destroyed in the reverse order they were created
579      in, e.g. the only popup you are allowed to destroy at all times
580      is the topmost one.
581
582      If there is an existing popup when creating a new popup, the
583      parent must be the current topmost popup.
584
585      A parent surface must be mapped before the new popup is mapped.
586
587      When compositors choose to dismiss a popup, they will likely
588      dismiss every nested popup as well. When a compositor dismisses
589      popups, it will follow the same dismissing order as required
590      from the client.
591
592      The x and y arguments passed when creating the popup object specify
593      where the top left of the popup should be placed, relative to the
594      local surface coordinates of the parent surface. See
595      xdg_shell.get_xdg_popup.
596
597      The client must call wl_surface.commit on the corresponding wl_surface
598      for the xdg_popup state to take effect.
599
600      For a surface to be mapped by the compositor the client must have
601      committed both the xdg_popup state and a buffer.
602    </description>
603
604    <request name="destroy" type="destructor">
605      <description summary="remove xdg_popup interface">
606	This destroys the popup. Explicitly destroying the xdg_popup
607	object will also dismiss the popup, and unmap the surface.
608
609	If this xdg_popup is not the "topmost" popup, a protocol error
610	will be sent.
611      </description>
612    </request>
613
614    <event name="popup_done">
615      <description summary="popup interaction is done">
616	The popup_done event is sent out when a popup is dismissed by the
617	compositor. The client should destroy the xdg_popup object at this
618	point.
619      </description>
620    </event>
621
622  </interface>
623</protocol>
624