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