Use a callback object instead of ad-hoc lists for sync and frame events
[profile/ivi/wayland.git] / protocol / wayland.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <protocol name="wayland">
3
4   <copyright>
5     Copyright © 2008-2011 Kristian Høgsberg
6     Copyright © 2010-2011 Intel Corporation
7
8     Permission to use, copy, modify, distribute, and sell this
9     software and its documentation for any purpose is hereby granted
10     without fee, provided that\n the above copyright notice appear in
11     all copies and that both that copyright notice and this permission
12     notice appear in supporting documentation, and that the name of
13     the copyright holders not be used in advertising or publicity
14     pertaining to distribution of the software without specific,
15     written prior permission.  The copyright holders make no
16     representations about the suitability of this software for any
17     purpose.  It is provided "as is" without express or implied
18     warranty.
19
20     THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
21     SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
22     FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
23     SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24     WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
25     AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
26     ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
27     THIS SOFTWARE.
28   </copyright>
29
30   <!-- The core global object. This is a special singleton object.
31        It is used for internal wayland protocol features. -->
32   <interface name="wl_display" version="1">
33     <request name="bind">
34       <arg name="id" type="uint"/>
35       <arg name="interface" type="string"/>
36       <arg name="version" type="uint"/>
37     </request>
38
39     <!-- sync is an just an echo, which will reply with a key event.
40          Since requests are handled in-order, this can be used as a
41          barrier to ensure all previous requests have been handled.
42          The key argument can be used to correlate between multiple
43          sync invocations. -->
44     <request name="sync">
45       <arg name="callback" type="new_id" interface="wl_callback"/>
46     </request>
47
48     <!-- A fatal error has occurred. -->
49     <event name="error">
50       <arg name="object_id" type="object" interface="wl_object"/>
51       <arg name="code" type="uint"/>
52       <arg name="message" type="string"/>
53     </event>
54
55     <enum name="error">
56       <entry name="invalid_object" value="0"/>
57       <entry name="invalid_method" value="1"/>
58       <entry name="no_memory" value="2"/>
59     </enum>
60
61     <!-- Notify the client of global objects. These are objects that
62          are created by the server. Globals are published on the
63          initial client connection sequence, upon device hotplugs,
64          device disconnects, reconfiguration or other events.  The
65          server will always announce an object before the object sends
66          out events. -->
67     <event name="global">
68       <arg name="id" type="uint" interface="wl_object"/>
69       <arg name="name" type="string"/>
70       <arg name="version" type="uint"/>
71     </event>
72
73     <!-- Notify the client of removed global objects. -->
74     <event name="global_remove">
75       <arg name="id" type="uint" />
76     </event>
77
78     <!-- Internal, deprecated, and will be changed.  This is an object
79          IDs range that is used by the client to allocate object IDs
80          in "new_id" type arguments.  The server sends range
81          allocations to the client before the next range is about to
82          be depleted. -->
83     <event name="range">
84       <arg name="base" type="uint"/>
85     </event>
86   </interface>
87
88   <interface name="wl_callback" version="1">
89     <event name="done">
90       <arg name="time" type="uint"/>
91     </event>
92   </interface>
93
94   <!-- A compositor. This object is a global.  The compositor is in
95        charge of combining the contents of multiple surfaces into one
96        displayable output. -->
97   <interface name="wl_compositor" version="1">
98     <!-- Factory request for a surface objects. A surface is akin to a
99          window. -->
100     <request name="create_surface">
101       <arg name="id" type="new_id" interface="wl_surface"/>
102     </request>
103
104     <enum name="visual">
105       <entry name="argb32" value="0"/>
106       <entry name="premultiplied_argb32" value="1"/>
107       <entry name="xrgb32" value="2"/>
108     </enum>
109
110     <event name="token_visual">
111       <arg name="visual" type="new_id" interface="wl_visual"/>
112       <arg name="token" type="uint"/>
113     </event>
114   </interface>
115
116   <!-- Shared memory support -->
117   <interface name="wl_shm" version="1">
118     <enum name="error">
119       <entry name="invalid_visual" value="0"/>
120       <entry name="invalid_stride" value="1"/>
121       <entry name="invalid_fd" value="2"/>
122     </enum>
123
124     <!-- Transfer a shm buffer to the server.  The allocated buffer
125          would include at least stride * height bytes starting at the
126          beginning of fd.  The file descriptor is transferred over the
127          socket using AF_UNIX magical features. width, height, stride
128          and visual describe the respective properties of the pixel
129          data contained in the buffer. -->
130     <request name="create_buffer">
131       <arg name="id" type="new_id" interface="wl_buffer"/>
132       <arg name="fd" type="fd"/>
133       <arg name="width" type="int"/>
134       <arg name="height" type="int"/>
135       <arg name="stride" type="uint"/>
136       <arg name="visual" type="object" interface="wl_visual"/>
137     </request>
138   </interface>
139
140
141   <!-- A pixel buffer. Created using the drm, shm or similar objects.
142        It has a size, visual and contents, but not a location on the
143        screen. -->
144   <interface name="wl_buffer" version="1">
145     <!-- Notify the server that the specified area of the buffers
146          contents have changed.  To describe a more complicated area
147          of damage, break down the region into rectangles and use this
148          request several times.
149     -->
150     <request name="damage">
151       <arg name="x" type="int"/>
152       <arg name="y" type="int"/>
153       <arg name="width" type="int"/>
154       <arg name="height" type="int"/>
155     </request>
156
157     <!-- Destroy a buffer.  This will invalidate the object id. -->
158     <request name="destroy" type="destructor"/>
159
160     <!-- Sent when an attached buffer is no longer used by the compositor. -->
161     <event name="release"/>
162   </interface>
163
164   <interface name="wl_shell" version="1">
165     <request name="move">
166       <arg name="surface" type="object" interface="wl_surface"/>
167       <arg name="input_device" type="object" interface="wl_input_device"/>
168       <arg name="time" type="uint"/>
169     </request>
170
171     <enum name="resize">
172       <entry name="none" value="0"/>
173       <entry name="top" value="1"/>
174       <entry name="bottom" value="2"/>
175       <entry name="left" value="4"/>
176       <entry name="top_left" value="5"/>
177       <entry name="bottom_left" value="6"/>
178       <entry name="right" value="8"/>
179       <entry name="top_right" value="9"/>
180       <entry name="bottom_right" value="10"/>
181     </enum>
182
183     <request name="resize">
184       <arg name="surface" type="object" interface="wl_surface"/>
185       <arg name="input_device" type="object" interface="wl_input_device"/>
186       <arg name="time" type="uint"/>
187       <!-- edges is an enum, need to get the values in here -->
188       <arg name="edges" type="uint"/>
189     </request>
190
191     <request name="create_drag">
192       <arg name="id" type="new_id" interface="wl_drag"/>
193     </request>
194
195     <request name="create_selection">
196       <arg name="id" type="new_id" interface="wl_selection"/>
197     </request>
198
199     <!-- Make the surface visible as a toplevel window. -->
200     <request name="set_toplevel">
201       <arg name="surface" type="object" interface="wl_surface"/>
202     </request>
203
204     <!-- Map the surface relative to an existing surface. The x and y
205          arguments specify the locations of the upper left corner of
206          the surface relative to the upper left corner of the parent
207          surface.  The flags argument controls overflow/clipping
208          behaviour when the surface would intersect a screen edge,
209          panel or such.  And possibly whether the offset only
210          determines the initial position or if the surface is locked
211          to that relative position during moves. -->
212     <request name="set_transient">
213       <arg name="surface" type="object" interface="wl_surface"/>
214       <arg name="parent" type="object" interface="wl_surface"/>
215       <arg name="x" type="int"/>
216       <arg name="y" type="int"/>
217       <arg name="flags" type="uint"/>
218     </request>
219
220     <!-- Map the surface as a fullscreen surface.  There are a number
221          of options here: on which output? if the surface size doesn't
222          match the output size, do we scale, change resolution, or add
223          black borders? is that something the client controls?  what
224          about transient surfaces, do they float on top of the
225          fullscreen? what if there's already a fullscreen surface on
226          the output, maybe you can only go fullscreen if you're
227          active?  -->
228     <request name="set_fullscreen">
229       <arg name="surface" type="object" interface="wl_surface"/>
230     </request>
231
232     <!-- The configure event asks the client to resize its surface.
233          The size is a hint, in the sense that the client is free to
234          ignore it if it doesn't resize, pick a smaller size (to
235          satisfy aspect ration or resize in steps of NxM pixels).  The
236          client is free to dismiss all but the last configure event it
237          received. -->
238     <event name="configure">
239       <arg name="time" type="uint"/>
240       <arg name="edges" type="uint"/>
241       <arg name="surface" type="object" interface="wl_surface"/>
242       <arg name="width" type="int"/>
243       <arg name="height" type="int"/>
244     </event>
245   </interface>
246
247   <interface name="wl_selection" version="1">
248     <!-- Add an offered mime type.  Can be called several times to
249          offer multiple types, but must be called before 'activate'. -->
250     <request name="offer">
251       <arg name="type" type="string"/>
252     </request>
253
254     <!-- Can the selection be activated for multiple devices? -->
255     <request name="activate">
256       <arg name="input_device" type="object" interface="wl_input_device"/>
257       <arg name="time" type="uint"/>
258     </request>
259
260     <!-- Destroy the selection. -->
261     <request name="destroy" type="destructor"/>
262
263     <!-- Another client pasted the selection, send the mime-type over
264          the passed fd. -->
265     <event name="send">
266       <arg name="mime_type" type="string"/>
267       <arg name="fd" type="fd"/>
268     </event>
269
270     <!-- Another selection became active. -->
271     <event name="cancelled"/>
272   </interface>
273
274   <interface name="wl_selection_offer" version="1">
275     <!-- Called to receive the selection data as the specified type.
276          Sends the pipe fd to the compositor, which forwards it to the
277          source in the 'send' event -->
278     <request name="receive">
279       <arg name="mime_type" type="string"/>
280       <arg name="fd" type="fd"/>
281     </request>
282
283     <!-- Sent before the keyboard_focus event to announce the types
284          offered.  One event per offered mime type.  A mime type of
285          NULL means the selection offer is going away.  -->
286     <event name="offer">
287       <arg name="type" type="string"/>
288     </event>
289
290     <event name="keyboard_focus">
291       <arg name="input_device" type="object" interface="wl_input_device"/>
292     </event>
293   </interface>
294
295   <interface name="wl_drag" version="1">
296     <!-- Add an offered mime type.  Can be called several times to
297          offer multiple types, but must be called before 'activate'. -->
298     <request name="offer">
299       <arg name="type" type="string"/>
300     </request>
301
302     <request name="activate">
303       <arg name="surface" type="object" interface="wl_surface"/>
304       <arg name="input_device" type="object" interface="wl_input_device"/>
305       <arg name="time" type="uint"/>
306     </request>
307
308     <!-- Destroy the drag and cancel the session. -->
309     <request name="destroy" type="destructor"/>
310
311     <!-- Sent when a target accepts pointer_focus or motion events.
312          If a target does not accept any of the offered types, type is
313          NULL -->
314     <event name="target">
315       <arg name="mime_type" type="string"/>
316     </event>
317
318     <!-- Sent when the drag is finished.  The final mime type is that
319          of the last target event.  If that was NULL, no drag target
320          was valid when the drag finished, fd is undefined and the
321          source should not send data.  The event is also sent in case
322          a drag source tries to activate a drag after the grab was
323          released, in which case mime_type will also be NULL. -->
324     <event name="finish">
325       <arg name="fd" type="fd"/>
326     </event>
327
328     <event name="reject"/>
329   </interface>
330
331
332   <interface name="wl_drag_offer" version="1">
333     <!-- Call to accept the offer of the given type -->
334     <request name="accept">
335       <arg name="time" type="uint"/>
336       <arg name="type" type="string"/>
337     </request>
338
339     <!-- Called to initiate the drag finish sequence.  Sends the pipe
340          fd to the compositor, which forwards it to the source in the
341          'finish' event -->
342     <request name="receive">
343       <arg name="fd" type="fd"/>
344     </request>
345
346     <!-- Called to reject a drop  -->
347     <request name="reject"/>
348
349     <!-- Sent before the pointer_focus event to announce the types
350          offered.  One event per offered mime type. -->
351     <event name="offer">
352       <arg name="type" type="string"/>
353     </event>
354
355     <!-- Similar to device::pointer_focus.  Sent to potential target
356          surfaces to offer drag data.  If the device leaves the
357          window, the drag stops or the originator cancels the drag,
358          this event is sent with the NULL surface, at which point the
359          drag object may no longer be valid. -->
360     <event name="pointer_focus">
361       <arg name="time" type="uint"/>
362       <arg name="surface" type="object" interface="wl_surface"/>
363       <arg name="x" type="int"/>
364       <arg name="y" type="int"/>
365       <arg name="surface_x" type="int"/>
366       <arg name="surface_y" type="int"/>
367     </event>
368
369     <!-- Similar to device::motion.  Sent to potential target surfaces
370          as the drag pointer moves around in the surface. -->
371     <event name="motion">
372       <arg name="time" type="uint"/>
373       <arg name="x" type="int"/>
374       <arg name="y" type="int"/>
375       <arg name="surface_x" type="int"/>
376       <arg name="surface_y" type="int"/>
377     </event>
378
379     <!-- Sent to indicate that the drag is finishing.  The last
380          motion/pointer_focus event gives the location of the drop.
381          Target must respond with the 'receive' request, which sends
382          an fd to the source for writing the drag data. -->
383     <event name="drop"/>
384   </interface>
385
386
387   <!-- A surface. This is an image that is displayed on the screen.
388        It has a location, size and pixel contents. Similar to a window. -->
389   <interface name="wl_surface" version="1">
390     <!-- Deletes the surface and invalidates its object id. -->
391     <request name="destroy" type="destructor"/>
392
393     <!-- Copy the contents of a buffer into this surface. The x and y
394          arguments specify the location of the new buffers upper left
395          corner, relative to the old buffers upper left corner. -->
396     <request name="attach">
397       <arg name="buffer" type="object" interface="wl_buffer"/>
398       <arg name="x" type="int"/>
399       <arg name="y" type="int"/>
400     </request>
401
402     <!-- After attaching a new buffer, this request is used to
403          describe the regions where the new buffer is different from
404          the previous buffer and needs to be repainted.  Coordinates
405          are relative to the new buffer. -->
406     <request name="damage">
407       <arg name="x" type="int"/>
408       <arg name="y" type="int"/>
409       <arg name="width" type="int"/>
410       <arg name="height" type="int"/>
411     </request>
412
413     <!-- Request notification when the next frame is displayed.
414          Useful for throttling redrawing operations, and driving
415          animations.  The notification will only be posted for one
416          frame unless requested again. -->
417     <request name="frame">
418       <arg name="callback" type="new_id" interface="wl_callback"/>
419     </request>
420
421   </interface>
422
423
424   <!-- A group of keyboards and pointer devices (mice, for
425        example). This object is published as a global during start up,
426        or when such a device is hot plugged.  A input_device group
427        typically has a pointer and maintains a keyboard_focus and a
428        pointer_focus.  -->
429   <interface name="wl_input_device" version="1">
430     <!-- Set the pointer's image.  This request only takes effect if
431          the pointer focus for this device is one of the requesting
432          clients surfaces.  -->
433     <request name="attach">
434       <arg name="time" type="uint"/>
435       <arg name="buffer" type="object" interface="wl_buffer"/>
436       <arg name="hotspot_x" type="int"/>
437       <arg name="hotspot_y" type="int"/>
438     </request>
439
440     <!-- Notification of pointer location change.
441          x,y are the absolute location on the screen.
442          surface_[xy] are the location relative to the focused surface. -->
443     <event name="motion">
444       <arg name="time" type="uint"/>
445       <arg name="x" type="int"/>
446       <arg name="y" type="int"/>
447       <arg name="surface_x" type="int"/>
448       <arg name="surface_y" type="int"/>
449     </event>
450
451     <!-- Mouse button click and release notifications.  The location
452          of the click is given by the last motion or pointer_focus
453          event. -->
454     <event name="button">
455       <arg name="time" type="uint"/>
456       <arg name="button" type="uint"/>
457       <arg name="state" type="uint"/>
458     </event>
459
460     <!-- Keyboard press. -->
461     <event name="key">
462       <arg name="time" type="uint"/>
463       <arg name="key" type="uint"/>
464       <arg name="state" type="uint"/>
465     </event>
466
467     <!-- Notification that this input device's pointer is focused on
468          certain surface. When an input_device enters a surface, the
469          pointer image is undefined and a client should respond to
470          this event by setting an apropriate pointer image. -->
471     <event name="pointer_focus">
472       <arg name="time" type="uint"/>
473       <arg name="surface" type="object" interface="wl_surface"/>
474       <arg name="x" type="int"/>
475       <arg name="y" type="int"/>
476       <arg name="surface_x" type="int"/>
477       <arg name="surface_y" type="int"/>
478     </event>
479
480     <event name="keyboard_focus">
481       <arg name="time" type="uint"/>
482       <arg name="surface" type="object" interface="wl_surface"/>
483       <arg name="keys" type="array"/>
484     </event>
485
486     <event name="touch_down">
487       <arg name="time" type="uint"/>
488       <arg name="id" type="int" />
489       <arg name="x" type="int" />
490       <arg name="y" type="int" />
491     </event>
492
493     <event name="touch_up">
494       <arg name="time" type="uint"/>
495       <arg name="id" type="int" />
496     </event>
497
498     <event name="touch_motion">
499       <arg name="time" type="uint"/>
500       <arg name="id" type="int" />
501       <arg name="x" type="int" />
502       <arg name="y" type="int" />
503     </event>
504
505     <!-- Indicates the end of a contact point list. -->
506     <event name="touch_frame"/>
507
508     <!-- Sent if the compositor decides the touch stream is a global
509          gesture. No further events are sent to the clients from that
510          particular gesture. -->
511     <event name="touch_cancel"/>
512   </interface>
513
514
515   <!-- An output describes part of the compositor geometry.  The
516        compositor work in the 'compositor coordinate system' and an
517        output corresponds to rectangular area in that space that is
518        actually visible.  This typically corresponds to a monitor that
519        displays part of the compositor space.  This object is
520        published as global during start up, or when a screen is hot
521        plugged.  -->
522   <interface name="wl_output" version="1">
523
524     <enum name="subpixel">
525       <entry name="unknown" value="0"/>
526       <entry name="none" value="1"/>
527       <entry name="horizontal_rgb" value="2"/>
528       <entry name="horizontal_bgr" value="3"/>
529       <entry name="vertical_rgb" value="4"/>
530       <entry name="vertical_bgr" value="5"/>
531     </enum>
532
533     <event name="geometry">
534       <arg name="x" type="int"/>
535       <arg name="y" type="int"/>
536       <arg name="physical_width" type="int"/>
537       <arg name="physical_height" type="int"/>
538       <arg name="subpixel" type="int"/>
539       <arg name="make" type="string"/>
540       <arg name="model" type="string"/>
541     </event>
542
543     <!-- Values for the flags bitfield of the mode event. -->
544     <enum name="mode">
545       <entry name="current" value="0x1"/>
546       <entry name="preferred" value="0x2"/>
547     </enum>
548       
549     <event name="mode">
550       <arg name="flags" type="uint"/>
551       <arg name="width" type="int"/>
552       <arg name="height" type="int"/>
553       <arg name="refresh" type="int"/>
554     </event>
555   </interface>
556
557
558   <!-- A visual is the pixel format.  The different visuals are
559        currently only identified by the order they are advertised by
560        the 'global' events.  We need something better.  -->
561   <interface name="wl_visual" version="1"/>
562
563 </protocol>