1*84e872a0SLloyd Pique /* SCANNER TEST */
2*84e872a0SLloyd Pique
3*84e872a0SLloyd Pique #ifndef WAYLAND_CLIENT_PROTOCOL_H
4*84e872a0SLloyd Pique #define WAYLAND_CLIENT_PROTOCOL_H
5*84e872a0SLloyd Pique
6*84e872a0SLloyd Pique #include <stdint.h>
7*84e872a0SLloyd Pique #include <stddef.h>
8*84e872a0SLloyd Pique #include "wayland-client.h"
9*84e872a0SLloyd Pique
10*84e872a0SLloyd Pique #ifdef __cplusplus
11*84e872a0SLloyd Pique extern "C" {
12*84e872a0SLloyd Pique #endif
13*84e872a0SLloyd Pique
14*84e872a0SLloyd Pique /**
15*84e872a0SLloyd Pique * @page page_wayland The wayland protocol
16*84e872a0SLloyd Pique * @section page_ifaces_wayland Interfaces
17*84e872a0SLloyd Pique * - @subpage page_iface_wl_display - core global object
18*84e872a0SLloyd Pique * - @subpage page_iface_wl_registry - global registry object
19*84e872a0SLloyd Pique * - @subpage page_iface_wl_callback - callback object
20*84e872a0SLloyd Pique * - @subpage page_iface_wl_compositor - the compositor singleton
21*84e872a0SLloyd Pique * - @subpage page_iface_wl_shm_pool - a shared memory pool
22*84e872a0SLloyd Pique * - @subpage page_iface_wl_shm - shared memory support
23*84e872a0SLloyd Pique * - @subpage page_iface_wl_buffer - content for a wl_surface
24*84e872a0SLloyd Pique * - @subpage page_iface_wl_data_offer - offer to transfer data
25*84e872a0SLloyd Pique * - @subpage page_iface_wl_data_source - offer to transfer data
26*84e872a0SLloyd Pique * - @subpage page_iface_wl_data_device - data transfer device
27*84e872a0SLloyd Pique * - @subpage page_iface_wl_data_device_manager - data transfer interface
28*84e872a0SLloyd Pique * - @subpage page_iface_wl_shell - create desktop-style surfaces
29*84e872a0SLloyd Pique * - @subpage page_iface_wl_shell_surface - desktop-style metadata interface
30*84e872a0SLloyd Pique * - @subpage page_iface_wl_surface - an onscreen surface
31*84e872a0SLloyd Pique * - @subpage page_iface_wl_seat - group of input devices
32*84e872a0SLloyd Pique * - @subpage page_iface_wl_pointer - pointer input device
33*84e872a0SLloyd Pique * - @subpage page_iface_wl_keyboard - keyboard input device
34*84e872a0SLloyd Pique * - @subpage page_iface_wl_touch - touchscreen input device
35*84e872a0SLloyd Pique * - @subpage page_iface_wl_output - compositor output region
36*84e872a0SLloyd Pique * - @subpage page_iface_wl_region - region interface
37*84e872a0SLloyd Pique * - @subpage page_iface_wl_subcompositor - sub-surface compositing
38*84e872a0SLloyd Pique * - @subpage page_iface_wl_subsurface - sub-surface interface to a wl_surface
39*84e872a0SLloyd Pique * @section page_copyright_wayland Copyright
40*84e872a0SLloyd Pique * <pre>
41*84e872a0SLloyd Pique *
42*84e872a0SLloyd Pique * Copyright © 2008-2011 Kristian Høgsberg
43*84e872a0SLloyd Pique * Copyright © 2010-2011 Intel Corporation
44*84e872a0SLloyd Pique * Copyright © 2012-2013 Collabora, Ltd.
45*84e872a0SLloyd Pique *
46*84e872a0SLloyd Pique * Permission is hereby granted, free of charge, to any person
47*84e872a0SLloyd Pique * obtaining a copy of this software and associated documentation files
48*84e872a0SLloyd Pique * (the "Software"), to deal in the Software without restriction,
49*84e872a0SLloyd Pique * including without limitation the rights to use, copy, modify, merge,
50*84e872a0SLloyd Pique * publish, distribute, sublicense, and/or sell copies of the Software,
51*84e872a0SLloyd Pique * and to permit persons to whom the Software is furnished to do so,
52*84e872a0SLloyd Pique * subject to the following conditions:
53*84e872a0SLloyd Pique *
54*84e872a0SLloyd Pique * The above copyright notice and this permission notice (including the
55*84e872a0SLloyd Pique * next paragraph) shall be included in all copies or substantial
56*84e872a0SLloyd Pique * portions of the Software.
57*84e872a0SLloyd Pique *
58*84e872a0SLloyd Pique * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
59*84e872a0SLloyd Pique * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60*84e872a0SLloyd Pique * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
61*84e872a0SLloyd Pique * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
62*84e872a0SLloyd Pique * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
63*84e872a0SLloyd Pique * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
64*84e872a0SLloyd Pique * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65*84e872a0SLloyd Pique * SOFTWARE.
66*84e872a0SLloyd Pique * </pre>
67*84e872a0SLloyd Pique */
68*84e872a0SLloyd Pique struct wl_buffer;
69*84e872a0SLloyd Pique struct wl_callback;
70*84e872a0SLloyd Pique struct wl_compositor;
71*84e872a0SLloyd Pique struct wl_data_device;
72*84e872a0SLloyd Pique struct wl_data_device_manager;
73*84e872a0SLloyd Pique struct wl_data_offer;
74*84e872a0SLloyd Pique struct wl_data_source;
75*84e872a0SLloyd Pique struct wl_display;
76*84e872a0SLloyd Pique struct wl_keyboard;
77*84e872a0SLloyd Pique struct wl_output;
78*84e872a0SLloyd Pique struct wl_pointer;
79*84e872a0SLloyd Pique struct wl_region;
80*84e872a0SLloyd Pique struct wl_registry;
81*84e872a0SLloyd Pique struct wl_seat;
82*84e872a0SLloyd Pique struct wl_shell;
83*84e872a0SLloyd Pique struct wl_shell_surface;
84*84e872a0SLloyd Pique struct wl_shm;
85*84e872a0SLloyd Pique struct wl_shm_pool;
86*84e872a0SLloyd Pique struct wl_subcompositor;
87*84e872a0SLloyd Pique struct wl_subsurface;
88*84e872a0SLloyd Pique struct wl_surface;
89*84e872a0SLloyd Pique struct wl_touch;
90*84e872a0SLloyd Pique
91*84e872a0SLloyd Pique #ifndef WL_DISPLAY_INTERFACE
92*84e872a0SLloyd Pique #define WL_DISPLAY_INTERFACE
93*84e872a0SLloyd Pique /**
94*84e872a0SLloyd Pique * @page page_iface_wl_display wl_display
95*84e872a0SLloyd Pique * @section page_iface_wl_display_desc Description
96*84e872a0SLloyd Pique *
97*84e872a0SLloyd Pique * The core global object. This is a special singleton object. It
98*84e872a0SLloyd Pique * is used for internal Wayland protocol features.
99*84e872a0SLloyd Pique * @section page_iface_wl_display_api API
100*84e872a0SLloyd Pique * See @ref iface_wl_display.
101*84e872a0SLloyd Pique */
102*84e872a0SLloyd Pique /**
103*84e872a0SLloyd Pique * @defgroup iface_wl_display The wl_display interface
104*84e872a0SLloyd Pique *
105*84e872a0SLloyd Pique * The core global object. This is a special singleton object. It
106*84e872a0SLloyd Pique * is used for internal Wayland protocol features.
107*84e872a0SLloyd Pique */
108*84e872a0SLloyd Pique extern const struct wl_interface wl_display_interface;
109*84e872a0SLloyd Pique #endif
110*84e872a0SLloyd Pique #ifndef WL_REGISTRY_INTERFACE
111*84e872a0SLloyd Pique #define WL_REGISTRY_INTERFACE
112*84e872a0SLloyd Pique /**
113*84e872a0SLloyd Pique * @page page_iface_wl_registry wl_registry
114*84e872a0SLloyd Pique * @section page_iface_wl_registry_desc Description
115*84e872a0SLloyd Pique *
116*84e872a0SLloyd Pique * The singleton global registry object. The server has a number of
117*84e872a0SLloyd Pique * global objects that are available to all clients. These objects
118*84e872a0SLloyd Pique * typically represent an actual object in the server (for example,
119*84e872a0SLloyd Pique * an input device) or they are singleton objects that provide
120*84e872a0SLloyd Pique * extension functionality.
121*84e872a0SLloyd Pique *
122*84e872a0SLloyd Pique * When a client creates a registry object, the registry object
123*84e872a0SLloyd Pique * will emit a global event for each global currently in the
124*84e872a0SLloyd Pique * registry. Globals come and go as a result of device or
125*84e872a0SLloyd Pique * monitor hotplugs, reconfiguration or other events, and the
126*84e872a0SLloyd Pique * registry will send out global and global_remove events to
127*84e872a0SLloyd Pique * keep the client up to date with the changes. To mark the end
128*84e872a0SLloyd Pique * of the initial burst of events, the client can use the
129*84e872a0SLloyd Pique * wl_display.sync request immediately after calling
130*84e872a0SLloyd Pique * wl_display.get_registry.
131*84e872a0SLloyd Pique *
132*84e872a0SLloyd Pique * A client can bind to a global object by using the bind
133*84e872a0SLloyd Pique * request. This creates a client-side handle that lets the object
134*84e872a0SLloyd Pique * emit events to the client and lets the client invoke requests on
135*84e872a0SLloyd Pique * the object.
136*84e872a0SLloyd Pique * @section page_iface_wl_registry_api API
137*84e872a0SLloyd Pique * See @ref iface_wl_registry.
138*84e872a0SLloyd Pique */
139*84e872a0SLloyd Pique /**
140*84e872a0SLloyd Pique * @defgroup iface_wl_registry The wl_registry interface
141*84e872a0SLloyd Pique *
142*84e872a0SLloyd Pique * The singleton global registry object. The server has a number of
143*84e872a0SLloyd Pique * global objects that are available to all clients. These objects
144*84e872a0SLloyd Pique * typically represent an actual object in the server (for example,
145*84e872a0SLloyd Pique * an input device) or they are singleton objects that provide
146*84e872a0SLloyd Pique * extension functionality.
147*84e872a0SLloyd Pique *
148*84e872a0SLloyd Pique * When a client creates a registry object, the registry object
149*84e872a0SLloyd Pique * will emit a global event for each global currently in the
150*84e872a0SLloyd Pique * registry. Globals come and go as a result of device or
151*84e872a0SLloyd Pique * monitor hotplugs, reconfiguration or other events, and the
152*84e872a0SLloyd Pique * registry will send out global and global_remove events to
153*84e872a0SLloyd Pique * keep the client up to date with the changes. To mark the end
154*84e872a0SLloyd Pique * of the initial burst of events, the client can use the
155*84e872a0SLloyd Pique * wl_display.sync request immediately after calling
156*84e872a0SLloyd Pique * wl_display.get_registry.
157*84e872a0SLloyd Pique *
158*84e872a0SLloyd Pique * A client can bind to a global object by using the bind
159*84e872a0SLloyd Pique * request. This creates a client-side handle that lets the object
160*84e872a0SLloyd Pique * emit events to the client and lets the client invoke requests on
161*84e872a0SLloyd Pique * the object.
162*84e872a0SLloyd Pique */
163*84e872a0SLloyd Pique extern const struct wl_interface wl_registry_interface;
164*84e872a0SLloyd Pique #endif
165*84e872a0SLloyd Pique #ifndef WL_CALLBACK_INTERFACE
166*84e872a0SLloyd Pique #define WL_CALLBACK_INTERFACE
167*84e872a0SLloyd Pique /**
168*84e872a0SLloyd Pique * @page page_iface_wl_callback wl_callback
169*84e872a0SLloyd Pique * @section page_iface_wl_callback_desc Description
170*84e872a0SLloyd Pique *
171*84e872a0SLloyd Pique * Clients can handle the 'done' event to get notified when
172*84e872a0SLloyd Pique * the related request is done.
173*84e872a0SLloyd Pique * @section page_iface_wl_callback_api API
174*84e872a0SLloyd Pique * See @ref iface_wl_callback.
175*84e872a0SLloyd Pique */
176*84e872a0SLloyd Pique /**
177*84e872a0SLloyd Pique * @defgroup iface_wl_callback The wl_callback interface
178*84e872a0SLloyd Pique *
179*84e872a0SLloyd Pique * Clients can handle the 'done' event to get notified when
180*84e872a0SLloyd Pique * the related request is done.
181*84e872a0SLloyd Pique */
182*84e872a0SLloyd Pique extern const struct wl_interface wl_callback_interface;
183*84e872a0SLloyd Pique #endif
184*84e872a0SLloyd Pique #ifndef WL_COMPOSITOR_INTERFACE
185*84e872a0SLloyd Pique #define WL_COMPOSITOR_INTERFACE
186*84e872a0SLloyd Pique /**
187*84e872a0SLloyd Pique * @page page_iface_wl_compositor wl_compositor
188*84e872a0SLloyd Pique * @section page_iface_wl_compositor_desc Description
189*84e872a0SLloyd Pique *
190*84e872a0SLloyd Pique * A compositor. This object is a singleton global. The
191*84e872a0SLloyd Pique * compositor is in charge of combining the contents of multiple
192*84e872a0SLloyd Pique * surfaces into one displayable output.
193*84e872a0SLloyd Pique * @section page_iface_wl_compositor_api API
194*84e872a0SLloyd Pique * See @ref iface_wl_compositor.
195*84e872a0SLloyd Pique */
196*84e872a0SLloyd Pique /**
197*84e872a0SLloyd Pique * @defgroup iface_wl_compositor The wl_compositor interface
198*84e872a0SLloyd Pique *
199*84e872a0SLloyd Pique * A compositor. This object is a singleton global. The
200*84e872a0SLloyd Pique * compositor is in charge of combining the contents of multiple
201*84e872a0SLloyd Pique * surfaces into one displayable output.
202*84e872a0SLloyd Pique */
203*84e872a0SLloyd Pique extern const struct wl_interface wl_compositor_interface;
204*84e872a0SLloyd Pique #endif
205*84e872a0SLloyd Pique #ifndef WL_SHM_POOL_INTERFACE
206*84e872a0SLloyd Pique #define WL_SHM_POOL_INTERFACE
207*84e872a0SLloyd Pique /**
208*84e872a0SLloyd Pique * @page page_iface_wl_shm_pool wl_shm_pool
209*84e872a0SLloyd Pique * @section page_iface_wl_shm_pool_desc Description
210*84e872a0SLloyd Pique *
211*84e872a0SLloyd Pique * The wl_shm_pool object encapsulates a piece of memory shared
212*84e872a0SLloyd Pique * between the compositor and client. Through the wl_shm_pool
213*84e872a0SLloyd Pique * object, the client can allocate shared memory wl_buffer objects.
214*84e872a0SLloyd Pique * All objects created through the same pool share the same
215*84e872a0SLloyd Pique * underlying mapped memory. Reusing the mapped memory avoids the
216*84e872a0SLloyd Pique * setup/teardown overhead and is useful when interactively resizing
217*84e872a0SLloyd Pique * a surface or for many small buffers.
218*84e872a0SLloyd Pique * @section page_iface_wl_shm_pool_api API
219*84e872a0SLloyd Pique * See @ref iface_wl_shm_pool.
220*84e872a0SLloyd Pique */
221*84e872a0SLloyd Pique /**
222*84e872a0SLloyd Pique * @defgroup iface_wl_shm_pool The wl_shm_pool interface
223*84e872a0SLloyd Pique *
224*84e872a0SLloyd Pique * The wl_shm_pool object encapsulates a piece of memory shared
225*84e872a0SLloyd Pique * between the compositor and client. Through the wl_shm_pool
226*84e872a0SLloyd Pique * object, the client can allocate shared memory wl_buffer objects.
227*84e872a0SLloyd Pique * All objects created through the same pool share the same
228*84e872a0SLloyd Pique * underlying mapped memory. Reusing the mapped memory avoids the
229*84e872a0SLloyd Pique * setup/teardown overhead and is useful when interactively resizing
230*84e872a0SLloyd Pique * a surface or for many small buffers.
231*84e872a0SLloyd Pique */
232*84e872a0SLloyd Pique extern const struct wl_interface wl_shm_pool_interface;
233*84e872a0SLloyd Pique #endif
234*84e872a0SLloyd Pique #ifndef WL_SHM_INTERFACE
235*84e872a0SLloyd Pique #define WL_SHM_INTERFACE
236*84e872a0SLloyd Pique /**
237*84e872a0SLloyd Pique * @page page_iface_wl_shm wl_shm
238*84e872a0SLloyd Pique * @section page_iface_wl_shm_desc Description
239*84e872a0SLloyd Pique *
240*84e872a0SLloyd Pique * A singleton global object that provides support for shared
241*84e872a0SLloyd Pique * memory.
242*84e872a0SLloyd Pique *
243*84e872a0SLloyd Pique * Clients can create wl_shm_pool objects using the create_pool
244*84e872a0SLloyd Pique * request.
245*84e872a0SLloyd Pique *
246*84e872a0SLloyd Pique * At connection setup time, the wl_shm object emits one or more
247*84e872a0SLloyd Pique * format events to inform clients about the valid pixel formats
248*84e872a0SLloyd Pique * that can be used for buffers.
249*84e872a0SLloyd Pique * @section page_iface_wl_shm_api API
250*84e872a0SLloyd Pique * See @ref iface_wl_shm.
251*84e872a0SLloyd Pique */
252*84e872a0SLloyd Pique /**
253*84e872a0SLloyd Pique * @defgroup iface_wl_shm The wl_shm interface
254*84e872a0SLloyd Pique *
255*84e872a0SLloyd Pique * A singleton global object that provides support for shared
256*84e872a0SLloyd Pique * memory.
257*84e872a0SLloyd Pique *
258*84e872a0SLloyd Pique * Clients can create wl_shm_pool objects using the create_pool
259*84e872a0SLloyd Pique * request.
260*84e872a0SLloyd Pique *
261*84e872a0SLloyd Pique * At connection setup time, the wl_shm object emits one or more
262*84e872a0SLloyd Pique * format events to inform clients about the valid pixel formats
263*84e872a0SLloyd Pique * that can be used for buffers.
264*84e872a0SLloyd Pique */
265*84e872a0SLloyd Pique extern const struct wl_interface wl_shm_interface;
266*84e872a0SLloyd Pique #endif
267*84e872a0SLloyd Pique #ifndef WL_BUFFER_INTERFACE
268*84e872a0SLloyd Pique #define WL_BUFFER_INTERFACE
269*84e872a0SLloyd Pique /**
270*84e872a0SLloyd Pique * @page page_iface_wl_buffer wl_buffer
271*84e872a0SLloyd Pique * @section page_iface_wl_buffer_desc Description
272*84e872a0SLloyd Pique *
273*84e872a0SLloyd Pique * A buffer provides the content for a wl_surface. Buffers are
274*84e872a0SLloyd Pique * created through factory interfaces such as wl_drm, wl_shm or
275*84e872a0SLloyd Pique * similar. It has a width and a height and can be attached to a
276*84e872a0SLloyd Pique * wl_surface, but the mechanism by which a client provides and
277*84e872a0SLloyd Pique * updates the contents is defined by the buffer factory interface.
278*84e872a0SLloyd Pique * @section page_iface_wl_buffer_api API
279*84e872a0SLloyd Pique * See @ref iface_wl_buffer.
280*84e872a0SLloyd Pique */
281*84e872a0SLloyd Pique /**
282*84e872a0SLloyd Pique * @defgroup iface_wl_buffer The wl_buffer interface
283*84e872a0SLloyd Pique *
284*84e872a0SLloyd Pique * A buffer provides the content for a wl_surface. Buffers are
285*84e872a0SLloyd Pique * created through factory interfaces such as wl_drm, wl_shm or
286*84e872a0SLloyd Pique * similar. It has a width and a height and can be attached to a
287*84e872a0SLloyd Pique * wl_surface, but the mechanism by which a client provides and
288*84e872a0SLloyd Pique * updates the contents is defined by the buffer factory interface.
289*84e872a0SLloyd Pique */
290*84e872a0SLloyd Pique extern const struct wl_interface wl_buffer_interface;
291*84e872a0SLloyd Pique #endif
292*84e872a0SLloyd Pique #ifndef WL_DATA_OFFER_INTERFACE
293*84e872a0SLloyd Pique #define WL_DATA_OFFER_INTERFACE
294*84e872a0SLloyd Pique /**
295*84e872a0SLloyd Pique * @page page_iface_wl_data_offer wl_data_offer
296*84e872a0SLloyd Pique * @section page_iface_wl_data_offer_desc Description
297*84e872a0SLloyd Pique *
298*84e872a0SLloyd Pique * A wl_data_offer represents a piece of data offered for transfer
299*84e872a0SLloyd Pique * by another client (the source client). It is used by the
300*84e872a0SLloyd Pique * copy-and-paste and drag-and-drop mechanisms. The offer
301*84e872a0SLloyd Pique * describes the different mime types that the data can be
302*84e872a0SLloyd Pique * converted to and provides the mechanism for transferring the
303*84e872a0SLloyd Pique * data directly from the source client.
304*84e872a0SLloyd Pique * @section page_iface_wl_data_offer_api API
305*84e872a0SLloyd Pique * See @ref iface_wl_data_offer.
306*84e872a0SLloyd Pique */
307*84e872a0SLloyd Pique /**
308*84e872a0SLloyd Pique * @defgroup iface_wl_data_offer The wl_data_offer interface
309*84e872a0SLloyd Pique *
310*84e872a0SLloyd Pique * A wl_data_offer represents a piece of data offered for transfer
311*84e872a0SLloyd Pique * by another client (the source client). It is used by the
312*84e872a0SLloyd Pique * copy-and-paste and drag-and-drop mechanisms. The offer
313*84e872a0SLloyd Pique * describes the different mime types that the data can be
314*84e872a0SLloyd Pique * converted to and provides the mechanism for transferring the
315*84e872a0SLloyd Pique * data directly from the source client.
316*84e872a0SLloyd Pique */
317*84e872a0SLloyd Pique extern const struct wl_interface wl_data_offer_interface;
318*84e872a0SLloyd Pique #endif
319*84e872a0SLloyd Pique #ifndef WL_DATA_SOURCE_INTERFACE
320*84e872a0SLloyd Pique #define WL_DATA_SOURCE_INTERFACE
321*84e872a0SLloyd Pique /**
322*84e872a0SLloyd Pique * @page page_iface_wl_data_source wl_data_source
323*84e872a0SLloyd Pique * @section page_iface_wl_data_source_desc Description
324*84e872a0SLloyd Pique *
325*84e872a0SLloyd Pique * The wl_data_source object is the source side of a wl_data_offer.
326*84e872a0SLloyd Pique * It is created by the source client in a data transfer and
327*84e872a0SLloyd Pique * provides a way to describe the offered data and a way to respond
328*84e872a0SLloyd Pique * to requests to transfer the data.
329*84e872a0SLloyd Pique * @section page_iface_wl_data_source_api API
330*84e872a0SLloyd Pique * See @ref iface_wl_data_source.
331*84e872a0SLloyd Pique */
332*84e872a0SLloyd Pique /**
333*84e872a0SLloyd Pique * @defgroup iface_wl_data_source The wl_data_source interface
334*84e872a0SLloyd Pique *
335*84e872a0SLloyd Pique * The wl_data_source object is the source side of a wl_data_offer.
336*84e872a0SLloyd Pique * It is created by the source client in a data transfer and
337*84e872a0SLloyd Pique * provides a way to describe the offered data and a way to respond
338*84e872a0SLloyd Pique * to requests to transfer the data.
339*84e872a0SLloyd Pique */
340*84e872a0SLloyd Pique extern const struct wl_interface wl_data_source_interface;
341*84e872a0SLloyd Pique #endif
342*84e872a0SLloyd Pique #ifndef WL_DATA_DEVICE_INTERFACE
343*84e872a0SLloyd Pique #define WL_DATA_DEVICE_INTERFACE
344*84e872a0SLloyd Pique /**
345*84e872a0SLloyd Pique * @page page_iface_wl_data_device wl_data_device
346*84e872a0SLloyd Pique * @section page_iface_wl_data_device_desc Description
347*84e872a0SLloyd Pique *
348*84e872a0SLloyd Pique * There is one wl_data_device per seat which can be obtained
349*84e872a0SLloyd Pique * from the global wl_data_device_manager singleton.
350*84e872a0SLloyd Pique *
351*84e872a0SLloyd Pique * A wl_data_device provides access to inter-client data transfer
352*84e872a0SLloyd Pique * mechanisms such as copy-and-paste and drag-and-drop.
353*84e872a0SLloyd Pique * @section page_iface_wl_data_device_api API
354*84e872a0SLloyd Pique * See @ref iface_wl_data_device.
355*84e872a0SLloyd Pique */
356*84e872a0SLloyd Pique /**
357*84e872a0SLloyd Pique * @defgroup iface_wl_data_device The wl_data_device interface
358*84e872a0SLloyd Pique *
359*84e872a0SLloyd Pique * There is one wl_data_device per seat which can be obtained
360*84e872a0SLloyd Pique * from the global wl_data_device_manager singleton.
361*84e872a0SLloyd Pique *
362*84e872a0SLloyd Pique * A wl_data_device provides access to inter-client data transfer
363*84e872a0SLloyd Pique * mechanisms such as copy-and-paste and drag-and-drop.
364*84e872a0SLloyd Pique */
365*84e872a0SLloyd Pique extern const struct wl_interface wl_data_device_interface;
366*84e872a0SLloyd Pique #endif
367*84e872a0SLloyd Pique #ifndef WL_DATA_DEVICE_MANAGER_INTERFACE
368*84e872a0SLloyd Pique #define WL_DATA_DEVICE_MANAGER_INTERFACE
369*84e872a0SLloyd Pique /**
370*84e872a0SLloyd Pique * @page page_iface_wl_data_device_manager wl_data_device_manager
371*84e872a0SLloyd Pique * @section page_iface_wl_data_device_manager_desc Description
372*84e872a0SLloyd Pique *
373*84e872a0SLloyd Pique * The wl_data_device_manager is a singleton global object that
374*84e872a0SLloyd Pique * provides access to inter-client data transfer mechanisms such as
375*84e872a0SLloyd Pique * copy-and-paste and drag-and-drop. These mechanisms are tied to
376*84e872a0SLloyd Pique * a wl_seat and this interface lets a client get a wl_data_device
377*84e872a0SLloyd Pique * corresponding to a wl_seat.
378*84e872a0SLloyd Pique *
379*84e872a0SLloyd Pique * Depending on the version bound, the objects created from the bound
380*84e872a0SLloyd Pique * wl_data_device_manager object will have different requirements for
381*84e872a0SLloyd Pique * functioning properly. See wl_data_source.set_actions,
382*84e872a0SLloyd Pique * wl_data_offer.accept and wl_data_offer.finish for details.
383*84e872a0SLloyd Pique * @section page_iface_wl_data_device_manager_api API
384*84e872a0SLloyd Pique * See @ref iface_wl_data_device_manager.
385*84e872a0SLloyd Pique */
386*84e872a0SLloyd Pique /**
387*84e872a0SLloyd Pique * @defgroup iface_wl_data_device_manager The wl_data_device_manager interface
388*84e872a0SLloyd Pique *
389*84e872a0SLloyd Pique * The wl_data_device_manager is a singleton global object that
390*84e872a0SLloyd Pique * provides access to inter-client data transfer mechanisms such as
391*84e872a0SLloyd Pique * copy-and-paste and drag-and-drop. These mechanisms are tied to
392*84e872a0SLloyd Pique * a wl_seat and this interface lets a client get a wl_data_device
393*84e872a0SLloyd Pique * corresponding to a wl_seat.
394*84e872a0SLloyd Pique *
395*84e872a0SLloyd Pique * Depending on the version bound, the objects created from the bound
396*84e872a0SLloyd Pique * wl_data_device_manager object will have different requirements for
397*84e872a0SLloyd Pique * functioning properly. See wl_data_source.set_actions,
398*84e872a0SLloyd Pique * wl_data_offer.accept and wl_data_offer.finish for details.
399*84e872a0SLloyd Pique */
400*84e872a0SLloyd Pique extern const struct wl_interface wl_data_device_manager_interface;
401*84e872a0SLloyd Pique #endif
402*84e872a0SLloyd Pique #ifndef WL_SHELL_INTERFACE
403*84e872a0SLloyd Pique #define WL_SHELL_INTERFACE
404*84e872a0SLloyd Pique /**
405*84e872a0SLloyd Pique * @page page_iface_wl_shell wl_shell
406*84e872a0SLloyd Pique * @section page_iface_wl_shell_desc Description
407*84e872a0SLloyd Pique *
408*84e872a0SLloyd Pique * This interface is implemented by servers that provide
409*84e872a0SLloyd Pique * desktop-style user interfaces.
410*84e872a0SLloyd Pique *
411*84e872a0SLloyd Pique * It allows clients to associate a wl_shell_surface with
412*84e872a0SLloyd Pique * a basic surface.
413*84e872a0SLloyd Pique * @section page_iface_wl_shell_api API
414*84e872a0SLloyd Pique * See @ref iface_wl_shell.
415*84e872a0SLloyd Pique */
416*84e872a0SLloyd Pique /**
417*84e872a0SLloyd Pique * @defgroup iface_wl_shell The wl_shell interface
418*84e872a0SLloyd Pique *
419*84e872a0SLloyd Pique * This interface is implemented by servers that provide
420*84e872a0SLloyd Pique * desktop-style user interfaces.
421*84e872a0SLloyd Pique *
422*84e872a0SLloyd Pique * It allows clients to associate a wl_shell_surface with
423*84e872a0SLloyd Pique * a basic surface.
424*84e872a0SLloyd Pique */
425*84e872a0SLloyd Pique extern const struct wl_interface wl_shell_interface;
426*84e872a0SLloyd Pique #endif
427*84e872a0SLloyd Pique #ifndef WL_SHELL_SURFACE_INTERFACE
428*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_INTERFACE
429*84e872a0SLloyd Pique /**
430*84e872a0SLloyd Pique * @page page_iface_wl_shell_surface wl_shell_surface
431*84e872a0SLloyd Pique * @section page_iface_wl_shell_surface_desc Description
432*84e872a0SLloyd Pique *
433*84e872a0SLloyd Pique * An interface that may be implemented by a wl_surface, for
434*84e872a0SLloyd Pique * implementations that provide a desktop-style user interface.
435*84e872a0SLloyd Pique *
436*84e872a0SLloyd Pique * It provides requests to treat surfaces like toplevel, fullscreen
437*84e872a0SLloyd Pique * or popup windows, move, resize or maximize them, associate
438*84e872a0SLloyd Pique * metadata like title and class, etc.
439*84e872a0SLloyd Pique *
440*84e872a0SLloyd Pique * On the server side the object is automatically destroyed when
441*84e872a0SLloyd Pique * the related wl_surface is destroyed. On the client side,
442*84e872a0SLloyd Pique * wl_shell_surface_destroy() must be called before destroying
443*84e872a0SLloyd Pique * the wl_surface object.
444*84e872a0SLloyd Pique * @section page_iface_wl_shell_surface_api API
445*84e872a0SLloyd Pique * See @ref iface_wl_shell_surface.
446*84e872a0SLloyd Pique */
447*84e872a0SLloyd Pique /**
448*84e872a0SLloyd Pique * @defgroup iface_wl_shell_surface The wl_shell_surface interface
449*84e872a0SLloyd Pique *
450*84e872a0SLloyd Pique * An interface that may be implemented by a wl_surface, for
451*84e872a0SLloyd Pique * implementations that provide a desktop-style user interface.
452*84e872a0SLloyd Pique *
453*84e872a0SLloyd Pique * It provides requests to treat surfaces like toplevel, fullscreen
454*84e872a0SLloyd Pique * or popup windows, move, resize or maximize them, associate
455*84e872a0SLloyd Pique * metadata like title and class, etc.
456*84e872a0SLloyd Pique *
457*84e872a0SLloyd Pique * On the server side the object is automatically destroyed when
458*84e872a0SLloyd Pique * the related wl_surface is destroyed. On the client side,
459*84e872a0SLloyd Pique * wl_shell_surface_destroy() must be called before destroying
460*84e872a0SLloyd Pique * the wl_surface object.
461*84e872a0SLloyd Pique */
462*84e872a0SLloyd Pique extern const struct wl_interface wl_shell_surface_interface;
463*84e872a0SLloyd Pique #endif
464*84e872a0SLloyd Pique #ifndef WL_SURFACE_INTERFACE
465*84e872a0SLloyd Pique #define WL_SURFACE_INTERFACE
466*84e872a0SLloyd Pique /**
467*84e872a0SLloyd Pique * @page page_iface_wl_surface wl_surface
468*84e872a0SLloyd Pique * @section page_iface_wl_surface_desc Description
469*84e872a0SLloyd Pique *
470*84e872a0SLloyd Pique * A surface is a rectangular area that is displayed on the screen.
471*84e872a0SLloyd Pique * It has a location, size and pixel contents.
472*84e872a0SLloyd Pique *
473*84e872a0SLloyd Pique * The size of a surface (and relative positions on it) is described
474*84e872a0SLloyd Pique * in surface-local coordinates, which may differ from the buffer
475*84e872a0SLloyd Pique * coordinates of the pixel content, in case a buffer_transform
476*84e872a0SLloyd Pique * or a buffer_scale is used.
477*84e872a0SLloyd Pique *
478*84e872a0SLloyd Pique * A surface without a "role" is fairly useless: a compositor does
479*84e872a0SLloyd Pique * not know where, when or how to present it. The role is the
480*84e872a0SLloyd Pique * purpose of a wl_surface. Examples of roles are a cursor for a
481*84e872a0SLloyd Pique * pointer (as set by wl_pointer.set_cursor), a drag icon
482*84e872a0SLloyd Pique * (wl_data_device.start_drag), a sub-surface
483*84e872a0SLloyd Pique * (wl_subcompositor.get_subsurface), and a window as defined by a
484*84e872a0SLloyd Pique * shell protocol (e.g. wl_shell.get_shell_surface).
485*84e872a0SLloyd Pique *
486*84e872a0SLloyd Pique * A surface can have only one role at a time. Initially a
487*84e872a0SLloyd Pique * wl_surface does not have a role. Once a wl_surface is given a
488*84e872a0SLloyd Pique * role, it is set permanently for the whole lifetime of the
489*84e872a0SLloyd Pique * wl_surface object. Giving the current role again is allowed,
490*84e872a0SLloyd Pique * unless explicitly forbidden by the relevant interface
491*84e872a0SLloyd Pique * specification.
492*84e872a0SLloyd Pique *
493*84e872a0SLloyd Pique * Surface roles are given by requests in other interfaces such as
494*84e872a0SLloyd Pique * wl_pointer.set_cursor. The request should explicitly mention
495*84e872a0SLloyd Pique * that this request gives a role to a wl_surface. Often, this
496*84e872a0SLloyd Pique * request also creates a new protocol object that represents the
497*84e872a0SLloyd Pique * role and adds additional functionality to wl_surface. When a
498*84e872a0SLloyd Pique * client wants to destroy a wl_surface, they must destroy this 'role
499*84e872a0SLloyd Pique * object' before the wl_surface.
500*84e872a0SLloyd Pique *
501*84e872a0SLloyd Pique * Destroying the role object does not remove the role from the
502*84e872a0SLloyd Pique * wl_surface, but it may stop the wl_surface from "playing the role".
503*84e872a0SLloyd Pique * For instance, if a wl_subsurface object is destroyed, the wl_surface
504*84e872a0SLloyd Pique * it was created for will be unmapped and forget its position and
505*84e872a0SLloyd Pique * z-order. It is allowed to create a wl_subsurface for the same
506*84e872a0SLloyd Pique * wl_surface again, but it is not allowed to use the wl_surface as
507*84e872a0SLloyd Pique * a cursor (cursor is a different role than sub-surface, and role
508*84e872a0SLloyd Pique * switching is not allowed).
509*84e872a0SLloyd Pique * @section page_iface_wl_surface_api API
510*84e872a0SLloyd Pique * See @ref iface_wl_surface.
511*84e872a0SLloyd Pique */
512*84e872a0SLloyd Pique /**
513*84e872a0SLloyd Pique * @defgroup iface_wl_surface The wl_surface interface
514*84e872a0SLloyd Pique *
515*84e872a0SLloyd Pique * A surface is a rectangular area that is displayed on the screen.
516*84e872a0SLloyd Pique * It has a location, size and pixel contents.
517*84e872a0SLloyd Pique *
518*84e872a0SLloyd Pique * The size of a surface (and relative positions on it) is described
519*84e872a0SLloyd Pique * in surface-local coordinates, which may differ from the buffer
520*84e872a0SLloyd Pique * coordinates of the pixel content, in case a buffer_transform
521*84e872a0SLloyd Pique * or a buffer_scale is used.
522*84e872a0SLloyd Pique *
523*84e872a0SLloyd Pique * A surface without a "role" is fairly useless: a compositor does
524*84e872a0SLloyd Pique * not know where, when or how to present it. The role is the
525*84e872a0SLloyd Pique * purpose of a wl_surface. Examples of roles are a cursor for a
526*84e872a0SLloyd Pique * pointer (as set by wl_pointer.set_cursor), a drag icon
527*84e872a0SLloyd Pique * (wl_data_device.start_drag), a sub-surface
528*84e872a0SLloyd Pique * (wl_subcompositor.get_subsurface), and a window as defined by a
529*84e872a0SLloyd Pique * shell protocol (e.g. wl_shell.get_shell_surface).
530*84e872a0SLloyd Pique *
531*84e872a0SLloyd Pique * A surface can have only one role at a time. Initially a
532*84e872a0SLloyd Pique * wl_surface does not have a role. Once a wl_surface is given a
533*84e872a0SLloyd Pique * role, it is set permanently for the whole lifetime of the
534*84e872a0SLloyd Pique * wl_surface object. Giving the current role again is allowed,
535*84e872a0SLloyd Pique * unless explicitly forbidden by the relevant interface
536*84e872a0SLloyd Pique * specification.
537*84e872a0SLloyd Pique *
538*84e872a0SLloyd Pique * Surface roles are given by requests in other interfaces such as
539*84e872a0SLloyd Pique * wl_pointer.set_cursor. The request should explicitly mention
540*84e872a0SLloyd Pique * that this request gives a role to a wl_surface. Often, this
541*84e872a0SLloyd Pique * request also creates a new protocol object that represents the
542*84e872a0SLloyd Pique * role and adds additional functionality to wl_surface. When a
543*84e872a0SLloyd Pique * client wants to destroy a wl_surface, they must destroy this 'role
544*84e872a0SLloyd Pique * object' before the wl_surface.
545*84e872a0SLloyd Pique *
546*84e872a0SLloyd Pique * Destroying the role object does not remove the role from the
547*84e872a0SLloyd Pique * wl_surface, but it may stop the wl_surface from "playing the role".
548*84e872a0SLloyd Pique * For instance, if a wl_subsurface object is destroyed, the wl_surface
549*84e872a0SLloyd Pique * it was created for will be unmapped and forget its position and
550*84e872a0SLloyd Pique * z-order. It is allowed to create a wl_subsurface for the same
551*84e872a0SLloyd Pique * wl_surface again, but it is not allowed to use the wl_surface as
552*84e872a0SLloyd Pique * a cursor (cursor is a different role than sub-surface, and role
553*84e872a0SLloyd Pique * switching is not allowed).
554*84e872a0SLloyd Pique */
555*84e872a0SLloyd Pique extern const struct wl_interface wl_surface_interface;
556*84e872a0SLloyd Pique #endif
557*84e872a0SLloyd Pique #ifndef WL_SEAT_INTERFACE
558*84e872a0SLloyd Pique #define WL_SEAT_INTERFACE
559*84e872a0SLloyd Pique /**
560*84e872a0SLloyd Pique * @page page_iface_wl_seat wl_seat
561*84e872a0SLloyd Pique * @section page_iface_wl_seat_desc Description
562*84e872a0SLloyd Pique *
563*84e872a0SLloyd Pique * A seat is a group of keyboards, pointer and touch devices. This
564*84e872a0SLloyd Pique * object is published as a global during start up, or when such a
565*84e872a0SLloyd Pique * device is hot plugged. A seat typically has a pointer and
566*84e872a0SLloyd Pique * maintains a keyboard focus and a pointer focus.
567*84e872a0SLloyd Pique * @section page_iface_wl_seat_api API
568*84e872a0SLloyd Pique * See @ref iface_wl_seat.
569*84e872a0SLloyd Pique */
570*84e872a0SLloyd Pique /**
571*84e872a0SLloyd Pique * @defgroup iface_wl_seat The wl_seat interface
572*84e872a0SLloyd Pique *
573*84e872a0SLloyd Pique * A seat is a group of keyboards, pointer and touch devices. This
574*84e872a0SLloyd Pique * object is published as a global during start up, or when such a
575*84e872a0SLloyd Pique * device is hot plugged. A seat typically has a pointer and
576*84e872a0SLloyd Pique * maintains a keyboard focus and a pointer focus.
577*84e872a0SLloyd Pique */
578*84e872a0SLloyd Pique extern const struct wl_interface wl_seat_interface;
579*84e872a0SLloyd Pique #endif
580*84e872a0SLloyd Pique #ifndef WL_POINTER_INTERFACE
581*84e872a0SLloyd Pique #define WL_POINTER_INTERFACE
582*84e872a0SLloyd Pique /**
583*84e872a0SLloyd Pique * @page page_iface_wl_pointer wl_pointer
584*84e872a0SLloyd Pique * @section page_iface_wl_pointer_desc Description
585*84e872a0SLloyd Pique *
586*84e872a0SLloyd Pique * The wl_pointer interface represents one or more input devices,
587*84e872a0SLloyd Pique * such as mice, which control the pointer location and pointer_focus
588*84e872a0SLloyd Pique * of a seat.
589*84e872a0SLloyd Pique *
590*84e872a0SLloyd Pique * The wl_pointer interface generates motion, enter and leave
591*84e872a0SLloyd Pique * events for the surfaces that the pointer is located over,
592*84e872a0SLloyd Pique * and button and axis events for button presses, button releases
593*84e872a0SLloyd Pique * and scrolling.
594*84e872a0SLloyd Pique * @section page_iface_wl_pointer_api API
595*84e872a0SLloyd Pique * See @ref iface_wl_pointer.
596*84e872a0SLloyd Pique */
597*84e872a0SLloyd Pique /**
598*84e872a0SLloyd Pique * @defgroup iface_wl_pointer The wl_pointer interface
599*84e872a0SLloyd Pique *
600*84e872a0SLloyd Pique * The wl_pointer interface represents one or more input devices,
601*84e872a0SLloyd Pique * such as mice, which control the pointer location and pointer_focus
602*84e872a0SLloyd Pique * of a seat.
603*84e872a0SLloyd Pique *
604*84e872a0SLloyd Pique * The wl_pointer interface generates motion, enter and leave
605*84e872a0SLloyd Pique * events for the surfaces that the pointer is located over,
606*84e872a0SLloyd Pique * and button and axis events for button presses, button releases
607*84e872a0SLloyd Pique * and scrolling.
608*84e872a0SLloyd Pique */
609*84e872a0SLloyd Pique extern const struct wl_interface wl_pointer_interface;
610*84e872a0SLloyd Pique #endif
611*84e872a0SLloyd Pique #ifndef WL_KEYBOARD_INTERFACE
612*84e872a0SLloyd Pique #define WL_KEYBOARD_INTERFACE
613*84e872a0SLloyd Pique /**
614*84e872a0SLloyd Pique * @page page_iface_wl_keyboard wl_keyboard
615*84e872a0SLloyd Pique * @section page_iface_wl_keyboard_desc Description
616*84e872a0SLloyd Pique *
617*84e872a0SLloyd Pique * The wl_keyboard interface represents one or more keyboards
618*84e872a0SLloyd Pique * associated with a seat.
619*84e872a0SLloyd Pique * @section page_iface_wl_keyboard_api API
620*84e872a0SLloyd Pique * See @ref iface_wl_keyboard.
621*84e872a0SLloyd Pique */
622*84e872a0SLloyd Pique /**
623*84e872a0SLloyd Pique * @defgroup iface_wl_keyboard The wl_keyboard interface
624*84e872a0SLloyd Pique *
625*84e872a0SLloyd Pique * The wl_keyboard interface represents one or more keyboards
626*84e872a0SLloyd Pique * associated with a seat.
627*84e872a0SLloyd Pique */
628*84e872a0SLloyd Pique extern const struct wl_interface wl_keyboard_interface;
629*84e872a0SLloyd Pique #endif
630*84e872a0SLloyd Pique #ifndef WL_TOUCH_INTERFACE
631*84e872a0SLloyd Pique #define WL_TOUCH_INTERFACE
632*84e872a0SLloyd Pique /**
633*84e872a0SLloyd Pique * @page page_iface_wl_touch wl_touch
634*84e872a0SLloyd Pique * @section page_iface_wl_touch_desc Description
635*84e872a0SLloyd Pique *
636*84e872a0SLloyd Pique * The wl_touch interface represents a touchscreen
637*84e872a0SLloyd Pique * associated with a seat.
638*84e872a0SLloyd Pique *
639*84e872a0SLloyd Pique * Touch interactions can consist of one or more contacts.
640*84e872a0SLloyd Pique * For each contact, a series of events is generated, starting
641*84e872a0SLloyd Pique * with a down event, followed by zero or more motion events,
642*84e872a0SLloyd Pique * and ending with an up event. Events relating to the same
643*84e872a0SLloyd Pique * contact point can be identified by the ID of the sequence.
644*84e872a0SLloyd Pique * @section page_iface_wl_touch_api API
645*84e872a0SLloyd Pique * See @ref iface_wl_touch.
646*84e872a0SLloyd Pique */
647*84e872a0SLloyd Pique /**
648*84e872a0SLloyd Pique * @defgroup iface_wl_touch The wl_touch interface
649*84e872a0SLloyd Pique *
650*84e872a0SLloyd Pique * The wl_touch interface represents a touchscreen
651*84e872a0SLloyd Pique * associated with a seat.
652*84e872a0SLloyd Pique *
653*84e872a0SLloyd Pique * Touch interactions can consist of one or more contacts.
654*84e872a0SLloyd Pique * For each contact, a series of events is generated, starting
655*84e872a0SLloyd Pique * with a down event, followed by zero or more motion events,
656*84e872a0SLloyd Pique * and ending with an up event. Events relating to the same
657*84e872a0SLloyd Pique * contact point can be identified by the ID of the sequence.
658*84e872a0SLloyd Pique */
659*84e872a0SLloyd Pique extern const struct wl_interface wl_touch_interface;
660*84e872a0SLloyd Pique #endif
661*84e872a0SLloyd Pique #ifndef WL_OUTPUT_INTERFACE
662*84e872a0SLloyd Pique #define WL_OUTPUT_INTERFACE
663*84e872a0SLloyd Pique /**
664*84e872a0SLloyd Pique * @page page_iface_wl_output wl_output
665*84e872a0SLloyd Pique * @section page_iface_wl_output_desc Description
666*84e872a0SLloyd Pique *
667*84e872a0SLloyd Pique * An output describes part of the compositor geometry. The
668*84e872a0SLloyd Pique * compositor works in the 'compositor coordinate system' and an
669*84e872a0SLloyd Pique * output corresponds to a rectangular area in that space that is
670*84e872a0SLloyd Pique * actually visible. This typically corresponds to a monitor that
671*84e872a0SLloyd Pique * displays part of the compositor space. This object is published
672*84e872a0SLloyd Pique * as global during start up, or when a monitor is hotplugged.
673*84e872a0SLloyd Pique * @section page_iface_wl_output_api API
674*84e872a0SLloyd Pique * See @ref iface_wl_output.
675*84e872a0SLloyd Pique */
676*84e872a0SLloyd Pique /**
677*84e872a0SLloyd Pique * @defgroup iface_wl_output The wl_output interface
678*84e872a0SLloyd Pique *
679*84e872a0SLloyd Pique * An output describes part of the compositor geometry. The
680*84e872a0SLloyd Pique * compositor works in the 'compositor coordinate system' and an
681*84e872a0SLloyd Pique * output corresponds to a rectangular area in that space that is
682*84e872a0SLloyd Pique * actually visible. This typically corresponds to a monitor that
683*84e872a0SLloyd Pique * displays part of the compositor space. This object is published
684*84e872a0SLloyd Pique * as global during start up, or when a monitor is hotplugged.
685*84e872a0SLloyd Pique */
686*84e872a0SLloyd Pique extern const struct wl_interface wl_output_interface;
687*84e872a0SLloyd Pique #endif
688*84e872a0SLloyd Pique #ifndef WL_REGION_INTERFACE
689*84e872a0SLloyd Pique #define WL_REGION_INTERFACE
690*84e872a0SLloyd Pique /**
691*84e872a0SLloyd Pique * @page page_iface_wl_region wl_region
692*84e872a0SLloyd Pique * @section page_iface_wl_region_desc Description
693*84e872a0SLloyd Pique *
694*84e872a0SLloyd Pique * A region object describes an area.
695*84e872a0SLloyd Pique *
696*84e872a0SLloyd Pique * Region objects are used to describe the opaque and input
697*84e872a0SLloyd Pique * regions of a surface.
698*84e872a0SLloyd Pique * @section page_iface_wl_region_api API
699*84e872a0SLloyd Pique * See @ref iface_wl_region.
700*84e872a0SLloyd Pique */
701*84e872a0SLloyd Pique /**
702*84e872a0SLloyd Pique * @defgroup iface_wl_region The wl_region interface
703*84e872a0SLloyd Pique *
704*84e872a0SLloyd Pique * A region object describes an area.
705*84e872a0SLloyd Pique *
706*84e872a0SLloyd Pique * Region objects are used to describe the opaque and input
707*84e872a0SLloyd Pique * regions of a surface.
708*84e872a0SLloyd Pique */
709*84e872a0SLloyd Pique extern const struct wl_interface wl_region_interface;
710*84e872a0SLloyd Pique #endif
711*84e872a0SLloyd Pique #ifndef WL_SUBCOMPOSITOR_INTERFACE
712*84e872a0SLloyd Pique #define WL_SUBCOMPOSITOR_INTERFACE
713*84e872a0SLloyd Pique /**
714*84e872a0SLloyd Pique * @page page_iface_wl_subcompositor wl_subcompositor
715*84e872a0SLloyd Pique * @section page_iface_wl_subcompositor_desc Description
716*84e872a0SLloyd Pique *
717*84e872a0SLloyd Pique * The global interface exposing sub-surface compositing capabilities.
718*84e872a0SLloyd Pique * A wl_surface, that has sub-surfaces associated, is called the
719*84e872a0SLloyd Pique * parent surface. Sub-surfaces can be arbitrarily nested and create
720*84e872a0SLloyd Pique * a tree of sub-surfaces.
721*84e872a0SLloyd Pique *
722*84e872a0SLloyd Pique * The root surface in a tree of sub-surfaces is the main
723*84e872a0SLloyd Pique * surface. The main surface cannot be a sub-surface, because
724*84e872a0SLloyd Pique * sub-surfaces must always have a parent.
725*84e872a0SLloyd Pique *
726*84e872a0SLloyd Pique * A main surface with its sub-surfaces forms a (compound) window.
727*84e872a0SLloyd Pique * For window management purposes, this set of wl_surface objects is
728*84e872a0SLloyd Pique * to be considered as a single window, and it should also behave as
729*84e872a0SLloyd Pique * such.
730*84e872a0SLloyd Pique *
731*84e872a0SLloyd Pique * The aim of sub-surfaces is to offload some of the compositing work
732*84e872a0SLloyd Pique * within a window from clients to the compositor. A prime example is
733*84e872a0SLloyd Pique * a video player with decorations and video in separate wl_surface
734*84e872a0SLloyd Pique * objects. This should allow the compositor to pass YUV video buffer
735*84e872a0SLloyd Pique * processing to dedicated overlay hardware when possible.
736*84e872a0SLloyd Pique * @section page_iface_wl_subcompositor_api API
737*84e872a0SLloyd Pique * See @ref iface_wl_subcompositor.
738*84e872a0SLloyd Pique */
739*84e872a0SLloyd Pique /**
740*84e872a0SLloyd Pique * @defgroup iface_wl_subcompositor The wl_subcompositor interface
741*84e872a0SLloyd Pique *
742*84e872a0SLloyd Pique * The global interface exposing sub-surface compositing capabilities.
743*84e872a0SLloyd Pique * A wl_surface, that has sub-surfaces associated, is called the
744*84e872a0SLloyd Pique * parent surface. Sub-surfaces can be arbitrarily nested and create
745*84e872a0SLloyd Pique * a tree of sub-surfaces.
746*84e872a0SLloyd Pique *
747*84e872a0SLloyd Pique * The root surface in a tree of sub-surfaces is the main
748*84e872a0SLloyd Pique * surface. The main surface cannot be a sub-surface, because
749*84e872a0SLloyd Pique * sub-surfaces must always have a parent.
750*84e872a0SLloyd Pique *
751*84e872a0SLloyd Pique * A main surface with its sub-surfaces forms a (compound) window.
752*84e872a0SLloyd Pique * For window management purposes, this set of wl_surface objects is
753*84e872a0SLloyd Pique * to be considered as a single window, and it should also behave as
754*84e872a0SLloyd Pique * such.
755*84e872a0SLloyd Pique *
756*84e872a0SLloyd Pique * The aim of sub-surfaces is to offload some of the compositing work
757*84e872a0SLloyd Pique * within a window from clients to the compositor. A prime example is
758*84e872a0SLloyd Pique * a video player with decorations and video in separate wl_surface
759*84e872a0SLloyd Pique * objects. This should allow the compositor to pass YUV video buffer
760*84e872a0SLloyd Pique * processing to dedicated overlay hardware when possible.
761*84e872a0SLloyd Pique */
762*84e872a0SLloyd Pique extern const struct wl_interface wl_subcompositor_interface;
763*84e872a0SLloyd Pique #endif
764*84e872a0SLloyd Pique #ifndef WL_SUBSURFACE_INTERFACE
765*84e872a0SLloyd Pique #define WL_SUBSURFACE_INTERFACE
766*84e872a0SLloyd Pique /**
767*84e872a0SLloyd Pique * @page page_iface_wl_subsurface wl_subsurface
768*84e872a0SLloyd Pique * @section page_iface_wl_subsurface_desc Description
769*84e872a0SLloyd Pique *
770*84e872a0SLloyd Pique * An additional interface to a wl_surface object, which has been
771*84e872a0SLloyd Pique * made a sub-surface. A sub-surface has one parent surface. A
772*84e872a0SLloyd Pique * sub-surface's size and position are not limited to that of the parent.
773*84e872a0SLloyd Pique * Particularly, a sub-surface is not automatically clipped to its
774*84e872a0SLloyd Pique * parent's area.
775*84e872a0SLloyd Pique *
776*84e872a0SLloyd Pique * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
777*84e872a0SLloyd Pique * and the parent surface is mapped. The order of which one happens
778*84e872a0SLloyd Pique * first is irrelevant. A sub-surface is hidden if the parent becomes
779*84e872a0SLloyd Pique * hidden, or if a NULL wl_buffer is applied. These rules apply
780*84e872a0SLloyd Pique * recursively through the tree of surfaces.
781*84e872a0SLloyd Pique *
782*84e872a0SLloyd Pique * The behaviour of a wl_surface.commit request on a sub-surface
783*84e872a0SLloyd Pique * depends on the sub-surface's mode. The possible modes are
784*84e872a0SLloyd Pique * synchronized and desynchronized, see methods
785*84e872a0SLloyd Pique * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
786*84e872a0SLloyd Pique * mode caches the wl_surface state to be applied when the parent's
787*84e872a0SLloyd Pique * state gets applied, and desynchronized mode applies the pending
788*84e872a0SLloyd Pique * wl_surface state directly. A sub-surface is initially in the
789*84e872a0SLloyd Pique * synchronized mode.
790*84e872a0SLloyd Pique *
791*84e872a0SLloyd Pique * Sub-surfaces have also other kind of state, which is managed by
792*84e872a0SLloyd Pique * wl_subsurface requests, as opposed to wl_surface requests. This
793*84e872a0SLloyd Pique * state includes the sub-surface position relative to the parent
794*84e872a0SLloyd Pique * surface (wl_subsurface.set_position), and the stacking order of
795*84e872a0SLloyd Pique * the parent and its sub-surfaces (wl_subsurface.place_above and
796*84e872a0SLloyd Pique * .place_below). This state is applied when the parent surface's
797*84e872a0SLloyd Pique * wl_surface state is applied, regardless of the sub-surface's mode.
798*84e872a0SLloyd Pique * As the exception, set_sync and set_desync are effective immediately.
799*84e872a0SLloyd Pique *
800*84e872a0SLloyd Pique * The main surface can be thought to be always in desynchronized mode,
801*84e872a0SLloyd Pique * since it does not have a parent in the sub-surfaces sense.
802*84e872a0SLloyd Pique *
803*84e872a0SLloyd Pique * Even if a sub-surface is in desynchronized mode, it will behave as
804*84e872a0SLloyd Pique * in synchronized mode, if its parent surface behaves as in
805*84e872a0SLloyd Pique * synchronized mode. This rule is applied recursively throughout the
806*84e872a0SLloyd Pique * tree of surfaces. This means, that one can set a sub-surface into
807*84e872a0SLloyd Pique * synchronized mode, and then assume that all its child and grand-child
808*84e872a0SLloyd Pique * sub-surfaces are synchronized, too, without explicitly setting them.
809*84e872a0SLloyd Pique *
810*84e872a0SLloyd Pique * If the wl_surface associated with the wl_subsurface is destroyed, the
811*84e872a0SLloyd Pique * wl_subsurface object becomes inert. Note, that destroying either object
812*84e872a0SLloyd Pique * takes effect immediately. If you need to synchronize the removal
813*84e872a0SLloyd Pique * of a sub-surface to the parent surface update, unmap the sub-surface
814*84e872a0SLloyd Pique * first by attaching a NULL wl_buffer, update parent, and then destroy
815*84e872a0SLloyd Pique * the sub-surface.
816*84e872a0SLloyd Pique *
817*84e872a0SLloyd Pique * If the parent wl_surface object is destroyed, the sub-surface is
818*84e872a0SLloyd Pique * unmapped.
819*84e872a0SLloyd Pique * @section page_iface_wl_subsurface_api API
820*84e872a0SLloyd Pique * See @ref iface_wl_subsurface.
821*84e872a0SLloyd Pique */
822*84e872a0SLloyd Pique /**
823*84e872a0SLloyd Pique * @defgroup iface_wl_subsurface The wl_subsurface interface
824*84e872a0SLloyd Pique *
825*84e872a0SLloyd Pique * An additional interface to a wl_surface object, which has been
826*84e872a0SLloyd Pique * made a sub-surface. A sub-surface has one parent surface. A
827*84e872a0SLloyd Pique * sub-surface's size and position are not limited to that of the parent.
828*84e872a0SLloyd Pique * Particularly, a sub-surface is not automatically clipped to its
829*84e872a0SLloyd Pique * parent's area.
830*84e872a0SLloyd Pique *
831*84e872a0SLloyd Pique * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
832*84e872a0SLloyd Pique * and the parent surface is mapped. The order of which one happens
833*84e872a0SLloyd Pique * first is irrelevant. A sub-surface is hidden if the parent becomes
834*84e872a0SLloyd Pique * hidden, or if a NULL wl_buffer is applied. These rules apply
835*84e872a0SLloyd Pique * recursively through the tree of surfaces.
836*84e872a0SLloyd Pique *
837*84e872a0SLloyd Pique * The behaviour of a wl_surface.commit request on a sub-surface
838*84e872a0SLloyd Pique * depends on the sub-surface's mode. The possible modes are
839*84e872a0SLloyd Pique * synchronized and desynchronized, see methods
840*84e872a0SLloyd Pique * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
841*84e872a0SLloyd Pique * mode caches the wl_surface state to be applied when the parent's
842*84e872a0SLloyd Pique * state gets applied, and desynchronized mode applies the pending
843*84e872a0SLloyd Pique * wl_surface state directly. A sub-surface is initially in the
844*84e872a0SLloyd Pique * synchronized mode.
845*84e872a0SLloyd Pique *
846*84e872a0SLloyd Pique * Sub-surfaces have also other kind of state, which is managed by
847*84e872a0SLloyd Pique * wl_subsurface requests, as opposed to wl_surface requests. This
848*84e872a0SLloyd Pique * state includes the sub-surface position relative to the parent
849*84e872a0SLloyd Pique * surface (wl_subsurface.set_position), and the stacking order of
850*84e872a0SLloyd Pique * the parent and its sub-surfaces (wl_subsurface.place_above and
851*84e872a0SLloyd Pique * .place_below). This state is applied when the parent surface's
852*84e872a0SLloyd Pique * wl_surface state is applied, regardless of the sub-surface's mode.
853*84e872a0SLloyd Pique * As the exception, set_sync and set_desync are effective immediately.
854*84e872a0SLloyd Pique *
855*84e872a0SLloyd Pique * The main surface can be thought to be always in desynchronized mode,
856*84e872a0SLloyd Pique * since it does not have a parent in the sub-surfaces sense.
857*84e872a0SLloyd Pique *
858*84e872a0SLloyd Pique * Even if a sub-surface is in desynchronized mode, it will behave as
859*84e872a0SLloyd Pique * in synchronized mode, if its parent surface behaves as in
860*84e872a0SLloyd Pique * synchronized mode. This rule is applied recursively throughout the
861*84e872a0SLloyd Pique * tree of surfaces. This means, that one can set a sub-surface into
862*84e872a0SLloyd Pique * synchronized mode, and then assume that all its child and grand-child
863*84e872a0SLloyd Pique * sub-surfaces are synchronized, too, without explicitly setting them.
864*84e872a0SLloyd Pique *
865*84e872a0SLloyd Pique * If the wl_surface associated with the wl_subsurface is destroyed, the
866*84e872a0SLloyd Pique * wl_subsurface object becomes inert. Note, that destroying either object
867*84e872a0SLloyd Pique * takes effect immediately. If you need to synchronize the removal
868*84e872a0SLloyd Pique * of a sub-surface to the parent surface update, unmap the sub-surface
869*84e872a0SLloyd Pique * first by attaching a NULL wl_buffer, update parent, and then destroy
870*84e872a0SLloyd Pique * the sub-surface.
871*84e872a0SLloyd Pique *
872*84e872a0SLloyd Pique * If the parent wl_surface object is destroyed, the sub-surface is
873*84e872a0SLloyd Pique * unmapped.
874*84e872a0SLloyd Pique */
875*84e872a0SLloyd Pique extern const struct wl_interface wl_subsurface_interface;
876*84e872a0SLloyd Pique #endif
877*84e872a0SLloyd Pique
878*84e872a0SLloyd Pique #ifndef WL_DISPLAY_ERROR_ENUM
879*84e872a0SLloyd Pique #define WL_DISPLAY_ERROR_ENUM
880*84e872a0SLloyd Pique /**
881*84e872a0SLloyd Pique * @ingroup iface_wl_display
882*84e872a0SLloyd Pique * global error values
883*84e872a0SLloyd Pique *
884*84e872a0SLloyd Pique * These errors are global and can be emitted in response to any
885*84e872a0SLloyd Pique * server request.
886*84e872a0SLloyd Pique */
887*84e872a0SLloyd Pique enum wl_display_error {
888*84e872a0SLloyd Pique /**
889*84e872a0SLloyd Pique * server couldn't find object
890*84e872a0SLloyd Pique */
891*84e872a0SLloyd Pique WL_DISPLAY_ERROR_INVALID_OBJECT = 0,
892*84e872a0SLloyd Pique /**
893*84e872a0SLloyd Pique * method doesn't exist on the specified interface
894*84e872a0SLloyd Pique */
895*84e872a0SLloyd Pique WL_DISPLAY_ERROR_INVALID_METHOD = 1,
896*84e872a0SLloyd Pique /**
897*84e872a0SLloyd Pique * server is out of memory
898*84e872a0SLloyd Pique */
899*84e872a0SLloyd Pique WL_DISPLAY_ERROR_NO_MEMORY = 2,
900*84e872a0SLloyd Pique };
901*84e872a0SLloyd Pique #endif /* WL_DISPLAY_ERROR_ENUM */
902*84e872a0SLloyd Pique
903*84e872a0SLloyd Pique /**
904*84e872a0SLloyd Pique * @ingroup iface_wl_display
905*84e872a0SLloyd Pique * @struct wl_display_listener
906*84e872a0SLloyd Pique */
907*84e872a0SLloyd Pique struct wl_display_listener {
908*84e872a0SLloyd Pique /**
909*84e872a0SLloyd Pique * fatal error event
910*84e872a0SLloyd Pique *
911*84e872a0SLloyd Pique * The error event is sent out when a fatal (non-recoverable)
912*84e872a0SLloyd Pique * error has occurred. The object_id argument is the object where
913*84e872a0SLloyd Pique * the error occurred, most often in response to a request to that
914*84e872a0SLloyd Pique * object. The code identifies the error and is defined by the
915*84e872a0SLloyd Pique * object interface. As such, each interface defines its own set of
916*84e872a0SLloyd Pique * error codes. The message is a brief description of the error,
917*84e872a0SLloyd Pique * for (debugging) convenience.
918*84e872a0SLloyd Pique * @param object_id object where the error occurred
919*84e872a0SLloyd Pique * @param code error code
920*84e872a0SLloyd Pique * @param message error description
921*84e872a0SLloyd Pique */
922*84e872a0SLloyd Pique void (*error)(void *data,
923*84e872a0SLloyd Pique struct wl_display *wl_display,
924*84e872a0SLloyd Pique void *object_id,
925*84e872a0SLloyd Pique uint32_t code,
926*84e872a0SLloyd Pique const char *message);
927*84e872a0SLloyd Pique /**
928*84e872a0SLloyd Pique * acknowledge object ID deletion
929*84e872a0SLloyd Pique *
930*84e872a0SLloyd Pique * This event is used internally by the object ID management
931*84e872a0SLloyd Pique * logic. When a client deletes an object, the server will send
932*84e872a0SLloyd Pique * this event to acknowledge that it has seen the delete request.
933*84e872a0SLloyd Pique * When the client receives this event, it will know that it can
934*84e872a0SLloyd Pique * safely reuse the object ID.
935*84e872a0SLloyd Pique * @param id deleted object ID
936*84e872a0SLloyd Pique */
937*84e872a0SLloyd Pique void (*delete_id)(void *data,
938*84e872a0SLloyd Pique struct wl_display *wl_display,
939*84e872a0SLloyd Pique uint32_t id);
940*84e872a0SLloyd Pique };
941*84e872a0SLloyd Pique
942*84e872a0SLloyd Pique /**
943*84e872a0SLloyd Pique * @ingroup iface_wl_display
944*84e872a0SLloyd Pique */
945*84e872a0SLloyd Pique static inline int
wl_display_add_listener(struct wl_display * wl_display,const struct wl_display_listener * listener,void * data)946*84e872a0SLloyd Pique wl_display_add_listener(struct wl_display *wl_display,
947*84e872a0SLloyd Pique const struct wl_display_listener *listener, void *data)
948*84e872a0SLloyd Pique {
949*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_display,
950*84e872a0SLloyd Pique (void (**)(void)) listener, data);
951*84e872a0SLloyd Pique }
952*84e872a0SLloyd Pique
953*84e872a0SLloyd Pique #define WL_DISPLAY_SYNC 0
954*84e872a0SLloyd Pique #define WL_DISPLAY_GET_REGISTRY 1
955*84e872a0SLloyd Pique
956*84e872a0SLloyd Pique /**
957*84e872a0SLloyd Pique * @ingroup iface_wl_display
958*84e872a0SLloyd Pique */
959*84e872a0SLloyd Pique #define WL_DISPLAY_ERROR_SINCE_VERSION 1
960*84e872a0SLloyd Pique /**
961*84e872a0SLloyd Pique * @ingroup iface_wl_display
962*84e872a0SLloyd Pique */
963*84e872a0SLloyd Pique #define WL_DISPLAY_DELETE_ID_SINCE_VERSION 1
964*84e872a0SLloyd Pique
965*84e872a0SLloyd Pique /**
966*84e872a0SLloyd Pique * @ingroup iface_wl_display
967*84e872a0SLloyd Pique */
968*84e872a0SLloyd Pique #define WL_DISPLAY_SYNC_SINCE_VERSION 1
969*84e872a0SLloyd Pique /**
970*84e872a0SLloyd Pique * @ingroup iface_wl_display
971*84e872a0SLloyd Pique */
972*84e872a0SLloyd Pique #define WL_DISPLAY_GET_REGISTRY_SINCE_VERSION 1
973*84e872a0SLloyd Pique
974*84e872a0SLloyd Pique /** @ingroup iface_wl_display */
975*84e872a0SLloyd Pique static inline void
wl_display_set_user_data(struct wl_display * wl_display,void * user_data)976*84e872a0SLloyd Pique wl_display_set_user_data(struct wl_display *wl_display, void *user_data)
977*84e872a0SLloyd Pique {
978*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_display, user_data);
979*84e872a0SLloyd Pique }
980*84e872a0SLloyd Pique
981*84e872a0SLloyd Pique /** @ingroup iface_wl_display */
982*84e872a0SLloyd Pique static inline void *
wl_display_get_user_data(struct wl_display * wl_display)983*84e872a0SLloyd Pique wl_display_get_user_data(struct wl_display *wl_display)
984*84e872a0SLloyd Pique {
985*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_display);
986*84e872a0SLloyd Pique }
987*84e872a0SLloyd Pique
988*84e872a0SLloyd Pique static inline uint32_t
wl_display_get_version(struct wl_display * wl_display)989*84e872a0SLloyd Pique wl_display_get_version(struct wl_display *wl_display)
990*84e872a0SLloyd Pique {
991*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_display);
992*84e872a0SLloyd Pique }
993*84e872a0SLloyd Pique
994*84e872a0SLloyd Pique /**
995*84e872a0SLloyd Pique * @ingroup iface_wl_display
996*84e872a0SLloyd Pique *
997*84e872a0SLloyd Pique * The sync request asks the server to emit the 'done' event
998*84e872a0SLloyd Pique * on the returned wl_callback object. Since requests are
999*84e872a0SLloyd Pique * handled in-order and events are delivered in-order, this can
1000*84e872a0SLloyd Pique * be used as a barrier to ensure all previous requests and the
1001*84e872a0SLloyd Pique * resulting events have been handled.
1002*84e872a0SLloyd Pique *
1003*84e872a0SLloyd Pique * The object returned by this request will be destroyed by the
1004*84e872a0SLloyd Pique * compositor after the callback is fired and as such the client must not
1005*84e872a0SLloyd Pique * attempt to use it after that point.
1006*84e872a0SLloyd Pique *
1007*84e872a0SLloyd Pique * The callback_data passed in the callback is the event serial.
1008*84e872a0SLloyd Pique */
1009*84e872a0SLloyd Pique static inline struct wl_callback *
wl_display_sync(struct wl_display * wl_display)1010*84e872a0SLloyd Pique wl_display_sync(struct wl_display *wl_display)
1011*84e872a0SLloyd Pique {
1012*84e872a0SLloyd Pique struct wl_proxy *callback;
1013*84e872a0SLloyd Pique
1014*84e872a0SLloyd Pique callback = wl_proxy_marshal_flags((struct wl_proxy *) wl_display,
1015*84e872a0SLloyd Pique WL_DISPLAY_SYNC, &wl_callback_interface, wl_proxy_get_version((struct wl_proxy *) wl_display), 0, NULL);
1016*84e872a0SLloyd Pique
1017*84e872a0SLloyd Pique return (struct wl_callback *) callback;
1018*84e872a0SLloyd Pique }
1019*84e872a0SLloyd Pique
1020*84e872a0SLloyd Pique /**
1021*84e872a0SLloyd Pique * @ingroup iface_wl_display
1022*84e872a0SLloyd Pique *
1023*84e872a0SLloyd Pique * This request creates a registry object that allows the client
1024*84e872a0SLloyd Pique * to list and bind the global objects available from the
1025*84e872a0SLloyd Pique * compositor.
1026*84e872a0SLloyd Pique */
1027*84e872a0SLloyd Pique static inline struct wl_registry *
wl_display_get_registry(struct wl_display * wl_display)1028*84e872a0SLloyd Pique wl_display_get_registry(struct wl_display *wl_display)
1029*84e872a0SLloyd Pique {
1030*84e872a0SLloyd Pique struct wl_proxy *registry;
1031*84e872a0SLloyd Pique
1032*84e872a0SLloyd Pique registry = wl_proxy_marshal_flags((struct wl_proxy *) wl_display,
1033*84e872a0SLloyd Pique WL_DISPLAY_GET_REGISTRY, &wl_registry_interface, wl_proxy_get_version((struct wl_proxy *) wl_display), 0, NULL);
1034*84e872a0SLloyd Pique
1035*84e872a0SLloyd Pique return (struct wl_registry *) registry;
1036*84e872a0SLloyd Pique }
1037*84e872a0SLloyd Pique
1038*84e872a0SLloyd Pique /**
1039*84e872a0SLloyd Pique * @ingroup iface_wl_registry
1040*84e872a0SLloyd Pique * @struct wl_registry_listener
1041*84e872a0SLloyd Pique */
1042*84e872a0SLloyd Pique struct wl_registry_listener {
1043*84e872a0SLloyd Pique /**
1044*84e872a0SLloyd Pique * announce global object
1045*84e872a0SLloyd Pique *
1046*84e872a0SLloyd Pique * Notify the client of global objects.
1047*84e872a0SLloyd Pique *
1048*84e872a0SLloyd Pique * The event notifies the client that a global object with the
1049*84e872a0SLloyd Pique * given name is now available, and it implements the given version
1050*84e872a0SLloyd Pique * of the given interface.
1051*84e872a0SLloyd Pique * @param name numeric name of the global object
1052*84e872a0SLloyd Pique * @param interface interface implemented by the object
1053*84e872a0SLloyd Pique * @param version interface version
1054*84e872a0SLloyd Pique */
1055*84e872a0SLloyd Pique void (*global)(void *data,
1056*84e872a0SLloyd Pique struct wl_registry *wl_registry,
1057*84e872a0SLloyd Pique uint32_t name,
1058*84e872a0SLloyd Pique const char *interface,
1059*84e872a0SLloyd Pique uint32_t version);
1060*84e872a0SLloyd Pique /**
1061*84e872a0SLloyd Pique * announce removal of global object
1062*84e872a0SLloyd Pique *
1063*84e872a0SLloyd Pique * Notify the client of removed global objects.
1064*84e872a0SLloyd Pique *
1065*84e872a0SLloyd Pique * This event notifies the client that the global identified by
1066*84e872a0SLloyd Pique * name is no longer available. If the client bound to the global
1067*84e872a0SLloyd Pique * using the bind request, the client should now destroy that
1068*84e872a0SLloyd Pique * object.
1069*84e872a0SLloyd Pique *
1070*84e872a0SLloyd Pique * The object remains valid and requests to the object will be
1071*84e872a0SLloyd Pique * ignored until the client destroys it, to avoid races between the
1072*84e872a0SLloyd Pique * global going away and a client sending a request to it.
1073*84e872a0SLloyd Pique * @param name numeric name of the global object
1074*84e872a0SLloyd Pique */
1075*84e872a0SLloyd Pique void (*global_remove)(void *data,
1076*84e872a0SLloyd Pique struct wl_registry *wl_registry,
1077*84e872a0SLloyd Pique uint32_t name);
1078*84e872a0SLloyd Pique };
1079*84e872a0SLloyd Pique
1080*84e872a0SLloyd Pique /**
1081*84e872a0SLloyd Pique * @ingroup iface_wl_registry
1082*84e872a0SLloyd Pique */
1083*84e872a0SLloyd Pique static inline int
wl_registry_add_listener(struct wl_registry * wl_registry,const struct wl_registry_listener * listener,void * data)1084*84e872a0SLloyd Pique wl_registry_add_listener(struct wl_registry *wl_registry,
1085*84e872a0SLloyd Pique const struct wl_registry_listener *listener, void *data)
1086*84e872a0SLloyd Pique {
1087*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_registry,
1088*84e872a0SLloyd Pique (void (**)(void)) listener, data);
1089*84e872a0SLloyd Pique }
1090*84e872a0SLloyd Pique
1091*84e872a0SLloyd Pique #define WL_REGISTRY_BIND 0
1092*84e872a0SLloyd Pique
1093*84e872a0SLloyd Pique /**
1094*84e872a0SLloyd Pique * @ingroup iface_wl_registry
1095*84e872a0SLloyd Pique */
1096*84e872a0SLloyd Pique #define WL_REGISTRY_GLOBAL_SINCE_VERSION 1
1097*84e872a0SLloyd Pique /**
1098*84e872a0SLloyd Pique * @ingroup iface_wl_registry
1099*84e872a0SLloyd Pique */
1100*84e872a0SLloyd Pique #define WL_REGISTRY_GLOBAL_REMOVE_SINCE_VERSION 1
1101*84e872a0SLloyd Pique
1102*84e872a0SLloyd Pique /**
1103*84e872a0SLloyd Pique * @ingroup iface_wl_registry
1104*84e872a0SLloyd Pique */
1105*84e872a0SLloyd Pique #define WL_REGISTRY_BIND_SINCE_VERSION 1
1106*84e872a0SLloyd Pique
1107*84e872a0SLloyd Pique /** @ingroup iface_wl_registry */
1108*84e872a0SLloyd Pique static inline void
wl_registry_set_user_data(struct wl_registry * wl_registry,void * user_data)1109*84e872a0SLloyd Pique wl_registry_set_user_data(struct wl_registry *wl_registry, void *user_data)
1110*84e872a0SLloyd Pique {
1111*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_registry, user_data);
1112*84e872a0SLloyd Pique }
1113*84e872a0SLloyd Pique
1114*84e872a0SLloyd Pique /** @ingroup iface_wl_registry */
1115*84e872a0SLloyd Pique static inline void *
wl_registry_get_user_data(struct wl_registry * wl_registry)1116*84e872a0SLloyd Pique wl_registry_get_user_data(struct wl_registry *wl_registry)
1117*84e872a0SLloyd Pique {
1118*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_registry);
1119*84e872a0SLloyd Pique }
1120*84e872a0SLloyd Pique
1121*84e872a0SLloyd Pique static inline uint32_t
wl_registry_get_version(struct wl_registry * wl_registry)1122*84e872a0SLloyd Pique wl_registry_get_version(struct wl_registry *wl_registry)
1123*84e872a0SLloyd Pique {
1124*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_registry);
1125*84e872a0SLloyd Pique }
1126*84e872a0SLloyd Pique
1127*84e872a0SLloyd Pique /** @ingroup iface_wl_registry */
1128*84e872a0SLloyd Pique static inline void
wl_registry_destroy(struct wl_registry * wl_registry)1129*84e872a0SLloyd Pique wl_registry_destroy(struct wl_registry *wl_registry)
1130*84e872a0SLloyd Pique {
1131*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_registry);
1132*84e872a0SLloyd Pique }
1133*84e872a0SLloyd Pique
1134*84e872a0SLloyd Pique /**
1135*84e872a0SLloyd Pique * @ingroup iface_wl_registry
1136*84e872a0SLloyd Pique *
1137*84e872a0SLloyd Pique * Binds a new, client-created object to the server using the
1138*84e872a0SLloyd Pique * specified name as the identifier.
1139*84e872a0SLloyd Pique */
1140*84e872a0SLloyd Pique static inline void *
wl_registry_bind(struct wl_registry * wl_registry,uint32_t name,const struct wl_interface * interface,uint32_t version)1141*84e872a0SLloyd Pique wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl_interface *interface, uint32_t version)
1142*84e872a0SLloyd Pique {
1143*84e872a0SLloyd Pique struct wl_proxy *id;
1144*84e872a0SLloyd Pique
1145*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_registry,
1146*84e872a0SLloyd Pique WL_REGISTRY_BIND, interface, version, 0, name, interface->name, version, NULL);
1147*84e872a0SLloyd Pique
1148*84e872a0SLloyd Pique return (void *) id;
1149*84e872a0SLloyd Pique }
1150*84e872a0SLloyd Pique
1151*84e872a0SLloyd Pique /**
1152*84e872a0SLloyd Pique * @ingroup iface_wl_callback
1153*84e872a0SLloyd Pique * @struct wl_callback_listener
1154*84e872a0SLloyd Pique */
1155*84e872a0SLloyd Pique struct wl_callback_listener {
1156*84e872a0SLloyd Pique /**
1157*84e872a0SLloyd Pique * done event
1158*84e872a0SLloyd Pique *
1159*84e872a0SLloyd Pique * Notify the client when the related request is done.
1160*84e872a0SLloyd Pique * @param callback_data request-specific data for the callback
1161*84e872a0SLloyd Pique */
1162*84e872a0SLloyd Pique void (*done)(void *data,
1163*84e872a0SLloyd Pique struct wl_callback *wl_callback,
1164*84e872a0SLloyd Pique uint32_t callback_data);
1165*84e872a0SLloyd Pique };
1166*84e872a0SLloyd Pique
1167*84e872a0SLloyd Pique /**
1168*84e872a0SLloyd Pique * @ingroup iface_wl_callback
1169*84e872a0SLloyd Pique */
1170*84e872a0SLloyd Pique static inline int
wl_callback_add_listener(struct wl_callback * wl_callback,const struct wl_callback_listener * listener,void * data)1171*84e872a0SLloyd Pique wl_callback_add_listener(struct wl_callback *wl_callback,
1172*84e872a0SLloyd Pique const struct wl_callback_listener *listener, void *data)
1173*84e872a0SLloyd Pique {
1174*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_callback,
1175*84e872a0SLloyd Pique (void (**)(void)) listener, data);
1176*84e872a0SLloyd Pique }
1177*84e872a0SLloyd Pique
1178*84e872a0SLloyd Pique /**
1179*84e872a0SLloyd Pique * @ingroup iface_wl_callback
1180*84e872a0SLloyd Pique */
1181*84e872a0SLloyd Pique #define WL_CALLBACK_DONE_SINCE_VERSION 1
1182*84e872a0SLloyd Pique
1183*84e872a0SLloyd Pique
1184*84e872a0SLloyd Pique /** @ingroup iface_wl_callback */
1185*84e872a0SLloyd Pique static inline void
wl_callback_set_user_data(struct wl_callback * wl_callback,void * user_data)1186*84e872a0SLloyd Pique wl_callback_set_user_data(struct wl_callback *wl_callback, void *user_data)
1187*84e872a0SLloyd Pique {
1188*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_callback, user_data);
1189*84e872a0SLloyd Pique }
1190*84e872a0SLloyd Pique
1191*84e872a0SLloyd Pique /** @ingroup iface_wl_callback */
1192*84e872a0SLloyd Pique static inline void *
wl_callback_get_user_data(struct wl_callback * wl_callback)1193*84e872a0SLloyd Pique wl_callback_get_user_data(struct wl_callback *wl_callback)
1194*84e872a0SLloyd Pique {
1195*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_callback);
1196*84e872a0SLloyd Pique }
1197*84e872a0SLloyd Pique
1198*84e872a0SLloyd Pique static inline uint32_t
wl_callback_get_version(struct wl_callback * wl_callback)1199*84e872a0SLloyd Pique wl_callback_get_version(struct wl_callback *wl_callback)
1200*84e872a0SLloyd Pique {
1201*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_callback);
1202*84e872a0SLloyd Pique }
1203*84e872a0SLloyd Pique
1204*84e872a0SLloyd Pique /** @ingroup iface_wl_callback */
1205*84e872a0SLloyd Pique static inline void
wl_callback_destroy(struct wl_callback * wl_callback)1206*84e872a0SLloyd Pique wl_callback_destroy(struct wl_callback *wl_callback)
1207*84e872a0SLloyd Pique {
1208*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_callback);
1209*84e872a0SLloyd Pique }
1210*84e872a0SLloyd Pique
1211*84e872a0SLloyd Pique #define WL_COMPOSITOR_CREATE_SURFACE 0
1212*84e872a0SLloyd Pique #define WL_COMPOSITOR_CREATE_REGION 1
1213*84e872a0SLloyd Pique
1214*84e872a0SLloyd Pique
1215*84e872a0SLloyd Pique /**
1216*84e872a0SLloyd Pique * @ingroup iface_wl_compositor
1217*84e872a0SLloyd Pique */
1218*84e872a0SLloyd Pique #define WL_COMPOSITOR_CREATE_SURFACE_SINCE_VERSION 1
1219*84e872a0SLloyd Pique /**
1220*84e872a0SLloyd Pique * @ingroup iface_wl_compositor
1221*84e872a0SLloyd Pique */
1222*84e872a0SLloyd Pique #define WL_COMPOSITOR_CREATE_REGION_SINCE_VERSION 1
1223*84e872a0SLloyd Pique
1224*84e872a0SLloyd Pique /** @ingroup iface_wl_compositor */
1225*84e872a0SLloyd Pique static inline void
wl_compositor_set_user_data(struct wl_compositor * wl_compositor,void * user_data)1226*84e872a0SLloyd Pique wl_compositor_set_user_data(struct wl_compositor *wl_compositor, void *user_data)
1227*84e872a0SLloyd Pique {
1228*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_compositor, user_data);
1229*84e872a0SLloyd Pique }
1230*84e872a0SLloyd Pique
1231*84e872a0SLloyd Pique /** @ingroup iface_wl_compositor */
1232*84e872a0SLloyd Pique static inline void *
wl_compositor_get_user_data(struct wl_compositor * wl_compositor)1233*84e872a0SLloyd Pique wl_compositor_get_user_data(struct wl_compositor *wl_compositor)
1234*84e872a0SLloyd Pique {
1235*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_compositor);
1236*84e872a0SLloyd Pique }
1237*84e872a0SLloyd Pique
1238*84e872a0SLloyd Pique static inline uint32_t
wl_compositor_get_version(struct wl_compositor * wl_compositor)1239*84e872a0SLloyd Pique wl_compositor_get_version(struct wl_compositor *wl_compositor)
1240*84e872a0SLloyd Pique {
1241*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_compositor);
1242*84e872a0SLloyd Pique }
1243*84e872a0SLloyd Pique
1244*84e872a0SLloyd Pique /** @ingroup iface_wl_compositor */
1245*84e872a0SLloyd Pique static inline void
wl_compositor_destroy(struct wl_compositor * wl_compositor)1246*84e872a0SLloyd Pique wl_compositor_destroy(struct wl_compositor *wl_compositor)
1247*84e872a0SLloyd Pique {
1248*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_compositor);
1249*84e872a0SLloyd Pique }
1250*84e872a0SLloyd Pique
1251*84e872a0SLloyd Pique /**
1252*84e872a0SLloyd Pique * @ingroup iface_wl_compositor
1253*84e872a0SLloyd Pique *
1254*84e872a0SLloyd Pique * Ask the compositor to create a new surface.
1255*84e872a0SLloyd Pique */
1256*84e872a0SLloyd Pique static inline struct wl_surface *
wl_compositor_create_surface(struct wl_compositor * wl_compositor)1257*84e872a0SLloyd Pique wl_compositor_create_surface(struct wl_compositor *wl_compositor)
1258*84e872a0SLloyd Pique {
1259*84e872a0SLloyd Pique struct wl_proxy *id;
1260*84e872a0SLloyd Pique
1261*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_compositor,
1262*84e872a0SLloyd Pique WL_COMPOSITOR_CREATE_SURFACE, &wl_surface_interface, wl_proxy_get_version((struct wl_proxy *) wl_compositor), 0, NULL);
1263*84e872a0SLloyd Pique
1264*84e872a0SLloyd Pique return (struct wl_surface *) id;
1265*84e872a0SLloyd Pique }
1266*84e872a0SLloyd Pique
1267*84e872a0SLloyd Pique /**
1268*84e872a0SLloyd Pique * @ingroup iface_wl_compositor
1269*84e872a0SLloyd Pique *
1270*84e872a0SLloyd Pique * Ask the compositor to create a new region.
1271*84e872a0SLloyd Pique */
1272*84e872a0SLloyd Pique static inline struct wl_region *
wl_compositor_create_region(struct wl_compositor * wl_compositor)1273*84e872a0SLloyd Pique wl_compositor_create_region(struct wl_compositor *wl_compositor)
1274*84e872a0SLloyd Pique {
1275*84e872a0SLloyd Pique struct wl_proxy *id;
1276*84e872a0SLloyd Pique
1277*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_compositor,
1278*84e872a0SLloyd Pique WL_COMPOSITOR_CREATE_REGION, &wl_region_interface, wl_proxy_get_version((struct wl_proxy *) wl_compositor), 0, NULL);
1279*84e872a0SLloyd Pique
1280*84e872a0SLloyd Pique return (struct wl_region *) id;
1281*84e872a0SLloyd Pique }
1282*84e872a0SLloyd Pique
1283*84e872a0SLloyd Pique #define WL_SHM_POOL_CREATE_BUFFER 0
1284*84e872a0SLloyd Pique #define WL_SHM_POOL_DESTROY 1
1285*84e872a0SLloyd Pique #define WL_SHM_POOL_RESIZE 2
1286*84e872a0SLloyd Pique
1287*84e872a0SLloyd Pique
1288*84e872a0SLloyd Pique /**
1289*84e872a0SLloyd Pique * @ingroup iface_wl_shm_pool
1290*84e872a0SLloyd Pique */
1291*84e872a0SLloyd Pique #define WL_SHM_POOL_CREATE_BUFFER_SINCE_VERSION 1
1292*84e872a0SLloyd Pique /**
1293*84e872a0SLloyd Pique * @ingroup iface_wl_shm_pool
1294*84e872a0SLloyd Pique */
1295*84e872a0SLloyd Pique #define WL_SHM_POOL_DESTROY_SINCE_VERSION 1
1296*84e872a0SLloyd Pique /**
1297*84e872a0SLloyd Pique * @ingroup iface_wl_shm_pool
1298*84e872a0SLloyd Pique */
1299*84e872a0SLloyd Pique #define WL_SHM_POOL_RESIZE_SINCE_VERSION 1
1300*84e872a0SLloyd Pique
1301*84e872a0SLloyd Pique /** @ingroup iface_wl_shm_pool */
1302*84e872a0SLloyd Pique static inline void
wl_shm_pool_set_user_data(struct wl_shm_pool * wl_shm_pool,void * user_data)1303*84e872a0SLloyd Pique wl_shm_pool_set_user_data(struct wl_shm_pool *wl_shm_pool, void *user_data)
1304*84e872a0SLloyd Pique {
1305*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_shm_pool, user_data);
1306*84e872a0SLloyd Pique }
1307*84e872a0SLloyd Pique
1308*84e872a0SLloyd Pique /** @ingroup iface_wl_shm_pool */
1309*84e872a0SLloyd Pique static inline void *
wl_shm_pool_get_user_data(struct wl_shm_pool * wl_shm_pool)1310*84e872a0SLloyd Pique wl_shm_pool_get_user_data(struct wl_shm_pool *wl_shm_pool)
1311*84e872a0SLloyd Pique {
1312*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_shm_pool);
1313*84e872a0SLloyd Pique }
1314*84e872a0SLloyd Pique
1315*84e872a0SLloyd Pique static inline uint32_t
wl_shm_pool_get_version(struct wl_shm_pool * wl_shm_pool)1316*84e872a0SLloyd Pique wl_shm_pool_get_version(struct wl_shm_pool *wl_shm_pool)
1317*84e872a0SLloyd Pique {
1318*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_shm_pool);
1319*84e872a0SLloyd Pique }
1320*84e872a0SLloyd Pique
1321*84e872a0SLloyd Pique /**
1322*84e872a0SLloyd Pique * @ingroup iface_wl_shm_pool
1323*84e872a0SLloyd Pique *
1324*84e872a0SLloyd Pique * Create a wl_buffer object from the pool.
1325*84e872a0SLloyd Pique *
1326*84e872a0SLloyd Pique * The buffer is created offset bytes into the pool and has
1327*84e872a0SLloyd Pique * width and height as specified. The stride argument specifies
1328*84e872a0SLloyd Pique * the number of bytes from the beginning of one row to the beginning
1329*84e872a0SLloyd Pique * of the next. The format is the pixel format of the buffer and
1330*84e872a0SLloyd Pique * must be one of those advertised through the wl_shm.format event.
1331*84e872a0SLloyd Pique *
1332*84e872a0SLloyd Pique * A buffer will keep a reference to the pool it was created from
1333*84e872a0SLloyd Pique * so it is valid to destroy the pool immediately after creating
1334*84e872a0SLloyd Pique * a buffer from it.
1335*84e872a0SLloyd Pique */
1336*84e872a0SLloyd Pique static inline struct wl_buffer *
wl_shm_pool_create_buffer(struct wl_shm_pool * wl_shm_pool,int32_t offset,int32_t width,int32_t height,int32_t stride,uint32_t format)1337*84e872a0SLloyd Pique wl_shm_pool_create_buffer(struct wl_shm_pool *wl_shm_pool, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format)
1338*84e872a0SLloyd Pique {
1339*84e872a0SLloyd Pique struct wl_proxy *id;
1340*84e872a0SLloyd Pique
1341*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
1342*84e872a0SLloyd Pique WL_SHM_POOL_CREATE_BUFFER, &wl_buffer_interface, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), 0, NULL, offset, width, height, stride, format);
1343*84e872a0SLloyd Pique
1344*84e872a0SLloyd Pique return (struct wl_buffer *) id;
1345*84e872a0SLloyd Pique }
1346*84e872a0SLloyd Pique
1347*84e872a0SLloyd Pique /**
1348*84e872a0SLloyd Pique * @ingroup iface_wl_shm_pool
1349*84e872a0SLloyd Pique *
1350*84e872a0SLloyd Pique * Destroy the shared memory pool.
1351*84e872a0SLloyd Pique *
1352*84e872a0SLloyd Pique * The mmapped memory will be released when all
1353*84e872a0SLloyd Pique * buffers that have been created from this pool
1354*84e872a0SLloyd Pique * are gone.
1355*84e872a0SLloyd Pique */
1356*84e872a0SLloyd Pique static inline void
wl_shm_pool_destroy(struct wl_shm_pool * wl_shm_pool)1357*84e872a0SLloyd Pique wl_shm_pool_destroy(struct wl_shm_pool *wl_shm_pool)
1358*84e872a0SLloyd Pique {
1359*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
1360*84e872a0SLloyd Pique WL_SHM_POOL_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), WL_MARSHAL_FLAG_DESTROY);
1361*84e872a0SLloyd Pique }
1362*84e872a0SLloyd Pique
1363*84e872a0SLloyd Pique /**
1364*84e872a0SLloyd Pique * @ingroup iface_wl_shm_pool
1365*84e872a0SLloyd Pique *
1366*84e872a0SLloyd Pique * This request will cause the server to remap the backing memory
1367*84e872a0SLloyd Pique * for the pool from the file descriptor passed when the pool was
1368*84e872a0SLloyd Pique * created, but using the new size. This request can only be
1369*84e872a0SLloyd Pique * used to make the pool bigger.
1370*84e872a0SLloyd Pique */
1371*84e872a0SLloyd Pique static inline void
wl_shm_pool_resize(struct wl_shm_pool * wl_shm_pool,int32_t size)1372*84e872a0SLloyd Pique wl_shm_pool_resize(struct wl_shm_pool *wl_shm_pool, int32_t size)
1373*84e872a0SLloyd Pique {
1374*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
1375*84e872a0SLloyd Pique WL_SHM_POOL_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), 0, size);
1376*84e872a0SLloyd Pique }
1377*84e872a0SLloyd Pique
1378*84e872a0SLloyd Pique #ifndef WL_SHM_ERROR_ENUM
1379*84e872a0SLloyd Pique #define WL_SHM_ERROR_ENUM
1380*84e872a0SLloyd Pique /**
1381*84e872a0SLloyd Pique * @ingroup iface_wl_shm
1382*84e872a0SLloyd Pique * wl_shm error values
1383*84e872a0SLloyd Pique *
1384*84e872a0SLloyd Pique * These errors can be emitted in response to wl_shm requests.
1385*84e872a0SLloyd Pique */
1386*84e872a0SLloyd Pique enum wl_shm_error {
1387*84e872a0SLloyd Pique /**
1388*84e872a0SLloyd Pique * buffer format is not known
1389*84e872a0SLloyd Pique */
1390*84e872a0SLloyd Pique WL_SHM_ERROR_INVALID_FORMAT = 0,
1391*84e872a0SLloyd Pique /**
1392*84e872a0SLloyd Pique * invalid size or stride during pool or buffer creation
1393*84e872a0SLloyd Pique */
1394*84e872a0SLloyd Pique WL_SHM_ERROR_INVALID_STRIDE = 1,
1395*84e872a0SLloyd Pique /**
1396*84e872a0SLloyd Pique * mmapping the file descriptor failed
1397*84e872a0SLloyd Pique */
1398*84e872a0SLloyd Pique WL_SHM_ERROR_INVALID_FD = 2,
1399*84e872a0SLloyd Pique };
1400*84e872a0SLloyd Pique #endif /* WL_SHM_ERROR_ENUM */
1401*84e872a0SLloyd Pique
1402*84e872a0SLloyd Pique #ifndef WL_SHM_FORMAT_ENUM
1403*84e872a0SLloyd Pique #define WL_SHM_FORMAT_ENUM
1404*84e872a0SLloyd Pique /**
1405*84e872a0SLloyd Pique * @ingroup iface_wl_shm
1406*84e872a0SLloyd Pique * pixel formats
1407*84e872a0SLloyd Pique *
1408*84e872a0SLloyd Pique * This describes the memory layout of an individual pixel.
1409*84e872a0SLloyd Pique *
1410*84e872a0SLloyd Pique * All renderers should support argb8888 and xrgb8888 but any other
1411*84e872a0SLloyd Pique * formats are optional and may not be supported by the particular
1412*84e872a0SLloyd Pique * renderer in use.
1413*84e872a0SLloyd Pique *
1414*84e872a0SLloyd Pique * The drm format codes match the macros defined in drm_fourcc.h.
1415*84e872a0SLloyd Pique * The formats actually supported by the compositor will be
1416*84e872a0SLloyd Pique * reported by the format event.
1417*84e872a0SLloyd Pique */
1418*84e872a0SLloyd Pique enum wl_shm_format {
1419*84e872a0SLloyd Pique /**
1420*84e872a0SLloyd Pique * 32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian
1421*84e872a0SLloyd Pique */
1422*84e872a0SLloyd Pique WL_SHM_FORMAT_ARGB8888 = 0,
1423*84e872a0SLloyd Pique /**
1424*84e872a0SLloyd Pique * 32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian
1425*84e872a0SLloyd Pique */
1426*84e872a0SLloyd Pique WL_SHM_FORMAT_XRGB8888 = 1,
1427*84e872a0SLloyd Pique /**
1428*84e872a0SLloyd Pique * 8-bit color index format, [7:0] C
1429*84e872a0SLloyd Pique */
1430*84e872a0SLloyd Pique WL_SHM_FORMAT_C8 = 0x20203843,
1431*84e872a0SLloyd Pique /**
1432*84e872a0SLloyd Pique * 8-bit RGB format, [7:0] R:G:B 3:3:2
1433*84e872a0SLloyd Pique */
1434*84e872a0SLloyd Pique WL_SHM_FORMAT_RGB332 = 0x38424752,
1435*84e872a0SLloyd Pique /**
1436*84e872a0SLloyd Pique * 8-bit BGR format, [7:0] B:G:R 2:3:3
1437*84e872a0SLloyd Pique */
1438*84e872a0SLloyd Pique WL_SHM_FORMAT_BGR233 = 0x38524742,
1439*84e872a0SLloyd Pique /**
1440*84e872a0SLloyd Pique * 16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian
1441*84e872a0SLloyd Pique */
1442*84e872a0SLloyd Pique WL_SHM_FORMAT_XRGB4444 = 0x32315258,
1443*84e872a0SLloyd Pique /**
1444*84e872a0SLloyd Pique * 16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian
1445*84e872a0SLloyd Pique */
1446*84e872a0SLloyd Pique WL_SHM_FORMAT_XBGR4444 = 0x32314258,
1447*84e872a0SLloyd Pique /**
1448*84e872a0SLloyd Pique * 16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian
1449*84e872a0SLloyd Pique */
1450*84e872a0SLloyd Pique WL_SHM_FORMAT_RGBX4444 = 0x32315852,
1451*84e872a0SLloyd Pique /**
1452*84e872a0SLloyd Pique * 16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian
1453*84e872a0SLloyd Pique */
1454*84e872a0SLloyd Pique WL_SHM_FORMAT_BGRX4444 = 0x32315842,
1455*84e872a0SLloyd Pique /**
1456*84e872a0SLloyd Pique * 16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian
1457*84e872a0SLloyd Pique */
1458*84e872a0SLloyd Pique WL_SHM_FORMAT_ARGB4444 = 0x32315241,
1459*84e872a0SLloyd Pique /**
1460*84e872a0SLloyd Pique * 16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian
1461*84e872a0SLloyd Pique */
1462*84e872a0SLloyd Pique WL_SHM_FORMAT_ABGR4444 = 0x32314241,
1463*84e872a0SLloyd Pique /**
1464*84e872a0SLloyd Pique * 16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian
1465*84e872a0SLloyd Pique */
1466*84e872a0SLloyd Pique WL_SHM_FORMAT_RGBA4444 = 0x32314152,
1467*84e872a0SLloyd Pique /**
1468*84e872a0SLloyd Pique * 16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian
1469*84e872a0SLloyd Pique */
1470*84e872a0SLloyd Pique WL_SHM_FORMAT_BGRA4444 = 0x32314142,
1471*84e872a0SLloyd Pique /**
1472*84e872a0SLloyd Pique * 16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian
1473*84e872a0SLloyd Pique */
1474*84e872a0SLloyd Pique WL_SHM_FORMAT_XRGB1555 = 0x35315258,
1475*84e872a0SLloyd Pique /**
1476*84e872a0SLloyd Pique * 16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian
1477*84e872a0SLloyd Pique */
1478*84e872a0SLloyd Pique WL_SHM_FORMAT_XBGR1555 = 0x35314258,
1479*84e872a0SLloyd Pique /**
1480*84e872a0SLloyd Pique * 16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian
1481*84e872a0SLloyd Pique */
1482*84e872a0SLloyd Pique WL_SHM_FORMAT_RGBX5551 = 0x35315852,
1483*84e872a0SLloyd Pique /**
1484*84e872a0SLloyd Pique * 16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian
1485*84e872a0SLloyd Pique */
1486*84e872a0SLloyd Pique WL_SHM_FORMAT_BGRX5551 = 0x35315842,
1487*84e872a0SLloyd Pique /**
1488*84e872a0SLloyd Pique * 16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian
1489*84e872a0SLloyd Pique */
1490*84e872a0SLloyd Pique WL_SHM_FORMAT_ARGB1555 = 0x35315241,
1491*84e872a0SLloyd Pique /**
1492*84e872a0SLloyd Pique * 16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian
1493*84e872a0SLloyd Pique */
1494*84e872a0SLloyd Pique WL_SHM_FORMAT_ABGR1555 = 0x35314241,
1495*84e872a0SLloyd Pique /**
1496*84e872a0SLloyd Pique * 16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian
1497*84e872a0SLloyd Pique */
1498*84e872a0SLloyd Pique WL_SHM_FORMAT_RGBA5551 = 0x35314152,
1499*84e872a0SLloyd Pique /**
1500*84e872a0SLloyd Pique * 16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian
1501*84e872a0SLloyd Pique */
1502*84e872a0SLloyd Pique WL_SHM_FORMAT_BGRA5551 = 0x35314142,
1503*84e872a0SLloyd Pique /**
1504*84e872a0SLloyd Pique * 16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian
1505*84e872a0SLloyd Pique */
1506*84e872a0SLloyd Pique WL_SHM_FORMAT_RGB565 = 0x36314752,
1507*84e872a0SLloyd Pique /**
1508*84e872a0SLloyd Pique * 16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian
1509*84e872a0SLloyd Pique */
1510*84e872a0SLloyd Pique WL_SHM_FORMAT_BGR565 = 0x36314742,
1511*84e872a0SLloyd Pique /**
1512*84e872a0SLloyd Pique * 24-bit RGB format, [23:0] R:G:B little endian
1513*84e872a0SLloyd Pique */
1514*84e872a0SLloyd Pique WL_SHM_FORMAT_RGB888 = 0x34324752,
1515*84e872a0SLloyd Pique /**
1516*84e872a0SLloyd Pique * 24-bit BGR format, [23:0] B:G:R little endian
1517*84e872a0SLloyd Pique */
1518*84e872a0SLloyd Pique WL_SHM_FORMAT_BGR888 = 0x34324742,
1519*84e872a0SLloyd Pique /**
1520*84e872a0SLloyd Pique * 32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian
1521*84e872a0SLloyd Pique */
1522*84e872a0SLloyd Pique WL_SHM_FORMAT_XBGR8888 = 0x34324258,
1523*84e872a0SLloyd Pique /**
1524*84e872a0SLloyd Pique * 32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian
1525*84e872a0SLloyd Pique */
1526*84e872a0SLloyd Pique WL_SHM_FORMAT_RGBX8888 = 0x34325852,
1527*84e872a0SLloyd Pique /**
1528*84e872a0SLloyd Pique * 32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian
1529*84e872a0SLloyd Pique */
1530*84e872a0SLloyd Pique WL_SHM_FORMAT_BGRX8888 = 0x34325842,
1531*84e872a0SLloyd Pique /**
1532*84e872a0SLloyd Pique * 32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian
1533*84e872a0SLloyd Pique */
1534*84e872a0SLloyd Pique WL_SHM_FORMAT_ABGR8888 = 0x34324241,
1535*84e872a0SLloyd Pique /**
1536*84e872a0SLloyd Pique * 32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian
1537*84e872a0SLloyd Pique */
1538*84e872a0SLloyd Pique WL_SHM_FORMAT_RGBA8888 = 0x34324152,
1539*84e872a0SLloyd Pique /**
1540*84e872a0SLloyd Pique * 32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian
1541*84e872a0SLloyd Pique */
1542*84e872a0SLloyd Pique WL_SHM_FORMAT_BGRA8888 = 0x34324142,
1543*84e872a0SLloyd Pique /**
1544*84e872a0SLloyd Pique * 32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian
1545*84e872a0SLloyd Pique */
1546*84e872a0SLloyd Pique WL_SHM_FORMAT_XRGB2101010 = 0x30335258,
1547*84e872a0SLloyd Pique /**
1548*84e872a0SLloyd Pique * 32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian
1549*84e872a0SLloyd Pique */
1550*84e872a0SLloyd Pique WL_SHM_FORMAT_XBGR2101010 = 0x30334258,
1551*84e872a0SLloyd Pique /**
1552*84e872a0SLloyd Pique * 32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian
1553*84e872a0SLloyd Pique */
1554*84e872a0SLloyd Pique WL_SHM_FORMAT_RGBX1010102 = 0x30335852,
1555*84e872a0SLloyd Pique /**
1556*84e872a0SLloyd Pique * 32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian
1557*84e872a0SLloyd Pique */
1558*84e872a0SLloyd Pique WL_SHM_FORMAT_BGRX1010102 = 0x30335842,
1559*84e872a0SLloyd Pique /**
1560*84e872a0SLloyd Pique * 32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian
1561*84e872a0SLloyd Pique */
1562*84e872a0SLloyd Pique WL_SHM_FORMAT_ARGB2101010 = 0x30335241,
1563*84e872a0SLloyd Pique /**
1564*84e872a0SLloyd Pique * 32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian
1565*84e872a0SLloyd Pique */
1566*84e872a0SLloyd Pique WL_SHM_FORMAT_ABGR2101010 = 0x30334241,
1567*84e872a0SLloyd Pique /**
1568*84e872a0SLloyd Pique * 32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian
1569*84e872a0SLloyd Pique */
1570*84e872a0SLloyd Pique WL_SHM_FORMAT_RGBA1010102 = 0x30334152,
1571*84e872a0SLloyd Pique /**
1572*84e872a0SLloyd Pique * 32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian
1573*84e872a0SLloyd Pique */
1574*84e872a0SLloyd Pique WL_SHM_FORMAT_BGRA1010102 = 0x30334142,
1575*84e872a0SLloyd Pique /**
1576*84e872a0SLloyd Pique * packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian
1577*84e872a0SLloyd Pique */
1578*84e872a0SLloyd Pique WL_SHM_FORMAT_YUYV = 0x56595559,
1579*84e872a0SLloyd Pique /**
1580*84e872a0SLloyd Pique * packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian
1581*84e872a0SLloyd Pique */
1582*84e872a0SLloyd Pique WL_SHM_FORMAT_YVYU = 0x55595659,
1583*84e872a0SLloyd Pique /**
1584*84e872a0SLloyd Pique * packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian
1585*84e872a0SLloyd Pique */
1586*84e872a0SLloyd Pique WL_SHM_FORMAT_UYVY = 0x59565955,
1587*84e872a0SLloyd Pique /**
1588*84e872a0SLloyd Pique * packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian
1589*84e872a0SLloyd Pique */
1590*84e872a0SLloyd Pique WL_SHM_FORMAT_VYUY = 0x59555956,
1591*84e872a0SLloyd Pique /**
1592*84e872a0SLloyd Pique * packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian
1593*84e872a0SLloyd Pique */
1594*84e872a0SLloyd Pique WL_SHM_FORMAT_AYUV = 0x56555941,
1595*84e872a0SLloyd Pique /**
1596*84e872a0SLloyd Pique * 2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane
1597*84e872a0SLloyd Pique */
1598*84e872a0SLloyd Pique WL_SHM_FORMAT_NV12 = 0x3231564e,
1599*84e872a0SLloyd Pique /**
1600*84e872a0SLloyd Pique * 2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane
1601*84e872a0SLloyd Pique */
1602*84e872a0SLloyd Pique WL_SHM_FORMAT_NV21 = 0x3132564e,
1603*84e872a0SLloyd Pique /**
1604*84e872a0SLloyd Pique * 2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane
1605*84e872a0SLloyd Pique */
1606*84e872a0SLloyd Pique WL_SHM_FORMAT_NV16 = 0x3631564e,
1607*84e872a0SLloyd Pique /**
1608*84e872a0SLloyd Pique * 2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane
1609*84e872a0SLloyd Pique */
1610*84e872a0SLloyd Pique WL_SHM_FORMAT_NV61 = 0x3136564e,
1611*84e872a0SLloyd Pique /**
1612*84e872a0SLloyd Pique * 3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes
1613*84e872a0SLloyd Pique */
1614*84e872a0SLloyd Pique WL_SHM_FORMAT_YUV410 = 0x39565559,
1615*84e872a0SLloyd Pique /**
1616*84e872a0SLloyd Pique * 3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes
1617*84e872a0SLloyd Pique */
1618*84e872a0SLloyd Pique WL_SHM_FORMAT_YVU410 = 0x39555659,
1619*84e872a0SLloyd Pique /**
1620*84e872a0SLloyd Pique * 3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes
1621*84e872a0SLloyd Pique */
1622*84e872a0SLloyd Pique WL_SHM_FORMAT_YUV411 = 0x31315559,
1623*84e872a0SLloyd Pique /**
1624*84e872a0SLloyd Pique * 3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes
1625*84e872a0SLloyd Pique */
1626*84e872a0SLloyd Pique WL_SHM_FORMAT_YVU411 = 0x31315659,
1627*84e872a0SLloyd Pique /**
1628*84e872a0SLloyd Pique * 3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes
1629*84e872a0SLloyd Pique */
1630*84e872a0SLloyd Pique WL_SHM_FORMAT_YUV420 = 0x32315559,
1631*84e872a0SLloyd Pique /**
1632*84e872a0SLloyd Pique * 3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes
1633*84e872a0SLloyd Pique */
1634*84e872a0SLloyd Pique WL_SHM_FORMAT_YVU420 = 0x32315659,
1635*84e872a0SLloyd Pique /**
1636*84e872a0SLloyd Pique * 3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes
1637*84e872a0SLloyd Pique */
1638*84e872a0SLloyd Pique WL_SHM_FORMAT_YUV422 = 0x36315559,
1639*84e872a0SLloyd Pique /**
1640*84e872a0SLloyd Pique * 3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes
1641*84e872a0SLloyd Pique */
1642*84e872a0SLloyd Pique WL_SHM_FORMAT_YVU422 = 0x36315659,
1643*84e872a0SLloyd Pique /**
1644*84e872a0SLloyd Pique * 3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes
1645*84e872a0SLloyd Pique */
1646*84e872a0SLloyd Pique WL_SHM_FORMAT_YUV444 = 0x34325559,
1647*84e872a0SLloyd Pique /**
1648*84e872a0SLloyd Pique * 3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes
1649*84e872a0SLloyd Pique */
1650*84e872a0SLloyd Pique WL_SHM_FORMAT_YVU444 = 0x34325659,
1651*84e872a0SLloyd Pique };
1652*84e872a0SLloyd Pique #endif /* WL_SHM_FORMAT_ENUM */
1653*84e872a0SLloyd Pique
1654*84e872a0SLloyd Pique /**
1655*84e872a0SLloyd Pique * @ingroup iface_wl_shm
1656*84e872a0SLloyd Pique * @struct wl_shm_listener
1657*84e872a0SLloyd Pique */
1658*84e872a0SLloyd Pique struct wl_shm_listener {
1659*84e872a0SLloyd Pique /**
1660*84e872a0SLloyd Pique * pixel format description
1661*84e872a0SLloyd Pique *
1662*84e872a0SLloyd Pique * Informs the client about a valid pixel format that can be used
1663*84e872a0SLloyd Pique * for buffers. Known formats include argb8888 and xrgb8888.
1664*84e872a0SLloyd Pique * @param format buffer pixel format
1665*84e872a0SLloyd Pique */
1666*84e872a0SLloyd Pique void (*format)(void *data,
1667*84e872a0SLloyd Pique struct wl_shm *wl_shm,
1668*84e872a0SLloyd Pique uint32_t format);
1669*84e872a0SLloyd Pique };
1670*84e872a0SLloyd Pique
1671*84e872a0SLloyd Pique /**
1672*84e872a0SLloyd Pique * @ingroup iface_wl_shm
1673*84e872a0SLloyd Pique */
1674*84e872a0SLloyd Pique static inline int
wl_shm_add_listener(struct wl_shm * wl_shm,const struct wl_shm_listener * listener,void * data)1675*84e872a0SLloyd Pique wl_shm_add_listener(struct wl_shm *wl_shm,
1676*84e872a0SLloyd Pique const struct wl_shm_listener *listener, void *data)
1677*84e872a0SLloyd Pique {
1678*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_shm,
1679*84e872a0SLloyd Pique (void (**)(void)) listener, data);
1680*84e872a0SLloyd Pique }
1681*84e872a0SLloyd Pique
1682*84e872a0SLloyd Pique #define WL_SHM_CREATE_POOL 0
1683*84e872a0SLloyd Pique
1684*84e872a0SLloyd Pique /**
1685*84e872a0SLloyd Pique * @ingroup iface_wl_shm
1686*84e872a0SLloyd Pique */
1687*84e872a0SLloyd Pique #define WL_SHM_FORMAT_SINCE_VERSION 1
1688*84e872a0SLloyd Pique
1689*84e872a0SLloyd Pique /**
1690*84e872a0SLloyd Pique * @ingroup iface_wl_shm
1691*84e872a0SLloyd Pique */
1692*84e872a0SLloyd Pique #define WL_SHM_CREATE_POOL_SINCE_VERSION 1
1693*84e872a0SLloyd Pique
1694*84e872a0SLloyd Pique /** @ingroup iface_wl_shm */
1695*84e872a0SLloyd Pique static inline void
wl_shm_set_user_data(struct wl_shm * wl_shm,void * user_data)1696*84e872a0SLloyd Pique wl_shm_set_user_data(struct wl_shm *wl_shm, void *user_data)
1697*84e872a0SLloyd Pique {
1698*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_shm, user_data);
1699*84e872a0SLloyd Pique }
1700*84e872a0SLloyd Pique
1701*84e872a0SLloyd Pique /** @ingroup iface_wl_shm */
1702*84e872a0SLloyd Pique static inline void *
wl_shm_get_user_data(struct wl_shm * wl_shm)1703*84e872a0SLloyd Pique wl_shm_get_user_data(struct wl_shm *wl_shm)
1704*84e872a0SLloyd Pique {
1705*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_shm);
1706*84e872a0SLloyd Pique }
1707*84e872a0SLloyd Pique
1708*84e872a0SLloyd Pique static inline uint32_t
wl_shm_get_version(struct wl_shm * wl_shm)1709*84e872a0SLloyd Pique wl_shm_get_version(struct wl_shm *wl_shm)
1710*84e872a0SLloyd Pique {
1711*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_shm);
1712*84e872a0SLloyd Pique }
1713*84e872a0SLloyd Pique
1714*84e872a0SLloyd Pique /** @ingroup iface_wl_shm */
1715*84e872a0SLloyd Pique static inline void
wl_shm_destroy(struct wl_shm * wl_shm)1716*84e872a0SLloyd Pique wl_shm_destroy(struct wl_shm *wl_shm)
1717*84e872a0SLloyd Pique {
1718*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_shm);
1719*84e872a0SLloyd Pique }
1720*84e872a0SLloyd Pique
1721*84e872a0SLloyd Pique /**
1722*84e872a0SLloyd Pique * @ingroup iface_wl_shm
1723*84e872a0SLloyd Pique *
1724*84e872a0SLloyd Pique * Create a new wl_shm_pool object.
1725*84e872a0SLloyd Pique *
1726*84e872a0SLloyd Pique * The pool can be used to create shared memory based buffer
1727*84e872a0SLloyd Pique * objects. The server will mmap size bytes of the passed file
1728*84e872a0SLloyd Pique * descriptor, to use as backing memory for the pool.
1729*84e872a0SLloyd Pique */
1730*84e872a0SLloyd Pique static inline struct wl_shm_pool *
wl_shm_create_pool(struct wl_shm * wl_shm,int32_t fd,int32_t size)1731*84e872a0SLloyd Pique wl_shm_create_pool(struct wl_shm *wl_shm, int32_t fd, int32_t size)
1732*84e872a0SLloyd Pique {
1733*84e872a0SLloyd Pique struct wl_proxy *id;
1734*84e872a0SLloyd Pique
1735*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_shm,
1736*84e872a0SLloyd Pique WL_SHM_CREATE_POOL, &wl_shm_pool_interface, wl_proxy_get_version((struct wl_proxy *) wl_shm), 0, NULL, fd, size);
1737*84e872a0SLloyd Pique
1738*84e872a0SLloyd Pique return (struct wl_shm_pool *) id;
1739*84e872a0SLloyd Pique }
1740*84e872a0SLloyd Pique
1741*84e872a0SLloyd Pique /**
1742*84e872a0SLloyd Pique * @ingroup iface_wl_buffer
1743*84e872a0SLloyd Pique * @struct wl_buffer_listener
1744*84e872a0SLloyd Pique */
1745*84e872a0SLloyd Pique struct wl_buffer_listener {
1746*84e872a0SLloyd Pique /**
1747*84e872a0SLloyd Pique * compositor releases buffer
1748*84e872a0SLloyd Pique *
1749*84e872a0SLloyd Pique * Sent when this wl_buffer is no longer used by the compositor.
1750*84e872a0SLloyd Pique * The client is now free to reuse or destroy this buffer and its
1751*84e872a0SLloyd Pique * backing storage.
1752*84e872a0SLloyd Pique *
1753*84e872a0SLloyd Pique * If a client receives a release event before the frame callback
1754*84e872a0SLloyd Pique * requested in the same wl_surface.commit that attaches this
1755*84e872a0SLloyd Pique * wl_buffer to a surface, then the client is immediately free to
1756*84e872a0SLloyd Pique * reuse the buffer and its backing storage, and does not need a
1757*84e872a0SLloyd Pique * second buffer for the next surface content update. Typically
1758*84e872a0SLloyd Pique * this is possible, when the compositor maintains a copy of the
1759*84e872a0SLloyd Pique * wl_surface contents, e.g. as a GL texture. This is an important
1760*84e872a0SLloyd Pique * optimization for GL(ES) compositors with wl_shm clients.
1761*84e872a0SLloyd Pique */
1762*84e872a0SLloyd Pique void (*release)(void *data,
1763*84e872a0SLloyd Pique struct wl_buffer *wl_buffer);
1764*84e872a0SLloyd Pique };
1765*84e872a0SLloyd Pique
1766*84e872a0SLloyd Pique /**
1767*84e872a0SLloyd Pique * @ingroup iface_wl_buffer
1768*84e872a0SLloyd Pique */
1769*84e872a0SLloyd Pique static inline int
wl_buffer_add_listener(struct wl_buffer * wl_buffer,const struct wl_buffer_listener * listener,void * data)1770*84e872a0SLloyd Pique wl_buffer_add_listener(struct wl_buffer *wl_buffer,
1771*84e872a0SLloyd Pique const struct wl_buffer_listener *listener, void *data)
1772*84e872a0SLloyd Pique {
1773*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_buffer,
1774*84e872a0SLloyd Pique (void (**)(void)) listener, data);
1775*84e872a0SLloyd Pique }
1776*84e872a0SLloyd Pique
1777*84e872a0SLloyd Pique #define WL_BUFFER_DESTROY 0
1778*84e872a0SLloyd Pique
1779*84e872a0SLloyd Pique /**
1780*84e872a0SLloyd Pique * @ingroup iface_wl_buffer
1781*84e872a0SLloyd Pique */
1782*84e872a0SLloyd Pique #define WL_BUFFER_RELEASE_SINCE_VERSION 1
1783*84e872a0SLloyd Pique
1784*84e872a0SLloyd Pique /**
1785*84e872a0SLloyd Pique * @ingroup iface_wl_buffer
1786*84e872a0SLloyd Pique */
1787*84e872a0SLloyd Pique #define WL_BUFFER_DESTROY_SINCE_VERSION 1
1788*84e872a0SLloyd Pique
1789*84e872a0SLloyd Pique /** @ingroup iface_wl_buffer */
1790*84e872a0SLloyd Pique static inline void
wl_buffer_set_user_data(struct wl_buffer * wl_buffer,void * user_data)1791*84e872a0SLloyd Pique wl_buffer_set_user_data(struct wl_buffer *wl_buffer, void *user_data)
1792*84e872a0SLloyd Pique {
1793*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_buffer, user_data);
1794*84e872a0SLloyd Pique }
1795*84e872a0SLloyd Pique
1796*84e872a0SLloyd Pique /** @ingroup iface_wl_buffer */
1797*84e872a0SLloyd Pique static inline void *
wl_buffer_get_user_data(struct wl_buffer * wl_buffer)1798*84e872a0SLloyd Pique wl_buffer_get_user_data(struct wl_buffer *wl_buffer)
1799*84e872a0SLloyd Pique {
1800*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_buffer);
1801*84e872a0SLloyd Pique }
1802*84e872a0SLloyd Pique
1803*84e872a0SLloyd Pique static inline uint32_t
wl_buffer_get_version(struct wl_buffer * wl_buffer)1804*84e872a0SLloyd Pique wl_buffer_get_version(struct wl_buffer *wl_buffer)
1805*84e872a0SLloyd Pique {
1806*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_buffer);
1807*84e872a0SLloyd Pique }
1808*84e872a0SLloyd Pique
1809*84e872a0SLloyd Pique /**
1810*84e872a0SLloyd Pique * @ingroup iface_wl_buffer
1811*84e872a0SLloyd Pique *
1812*84e872a0SLloyd Pique * Destroy a buffer. If and how you need to release the backing
1813*84e872a0SLloyd Pique * storage is defined by the buffer factory interface.
1814*84e872a0SLloyd Pique *
1815*84e872a0SLloyd Pique * For possible side-effects to a surface, see wl_surface.attach.
1816*84e872a0SLloyd Pique */
1817*84e872a0SLloyd Pique static inline void
wl_buffer_destroy(struct wl_buffer * wl_buffer)1818*84e872a0SLloyd Pique wl_buffer_destroy(struct wl_buffer *wl_buffer)
1819*84e872a0SLloyd Pique {
1820*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_buffer,
1821*84e872a0SLloyd Pique WL_BUFFER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_buffer), WL_MARSHAL_FLAG_DESTROY);
1822*84e872a0SLloyd Pique }
1823*84e872a0SLloyd Pique
1824*84e872a0SLloyd Pique #ifndef WL_DATA_OFFER_ERROR_ENUM
1825*84e872a0SLloyd Pique #define WL_DATA_OFFER_ERROR_ENUM
1826*84e872a0SLloyd Pique enum wl_data_offer_error {
1827*84e872a0SLloyd Pique /**
1828*84e872a0SLloyd Pique * finish request was called untimely
1829*84e872a0SLloyd Pique */
1830*84e872a0SLloyd Pique WL_DATA_OFFER_ERROR_INVALID_FINISH = 0,
1831*84e872a0SLloyd Pique /**
1832*84e872a0SLloyd Pique * action mask contains invalid values
1833*84e872a0SLloyd Pique */
1834*84e872a0SLloyd Pique WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK = 1,
1835*84e872a0SLloyd Pique /**
1836*84e872a0SLloyd Pique * action argument has an invalid value
1837*84e872a0SLloyd Pique */
1838*84e872a0SLloyd Pique WL_DATA_OFFER_ERROR_INVALID_ACTION = 2,
1839*84e872a0SLloyd Pique /**
1840*84e872a0SLloyd Pique * offer doesn't accept this request
1841*84e872a0SLloyd Pique */
1842*84e872a0SLloyd Pique WL_DATA_OFFER_ERROR_INVALID_OFFER = 3,
1843*84e872a0SLloyd Pique };
1844*84e872a0SLloyd Pique #endif /* WL_DATA_OFFER_ERROR_ENUM */
1845*84e872a0SLloyd Pique
1846*84e872a0SLloyd Pique /**
1847*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1848*84e872a0SLloyd Pique * @struct wl_data_offer_listener
1849*84e872a0SLloyd Pique */
1850*84e872a0SLloyd Pique struct wl_data_offer_listener {
1851*84e872a0SLloyd Pique /**
1852*84e872a0SLloyd Pique * advertise offered mime type
1853*84e872a0SLloyd Pique *
1854*84e872a0SLloyd Pique * Sent immediately after creating the wl_data_offer object. One
1855*84e872a0SLloyd Pique * event per offered mime type.
1856*84e872a0SLloyd Pique * @param mime_type offered mime type
1857*84e872a0SLloyd Pique */
1858*84e872a0SLloyd Pique void (*offer)(void *data,
1859*84e872a0SLloyd Pique struct wl_data_offer *wl_data_offer,
1860*84e872a0SLloyd Pique const char *mime_type);
1861*84e872a0SLloyd Pique /**
1862*84e872a0SLloyd Pique * notify the source-side available actions
1863*84e872a0SLloyd Pique *
1864*84e872a0SLloyd Pique * This event indicates the actions offered by the data source.
1865*84e872a0SLloyd Pique * It will be sent right after wl_data_device.enter, or anytime the
1866*84e872a0SLloyd Pique * source side changes its offered actions through
1867*84e872a0SLloyd Pique * wl_data_source.set_actions.
1868*84e872a0SLloyd Pique * @param source_actions actions offered by the data source
1869*84e872a0SLloyd Pique * @since 3
1870*84e872a0SLloyd Pique */
1871*84e872a0SLloyd Pique void (*source_actions)(void *data,
1872*84e872a0SLloyd Pique struct wl_data_offer *wl_data_offer,
1873*84e872a0SLloyd Pique uint32_t source_actions);
1874*84e872a0SLloyd Pique /**
1875*84e872a0SLloyd Pique * notify the selected action
1876*84e872a0SLloyd Pique *
1877*84e872a0SLloyd Pique * This event indicates the action selected by the compositor
1878*84e872a0SLloyd Pique * after matching the source/destination side actions. Only one
1879*84e872a0SLloyd Pique * action (or none) will be offered here.
1880*84e872a0SLloyd Pique *
1881*84e872a0SLloyd Pique * This event can be emitted multiple times during the
1882*84e872a0SLloyd Pique * drag-and-drop operation in response to destination side action
1883*84e872a0SLloyd Pique * changes through wl_data_offer.set_actions.
1884*84e872a0SLloyd Pique *
1885*84e872a0SLloyd Pique * This event will no longer be emitted after wl_data_device.drop
1886*84e872a0SLloyd Pique * happened on the drag-and-drop destination, the client must honor
1887*84e872a0SLloyd Pique * the last action received, or the last preferred one set through
1888*84e872a0SLloyd Pique * wl_data_offer.set_actions when handling an "ask" action.
1889*84e872a0SLloyd Pique *
1890*84e872a0SLloyd Pique * Compositors may also change the selected action on the fly,
1891*84e872a0SLloyd Pique * mainly in response to keyboard modifier changes during the
1892*84e872a0SLloyd Pique * drag-and-drop operation.
1893*84e872a0SLloyd Pique *
1894*84e872a0SLloyd Pique * The most recent action received is always the valid one. Prior
1895*84e872a0SLloyd Pique * to receiving wl_data_device.drop, the chosen action may change
1896*84e872a0SLloyd Pique * (e.g. due to keyboard modifiers being pressed). At the time of
1897*84e872a0SLloyd Pique * receiving wl_data_device.drop the drag-and-drop destination must
1898*84e872a0SLloyd Pique * honor the last action received.
1899*84e872a0SLloyd Pique *
1900*84e872a0SLloyd Pique * Action changes may still happen after wl_data_device.drop,
1901*84e872a0SLloyd Pique * especially on "ask" actions, where the drag-and-drop destination
1902*84e872a0SLloyd Pique * may choose another action afterwards. Action changes happening
1903*84e872a0SLloyd Pique * at this stage are always the result of inter-client negotiation,
1904*84e872a0SLloyd Pique * the compositor shall no longer be able to induce a different
1905*84e872a0SLloyd Pique * action.
1906*84e872a0SLloyd Pique *
1907*84e872a0SLloyd Pique * Upon "ask" actions, it is expected that the drag-and-drop
1908*84e872a0SLloyd Pique * destination may potentially choose a different action and/or
1909*84e872a0SLloyd Pique * mime type, based on wl_data_offer.source_actions and finally
1910*84e872a0SLloyd Pique * chosen by the user (e.g. popping up a menu with the available
1911*84e872a0SLloyd Pique * options). The final wl_data_offer.set_actions and
1912*84e872a0SLloyd Pique * wl_data_offer.accept requests must happen before the call to
1913*84e872a0SLloyd Pique * wl_data_offer.finish.
1914*84e872a0SLloyd Pique * @param dnd_action action selected by the compositor
1915*84e872a0SLloyd Pique * @since 3
1916*84e872a0SLloyd Pique */
1917*84e872a0SLloyd Pique void (*action)(void *data,
1918*84e872a0SLloyd Pique struct wl_data_offer *wl_data_offer,
1919*84e872a0SLloyd Pique uint32_t dnd_action);
1920*84e872a0SLloyd Pique };
1921*84e872a0SLloyd Pique
1922*84e872a0SLloyd Pique /**
1923*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1924*84e872a0SLloyd Pique */
1925*84e872a0SLloyd Pique static inline int
wl_data_offer_add_listener(struct wl_data_offer * wl_data_offer,const struct wl_data_offer_listener * listener,void * data)1926*84e872a0SLloyd Pique wl_data_offer_add_listener(struct wl_data_offer *wl_data_offer,
1927*84e872a0SLloyd Pique const struct wl_data_offer_listener *listener, void *data)
1928*84e872a0SLloyd Pique {
1929*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_data_offer,
1930*84e872a0SLloyd Pique (void (**)(void)) listener, data);
1931*84e872a0SLloyd Pique }
1932*84e872a0SLloyd Pique
1933*84e872a0SLloyd Pique #define WL_DATA_OFFER_ACCEPT 0
1934*84e872a0SLloyd Pique #define WL_DATA_OFFER_RECEIVE 1
1935*84e872a0SLloyd Pique #define WL_DATA_OFFER_DESTROY 2
1936*84e872a0SLloyd Pique #define WL_DATA_OFFER_FINISH 3
1937*84e872a0SLloyd Pique #define WL_DATA_OFFER_SET_ACTIONS 4
1938*84e872a0SLloyd Pique
1939*84e872a0SLloyd Pique /**
1940*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1941*84e872a0SLloyd Pique */
1942*84e872a0SLloyd Pique #define WL_DATA_OFFER_OFFER_SINCE_VERSION 1
1943*84e872a0SLloyd Pique /**
1944*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1945*84e872a0SLloyd Pique */
1946*84e872a0SLloyd Pique #define WL_DATA_OFFER_SOURCE_ACTIONS_SINCE_VERSION 3
1947*84e872a0SLloyd Pique /**
1948*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1949*84e872a0SLloyd Pique */
1950*84e872a0SLloyd Pique #define WL_DATA_OFFER_ACTION_SINCE_VERSION 3
1951*84e872a0SLloyd Pique
1952*84e872a0SLloyd Pique /**
1953*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1954*84e872a0SLloyd Pique */
1955*84e872a0SLloyd Pique #define WL_DATA_OFFER_ACCEPT_SINCE_VERSION 1
1956*84e872a0SLloyd Pique /**
1957*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1958*84e872a0SLloyd Pique */
1959*84e872a0SLloyd Pique #define WL_DATA_OFFER_RECEIVE_SINCE_VERSION 1
1960*84e872a0SLloyd Pique /**
1961*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1962*84e872a0SLloyd Pique */
1963*84e872a0SLloyd Pique #define WL_DATA_OFFER_DESTROY_SINCE_VERSION 1
1964*84e872a0SLloyd Pique /**
1965*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1966*84e872a0SLloyd Pique */
1967*84e872a0SLloyd Pique #define WL_DATA_OFFER_FINISH_SINCE_VERSION 3
1968*84e872a0SLloyd Pique /**
1969*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1970*84e872a0SLloyd Pique */
1971*84e872a0SLloyd Pique #define WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION 3
1972*84e872a0SLloyd Pique
1973*84e872a0SLloyd Pique /** @ingroup iface_wl_data_offer */
1974*84e872a0SLloyd Pique static inline void
wl_data_offer_set_user_data(struct wl_data_offer * wl_data_offer,void * user_data)1975*84e872a0SLloyd Pique wl_data_offer_set_user_data(struct wl_data_offer *wl_data_offer, void *user_data)
1976*84e872a0SLloyd Pique {
1977*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_data_offer, user_data);
1978*84e872a0SLloyd Pique }
1979*84e872a0SLloyd Pique
1980*84e872a0SLloyd Pique /** @ingroup iface_wl_data_offer */
1981*84e872a0SLloyd Pique static inline void *
wl_data_offer_get_user_data(struct wl_data_offer * wl_data_offer)1982*84e872a0SLloyd Pique wl_data_offer_get_user_data(struct wl_data_offer *wl_data_offer)
1983*84e872a0SLloyd Pique {
1984*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_data_offer);
1985*84e872a0SLloyd Pique }
1986*84e872a0SLloyd Pique
1987*84e872a0SLloyd Pique static inline uint32_t
wl_data_offer_get_version(struct wl_data_offer * wl_data_offer)1988*84e872a0SLloyd Pique wl_data_offer_get_version(struct wl_data_offer *wl_data_offer)
1989*84e872a0SLloyd Pique {
1990*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_data_offer);
1991*84e872a0SLloyd Pique }
1992*84e872a0SLloyd Pique
1993*84e872a0SLloyd Pique /**
1994*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
1995*84e872a0SLloyd Pique *
1996*84e872a0SLloyd Pique * Indicate that the client can accept the given mime type, or
1997*84e872a0SLloyd Pique * NULL for not accepted.
1998*84e872a0SLloyd Pique *
1999*84e872a0SLloyd Pique * For objects of version 2 or older, this request is used by the
2000*84e872a0SLloyd Pique * client to give feedback whether the client can receive the given
2001*84e872a0SLloyd Pique * mime type, or NULL if none is accepted; the feedback does not
2002*84e872a0SLloyd Pique * determine whether the drag-and-drop operation succeeds or not.
2003*84e872a0SLloyd Pique *
2004*84e872a0SLloyd Pique * For objects of version 3 or newer, this request determines the
2005*84e872a0SLloyd Pique * final result of the drag-and-drop operation. If the end result
2006*84e872a0SLloyd Pique * is that no mime types were accepted, the drag-and-drop operation
2007*84e872a0SLloyd Pique * will be cancelled and the corresponding drag source will receive
2008*84e872a0SLloyd Pique * wl_data_source.cancelled. Clients may still use this event in
2009*84e872a0SLloyd Pique * conjunction with wl_data_source.action for feedback.
2010*84e872a0SLloyd Pique */
2011*84e872a0SLloyd Pique static inline void
wl_data_offer_accept(struct wl_data_offer * wl_data_offer,uint32_t serial,const char * mime_type)2012*84e872a0SLloyd Pique wl_data_offer_accept(struct wl_data_offer *wl_data_offer, uint32_t serial, const char *mime_type)
2013*84e872a0SLloyd Pique {
2014*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
2015*84e872a0SLloyd Pique WL_DATA_OFFER_ACCEPT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), 0, serial, mime_type);
2016*84e872a0SLloyd Pique }
2017*84e872a0SLloyd Pique
2018*84e872a0SLloyd Pique /**
2019*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
2020*84e872a0SLloyd Pique *
2021*84e872a0SLloyd Pique * To transfer the offered data, the client issues this request
2022*84e872a0SLloyd Pique * and indicates the mime type it wants to receive. The transfer
2023*84e872a0SLloyd Pique * happens through the passed file descriptor (typically created
2024*84e872a0SLloyd Pique * with the pipe system call). The source client writes the data
2025*84e872a0SLloyd Pique * in the mime type representation requested and then closes the
2026*84e872a0SLloyd Pique * file descriptor.
2027*84e872a0SLloyd Pique *
2028*84e872a0SLloyd Pique * The receiving client reads from the read end of the pipe until
2029*84e872a0SLloyd Pique * EOF and then closes its end, at which point the transfer is
2030*84e872a0SLloyd Pique * complete.
2031*84e872a0SLloyd Pique *
2032*84e872a0SLloyd Pique * This request may happen multiple times for different mime types,
2033*84e872a0SLloyd Pique * both before and after wl_data_device.drop. Drag-and-drop destination
2034*84e872a0SLloyd Pique * clients may preemptively fetch data or examine it more closely to
2035*84e872a0SLloyd Pique * determine acceptance.
2036*84e872a0SLloyd Pique */
2037*84e872a0SLloyd Pique static inline void
wl_data_offer_receive(struct wl_data_offer * wl_data_offer,const char * mime_type,int32_t fd)2038*84e872a0SLloyd Pique wl_data_offer_receive(struct wl_data_offer *wl_data_offer, const char *mime_type, int32_t fd)
2039*84e872a0SLloyd Pique {
2040*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
2041*84e872a0SLloyd Pique WL_DATA_OFFER_RECEIVE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), 0, mime_type, fd);
2042*84e872a0SLloyd Pique }
2043*84e872a0SLloyd Pique
2044*84e872a0SLloyd Pique /**
2045*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
2046*84e872a0SLloyd Pique *
2047*84e872a0SLloyd Pique * Destroy the data offer.
2048*84e872a0SLloyd Pique */
2049*84e872a0SLloyd Pique static inline void
wl_data_offer_destroy(struct wl_data_offer * wl_data_offer)2050*84e872a0SLloyd Pique wl_data_offer_destroy(struct wl_data_offer *wl_data_offer)
2051*84e872a0SLloyd Pique {
2052*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
2053*84e872a0SLloyd Pique WL_DATA_OFFER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), WL_MARSHAL_FLAG_DESTROY);
2054*84e872a0SLloyd Pique }
2055*84e872a0SLloyd Pique
2056*84e872a0SLloyd Pique /**
2057*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
2058*84e872a0SLloyd Pique *
2059*84e872a0SLloyd Pique * Notifies the compositor that the drag destination successfully
2060*84e872a0SLloyd Pique * finished the drag-and-drop operation.
2061*84e872a0SLloyd Pique *
2062*84e872a0SLloyd Pique * Upon receiving this request, the compositor will emit
2063*84e872a0SLloyd Pique * wl_data_source.dnd_finished on the drag source client.
2064*84e872a0SLloyd Pique *
2065*84e872a0SLloyd Pique * It is a client error to perform other requests than
2066*84e872a0SLloyd Pique * wl_data_offer.destroy after this one. It is also an error to perform
2067*84e872a0SLloyd Pique * this request after a NULL mime type has been set in
2068*84e872a0SLloyd Pique * wl_data_offer.accept or no action was received through
2069*84e872a0SLloyd Pique * wl_data_offer.action.
2070*84e872a0SLloyd Pique */
2071*84e872a0SLloyd Pique static inline void
wl_data_offer_finish(struct wl_data_offer * wl_data_offer)2072*84e872a0SLloyd Pique wl_data_offer_finish(struct wl_data_offer *wl_data_offer)
2073*84e872a0SLloyd Pique {
2074*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
2075*84e872a0SLloyd Pique WL_DATA_OFFER_FINISH, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), 0);
2076*84e872a0SLloyd Pique }
2077*84e872a0SLloyd Pique
2078*84e872a0SLloyd Pique /**
2079*84e872a0SLloyd Pique * @ingroup iface_wl_data_offer
2080*84e872a0SLloyd Pique *
2081*84e872a0SLloyd Pique * Sets the actions that the destination side client supports for
2082*84e872a0SLloyd Pique * this operation. This request may trigger the emission of
2083*84e872a0SLloyd Pique * wl_data_source.action and wl_data_offer.action events if the compositor
2084*84e872a0SLloyd Pique * needs to change the selected action.
2085*84e872a0SLloyd Pique *
2086*84e872a0SLloyd Pique * This request can be called multiple times throughout the
2087*84e872a0SLloyd Pique * drag-and-drop operation, typically in response to wl_data_device.enter
2088*84e872a0SLloyd Pique * or wl_data_device.motion events.
2089*84e872a0SLloyd Pique *
2090*84e872a0SLloyd Pique * This request determines the final result of the drag-and-drop
2091*84e872a0SLloyd Pique * operation. If the end result is that no action is accepted,
2092*84e872a0SLloyd Pique * the drag source will receive wl_drag_source.cancelled.
2093*84e872a0SLloyd Pique *
2094*84e872a0SLloyd Pique * The dnd_actions argument must contain only values expressed in the
2095*84e872a0SLloyd Pique * wl_data_device_manager.dnd_actions enum, and the preferred_action
2096*84e872a0SLloyd Pique * argument must only contain one of those values set, otherwise it
2097*84e872a0SLloyd Pique * will result in a protocol error.
2098*84e872a0SLloyd Pique *
2099*84e872a0SLloyd Pique * While managing an "ask" action, the destination drag-and-drop client
2100*84e872a0SLloyd Pique * may perform further wl_data_offer.receive requests, and is expected
2101*84e872a0SLloyd Pique * to perform one last wl_data_offer.set_actions request with a preferred
2102*84e872a0SLloyd Pique * action other than "ask" (and optionally wl_data_offer.accept) before
2103*84e872a0SLloyd Pique * requesting wl_data_offer.finish, in order to convey the action selected
2104*84e872a0SLloyd Pique * by the user. If the preferred action is not in the
2105*84e872a0SLloyd Pique * wl_data_offer.source_actions mask, an error will be raised.
2106*84e872a0SLloyd Pique *
2107*84e872a0SLloyd Pique * If the "ask" action is dismissed (e.g. user cancellation), the client
2108*84e872a0SLloyd Pique * is expected to perform wl_data_offer.destroy right away.
2109*84e872a0SLloyd Pique *
2110*84e872a0SLloyd Pique * This request can only be made on drag-and-drop offers, a protocol error
2111*84e872a0SLloyd Pique * will be raised otherwise.
2112*84e872a0SLloyd Pique */
2113*84e872a0SLloyd Pique static inline void
wl_data_offer_set_actions(struct wl_data_offer * wl_data_offer,uint32_t dnd_actions,uint32_t preferred_action)2114*84e872a0SLloyd Pique wl_data_offer_set_actions(struct wl_data_offer *wl_data_offer, uint32_t dnd_actions, uint32_t preferred_action)
2115*84e872a0SLloyd Pique {
2116*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
2117*84e872a0SLloyd Pique WL_DATA_OFFER_SET_ACTIONS, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), 0, dnd_actions, preferred_action);
2118*84e872a0SLloyd Pique }
2119*84e872a0SLloyd Pique
2120*84e872a0SLloyd Pique #ifndef WL_DATA_SOURCE_ERROR_ENUM
2121*84e872a0SLloyd Pique #define WL_DATA_SOURCE_ERROR_ENUM
2122*84e872a0SLloyd Pique enum wl_data_source_error {
2123*84e872a0SLloyd Pique /**
2124*84e872a0SLloyd Pique * action mask contains invalid values
2125*84e872a0SLloyd Pique */
2126*84e872a0SLloyd Pique WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK = 0,
2127*84e872a0SLloyd Pique /**
2128*84e872a0SLloyd Pique * source doesn't accept this request
2129*84e872a0SLloyd Pique */
2130*84e872a0SLloyd Pique WL_DATA_SOURCE_ERROR_INVALID_SOURCE = 1,
2131*84e872a0SLloyd Pique };
2132*84e872a0SLloyd Pique #endif /* WL_DATA_SOURCE_ERROR_ENUM */
2133*84e872a0SLloyd Pique
2134*84e872a0SLloyd Pique /**
2135*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2136*84e872a0SLloyd Pique * @struct wl_data_source_listener
2137*84e872a0SLloyd Pique */
2138*84e872a0SLloyd Pique struct wl_data_source_listener {
2139*84e872a0SLloyd Pique /**
2140*84e872a0SLloyd Pique * a target accepts an offered mime type
2141*84e872a0SLloyd Pique *
2142*84e872a0SLloyd Pique * Sent when a target accepts pointer_focus or motion events. If
2143*84e872a0SLloyd Pique * a target does not accept any of the offered types, type is NULL.
2144*84e872a0SLloyd Pique *
2145*84e872a0SLloyd Pique * Used for feedback during drag-and-drop.
2146*84e872a0SLloyd Pique * @param mime_type mime type accepted by the target
2147*84e872a0SLloyd Pique */
2148*84e872a0SLloyd Pique void (*target)(void *data,
2149*84e872a0SLloyd Pique struct wl_data_source *wl_data_source,
2150*84e872a0SLloyd Pique const char *mime_type);
2151*84e872a0SLloyd Pique /**
2152*84e872a0SLloyd Pique * send the data
2153*84e872a0SLloyd Pique *
2154*84e872a0SLloyd Pique * Request for data from the client. Send the data as the
2155*84e872a0SLloyd Pique * specified mime type over the passed file descriptor, then close
2156*84e872a0SLloyd Pique * it.
2157*84e872a0SLloyd Pique * @param mime_type mime type for the data
2158*84e872a0SLloyd Pique * @param fd file descriptor for the data
2159*84e872a0SLloyd Pique */
2160*84e872a0SLloyd Pique void (*send)(void *data,
2161*84e872a0SLloyd Pique struct wl_data_source *wl_data_source,
2162*84e872a0SLloyd Pique const char *mime_type,
2163*84e872a0SLloyd Pique int32_t fd);
2164*84e872a0SLloyd Pique /**
2165*84e872a0SLloyd Pique * selection was cancelled
2166*84e872a0SLloyd Pique *
2167*84e872a0SLloyd Pique * This data source is no longer valid. There are several reasons
2168*84e872a0SLloyd Pique * why this could happen:
2169*84e872a0SLloyd Pique *
2170*84e872a0SLloyd Pique * - The data source has been replaced by another data source. -
2171*84e872a0SLloyd Pique * The drag-and-drop operation was performed, but the drop
2172*84e872a0SLloyd Pique * destination did not accept any of the mime types offered through
2173*84e872a0SLloyd Pique * wl_data_source.target. - The drag-and-drop operation was
2174*84e872a0SLloyd Pique * performed, but the drop destination did not select any of the
2175*84e872a0SLloyd Pique * actions present in the mask offered through
2176*84e872a0SLloyd Pique * wl_data_source.action. - The drag-and-drop operation was
2177*84e872a0SLloyd Pique * performed but didn't happen over a surface. - The compositor
2178*84e872a0SLloyd Pique * cancelled the drag-and-drop operation (e.g. compositor dependent
2179*84e872a0SLloyd Pique * timeouts to avoid stale drag-and-drop transfers).
2180*84e872a0SLloyd Pique *
2181*84e872a0SLloyd Pique * The client should clean up and destroy this data source.
2182*84e872a0SLloyd Pique *
2183*84e872a0SLloyd Pique * For objects of version 2 or older, wl_data_source.cancelled will
2184*84e872a0SLloyd Pique * only be emitted if the data source was replaced by another data
2185*84e872a0SLloyd Pique * source.
2186*84e872a0SLloyd Pique */
2187*84e872a0SLloyd Pique void (*cancelled)(void *data,
2188*84e872a0SLloyd Pique struct wl_data_source *wl_data_source);
2189*84e872a0SLloyd Pique /**
2190*84e872a0SLloyd Pique * the drag-and-drop operation physically finished
2191*84e872a0SLloyd Pique *
2192*84e872a0SLloyd Pique * The user performed the drop action. This event does not
2193*84e872a0SLloyd Pique * indicate acceptance, wl_data_source.cancelled may still be
2194*84e872a0SLloyd Pique * emitted afterwards if the drop destination does not accept any
2195*84e872a0SLloyd Pique * mime type.
2196*84e872a0SLloyd Pique *
2197*84e872a0SLloyd Pique * However, this event might however not be received if the
2198*84e872a0SLloyd Pique * compositor cancelled the drag-and-drop operation before this
2199*84e872a0SLloyd Pique * event could happen.
2200*84e872a0SLloyd Pique *
2201*84e872a0SLloyd Pique * Note that the data_source may still be used in the future and
2202*84e872a0SLloyd Pique * should not be destroyed here.
2203*84e872a0SLloyd Pique * @since 3
2204*84e872a0SLloyd Pique */
2205*84e872a0SLloyd Pique void (*dnd_drop_performed)(void *data,
2206*84e872a0SLloyd Pique struct wl_data_source *wl_data_source);
2207*84e872a0SLloyd Pique /**
2208*84e872a0SLloyd Pique * the drag-and-drop operation concluded
2209*84e872a0SLloyd Pique *
2210*84e872a0SLloyd Pique * The drop destination finished interoperating with this data
2211*84e872a0SLloyd Pique * source, so the client is now free to destroy this data source
2212*84e872a0SLloyd Pique * and free all associated data.
2213*84e872a0SLloyd Pique *
2214*84e872a0SLloyd Pique * If the action used to perform the operation was "move", the
2215*84e872a0SLloyd Pique * source can now delete the transferred data.
2216*84e872a0SLloyd Pique * @since 3
2217*84e872a0SLloyd Pique */
2218*84e872a0SLloyd Pique void (*dnd_finished)(void *data,
2219*84e872a0SLloyd Pique struct wl_data_source *wl_data_source);
2220*84e872a0SLloyd Pique /**
2221*84e872a0SLloyd Pique * notify the selected action
2222*84e872a0SLloyd Pique *
2223*84e872a0SLloyd Pique * This event indicates the action selected by the compositor
2224*84e872a0SLloyd Pique * after matching the source/destination side actions. Only one
2225*84e872a0SLloyd Pique * action (or none) will be offered here.
2226*84e872a0SLloyd Pique *
2227*84e872a0SLloyd Pique * This event can be emitted multiple times during the
2228*84e872a0SLloyd Pique * drag-and-drop operation, mainly in response to destination side
2229*84e872a0SLloyd Pique * changes through wl_data_offer.set_actions, and as the data
2230*84e872a0SLloyd Pique * device enters/leaves surfaces.
2231*84e872a0SLloyd Pique *
2232*84e872a0SLloyd Pique * It is only possible to receive this event after
2233*84e872a0SLloyd Pique * wl_data_source.dnd_drop_performed if the drag-and-drop operation
2234*84e872a0SLloyd Pique * ended in an "ask" action, in which case the final
2235*84e872a0SLloyd Pique * wl_data_source.action event will happen immediately before
2236*84e872a0SLloyd Pique * wl_data_source.dnd_finished.
2237*84e872a0SLloyd Pique *
2238*84e872a0SLloyd Pique * Compositors may also change the selected action on the fly,
2239*84e872a0SLloyd Pique * mainly in response to keyboard modifier changes during the
2240*84e872a0SLloyd Pique * drag-and-drop operation.
2241*84e872a0SLloyd Pique *
2242*84e872a0SLloyd Pique * The most recent action received is always the valid one. The
2243*84e872a0SLloyd Pique * chosen action may change alongside negotiation (e.g. an "ask"
2244*84e872a0SLloyd Pique * action can turn into a "move" operation), so the effects of the
2245*84e872a0SLloyd Pique * final action must always be applied in
2246*84e872a0SLloyd Pique * wl_data_offer.dnd_finished.
2247*84e872a0SLloyd Pique *
2248*84e872a0SLloyd Pique * Clients can trigger cursor surface changes from this point, so
2249*84e872a0SLloyd Pique * they reflect the current action.
2250*84e872a0SLloyd Pique * @param dnd_action action selected by the compositor
2251*84e872a0SLloyd Pique * @since 3
2252*84e872a0SLloyd Pique */
2253*84e872a0SLloyd Pique void (*action)(void *data,
2254*84e872a0SLloyd Pique struct wl_data_source *wl_data_source,
2255*84e872a0SLloyd Pique uint32_t dnd_action);
2256*84e872a0SLloyd Pique };
2257*84e872a0SLloyd Pique
2258*84e872a0SLloyd Pique /**
2259*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2260*84e872a0SLloyd Pique */
2261*84e872a0SLloyd Pique static inline int
wl_data_source_add_listener(struct wl_data_source * wl_data_source,const struct wl_data_source_listener * listener,void * data)2262*84e872a0SLloyd Pique wl_data_source_add_listener(struct wl_data_source *wl_data_source,
2263*84e872a0SLloyd Pique const struct wl_data_source_listener *listener, void *data)
2264*84e872a0SLloyd Pique {
2265*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_data_source,
2266*84e872a0SLloyd Pique (void (**)(void)) listener, data);
2267*84e872a0SLloyd Pique }
2268*84e872a0SLloyd Pique
2269*84e872a0SLloyd Pique #define WL_DATA_SOURCE_OFFER 0
2270*84e872a0SLloyd Pique #define WL_DATA_SOURCE_DESTROY 1
2271*84e872a0SLloyd Pique #define WL_DATA_SOURCE_SET_ACTIONS 2
2272*84e872a0SLloyd Pique
2273*84e872a0SLloyd Pique /**
2274*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2275*84e872a0SLloyd Pique */
2276*84e872a0SLloyd Pique #define WL_DATA_SOURCE_TARGET_SINCE_VERSION 1
2277*84e872a0SLloyd Pique /**
2278*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2279*84e872a0SLloyd Pique */
2280*84e872a0SLloyd Pique #define WL_DATA_SOURCE_SEND_SINCE_VERSION 1
2281*84e872a0SLloyd Pique /**
2282*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2283*84e872a0SLloyd Pique */
2284*84e872a0SLloyd Pique #define WL_DATA_SOURCE_CANCELLED_SINCE_VERSION 1
2285*84e872a0SLloyd Pique /**
2286*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2287*84e872a0SLloyd Pique */
2288*84e872a0SLloyd Pique #define WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION 3
2289*84e872a0SLloyd Pique /**
2290*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2291*84e872a0SLloyd Pique */
2292*84e872a0SLloyd Pique #define WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION 3
2293*84e872a0SLloyd Pique /**
2294*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2295*84e872a0SLloyd Pique */
2296*84e872a0SLloyd Pique #define WL_DATA_SOURCE_ACTION_SINCE_VERSION 3
2297*84e872a0SLloyd Pique
2298*84e872a0SLloyd Pique /**
2299*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2300*84e872a0SLloyd Pique */
2301*84e872a0SLloyd Pique #define WL_DATA_SOURCE_OFFER_SINCE_VERSION 1
2302*84e872a0SLloyd Pique /**
2303*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2304*84e872a0SLloyd Pique */
2305*84e872a0SLloyd Pique #define WL_DATA_SOURCE_DESTROY_SINCE_VERSION 1
2306*84e872a0SLloyd Pique /**
2307*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2308*84e872a0SLloyd Pique */
2309*84e872a0SLloyd Pique #define WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION 3
2310*84e872a0SLloyd Pique
2311*84e872a0SLloyd Pique /** @ingroup iface_wl_data_source */
2312*84e872a0SLloyd Pique static inline void
wl_data_source_set_user_data(struct wl_data_source * wl_data_source,void * user_data)2313*84e872a0SLloyd Pique wl_data_source_set_user_data(struct wl_data_source *wl_data_source, void *user_data)
2314*84e872a0SLloyd Pique {
2315*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_data_source, user_data);
2316*84e872a0SLloyd Pique }
2317*84e872a0SLloyd Pique
2318*84e872a0SLloyd Pique /** @ingroup iface_wl_data_source */
2319*84e872a0SLloyd Pique static inline void *
wl_data_source_get_user_data(struct wl_data_source * wl_data_source)2320*84e872a0SLloyd Pique wl_data_source_get_user_data(struct wl_data_source *wl_data_source)
2321*84e872a0SLloyd Pique {
2322*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_data_source);
2323*84e872a0SLloyd Pique }
2324*84e872a0SLloyd Pique
2325*84e872a0SLloyd Pique static inline uint32_t
wl_data_source_get_version(struct wl_data_source * wl_data_source)2326*84e872a0SLloyd Pique wl_data_source_get_version(struct wl_data_source *wl_data_source)
2327*84e872a0SLloyd Pique {
2328*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_data_source);
2329*84e872a0SLloyd Pique }
2330*84e872a0SLloyd Pique
2331*84e872a0SLloyd Pique /**
2332*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2333*84e872a0SLloyd Pique *
2334*84e872a0SLloyd Pique * This request adds a mime type to the set of mime types
2335*84e872a0SLloyd Pique * advertised to targets. Can be called several times to offer
2336*84e872a0SLloyd Pique * multiple types.
2337*84e872a0SLloyd Pique */
2338*84e872a0SLloyd Pique static inline void
wl_data_source_offer(struct wl_data_source * wl_data_source,const char * mime_type)2339*84e872a0SLloyd Pique wl_data_source_offer(struct wl_data_source *wl_data_source, const char *mime_type)
2340*84e872a0SLloyd Pique {
2341*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_source,
2342*84e872a0SLloyd Pique WL_DATA_SOURCE_OFFER, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_source), 0, mime_type);
2343*84e872a0SLloyd Pique }
2344*84e872a0SLloyd Pique
2345*84e872a0SLloyd Pique /**
2346*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2347*84e872a0SLloyd Pique *
2348*84e872a0SLloyd Pique * Destroy the data source.
2349*84e872a0SLloyd Pique */
2350*84e872a0SLloyd Pique static inline void
wl_data_source_destroy(struct wl_data_source * wl_data_source)2351*84e872a0SLloyd Pique wl_data_source_destroy(struct wl_data_source *wl_data_source)
2352*84e872a0SLloyd Pique {
2353*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_source,
2354*84e872a0SLloyd Pique WL_DATA_SOURCE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_source), WL_MARSHAL_FLAG_DESTROY);
2355*84e872a0SLloyd Pique }
2356*84e872a0SLloyd Pique
2357*84e872a0SLloyd Pique /**
2358*84e872a0SLloyd Pique * @ingroup iface_wl_data_source
2359*84e872a0SLloyd Pique *
2360*84e872a0SLloyd Pique * Sets the actions that the source side client supports for this
2361*84e872a0SLloyd Pique * operation. This request may trigger wl_data_source.action and
2362*84e872a0SLloyd Pique * wl_data_offer.action events if the compositor needs to change the
2363*84e872a0SLloyd Pique * selected action.
2364*84e872a0SLloyd Pique *
2365*84e872a0SLloyd Pique * The dnd_actions argument must contain only values expressed in the
2366*84e872a0SLloyd Pique * wl_data_device_manager.dnd_actions enum, otherwise it will result
2367*84e872a0SLloyd Pique * in a protocol error.
2368*84e872a0SLloyd Pique *
2369*84e872a0SLloyd Pique * This request must be made once only, and can only be made on sources
2370*84e872a0SLloyd Pique * used in drag-and-drop, so it must be performed before
2371*84e872a0SLloyd Pique * wl_data_device.start_drag. Attempting to use the source other than
2372*84e872a0SLloyd Pique * for drag-and-drop will raise a protocol error.
2373*84e872a0SLloyd Pique */
2374*84e872a0SLloyd Pique static inline void
wl_data_source_set_actions(struct wl_data_source * wl_data_source,uint32_t dnd_actions)2375*84e872a0SLloyd Pique wl_data_source_set_actions(struct wl_data_source *wl_data_source, uint32_t dnd_actions)
2376*84e872a0SLloyd Pique {
2377*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_source,
2378*84e872a0SLloyd Pique WL_DATA_SOURCE_SET_ACTIONS, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_source), 0, dnd_actions);
2379*84e872a0SLloyd Pique }
2380*84e872a0SLloyd Pique
2381*84e872a0SLloyd Pique #ifndef WL_DATA_DEVICE_ERROR_ENUM
2382*84e872a0SLloyd Pique #define WL_DATA_DEVICE_ERROR_ENUM
2383*84e872a0SLloyd Pique enum wl_data_device_error {
2384*84e872a0SLloyd Pique /**
2385*84e872a0SLloyd Pique * given wl_surface has another role
2386*84e872a0SLloyd Pique */
2387*84e872a0SLloyd Pique WL_DATA_DEVICE_ERROR_ROLE = 0,
2388*84e872a0SLloyd Pique };
2389*84e872a0SLloyd Pique #endif /* WL_DATA_DEVICE_ERROR_ENUM */
2390*84e872a0SLloyd Pique
2391*84e872a0SLloyd Pique /**
2392*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2393*84e872a0SLloyd Pique * @struct wl_data_device_listener
2394*84e872a0SLloyd Pique */
2395*84e872a0SLloyd Pique struct wl_data_device_listener {
2396*84e872a0SLloyd Pique /**
2397*84e872a0SLloyd Pique * introduce a new wl_data_offer
2398*84e872a0SLloyd Pique *
2399*84e872a0SLloyd Pique * The data_offer event introduces a new wl_data_offer object,
2400*84e872a0SLloyd Pique * which will subsequently be used in either the data_device.enter
2401*84e872a0SLloyd Pique * event (for drag-and-drop) or the data_device.selection event
2402*84e872a0SLloyd Pique * (for selections). Immediately following the
2403*84e872a0SLloyd Pique * data_device.data_offer event, the new data_offer object will
2404*84e872a0SLloyd Pique * send out data_offer.offer events to describe the mime types it
2405*84e872a0SLloyd Pique * offers.
2406*84e872a0SLloyd Pique * @param id the new data_offer object
2407*84e872a0SLloyd Pique */
2408*84e872a0SLloyd Pique void (*data_offer)(void *data,
2409*84e872a0SLloyd Pique struct wl_data_device *wl_data_device,
2410*84e872a0SLloyd Pique struct wl_data_offer *id);
2411*84e872a0SLloyd Pique /**
2412*84e872a0SLloyd Pique * initiate drag-and-drop session
2413*84e872a0SLloyd Pique *
2414*84e872a0SLloyd Pique * This event is sent when an active drag-and-drop pointer enters
2415*84e872a0SLloyd Pique * a surface owned by the client. The position of the pointer at
2416*84e872a0SLloyd Pique * enter time is provided by the x and y arguments, in
2417*84e872a0SLloyd Pique * surface-local coordinates.
2418*84e872a0SLloyd Pique * @param serial serial number of the enter event
2419*84e872a0SLloyd Pique * @param surface client surface entered
2420*84e872a0SLloyd Pique * @param x surface-local x coordinate
2421*84e872a0SLloyd Pique * @param y surface-local y coordinate
2422*84e872a0SLloyd Pique * @param id source data_offer object
2423*84e872a0SLloyd Pique */
2424*84e872a0SLloyd Pique void (*enter)(void *data,
2425*84e872a0SLloyd Pique struct wl_data_device *wl_data_device,
2426*84e872a0SLloyd Pique uint32_t serial,
2427*84e872a0SLloyd Pique struct wl_surface *surface,
2428*84e872a0SLloyd Pique wl_fixed_t x,
2429*84e872a0SLloyd Pique wl_fixed_t y,
2430*84e872a0SLloyd Pique struct wl_data_offer *id);
2431*84e872a0SLloyd Pique /**
2432*84e872a0SLloyd Pique * end drag-and-drop session
2433*84e872a0SLloyd Pique *
2434*84e872a0SLloyd Pique * This event is sent when the drag-and-drop pointer leaves the
2435*84e872a0SLloyd Pique * surface and the session ends. The client must destroy the
2436*84e872a0SLloyd Pique * wl_data_offer introduced at enter time at this point.
2437*84e872a0SLloyd Pique */
2438*84e872a0SLloyd Pique void (*leave)(void *data,
2439*84e872a0SLloyd Pique struct wl_data_device *wl_data_device);
2440*84e872a0SLloyd Pique /**
2441*84e872a0SLloyd Pique * drag-and-drop session motion
2442*84e872a0SLloyd Pique *
2443*84e872a0SLloyd Pique * This event is sent when the drag-and-drop pointer moves within
2444*84e872a0SLloyd Pique * the currently focused surface. The new position of the pointer
2445*84e872a0SLloyd Pique * is provided by the x and y arguments, in surface-local
2446*84e872a0SLloyd Pique * coordinates.
2447*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
2448*84e872a0SLloyd Pique * @param x surface-local x coordinate
2449*84e872a0SLloyd Pique * @param y surface-local y coordinate
2450*84e872a0SLloyd Pique */
2451*84e872a0SLloyd Pique void (*motion)(void *data,
2452*84e872a0SLloyd Pique struct wl_data_device *wl_data_device,
2453*84e872a0SLloyd Pique uint32_t time,
2454*84e872a0SLloyd Pique wl_fixed_t x,
2455*84e872a0SLloyd Pique wl_fixed_t y);
2456*84e872a0SLloyd Pique /**
2457*84e872a0SLloyd Pique * end drag-and-drop session successfully
2458*84e872a0SLloyd Pique *
2459*84e872a0SLloyd Pique * The event is sent when a drag-and-drop operation is ended
2460*84e872a0SLloyd Pique * because the implicit grab is removed.
2461*84e872a0SLloyd Pique *
2462*84e872a0SLloyd Pique * The drag-and-drop destination is expected to honor the last
2463*84e872a0SLloyd Pique * action received through wl_data_offer.action, if the resulting
2464*84e872a0SLloyd Pique * action is "copy" or "move", the destination can still perform
2465*84e872a0SLloyd Pique * wl_data_offer.receive requests, and is expected to end all
2466*84e872a0SLloyd Pique * transfers with a wl_data_offer.finish request.
2467*84e872a0SLloyd Pique *
2468*84e872a0SLloyd Pique * If the resulting action is "ask", the action will not be
2469*84e872a0SLloyd Pique * considered final. The drag-and-drop destination is expected to
2470*84e872a0SLloyd Pique * perform one last wl_data_offer.set_actions request, or
2471*84e872a0SLloyd Pique * wl_data_offer.destroy in order to cancel the operation.
2472*84e872a0SLloyd Pique */
2473*84e872a0SLloyd Pique void (*drop)(void *data,
2474*84e872a0SLloyd Pique struct wl_data_device *wl_data_device);
2475*84e872a0SLloyd Pique /**
2476*84e872a0SLloyd Pique * advertise new selection
2477*84e872a0SLloyd Pique *
2478*84e872a0SLloyd Pique * The selection event is sent out to notify the client of a new
2479*84e872a0SLloyd Pique * wl_data_offer for the selection for this device. The
2480*84e872a0SLloyd Pique * data_device.data_offer and the data_offer.offer events are sent
2481*84e872a0SLloyd Pique * out immediately before this event to introduce the data offer
2482*84e872a0SLloyd Pique * object. The selection event is sent to a client immediately
2483*84e872a0SLloyd Pique * before receiving keyboard focus and when a new selection is set
2484*84e872a0SLloyd Pique * while the client has keyboard focus. The data_offer is valid
2485*84e872a0SLloyd Pique * until a new data_offer or NULL is received or until the client
2486*84e872a0SLloyd Pique * loses keyboard focus. The client must destroy the previous
2487*84e872a0SLloyd Pique * selection data_offer, if any, upon receiving this event.
2488*84e872a0SLloyd Pique * @param id selection data_offer object
2489*84e872a0SLloyd Pique */
2490*84e872a0SLloyd Pique void (*selection)(void *data,
2491*84e872a0SLloyd Pique struct wl_data_device *wl_data_device,
2492*84e872a0SLloyd Pique struct wl_data_offer *id);
2493*84e872a0SLloyd Pique };
2494*84e872a0SLloyd Pique
2495*84e872a0SLloyd Pique /**
2496*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2497*84e872a0SLloyd Pique */
2498*84e872a0SLloyd Pique static inline int
wl_data_device_add_listener(struct wl_data_device * wl_data_device,const struct wl_data_device_listener * listener,void * data)2499*84e872a0SLloyd Pique wl_data_device_add_listener(struct wl_data_device *wl_data_device,
2500*84e872a0SLloyd Pique const struct wl_data_device_listener *listener, void *data)
2501*84e872a0SLloyd Pique {
2502*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_data_device,
2503*84e872a0SLloyd Pique (void (**)(void)) listener, data);
2504*84e872a0SLloyd Pique }
2505*84e872a0SLloyd Pique
2506*84e872a0SLloyd Pique #define WL_DATA_DEVICE_START_DRAG 0
2507*84e872a0SLloyd Pique #define WL_DATA_DEVICE_SET_SELECTION 1
2508*84e872a0SLloyd Pique #define WL_DATA_DEVICE_RELEASE 2
2509*84e872a0SLloyd Pique
2510*84e872a0SLloyd Pique /**
2511*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2512*84e872a0SLloyd Pique */
2513*84e872a0SLloyd Pique #define WL_DATA_DEVICE_DATA_OFFER_SINCE_VERSION 1
2514*84e872a0SLloyd Pique /**
2515*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2516*84e872a0SLloyd Pique */
2517*84e872a0SLloyd Pique #define WL_DATA_DEVICE_ENTER_SINCE_VERSION 1
2518*84e872a0SLloyd Pique /**
2519*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2520*84e872a0SLloyd Pique */
2521*84e872a0SLloyd Pique #define WL_DATA_DEVICE_LEAVE_SINCE_VERSION 1
2522*84e872a0SLloyd Pique /**
2523*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2524*84e872a0SLloyd Pique */
2525*84e872a0SLloyd Pique #define WL_DATA_DEVICE_MOTION_SINCE_VERSION 1
2526*84e872a0SLloyd Pique /**
2527*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2528*84e872a0SLloyd Pique */
2529*84e872a0SLloyd Pique #define WL_DATA_DEVICE_DROP_SINCE_VERSION 1
2530*84e872a0SLloyd Pique /**
2531*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2532*84e872a0SLloyd Pique */
2533*84e872a0SLloyd Pique #define WL_DATA_DEVICE_SELECTION_SINCE_VERSION 1
2534*84e872a0SLloyd Pique
2535*84e872a0SLloyd Pique /**
2536*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2537*84e872a0SLloyd Pique */
2538*84e872a0SLloyd Pique #define WL_DATA_DEVICE_START_DRAG_SINCE_VERSION 1
2539*84e872a0SLloyd Pique /**
2540*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2541*84e872a0SLloyd Pique */
2542*84e872a0SLloyd Pique #define WL_DATA_DEVICE_SET_SELECTION_SINCE_VERSION 1
2543*84e872a0SLloyd Pique /**
2544*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2545*84e872a0SLloyd Pique */
2546*84e872a0SLloyd Pique #define WL_DATA_DEVICE_RELEASE_SINCE_VERSION 2
2547*84e872a0SLloyd Pique
2548*84e872a0SLloyd Pique /** @ingroup iface_wl_data_device */
2549*84e872a0SLloyd Pique static inline void
wl_data_device_set_user_data(struct wl_data_device * wl_data_device,void * user_data)2550*84e872a0SLloyd Pique wl_data_device_set_user_data(struct wl_data_device *wl_data_device, void *user_data)
2551*84e872a0SLloyd Pique {
2552*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_data_device, user_data);
2553*84e872a0SLloyd Pique }
2554*84e872a0SLloyd Pique
2555*84e872a0SLloyd Pique /** @ingroup iface_wl_data_device */
2556*84e872a0SLloyd Pique static inline void *
wl_data_device_get_user_data(struct wl_data_device * wl_data_device)2557*84e872a0SLloyd Pique wl_data_device_get_user_data(struct wl_data_device *wl_data_device)
2558*84e872a0SLloyd Pique {
2559*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device);
2560*84e872a0SLloyd Pique }
2561*84e872a0SLloyd Pique
2562*84e872a0SLloyd Pique static inline uint32_t
wl_data_device_get_version(struct wl_data_device * wl_data_device)2563*84e872a0SLloyd Pique wl_data_device_get_version(struct wl_data_device *wl_data_device)
2564*84e872a0SLloyd Pique {
2565*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_data_device);
2566*84e872a0SLloyd Pique }
2567*84e872a0SLloyd Pique
2568*84e872a0SLloyd Pique /** @ingroup iface_wl_data_device */
2569*84e872a0SLloyd Pique static inline void
wl_data_device_destroy(struct wl_data_device * wl_data_device)2570*84e872a0SLloyd Pique wl_data_device_destroy(struct wl_data_device *wl_data_device)
2571*84e872a0SLloyd Pique {
2572*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_data_device);
2573*84e872a0SLloyd Pique }
2574*84e872a0SLloyd Pique
2575*84e872a0SLloyd Pique /**
2576*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2577*84e872a0SLloyd Pique *
2578*84e872a0SLloyd Pique * This request asks the compositor to start a drag-and-drop
2579*84e872a0SLloyd Pique * operation on behalf of the client.
2580*84e872a0SLloyd Pique *
2581*84e872a0SLloyd Pique * The source argument is the data source that provides the data
2582*84e872a0SLloyd Pique * for the eventual data transfer. If source is NULL, enter, leave
2583*84e872a0SLloyd Pique * and motion events are sent only to the client that initiated the
2584*84e872a0SLloyd Pique * drag and the client is expected to handle the data passing
2585*84e872a0SLloyd Pique * internally.
2586*84e872a0SLloyd Pique *
2587*84e872a0SLloyd Pique * The origin surface is the surface where the drag originates and
2588*84e872a0SLloyd Pique * the client must have an active implicit grab that matches the
2589*84e872a0SLloyd Pique * serial.
2590*84e872a0SLloyd Pique *
2591*84e872a0SLloyd Pique * The icon surface is an optional (can be NULL) surface that
2592*84e872a0SLloyd Pique * provides an icon to be moved around with the cursor. Initially,
2593*84e872a0SLloyd Pique * the top-left corner of the icon surface is placed at the cursor
2594*84e872a0SLloyd Pique * hotspot, but subsequent wl_surface.attach request can move the
2595*84e872a0SLloyd Pique * relative position. Attach requests must be confirmed with
2596*84e872a0SLloyd Pique * wl_surface.commit as usual. The icon surface is given the role of
2597*84e872a0SLloyd Pique * a drag-and-drop icon. If the icon surface already has another role,
2598*84e872a0SLloyd Pique * it raises a protocol error.
2599*84e872a0SLloyd Pique *
2600*84e872a0SLloyd Pique * The current and pending input regions of the icon wl_surface are
2601*84e872a0SLloyd Pique * cleared, and wl_surface.set_input_region is ignored until the
2602*84e872a0SLloyd Pique * wl_surface is no longer used as the icon surface. When the use
2603*84e872a0SLloyd Pique * as an icon ends, the current and pending input regions become
2604*84e872a0SLloyd Pique * undefined, and the wl_surface is unmapped.
2605*84e872a0SLloyd Pique */
2606*84e872a0SLloyd Pique static inline void
wl_data_device_start_drag(struct wl_data_device * wl_data_device,struct wl_data_source * source,struct wl_surface * origin,struct wl_surface * icon,uint32_t serial)2607*84e872a0SLloyd Pique wl_data_device_start_drag(struct wl_data_device *wl_data_device, struct wl_data_source *source, struct wl_surface *origin, struct wl_surface *icon, uint32_t serial)
2608*84e872a0SLloyd Pique {
2609*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device,
2610*84e872a0SLloyd Pique WL_DATA_DEVICE_START_DRAG, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_device), 0, source, origin, icon, serial);
2611*84e872a0SLloyd Pique }
2612*84e872a0SLloyd Pique
2613*84e872a0SLloyd Pique /**
2614*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2615*84e872a0SLloyd Pique *
2616*84e872a0SLloyd Pique * This request asks the compositor to set the selection
2617*84e872a0SLloyd Pique * to the data from the source on behalf of the client.
2618*84e872a0SLloyd Pique *
2619*84e872a0SLloyd Pique * To unset the selection, set the source to NULL.
2620*84e872a0SLloyd Pique */
2621*84e872a0SLloyd Pique static inline void
wl_data_device_set_selection(struct wl_data_device * wl_data_device,struct wl_data_source * source,uint32_t serial)2622*84e872a0SLloyd Pique wl_data_device_set_selection(struct wl_data_device *wl_data_device, struct wl_data_source *source, uint32_t serial)
2623*84e872a0SLloyd Pique {
2624*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device,
2625*84e872a0SLloyd Pique WL_DATA_DEVICE_SET_SELECTION, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_device), 0, source, serial);
2626*84e872a0SLloyd Pique }
2627*84e872a0SLloyd Pique
2628*84e872a0SLloyd Pique /**
2629*84e872a0SLloyd Pique * @ingroup iface_wl_data_device
2630*84e872a0SLloyd Pique *
2631*84e872a0SLloyd Pique * This request destroys the data device.
2632*84e872a0SLloyd Pique */
2633*84e872a0SLloyd Pique static inline void
wl_data_device_release(struct wl_data_device * wl_data_device)2634*84e872a0SLloyd Pique wl_data_device_release(struct wl_data_device *wl_data_device)
2635*84e872a0SLloyd Pique {
2636*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device,
2637*84e872a0SLloyd Pique WL_DATA_DEVICE_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_device), WL_MARSHAL_FLAG_DESTROY);
2638*84e872a0SLloyd Pique }
2639*84e872a0SLloyd Pique
2640*84e872a0SLloyd Pique #ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
2641*84e872a0SLloyd Pique #define WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
2642*84e872a0SLloyd Pique /**
2643*84e872a0SLloyd Pique * @ingroup iface_wl_data_device_manager
2644*84e872a0SLloyd Pique * drag and drop actions
2645*84e872a0SLloyd Pique *
2646*84e872a0SLloyd Pique * This is a bitmask of the available/preferred actions in a
2647*84e872a0SLloyd Pique * drag-and-drop operation.
2648*84e872a0SLloyd Pique *
2649*84e872a0SLloyd Pique * In the compositor, the selected action is a result of matching the
2650*84e872a0SLloyd Pique * actions offered by the source and destination sides. "action" events
2651*84e872a0SLloyd Pique * with a "none" action will be sent to both source and destination if
2652*84e872a0SLloyd Pique * there is no match. All further checks will effectively happen on
2653*84e872a0SLloyd Pique * (source actions ∩ destination actions).
2654*84e872a0SLloyd Pique *
2655*84e872a0SLloyd Pique * In addition, compositors may also pick different actions in
2656*84e872a0SLloyd Pique * reaction to key modifiers being pressed. One common design that
2657*84e872a0SLloyd Pique * is used in major toolkits (and the behavior recommended for
2658*84e872a0SLloyd Pique * compositors) is:
2659*84e872a0SLloyd Pique *
2660*84e872a0SLloyd Pique * - If no modifiers are pressed, the first match (in bit order)
2661*84e872a0SLloyd Pique * will be used.
2662*84e872a0SLloyd Pique * - Pressing Shift selects "move", if enabled in the mask.
2663*84e872a0SLloyd Pique * - Pressing Control selects "copy", if enabled in the mask.
2664*84e872a0SLloyd Pique *
2665*84e872a0SLloyd Pique * Behavior beyond that is considered implementation-dependent.
2666*84e872a0SLloyd Pique * Compositors may for example bind other modifiers (like Alt/Meta)
2667*84e872a0SLloyd Pique * or drags initiated with other buttons than BTN_LEFT to specific
2668*84e872a0SLloyd Pique * actions (e.g. "ask").
2669*84e872a0SLloyd Pique */
2670*84e872a0SLloyd Pique enum wl_data_device_manager_dnd_action {
2671*84e872a0SLloyd Pique /**
2672*84e872a0SLloyd Pique * no action
2673*84e872a0SLloyd Pique */
2674*84e872a0SLloyd Pique WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE = 0,
2675*84e872a0SLloyd Pique /**
2676*84e872a0SLloyd Pique * copy action
2677*84e872a0SLloyd Pique */
2678*84e872a0SLloyd Pique WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY = 1,
2679*84e872a0SLloyd Pique /**
2680*84e872a0SLloyd Pique * move action
2681*84e872a0SLloyd Pique */
2682*84e872a0SLloyd Pique WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE = 2,
2683*84e872a0SLloyd Pique /**
2684*84e872a0SLloyd Pique * ask action
2685*84e872a0SLloyd Pique */
2686*84e872a0SLloyd Pique WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK = 4,
2687*84e872a0SLloyd Pique };
2688*84e872a0SLloyd Pique #endif /* WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM */
2689*84e872a0SLloyd Pique
2690*84e872a0SLloyd Pique #define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE 0
2691*84e872a0SLloyd Pique #define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE 1
2692*84e872a0SLloyd Pique
2693*84e872a0SLloyd Pique
2694*84e872a0SLloyd Pique /**
2695*84e872a0SLloyd Pique * @ingroup iface_wl_data_device_manager
2696*84e872a0SLloyd Pique */
2697*84e872a0SLloyd Pique #define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE_SINCE_VERSION 1
2698*84e872a0SLloyd Pique /**
2699*84e872a0SLloyd Pique * @ingroup iface_wl_data_device_manager
2700*84e872a0SLloyd Pique */
2701*84e872a0SLloyd Pique #define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE_SINCE_VERSION 1
2702*84e872a0SLloyd Pique
2703*84e872a0SLloyd Pique /** @ingroup iface_wl_data_device_manager */
2704*84e872a0SLloyd Pique static inline void
wl_data_device_manager_set_user_data(struct wl_data_device_manager * wl_data_device_manager,void * user_data)2705*84e872a0SLloyd Pique wl_data_device_manager_set_user_data(struct wl_data_device_manager *wl_data_device_manager, void *user_data)
2706*84e872a0SLloyd Pique {
2707*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_data_device_manager, user_data);
2708*84e872a0SLloyd Pique }
2709*84e872a0SLloyd Pique
2710*84e872a0SLloyd Pique /** @ingroup iface_wl_data_device_manager */
2711*84e872a0SLloyd Pique static inline void *
wl_data_device_manager_get_user_data(struct wl_data_device_manager * wl_data_device_manager)2712*84e872a0SLloyd Pique wl_data_device_manager_get_user_data(struct wl_data_device_manager *wl_data_device_manager)
2713*84e872a0SLloyd Pique {
2714*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device_manager);
2715*84e872a0SLloyd Pique }
2716*84e872a0SLloyd Pique
2717*84e872a0SLloyd Pique static inline uint32_t
wl_data_device_manager_get_version(struct wl_data_device_manager * wl_data_device_manager)2718*84e872a0SLloyd Pique wl_data_device_manager_get_version(struct wl_data_device_manager *wl_data_device_manager)
2719*84e872a0SLloyd Pique {
2720*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_data_device_manager);
2721*84e872a0SLloyd Pique }
2722*84e872a0SLloyd Pique
2723*84e872a0SLloyd Pique /** @ingroup iface_wl_data_device_manager */
2724*84e872a0SLloyd Pique static inline void
wl_data_device_manager_destroy(struct wl_data_device_manager * wl_data_device_manager)2725*84e872a0SLloyd Pique wl_data_device_manager_destroy(struct wl_data_device_manager *wl_data_device_manager)
2726*84e872a0SLloyd Pique {
2727*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_data_device_manager);
2728*84e872a0SLloyd Pique }
2729*84e872a0SLloyd Pique
2730*84e872a0SLloyd Pique /**
2731*84e872a0SLloyd Pique * @ingroup iface_wl_data_device_manager
2732*84e872a0SLloyd Pique *
2733*84e872a0SLloyd Pique * Create a new data source.
2734*84e872a0SLloyd Pique */
2735*84e872a0SLloyd Pique static inline struct wl_data_source *
wl_data_device_manager_create_data_source(struct wl_data_device_manager * wl_data_device_manager)2736*84e872a0SLloyd Pique wl_data_device_manager_create_data_source(struct wl_data_device_manager *wl_data_device_manager)
2737*84e872a0SLloyd Pique {
2738*84e872a0SLloyd Pique struct wl_proxy *id;
2739*84e872a0SLloyd Pique
2740*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device_manager,
2741*84e872a0SLloyd Pique WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE, &wl_data_source_interface, wl_proxy_get_version((struct wl_proxy *) wl_data_device_manager), 0, NULL);
2742*84e872a0SLloyd Pique
2743*84e872a0SLloyd Pique return (struct wl_data_source *) id;
2744*84e872a0SLloyd Pique }
2745*84e872a0SLloyd Pique
2746*84e872a0SLloyd Pique /**
2747*84e872a0SLloyd Pique * @ingroup iface_wl_data_device_manager
2748*84e872a0SLloyd Pique *
2749*84e872a0SLloyd Pique * Create a new data device for a given seat.
2750*84e872a0SLloyd Pique */
2751*84e872a0SLloyd Pique static inline struct wl_data_device *
wl_data_device_manager_get_data_device(struct wl_data_device_manager * wl_data_device_manager,struct wl_seat * seat)2752*84e872a0SLloyd Pique wl_data_device_manager_get_data_device(struct wl_data_device_manager *wl_data_device_manager, struct wl_seat *seat)
2753*84e872a0SLloyd Pique {
2754*84e872a0SLloyd Pique struct wl_proxy *id;
2755*84e872a0SLloyd Pique
2756*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device_manager,
2757*84e872a0SLloyd Pique WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE, &wl_data_device_interface, wl_proxy_get_version((struct wl_proxy *) wl_data_device_manager), 0, NULL, seat);
2758*84e872a0SLloyd Pique
2759*84e872a0SLloyd Pique return (struct wl_data_device *) id;
2760*84e872a0SLloyd Pique }
2761*84e872a0SLloyd Pique
2762*84e872a0SLloyd Pique #ifndef WL_SHELL_ERROR_ENUM
2763*84e872a0SLloyd Pique #define WL_SHELL_ERROR_ENUM
2764*84e872a0SLloyd Pique enum wl_shell_error {
2765*84e872a0SLloyd Pique /**
2766*84e872a0SLloyd Pique * given wl_surface has another role
2767*84e872a0SLloyd Pique */
2768*84e872a0SLloyd Pique WL_SHELL_ERROR_ROLE = 0,
2769*84e872a0SLloyd Pique };
2770*84e872a0SLloyd Pique #endif /* WL_SHELL_ERROR_ENUM */
2771*84e872a0SLloyd Pique
2772*84e872a0SLloyd Pique #define WL_SHELL_GET_SHELL_SURFACE 0
2773*84e872a0SLloyd Pique
2774*84e872a0SLloyd Pique
2775*84e872a0SLloyd Pique /**
2776*84e872a0SLloyd Pique * @ingroup iface_wl_shell
2777*84e872a0SLloyd Pique */
2778*84e872a0SLloyd Pique #define WL_SHELL_GET_SHELL_SURFACE_SINCE_VERSION 1
2779*84e872a0SLloyd Pique
2780*84e872a0SLloyd Pique /** @ingroup iface_wl_shell */
2781*84e872a0SLloyd Pique static inline void
wl_shell_set_user_data(struct wl_shell * wl_shell,void * user_data)2782*84e872a0SLloyd Pique wl_shell_set_user_data(struct wl_shell *wl_shell, void *user_data)
2783*84e872a0SLloyd Pique {
2784*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_shell, user_data);
2785*84e872a0SLloyd Pique }
2786*84e872a0SLloyd Pique
2787*84e872a0SLloyd Pique /** @ingroup iface_wl_shell */
2788*84e872a0SLloyd Pique static inline void *
wl_shell_get_user_data(struct wl_shell * wl_shell)2789*84e872a0SLloyd Pique wl_shell_get_user_data(struct wl_shell *wl_shell)
2790*84e872a0SLloyd Pique {
2791*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_shell);
2792*84e872a0SLloyd Pique }
2793*84e872a0SLloyd Pique
2794*84e872a0SLloyd Pique static inline uint32_t
wl_shell_get_version(struct wl_shell * wl_shell)2795*84e872a0SLloyd Pique wl_shell_get_version(struct wl_shell *wl_shell)
2796*84e872a0SLloyd Pique {
2797*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_shell);
2798*84e872a0SLloyd Pique }
2799*84e872a0SLloyd Pique
2800*84e872a0SLloyd Pique /** @ingroup iface_wl_shell */
2801*84e872a0SLloyd Pique static inline void
wl_shell_destroy(struct wl_shell * wl_shell)2802*84e872a0SLloyd Pique wl_shell_destroy(struct wl_shell *wl_shell)
2803*84e872a0SLloyd Pique {
2804*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_shell);
2805*84e872a0SLloyd Pique }
2806*84e872a0SLloyd Pique
2807*84e872a0SLloyd Pique /**
2808*84e872a0SLloyd Pique * @ingroup iface_wl_shell
2809*84e872a0SLloyd Pique *
2810*84e872a0SLloyd Pique * Create a shell surface for an existing surface. This gives
2811*84e872a0SLloyd Pique * the wl_surface the role of a shell surface. If the wl_surface
2812*84e872a0SLloyd Pique * already has another role, it raises a protocol error.
2813*84e872a0SLloyd Pique *
2814*84e872a0SLloyd Pique * Only one shell surface can be associated with a given surface.
2815*84e872a0SLloyd Pique */
2816*84e872a0SLloyd Pique static inline struct wl_shell_surface *
wl_shell_get_shell_surface(struct wl_shell * wl_shell,struct wl_surface * surface)2817*84e872a0SLloyd Pique wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
2818*84e872a0SLloyd Pique {
2819*84e872a0SLloyd Pique struct wl_proxy *id;
2820*84e872a0SLloyd Pique
2821*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_shell,
2822*84e872a0SLloyd Pique WL_SHELL_GET_SHELL_SURFACE, &wl_shell_surface_interface, wl_proxy_get_version((struct wl_proxy *) wl_shell), 0, NULL, surface);
2823*84e872a0SLloyd Pique
2824*84e872a0SLloyd Pique return (struct wl_shell_surface *) id;
2825*84e872a0SLloyd Pique }
2826*84e872a0SLloyd Pique
2827*84e872a0SLloyd Pique #ifndef WL_SHELL_SURFACE_RESIZE_ENUM
2828*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_RESIZE_ENUM
2829*84e872a0SLloyd Pique /**
2830*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
2831*84e872a0SLloyd Pique * edge values for resizing
2832*84e872a0SLloyd Pique *
2833*84e872a0SLloyd Pique * These values are used to indicate which edge of a surface
2834*84e872a0SLloyd Pique * is being dragged in a resize operation. The server may
2835*84e872a0SLloyd Pique * use this information to adapt its behavior, e.g. choose
2836*84e872a0SLloyd Pique * an appropriate cursor image.
2837*84e872a0SLloyd Pique */
2838*84e872a0SLloyd Pique enum wl_shell_surface_resize {
2839*84e872a0SLloyd Pique /**
2840*84e872a0SLloyd Pique * no edge
2841*84e872a0SLloyd Pique */
2842*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_NONE = 0,
2843*84e872a0SLloyd Pique /**
2844*84e872a0SLloyd Pique * top edge
2845*84e872a0SLloyd Pique */
2846*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_TOP = 1,
2847*84e872a0SLloyd Pique /**
2848*84e872a0SLloyd Pique * bottom edge
2849*84e872a0SLloyd Pique */
2850*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_BOTTOM = 2,
2851*84e872a0SLloyd Pique /**
2852*84e872a0SLloyd Pique * left edge
2853*84e872a0SLloyd Pique */
2854*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_LEFT = 4,
2855*84e872a0SLloyd Pique /**
2856*84e872a0SLloyd Pique * top and left edges
2857*84e872a0SLloyd Pique */
2858*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5,
2859*84e872a0SLloyd Pique /**
2860*84e872a0SLloyd Pique * bottom and left edges
2861*84e872a0SLloyd Pique */
2862*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6,
2863*84e872a0SLloyd Pique /**
2864*84e872a0SLloyd Pique * right edge
2865*84e872a0SLloyd Pique */
2866*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_RIGHT = 8,
2867*84e872a0SLloyd Pique /**
2868*84e872a0SLloyd Pique * top and right edges
2869*84e872a0SLloyd Pique */
2870*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9,
2871*84e872a0SLloyd Pique /**
2872*84e872a0SLloyd Pique * bottom and right edges
2873*84e872a0SLloyd Pique */
2874*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10,
2875*84e872a0SLloyd Pique };
2876*84e872a0SLloyd Pique #endif /* WL_SHELL_SURFACE_RESIZE_ENUM */
2877*84e872a0SLloyd Pique
2878*84e872a0SLloyd Pique #ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM
2879*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_TRANSIENT_ENUM
2880*84e872a0SLloyd Pique /**
2881*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
2882*84e872a0SLloyd Pique * details of transient behaviour
2883*84e872a0SLloyd Pique *
2884*84e872a0SLloyd Pique * These flags specify details of the expected behaviour
2885*84e872a0SLloyd Pique * of transient surfaces. Used in the set_transient request.
2886*84e872a0SLloyd Pique */
2887*84e872a0SLloyd Pique enum wl_shell_surface_transient {
2888*84e872a0SLloyd Pique /**
2889*84e872a0SLloyd Pique * do not set keyboard focus
2890*84e872a0SLloyd Pique */
2891*84e872a0SLloyd Pique WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1,
2892*84e872a0SLloyd Pique };
2893*84e872a0SLloyd Pique #endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */
2894*84e872a0SLloyd Pique
2895*84e872a0SLloyd Pique #ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
2896*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
2897*84e872a0SLloyd Pique /**
2898*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
2899*84e872a0SLloyd Pique * different method to set the surface fullscreen
2900*84e872a0SLloyd Pique *
2901*84e872a0SLloyd Pique * Hints to indicate to the compositor how to deal with a conflict
2902*84e872a0SLloyd Pique * between the dimensions of the surface and the dimensions of the
2903*84e872a0SLloyd Pique * output. The compositor is free to ignore this parameter.
2904*84e872a0SLloyd Pique */
2905*84e872a0SLloyd Pique enum wl_shell_surface_fullscreen_method {
2906*84e872a0SLloyd Pique /**
2907*84e872a0SLloyd Pique * no preference, apply default policy
2908*84e872a0SLloyd Pique */
2909*84e872a0SLloyd Pique WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0,
2910*84e872a0SLloyd Pique /**
2911*84e872a0SLloyd Pique * scale, preserve the surface's aspect ratio and center on output
2912*84e872a0SLloyd Pique */
2913*84e872a0SLloyd Pique WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1,
2914*84e872a0SLloyd Pique /**
2915*84e872a0SLloyd Pique * switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch
2916*84e872a0SLloyd Pique */
2917*84e872a0SLloyd Pique WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2,
2918*84e872a0SLloyd Pique /**
2919*84e872a0SLloyd Pique * no upscaling, center on output and add black borders to compensate size mismatch
2920*84e872a0SLloyd Pique */
2921*84e872a0SLloyd Pique WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3,
2922*84e872a0SLloyd Pique };
2923*84e872a0SLloyd Pique #endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */
2924*84e872a0SLloyd Pique
2925*84e872a0SLloyd Pique /**
2926*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
2927*84e872a0SLloyd Pique * @struct wl_shell_surface_listener
2928*84e872a0SLloyd Pique */
2929*84e872a0SLloyd Pique struct wl_shell_surface_listener {
2930*84e872a0SLloyd Pique /**
2931*84e872a0SLloyd Pique * ping client
2932*84e872a0SLloyd Pique *
2933*84e872a0SLloyd Pique * Ping a client to check if it is receiving events and sending
2934*84e872a0SLloyd Pique * requests. A client is expected to reply with a pong request.
2935*84e872a0SLloyd Pique * @param serial serial number of the ping
2936*84e872a0SLloyd Pique */
2937*84e872a0SLloyd Pique void (*ping)(void *data,
2938*84e872a0SLloyd Pique struct wl_shell_surface *wl_shell_surface,
2939*84e872a0SLloyd Pique uint32_t serial);
2940*84e872a0SLloyd Pique /**
2941*84e872a0SLloyd Pique * suggest resize
2942*84e872a0SLloyd Pique *
2943*84e872a0SLloyd Pique * The configure event asks the client to resize its surface.
2944*84e872a0SLloyd Pique *
2945*84e872a0SLloyd Pique * The size is a hint, in the sense that the client is free to
2946*84e872a0SLloyd Pique * ignore it if it doesn't resize, pick a smaller size (to satisfy
2947*84e872a0SLloyd Pique * aspect ratio or resize in steps of NxM pixels).
2948*84e872a0SLloyd Pique *
2949*84e872a0SLloyd Pique * The edges parameter provides a hint about how the surface was
2950*84e872a0SLloyd Pique * resized. The client may use this information to decide how to
2951*84e872a0SLloyd Pique * adjust its content to the new size (e.g. a scrolling area might
2952*84e872a0SLloyd Pique * adjust its content position to leave the viewable content
2953*84e872a0SLloyd Pique * unmoved).
2954*84e872a0SLloyd Pique *
2955*84e872a0SLloyd Pique * The client is free to dismiss all but the last configure event
2956*84e872a0SLloyd Pique * it received.
2957*84e872a0SLloyd Pique *
2958*84e872a0SLloyd Pique * The width and height arguments specify the size of the window in
2959*84e872a0SLloyd Pique * surface-local coordinates.
2960*84e872a0SLloyd Pique * @param edges how the surface was resized
2961*84e872a0SLloyd Pique * @param width new width of the surface
2962*84e872a0SLloyd Pique * @param height new height of the surface
2963*84e872a0SLloyd Pique */
2964*84e872a0SLloyd Pique void (*configure)(void *data,
2965*84e872a0SLloyd Pique struct wl_shell_surface *wl_shell_surface,
2966*84e872a0SLloyd Pique uint32_t edges,
2967*84e872a0SLloyd Pique int32_t width,
2968*84e872a0SLloyd Pique int32_t height);
2969*84e872a0SLloyd Pique /**
2970*84e872a0SLloyd Pique * popup interaction is done
2971*84e872a0SLloyd Pique *
2972*84e872a0SLloyd Pique * The popup_done event is sent out when a popup grab is broken,
2973*84e872a0SLloyd Pique * that is, when the user clicks a surface that doesn't belong to
2974*84e872a0SLloyd Pique * the client owning the popup surface.
2975*84e872a0SLloyd Pique */
2976*84e872a0SLloyd Pique void (*popup_done)(void *data,
2977*84e872a0SLloyd Pique struct wl_shell_surface *wl_shell_surface);
2978*84e872a0SLloyd Pique };
2979*84e872a0SLloyd Pique
2980*84e872a0SLloyd Pique /**
2981*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
2982*84e872a0SLloyd Pique */
2983*84e872a0SLloyd Pique static inline int
wl_shell_surface_add_listener(struct wl_shell_surface * wl_shell_surface,const struct wl_shell_surface_listener * listener,void * data)2984*84e872a0SLloyd Pique wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface,
2985*84e872a0SLloyd Pique const struct wl_shell_surface_listener *listener, void *data)
2986*84e872a0SLloyd Pique {
2987*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_shell_surface,
2988*84e872a0SLloyd Pique (void (**)(void)) listener, data);
2989*84e872a0SLloyd Pique }
2990*84e872a0SLloyd Pique
2991*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_PONG 0
2992*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_MOVE 1
2993*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_RESIZE 2
2994*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_TOPLEVEL 3
2995*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_TRANSIENT 4
2996*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_FULLSCREEN 5
2997*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_POPUP 6
2998*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_MAXIMIZED 7
2999*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_TITLE 8
3000*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_CLASS 9
3001*84e872a0SLloyd Pique
3002*84e872a0SLloyd Pique /**
3003*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3004*84e872a0SLloyd Pique */
3005*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_PING_SINCE_VERSION 1
3006*84e872a0SLloyd Pique /**
3007*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3008*84e872a0SLloyd Pique */
3009*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION 1
3010*84e872a0SLloyd Pique /**
3011*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3012*84e872a0SLloyd Pique */
3013*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION 1
3014*84e872a0SLloyd Pique
3015*84e872a0SLloyd Pique /**
3016*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3017*84e872a0SLloyd Pique */
3018*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_PONG_SINCE_VERSION 1
3019*84e872a0SLloyd Pique /**
3020*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3021*84e872a0SLloyd Pique */
3022*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_MOVE_SINCE_VERSION 1
3023*84e872a0SLloyd Pique /**
3024*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3025*84e872a0SLloyd Pique */
3026*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_RESIZE_SINCE_VERSION 1
3027*84e872a0SLloyd Pique /**
3028*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3029*84e872a0SLloyd Pique */
3030*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_TOPLEVEL_SINCE_VERSION 1
3031*84e872a0SLloyd Pique /**
3032*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3033*84e872a0SLloyd Pique */
3034*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_TRANSIENT_SINCE_VERSION 1
3035*84e872a0SLloyd Pique /**
3036*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3037*84e872a0SLloyd Pique */
3038*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1
3039*84e872a0SLloyd Pique /**
3040*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3041*84e872a0SLloyd Pique */
3042*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_POPUP_SINCE_VERSION 1
3043*84e872a0SLloyd Pique /**
3044*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3045*84e872a0SLloyd Pique */
3046*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1
3047*84e872a0SLloyd Pique /**
3048*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3049*84e872a0SLloyd Pique */
3050*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_TITLE_SINCE_VERSION 1
3051*84e872a0SLloyd Pique /**
3052*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3053*84e872a0SLloyd Pique */
3054*84e872a0SLloyd Pique #define WL_SHELL_SURFACE_SET_CLASS_SINCE_VERSION 1
3055*84e872a0SLloyd Pique
3056*84e872a0SLloyd Pique /** @ingroup iface_wl_shell_surface */
3057*84e872a0SLloyd Pique static inline void
wl_shell_surface_set_user_data(struct wl_shell_surface * wl_shell_surface,void * user_data)3058*84e872a0SLloyd Pique wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_data)
3059*84e872a0SLloyd Pique {
3060*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_shell_surface, user_data);
3061*84e872a0SLloyd Pique }
3062*84e872a0SLloyd Pique
3063*84e872a0SLloyd Pique /** @ingroup iface_wl_shell_surface */
3064*84e872a0SLloyd Pique static inline void *
wl_shell_surface_get_user_data(struct wl_shell_surface * wl_shell_surface)3065*84e872a0SLloyd Pique wl_shell_surface_get_user_data(struct wl_shell_surface *wl_shell_surface)
3066*84e872a0SLloyd Pique {
3067*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_shell_surface);
3068*84e872a0SLloyd Pique }
3069*84e872a0SLloyd Pique
3070*84e872a0SLloyd Pique static inline uint32_t
wl_shell_surface_get_version(struct wl_shell_surface * wl_shell_surface)3071*84e872a0SLloyd Pique wl_shell_surface_get_version(struct wl_shell_surface *wl_shell_surface)
3072*84e872a0SLloyd Pique {
3073*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_shell_surface);
3074*84e872a0SLloyd Pique }
3075*84e872a0SLloyd Pique
3076*84e872a0SLloyd Pique /** @ingroup iface_wl_shell_surface */
3077*84e872a0SLloyd Pique static inline void
wl_shell_surface_destroy(struct wl_shell_surface * wl_shell_surface)3078*84e872a0SLloyd Pique wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
3079*84e872a0SLloyd Pique {
3080*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_shell_surface);
3081*84e872a0SLloyd Pique }
3082*84e872a0SLloyd Pique
3083*84e872a0SLloyd Pique /**
3084*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3085*84e872a0SLloyd Pique *
3086*84e872a0SLloyd Pique * A client must respond to a ping event with a pong request or
3087*84e872a0SLloyd Pique * the client may be deemed unresponsive.
3088*84e872a0SLloyd Pique */
3089*84e872a0SLloyd Pique static inline void
wl_shell_surface_pong(struct wl_shell_surface * wl_shell_surface,uint32_t serial)3090*84e872a0SLloyd Pique wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
3091*84e872a0SLloyd Pique {
3092*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3093*84e872a0SLloyd Pique WL_SHELL_SURFACE_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, serial);
3094*84e872a0SLloyd Pique }
3095*84e872a0SLloyd Pique
3096*84e872a0SLloyd Pique /**
3097*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3098*84e872a0SLloyd Pique *
3099*84e872a0SLloyd Pique * Start a pointer-driven move of the surface.
3100*84e872a0SLloyd Pique *
3101*84e872a0SLloyd Pique * This request must be used in response to a button press event.
3102*84e872a0SLloyd Pique * The server may ignore move requests depending on the state of
3103*84e872a0SLloyd Pique * the surface (e.g. fullscreen or maximized).
3104*84e872a0SLloyd Pique */
3105*84e872a0SLloyd Pique static inline void
wl_shell_surface_move(struct wl_shell_surface * wl_shell_surface,struct wl_seat * seat,uint32_t serial)3106*84e872a0SLloyd Pique wl_shell_surface_move(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial)
3107*84e872a0SLloyd Pique {
3108*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3109*84e872a0SLloyd Pique WL_SHELL_SURFACE_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial);
3110*84e872a0SLloyd Pique }
3111*84e872a0SLloyd Pique
3112*84e872a0SLloyd Pique /**
3113*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3114*84e872a0SLloyd Pique *
3115*84e872a0SLloyd Pique * Start a pointer-driven resizing of the surface.
3116*84e872a0SLloyd Pique *
3117*84e872a0SLloyd Pique * This request must be used in response to a button press event.
3118*84e872a0SLloyd Pique * The server may ignore resize requests depending on the state of
3119*84e872a0SLloyd Pique * the surface (e.g. fullscreen or maximized).
3120*84e872a0SLloyd Pique */
3121*84e872a0SLloyd Pique static inline void
wl_shell_surface_resize(struct wl_shell_surface * wl_shell_surface,struct wl_seat * seat,uint32_t serial,uint32_t edges)3122*84e872a0SLloyd Pique wl_shell_surface_resize(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
3123*84e872a0SLloyd Pique {
3124*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3125*84e872a0SLloyd Pique WL_SHELL_SURFACE_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial, edges);
3126*84e872a0SLloyd Pique }
3127*84e872a0SLloyd Pique
3128*84e872a0SLloyd Pique /**
3129*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3130*84e872a0SLloyd Pique *
3131*84e872a0SLloyd Pique * Map the surface as a toplevel surface.
3132*84e872a0SLloyd Pique *
3133*84e872a0SLloyd Pique * A toplevel surface is not fullscreen, maximized or transient.
3134*84e872a0SLloyd Pique */
3135*84e872a0SLloyd Pique static inline void
wl_shell_surface_set_toplevel(struct wl_shell_surface * wl_shell_surface)3136*84e872a0SLloyd Pique wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
3137*84e872a0SLloyd Pique {
3138*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3139*84e872a0SLloyd Pique WL_SHELL_SURFACE_SET_TOPLEVEL, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0);
3140*84e872a0SLloyd Pique }
3141*84e872a0SLloyd Pique
3142*84e872a0SLloyd Pique /**
3143*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3144*84e872a0SLloyd Pique *
3145*84e872a0SLloyd Pique * Map the surface relative to an existing surface.
3146*84e872a0SLloyd Pique *
3147*84e872a0SLloyd Pique * The x and y arguments specify the location of the upper left
3148*84e872a0SLloyd Pique * corner of the surface relative to the upper left corner of the
3149*84e872a0SLloyd Pique * parent surface, in surface-local coordinates.
3150*84e872a0SLloyd Pique *
3151*84e872a0SLloyd Pique * The flags argument controls details of the transient behaviour.
3152*84e872a0SLloyd Pique */
3153*84e872a0SLloyd Pique static inline void
wl_shell_surface_set_transient(struct wl_shell_surface * wl_shell_surface,struct wl_surface * parent,int32_t x,int32_t y,uint32_t flags)3154*84e872a0SLloyd Pique wl_shell_surface_set_transient(struct wl_shell_surface *wl_shell_surface, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
3155*84e872a0SLloyd Pique {
3156*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3157*84e872a0SLloyd Pique WL_SHELL_SURFACE_SET_TRANSIENT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, parent, x, y, flags);
3158*84e872a0SLloyd Pique }
3159*84e872a0SLloyd Pique
3160*84e872a0SLloyd Pique /**
3161*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3162*84e872a0SLloyd Pique *
3163*84e872a0SLloyd Pique * Map the surface as a fullscreen surface.
3164*84e872a0SLloyd Pique *
3165*84e872a0SLloyd Pique * If an output parameter is given then the surface will be made
3166*84e872a0SLloyd Pique * fullscreen on that output. If the client does not specify the
3167*84e872a0SLloyd Pique * output then the compositor will apply its policy - usually
3168*84e872a0SLloyd Pique * choosing the output on which the surface has the biggest surface
3169*84e872a0SLloyd Pique * area.
3170*84e872a0SLloyd Pique *
3171*84e872a0SLloyd Pique * The client may specify a method to resolve a size conflict
3172*84e872a0SLloyd Pique * between the output size and the surface size - this is provided
3173*84e872a0SLloyd Pique * through the method parameter.
3174*84e872a0SLloyd Pique *
3175*84e872a0SLloyd Pique * The framerate parameter is used only when the method is set
3176*84e872a0SLloyd Pique * to "driver", to indicate the preferred framerate. A value of 0
3177*84e872a0SLloyd Pique * indicates that the client does not care about framerate. The
3178*84e872a0SLloyd Pique * framerate is specified in mHz, that is framerate of 60000 is 60Hz.
3179*84e872a0SLloyd Pique *
3180*84e872a0SLloyd Pique * A method of "scale" or "driver" implies a scaling operation of
3181*84e872a0SLloyd Pique * the surface, either via a direct scaling operation or a change of
3182*84e872a0SLloyd Pique * the output mode. This will override any kind of output scaling, so
3183*84e872a0SLloyd Pique * that mapping a surface with a buffer size equal to the mode can
3184*84e872a0SLloyd Pique * fill the screen independent of buffer_scale.
3185*84e872a0SLloyd Pique *
3186*84e872a0SLloyd Pique * A method of "fill" means we don't scale up the buffer, however
3187*84e872a0SLloyd Pique * any output scale is applied. This means that you may run into
3188*84e872a0SLloyd Pique * an edge case where the application maps a buffer with the same
3189*84e872a0SLloyd Pique * size of the output mode but buffer_scale 1 (thus making a
3190*84e872a0SLloyd Pique * surface larger than the output). In this case it is allowed to
3191*84e872a0SLloyd Pique * downscale the results to fit the screen.
3192*84e872a0SLloyd Pique *
3193*84e872a0SLloyd Pique * The compositor must reply to this request with a configure event
3194*84e872a0SLloyd Pique * with the dimensions for the output on which the surface will
3195*84e872a0SLloyd Pique * be made fullscreen.
3196*84e872a0SLloyd Pique */
3197*84e872a0SLloyd Pique static inline void
wl_shell_surface_set_fullscreen(struct wl_shell_surface * wl_shell_surface,uint32_t method,uint32_t framerate,struct wl_output * output)3198*84e872a0SLloyd Pique wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
3199*84e872a0SLloyd Pique {
3200*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3201*84e872a0SLloyd Pique WL_SHELL_SURFACE_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, method, framerate, output);
3202*84e872a0SLloyd Pique }
3203*84e872a0SLloyd Pique
3204*84e872a0SLloyd Pique /**
3205*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3206*84e872a0SLloyd Pique *
3207*84e872a0SLloyd Pique * Map the surface as a popup.
3208*84e872a0SLloyd Pique *
3209*84e872a0SLloyd Pique * A popup surface is a transient surface with an added pointer
3210*84e872a0SLloyd Pique * grab.
3211*84e872a0SLloyd Pique *
3212*84e872a0SLloyd Pique * An existing implicit grab will be changed to owner-events mode,
3213*84e872a0SLloyd Pique * and the popup grab will continue after the implicit grab ends
3214*84e872a0SLloyd Pique * (i.e. releasing the mouse button does not cause the popup to
3215*84e872a0SLloyd Pique * be unmapped).
3216*84e872a0SLloyd Pique *
3217*84e872a0SLloyd Pique * The popup grab continues until the window is destroyed or a
3218*84e872a0SLloyd Pique * mouse button is pressed in any other client's window. A click
3219*84e872a0SLloyd Pique * in any of the client's surfaces is reported as normal, however,
3220*84e872a0SLloyd Pique * clicks in other clients' surfaces will be discarded and trigger
3221*84e872a0SLloyd Pique * the callback.
3222*84e872a0SLloyd Pique *
3223*84e872a0SLloyd Pique * The x and y arguments specify the location of the upper left
3224*84e872a0SLloyd Pique * corner of the surface relative to the upper left corner of the
3225*84e872a0SLloyd Pique * parent surface, in surface-local coordinates.
3226*84e872a0SLloyd Pique */
3227*84e872a0SLloyd Pique static inline void
wl_shell_surface_set_popup(struct wl_shell_surface * wl_shell_surface,struct wl_seat * seat,uint32_t serial,struct wl_surface * parent,int32_t x,int32_t y,uint32_t flags)3228*84e872a0SLloyd Pique wl_shell_surface_set_popup(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
3229*84e872a0SLloyd Pique {
3230*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3231*84e872a0SLloyd Pique WL_SHELL_SURFACE_SET_POPUP, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial, parent, x, y, flags);
3232*84e872a0SLloyd Pique }
3233*84e872a0SLloyd Pique
3234*84e872a0SLloyd Pique /**
3235*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3236*84e872a0SLloyd Pique *
3237*84e872a0SLloyd Pique * Map the surface as a maximized surface.
3238*84e872a0SLloyd Pique *
3239*84e872a0SLloyd Pique * If an output parameter is given then the surface will be
3240*84e872a0SLloyd Pique * maximized on that output. If the client does not specify the
3241*84e872a0SLloyd Pique * output then the compositor will apply its policy - usually
3242*84e872a0SLloyd Pique * choosing the output on which the surface has the biggest surface
3243*84e872a0SLloyd Pique * area.
3244*84e872a0SLloyd Pique *
3245*84e872a0SLloyd Pique * The compositor will reply with a configure event telling
3246*84e872a0SLloyd Pique * the expected new surface size. The operation is completed
3247*84e872a0SLloyd Pique * on the next buffer attach to this surface.
3248*84e872a0SLloyd Pique *
3249*84e872a0SLloyd Pique * A maximized surface typically fills the entire output it is
3250*84e872a0SLloyd Pique * bound to, except for desktop elements such as panels. This is
3251*84e872a0SLloyd Pique * the main difference between a maximized shell surface and a
3252*84e872a0SLloyd Pique * fullscreen shell surface.
3253*84e872a0SLloyd Pique *
3254*84e872a0SLloyd Pique * The details depend on the compositor implementation.
3255*84e872a0SLloyd Pique */
3256*84e872a0SLloyd Pique static inline void
wl_shell_surface_set_maximized(struct wl_shell_surface * wl_shell_surface,struct wl_output * output)3257*84e872a0SLloyd Pique wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
3258*84e872a0SLloyd Pique {
3259*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3260*84e872a0SLloyd Pique WL_SHELL_SURFACE_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, output);
3261*84e872a0SLloyd Pique }
3262*84e872a0SLloyd Pique
3263*84e872a0SLloyd Pique /**
3264*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3265*84e872a0SLloyd Pique *
3266*84e872a0SLloyd Pique * Set a short title for the surface.
3267*84e872a0SLloyd Pique *
3268*84e872a0SLloyd Pique * This string may be used to identify the surface in a task bar,
3269*84e872a0SLloyd Pique * window list, or other user interface elements provided by the
3270*84e872a0SLloyd Pique * compositor.
3271*84e872a0SLloyd Pique *
3272*84e872a0SLloyd Pique * The string must be encoded in UTF-8.
3273*84e872a0SLloyd Pique */
3274*84e872a0SLloyd Pique static inline void
wl_shell_surface_set_title(struct wl_shell_surface * wl_shell_surface,const char * title)3275*84e872a0SLloyd Pique wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
3276*84e872a0SLloyd Pique {
3277*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3278*84e872a0SLloyd Pique WL_SHELL_SURFACE_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, title);
3279*84e872a0SLloyd Pique }
3280*84e872a0SLloyd Pique
3281*84e872a0SLloyd Pique /**
3282*84e872a0SLloyd Pique * @ingroup iface_wl_shell_surface
3283*84e872a0SLloyd Pique *
3284*84e872a0SLloyd Pique * Set a class for the surface.
3285*84e872a0SLloyd Pique *
3286*84e872a0SLloyd Pique * The surface class identifies the general class of applications
3287*84e872a0SLloyd Pique * to which the surface belongs. A common convention is to use the
3288*84e872a0SLloyd Pique * file name (or the full path if it is a non-standard location) of
3289*84e872a0SLloyd Pique * the application's .desktop file as the class.
3290*84e872a0SLloyd Pique */
3291*84e872a0SLloyd Pique static inline void
wl_shell_surface_set_class(struct wl_shell_surface * wl_shell_surface,const char * class_)3292*84e872a0SLloyd Pique wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
3293*84e872a0SLloyd Pique {
3294*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
3295*84e872a0SLloyd Pique WL_SHELL_SURFACE_SET_CLASS, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, class_);
3296*84e872a0SLloyd Pique }
3297*84e872a0SLloyd Pique
3298*84e872a0SLloyd Pique #ifndef WL_SURFACE_ERROR_ENUM
3299*84e872a0SLloyd Pique #define WL_SURFACE_ERROR_ENUM
3300*84e872a0SLloyd Pique /**
3301*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3302*84e872a0SLloyd Pique * wl_surface error values
3303*84e872a0SLloyd Pique *
3304*84e872a0SLloyd Pique * These errors can be emitted in response to wl_surface requests.
3305*84e872a0SLloyd Pique */
3306*84e872a0SLloyd Pique enum wl_surface_error {
3307*84e872a0SLloyd Pique /**
3308*84e872a0SLloyd Pique * buffer scale value is invalid
3309*84e872a0SLloyd Pique */
3310*84e872a0SLloyd Pique WL_SURFACE_ERROR_INVALID_SCALE = 0,
3311*84e872a0SLloyd Pique /**
3312*84e872a0SLloyd Pique * buffer transform value is invalid
3313*84e872a0SLloyd Pique */
3314*84e872a0SLloyd Pique WL_SURFACE_ERROR_INVALID_TRANSFORM = 1,
3315*84e872a0SLloyd Pique };
3316*84e872a0SLloyd Pique #endif /* WL_SURFACE_ERROR_ENUM */
3317*84e872a0SLloyd Pique
3318*84e872a0SLloyd Pique /**
3319*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3320*84e872a0SLloyd Pique * @struct wl_surface_listener
3321*84e872a0SLloyd Pique */
3322*84e872a0SLloyd Pique struct wl_surface_listener {
3323*84e872a0SLloyd Pique /**
3324*84e872a0SLloyd Pique * surface enters an output
3325*84e872a0SLloyd Pique *
3326*84e872a0SLloyd Pique * This is emitted whenever a surface's creation, movement, or
3327*84e872a0SLloyd Pique * resizing results in some part of it being within the scanout
3328*84e872a0SLloyd Pique * region of an output.
3329*84e872a0SLloyd Pique *
3330*84e872a0SLloyd Pique * Note that a surface may be overlapping with zero or more
3331*84e872a0SLloyd Pique * outputs.
3332*84e872a0SLloyd Pique * @param output output entered by the surface
3333*84e872a0SLloyd Pique */
3334*84e872a0SLloyd Pique void (*enter)(void *data,
3335*84e872a0SLloyd Pique struct wl_surface *wl_surface,
3336*84e872a0SLloyd Pique struct wl_output *output);
3337*84e872a0SLloyd Pique /**
3338*84e872a0SLloyd Pique * surface leaves an output
3339*84e872a0SLloyd Pique *
3340*84e872a0SLloyd Pique * This is emitted whenever a surface's creation, movement, or
3341*84e872a0SLloyd Pique * resizing results in it no longer having any part of it within
3342*84e872a0SLloyd Pique * the scanout region of an output.
3343*84e872a0SLloyd Pique * @param output output left by the surface
3344*84e872a0SLloyd Pique */
3345*84e872a0SLloyd Pique void (*leave)(void *data,
3346*84e872a0SLloyd Pique struct wl_surface *wl_surface,
3347*84e872a0SLloyd Pique struct wl_output *output);
3348*84e872a0SLloyd Pique };
3349*84e872a0SLloyd Pique
3350*84e872a0SLloyd Pique /**
3351*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3352*84e872a0SLloyd Pique */
3353*84e872a0SLloyd Pique static inline int
wl_surface_add_listener(struct wl_surface * wl_surface,const struct wl_surface_listener * listener,void * data)3354*84e872a0SLloyd Pique wl_surface_add_listener(struct wl_surface *wl_surface,
3355*84e872a0SLloyd Pique const struct wl_surface_listener *listener, void *data)
3356*84e872a0SLloyd Pique {
3357*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_surface,
3358*84e872a0SLloyd Pique (void (**)(void)) listener, data);
3359*84e872a0SLloyd Pique }
3360*84e872a0SLloyd Pique
3361*84e872a0SLloyd Pique #define WL_SURFACE_DESTROY 0
3362*84e872a0SLloyd Pique #define WL_SURFACE_ATTACH 1
3363*84e872a0SLloyd Pique #define WL_SURFACE_DAMAGE 2
3364*84e872a0SLloyd Pique #define WL_SURFACE_FRAME 3
3365*84e872a0SLloyd Pique #define WL_SURFACE_SET_OPAQUE_REGION 4
3366*84e872a0SLloyd Pique #define WL_SURFACE_SET_INPUT_REGION 5
3367*84e872a0SLloyd Pique #define WL_SURFACE_COMMIT 6
3368*84e872a0SLloyd Pique #define WL_SURFACE_SET_BUFFER_TRANSFORM 7
3369*84e872a0SLloyd Pique #define WL_SURFACE_SET_BUFFER_SCALE 8
3370*84e872a0SLloyd Pique #define WL_SURFACE_DAMAGE_BUFFER 9
3371*84e872a0SLloyd Pique
3372*84e872a0SLloyd Pique /**
3373*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3374*84e872a0SLloyd Pique */
3375*84e872a0SLloyd Pique #define WL_SURFACE_ENTER_SINCE_VERSION 1
3376*84e872a0SLloyd Pique /**
3377*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3378*84e872a0SLloyd Pique */
3379*84e872a0SLloyd Pique #define WL_SURFACE_LEAVE_SINCE_VERSION 1
3380*84e872a0SLloyd Pique
3381*84e872a0SLloyd Pique /**
3382*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3383*84e872a0SLloyd Pique */
3384*84e872a0SLloyd Pique #define WL_SURFACE_DESTROY_SINCE_VERSION 1
3385*84e872a0SLloyd Pique /**
3386*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3387*84e872a0SLloyd Pique */
3388*84e872a0SLloyd Pique #define WL_SURFACE_ATTACH_SINCE_VERSION 1
3389*84e872a0SLloyd Pique /**
3390*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3391*84e872a0SLloyd Pique */
3392*84e872a0SLloyd Pique #define WL_SURFACE_DAMAGE_SINCE_VERSION 1
3393*84e872a0SLloyd Pique /**
3394*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3395*84e872a0SLloyd Pique */
3396*84e872a0SLloyd Pique #define WL_SURFACE_FRAME_SINCE_VERSION 1
3397*84e872a0SLloyd Pique /**
3398*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3399*84e872a0SLloyd Pique */
3400*84e872a0SLloyd Pique #define WL_SURFACE_SET_OPAQUE_REGION_SINCE_VERSION 1
3401*84e872a0SLloyd Pique /**
3402*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3403*84e872a0SLloyd Pique */
3404*84e872a0SLloyd Pique #define WL_SURFACE_SET_INPUT_REGION_SINCE_VERSION 1
3405*84e872a0SLloyd Pique /**
3406*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3407*84e872a0SLloyd Pique */
3408*84e872a0SLloyd Pique #define WL_SURFACE_COMMIT_SINCE_VERSION 1
3409*84e872a0SLloyd Pique /**
3410*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3411*84e872a0SLloyd Pique */
3412*84e872a0SLloyd Pique #define WL_SURFACE_SET_BUFFER_TRANSFORM_SINCE_VERSION 2
3413*84e872a0SLloyd Pique /**
3414*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3415*84e872a0SLloyd Pique */
3416*84e872a0SLloyd Pique #define WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION 3
3417*84e872a0SLloyd Pique /**
3418*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3419*84e872a0SLloyd Pique */
3420*84e872a0SLloyd Pique #define WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION 4
3421*84e872a0SLloyd Pique
3422*84e872a0SLloyd Pique /** @ingroup iface_wl_surface */
3423*84e872a0SLloyd Pique static inline void
wl_surface_set_user_data(struct wl_surface * wl_surface,void * user_data)3424*84e872a0SLloyd Pique wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data)
3425*84e872a0SLloyd Pique {
3426*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_surface, user_data);
3427*84e872a0SLloyd Pique }
3428*84e872a0SLloyd Pique
3429*84e872a0SLloyd Pique /** @ingroup iface_wl_surface */
3430*84e872a0SLloyd Pique static inline void *
wl_surface_get_user_data(struct wl_surface * wl_surface)3431*84e872a0SLloyd Pique wl_surface_get_user_data(struct wl_surface *wl_surface)
3432*84e872a0SLloyd Pique {
3433*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_surface);
3434*84e872a0SLloyd Pique }
3435*84e872a0SLloyd Pique
3436*84e872a0SLloyd Pique static inline uint32_t
wl_surface_get_version(struct wl_surface * wl_surface)3437*84e872a0SLloyd Pique wl_surface_get_version(struct wl_surface *wl_surface)
3438*84e872a0SLloyd Pique {
3439*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_surface);
3440*84e872a0SLloyd Pique }
3441*84e872a0SLloyd Pique
3442*84e872a0SLloyd Pique /**
3443*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3444*84e872a0SLloyd Pique *
3445*84e872a0SLloyd Pique * Deletes the surface and invalidates its object ID.
3446*84e872a0SLloyd Pique */
3447*84e872a0SLloyd Pique static inline void
wl_surface_destroy(struct wl_surface * wl_surface)3448*84e872a0SLloyd Pique wl_surface_destroy(struct wl_surface *wl_surface)
3449*84e872a0SLloyd Pique {
3450*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3451*84e872a0SLloyd Pique WL_SURFACE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), WL_MARSHAL_FLAG_DESTROY);
3452*84e872a0SLloyd Pique }
3453*84e872a0SLloyd Pique
3454*84e872a0SLloyd Pique /**
3455*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3456*84e872a0SLloyd Pique *
3457*84e872a0SLloyd Pique * Set a buffer as the content of this surface.
3458*84e872a0SLloyd Pique *
3459*84e872a0SLloyd Pique * The new size of the surface is calculated based on the buffer
3460*84e872a0SLloyd Pique * size transformed by the inverse buffer_transform and the
3461*84e872a0SLloyd Pique * inverse buffer_scale. This means that the supplied buffer
3462*84e872a0SLloyd Pique * must be an integer multiple of the buffer_scale.
3463*84e872a0SLloyd Pique *
3464*84e872a0SLloyd Pique * The x and y arguments specify the location of the new pending
3465*84e872a0SLloyd Pique * buffer's upper left corner, relative to the current buffer's upper
3466*84e872a0SLloyd Pique * left corner, in surface-local coordinates. In other words, the
3467*84e872a0SLloyd Pique * x and y, combined with the new surface size define in which
3468*84e872a0SLloyd Pique * directions the surface's size changes.
3469*84e872a0SLloyd Pique *
3470*84e872a0SLloyd Pique * Surface contents are double-buffered state, see wl_surface.commit.
3471*84e872a0SLloyd Pique *
3472*84e872a0SLloyd Pique * The initial surface contents are void; there is no content.
3473*84e872a0SLloyd Pique * wl_surface.attach assigns the given wl_buffer as the pending
3474*84e872a0SLloyd Pique * wl_buffer. wl_surface.commit makes the pending wl_buffer the new
3475*84e872a0SLloyd Pique * surface contents, and the size of the surface becomes the size
3476*84e872a0SLloyd Pique * calculated from the wl_buffer, as described above. After commit,
3477*84e872a0SLloyd Pique * there is no pending buffer until the next attach.
3478*84e872a0SLloyd Pique *
3479*84e872a0SLloyd Pique * Committing a pending wl_buffer allows the compositor to read the
3480*84e872a0SLloyd Pique * pixels in the wl_buffer. The compositor may access the pixels at
3481*84e872a0SLloyd Pique * any time after the wl_surface.commit request. When the compositor
3482*84e872a0SLloyd Pique * will not access the pixels anymore, it will send the
3483*84e872a0SLloyd Pique * wl_buffer.release event. Only after receiving wl_buffer.release,
3484*84e872a0SLloyd Pique * the client may reuse the wl_buffer. A wl_buffer that has been
3485*84e872a0SLloyd Pique * attached and then replaced by another attach instead of committed
3486*84e872a0SLloyd Pique * will not receive a release event, and is not used by the
3487*84e872a0SLloyd Pique * compositor.
3488*84e872a0SLloyd Pique *
3489*84e872a0SLloyd Pique * Destroying the wl_buffer after wl_buffer.release does not change
3490*84e872a0SLloyd Pique * the surface contents. However, if the client destroys the
3491*84e872a0SLloyd Pique * wl_buffer before receiving the wl_buffer.release event, the surface
3492*84e872a0SLloyd Pique * contents become undefined immediately.
3493*84e872a0SLloyd Pique *
3494*84e872a0SLloyd Pique * If wl_surface.attach is sent with a NULL wl_buffer, the
3495*84e872a0SLloyd Pique * following wl_surface.commit will remove the surface content.
3496*84e872a0SLloyd Pique */
3497*84e872a0SLloyd Pique static inline void
wl_surface_attach(struct wl_surface * wl_surface,struct wl_buffer * buffer,int32_t x,int32_t y)3498*84e872a0SLloyd Pique wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int32_t x, int32_t y)
3499*84e872a0SLloyd Pique {
3500*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3501*84e872a0SLloyd Pique WL_SURFACE_ATTACH, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, buffer, x, y);
3502*84e872a0SLloyd Pique }
3503*84e872a0SLloyd Pique
3504*84e872a0SLloyd Pique /**
3505*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3506*84e872a0SLloyd Pique *
3507*84e872a0SLloyd Pique * This request is used to describe the regions where the pending
3508*84e872a0SLloyd Pique * buffer is different from the current surface contents, and where
3509*84e872a0SLloyd Pique * the surface therefore needs to be repainted. The compositor
3510*84e872a0SLloyd Pique * ignores the parts of the damage that fall outside of the surface.
3511*84e872a0SLloyd Pique *
3512*84e872a0SLloyd Pique * Damage is double-buffered state, see wl_surface.commit.
3513*84e872a0SLloyd Pique *
3514*84e872a0SLloyd Pique * The damage rectangle is specified in surface-local coordinates,
3515*84e872a0SLloyd Pique * where x and y specify the upper left corner of the damage rectangle.
3516*84e872a0SLloyd Pique *
3517*84e872a0SLloyd Pique * The initial value for pending damage is empty: no damage.
3518*84e872a0SLloyd Pique * wl_surface.damage adds pending damage: the new pending damage
3519*84e872a0SLloyd Pique * is the union of old pending damage and the given rectangle.
3520*84e872a0SLloyd Pique *
3521*84e872a0SLloyd Pique * wl_surface.commit assigns pending damage as the current damage,
3522*84e872a0SLloyd Pique * and clears pending damage. The server will clear the current
3523*84e872a0SLloyd Pique * damage as it repaints the surface.
3524*84e872a0SLloyd Pique *
3525*84e872a0SLloyd Pique * Alternatively, damage can be posted with wl_surface.damage_buffer
3526*84e872a0SLloyd Pique * which uses buffer coordinates instead of surface coordinates,
3527*84e872a0SLloyd Pique * and is probably the preferred and intuitive way of doing this.
3528*84e872a0SLloyd Pique */
3529*84e872a0SLloyd Pique static inline void
wl_surface_damage(struct wl_surface * wl_surface,int32_t x,int32_t y,int32_t width,int32_t height)3530*84e872a0SLloyd Pique wl_surface_damage(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
3531*84e872a0SLloyd Pique {
3532*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3533*84e872a0SLloyd Pique WL_SURFACE_DAMAGE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, x, y, width, height);
3534*84e872a0SLloyd Pique }
3535*84e872a0SLloyd Pique
3536*84e872a0SLloyd Pique /**
3537*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3538*84e872a0SLloyd Pique *
3539*84e872a0SLloyd Pique * Request a notification when it is a good time to start drawing a new
3540*84e872a0SLloyd Pique * frame, by creating a frame callback. This is useful for throttling
3541*84e872a0SLloyd Pique * redrawing operations, and driving animations.
3542*84e872a0SLloyd Pique *
3543*84e872a0SLloyd Pique * When a client is animating on a wl_surface, it can use the 'frame'
3544*84e872a0SLloyd Pique * request to get notified when it is a good time to draw and commit the
3545*84e872a0SLloyd Pique * next frame of animation. If the client commits an update earlier than
3546*84e872a0SLloyd Pique * that, it is likely that some updates will not make it to the display,
3547*84e872a0SLloyd Pique * and the client is wasting resources by drawing too often.
3548*84e872a0SLloyd Pique *
3549*84e872a0SLloyd Pique * The frame request will take effect on the next wl_surface.commit.
3550*84e872a0SLloyd Pique * The notification will only be posted for one frame unless
3551*84e872a0SLloyd Pique * requested again. For a wl_surface, the notifications are posted in
3552*84e872a0SLloyd Pique * the order the frame requests were committed.
3553*84e872a0SLloyd Pique *
3554*84e872a0SLloyd Pique * The server must send the notifications so that a client
3555*84e872a0SLloyd Pique * will not send excessive updates, while still allowing
3556*84e872a0SLloyd Pique * the highest possible update rate for clients that wait for the reply
3557*84e872a0SLloyd Pique * before drawing again. The server should give some time for the client
3558*84e872a0SLloyd Pique * to draw and commit after sending the frame callback events to let it
3559*84e872a0SLloyd Pique * hit the next output refresh.
3560*84e872a0SLloyd Pique *
3561*84e872a0SLloyd Pique * A server should avoid signaling the frame callbacks if the
3562*84e872a0SLloyd Pique * surface is not visible in any way, e.g. the surface is off-screen,
3563*84e872a0SLloyd Pique * or completely obscured by other opaque surfaces.
3564*84e872a0SLloyd Pique *
3565*84e872a0SLloyd Pique * The object returned by this request will be destroyed by the
3566*84e872a0SLloyd Pique * compositor after the callback is fired and as such the client must not
3567*84e872a0SLloyd Pique * attempt to use it after that point.
3568*84e872a0SLloyd Pique *
3569*84e872a0SLloyd Pique * The callback_data passed in the callback is the current time, in
3570*84e872a0SLloyd Pique * milliseconds, with an undefined base.
3571*84e872a0SLloyd Pique */
3572*84e872a0SLloyd Pique static inline struct wl_callback *
wl_surface_frame(struct wl_surface * wl_surface)3573*84e872a0SLloyd Pique wl_surface_frame(struct wl_surface *wl_surface)
3574*84e872a0SLloyd Pique {
3575*84e872a0SLloyd Pique struct wl_proxy *callback;
3576*84e872a0SLloyd Pique
3577*84e872a0SLloyd Pique callback = wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3578*84e872a0SLloyd Pique WL_SURFACE_FRAME, &wl_callback_interface, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, NULL);
3579*84e872a0SLloyd Pique
3580*84e872a0SLloyd Pique return (struct wl_callback *) callback;
3581*84e872a0SLloyd Pique }
3582*84e872a0SLloyd Pique
3583*84e872a0SLloyd Pique /**
3584*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3585*84e872a0SLloyd Pique *
3586*84e872a0SLloyd Pique * This request sets the region of the surface that contains
3587*84e872a0SLloyd Pique * opaque content.
3588*84e872a0SLloyd Pique *
3589*84e872a0SLloyd Pique * The opaque region is an optimization hint for the compositor
3590*84e872a0SLloyd Pique * that lets it optimize the redrawing of content behind opaque
3591*84e872a0SLloyd Pique * regions. Setting an opaque region is not required for correct
3592*84e872a0SLloyd Pique * behaviour, but marking transparent content as opaque will result
3593*84e872a0SLloyd Pique * in repaint artifacts.
3594*84e872a0SLloyd Pique *
3595*84e872a0SLloyd Pique * The opaque region is specified in surface-local coordinates.
3596*84e872a0SLloyd Pique *
3597*84e872a0SLloyd Pique * The compositor ignores the parts of the opaque region that fall
3598*84e872a0SLloyd Pique * outside of the surface.
3599*84e872a0SLloyd Pique *
3600*84e872a0SLloyd Pique * Opaque region is double-buffered state, see wl_surface.commit.
3601*84e872a0SLloyd Pique *
3602*84e872a0SLloyd Pique * wl_surface.set_opaque_region changes the pending opaque region.
3603*84e872a0SLloyd Pique * wl_surface.commit copies the pending region to the current region.
3604*84e872a0SLloyd Pique * Otherwise, the pending and current regions are never changed.
3605*84e872a0SLloyd Pique *
3606*84e872a0SLloyd Pique * The initial value for an opaque region is empty. Setting the pending
3607*84e872a0SLloyd Pique * opaque region has copy semantics, and the wl_region object can be
3608*84e872a0SLloyd Pique * destroyed immediately. A NULL wl_region causes the pending opaque
3609*84e872a0SLloyd Pique * region to be set to empty.
3610*84e872a0SLloyd Pique */
3611*84e872a0SLloyd Pique static inline void
wl_surface_set_opaque_region(struct wl_surface * wl_surface,struct wl_region * region)3612*84e872a0SLloyd Pique wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
3613*84e872a0SLloyd Pique {
3614*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3615*84e872a0SLloyd Pique WL_SURFACE_SET_OPAQUE_REGION, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, region);
3616*84e872a0SLloyd Pique }
3617*84e872a0SLloyd Pique
3618*84e872a0SLloyd Pique /**
3619*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3620*84e872a0SLloyd Pique *
3621*84e872a0SLloyd Pique * This request sets the region of the surface that can receive
3622*84e872a0SLloyd Pique * pointer and touch events.
3623*84e872a0SLloyd Pique *
3624*84e872a0SLloyd Pique * Input events happening outside of this region will try the next
3625*84e872a0SLloyd Pique * surface in the server surface stack. The compositor ignores the
3626*84e872a0SLloyd Pique * parts of the input region that fall outside of the surface.
3627*84e872a0SLloyd Pique *
3628*84e872a0SLloyd Pique * The input region is specified in surface-local coordinates.
3629*84e872a0SLloyd Pique *
3630*84e872a0SLloyd Pique * Input region is double-buffered state, see wl_surface.commit.
3631*84e872a0SLloyd Pique *
3632*84e872a0SLloyd Pique * wl_surface.set_input_region changes the pending input region.
3633*84e872a0SLloyd Pique * wl_surface.commit copies the pending region to the current region.
3634*84e872a0SLloyd Pique * Otherwise the pending and current regions are never changed,
3635*84e872a0SLloyd Pique * except cursor and icon surfaces are special cases, see
3636*84e872a0SLloyd Pique * wl_pointer.set_cursor and wl_data_device.start_drag.
3637*84e872a0SLloyd Pique *
3638*84e872a0SLloyd Pique * The initial value for an input region is infinite. That means the
3639*84e872a0SLloyd Pique * whole surface will accept input. Setting the pending input region
3640*84e872a0SLloyd Pique * has copy semantics, and the wl_region object can be destroyed
3641*84e872a0SLloyd Pique * immediately. A NULL wl_region causes the input region to be set
3642*84e872a0SLloyd Pique * to infinite.
3643*84e872a0SLloyd Pique */
3644*84e872a0SLloyd Pique static inline void
wl_surface_set_input_region(struct wl_surface * wl_surface,struct wl_region * region)3645*84e872a0SLloyd Pique wl_surface_set_input_region(struct wl_surface *wl_surface, struct wl_region *region)
3646*84e872a0SLloyd Pique {
3647*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3648*84e872a0SLloyd Pique WL_SURFACE_SET_INPUT_REGION, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, region);
3649*84e872a0SLloyd Pique }
3650*84e872a0SLloyd Pique
3651*84e872a0SLloyd Pique /**
3652*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3653*84e872a0SLloyd Pique *
3654*84e872a0SLloyd Pique * Surface state (input, opaque, and damage regions, attached buffers,
3655*84e872a0SLloyd Pique * etc.) is double-buffered. Protocol requests modify the pending state,
3656*84e872a0SLloyd Pique * as opposed to the current state in use by the compositor. A commit
3657*84e872a0SLloyd Pique * request atomically applies all pending state, replacing the current
3658*84e872a0SLloyd Pique * state. After commit, the new pending state is as documented for each
3659*84e872a0SLloyd Pique * related request.
3660*84e872a0SLloyd Pique *
3661*84e872a0SLloyd Pique * On commit, a pending wl_buffer is applied first, and all other state
3662*84e872a0SLloyd Pique * second. This means that all coordinates in double-buffered state are
3663*84e872a0SLloyd Pique * relative to the new wl_buffer coming into use, except for
3664*84e872a0SLloyd Pique * wl_surface.attach itself. If there is no pending wl_buffer, the
3665*84e872a0SLloyd Pique * coordinates are relative to the current surface contents.
3666*84e872a0SLloyd Pique *
3667*84e872a0SLloyd Pique * All requests that need a commit to become effective are documented
3668*84e872a0SLloyd Pique * to affect double-buffered state.
3669*84e872a0SLloyd Pique *
3670*84e872a0SLloyd Pique * Other interfaces may add further double-buffered surface state.
3671*84e872a0SLloyd Pique */
3672*84e872a0SLloyd Pique static inline void
wl_surface_commit(struct wl_surface * wl_surface)3673*84e872a0SLloyd Pique wl_surface_commit(struct wl_surface *wl_surface)
3674*84e872a0SLloyd Pique {
3675*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3676*84e872a0SLloyd Pique WL_SURFACE_COMMIT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0);
3677*84e872a0SLloyd Pique }
3678*84e872a0SLloyd Pique
3679*84e872a0SLloyd Pique /**
3680*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3681*84e872a0SLloyd Pique *
3682*84e872a0SLloyd Pique * This request sets an optional transformation on how the compositor
3683*84e872a0SLloyd Pique * interprets the contents of the buffer attached to the surface. The
3684*84e872a0SLloyd Pique * accepted values for the transform parameter are the values for
3685*84e872a0SLloyd Pique * wl_output.transform.
3686*84e872a0SLloyd Pique *
3687*84e872a0SLloyd Pique * Buffer transform is double-buffered state, see wl_surface.commit.
3688*84e872a0SLloyd Pique *
3689*84e872a0SLloyd Pique * A newly created surface has its buffer transformation set to normal.
3690*84e872a0SLloyd Pique *
3691*84e872a0SLloyd Pique * wl_surface.set_buffer_transform changes the pending buffer
3692*84e872a0SLloyd Pique * transformation. wl_surface.commit copies the pending buffer
3693*84e872a0SLloyd Pique * transformation to the current one. Otherwise, the pending and current
3694*84e872a0SLloyd Pique * values are never changed.
3695*84e872a0SLloyd Pique *
3696*84e872a0SLloyd Pique * The purpose of this request is to allow clients to render content
3697*84e872a0SLloyd Pique * according to the output transform, thus permitting the compositor to
3698*84e872a0SLloyd Pique * use certain optimizations even if the display is rotated. Using
3699*84e872a0SLloyd Pique * hardware overlays and scanning out a client buffer for fullscreen
3700*84e872a0SLloyd Pique * surfaces are examples of such optimizations. Those optimizations are
3701*84e872a0SLloyd Pique * highly dependent on the compositor implementation, so the use of this
3702*84e872a0SLloyd Pique * request should be considered on a case-by-case basis.
3703*84e872a0SLloyd Pique *
3704*84e872a0SLloyd Pique * Note that if the transform value includes 90 or 270 degree rotation,
3705*84e872a0SLloyd Pique * the width of the buffer will become the surface height and the height
3706*84e872a0SLloyd Pique * of the buffer will become the surface width.
3707*84e872a0SLloyd Pique *
3708*84e872a0SLloyd Pique * If transform is not one of the values from the
3709*84e872a0SLloyd Pique * wl_output.transform enum the invalid_transform protocol error
3710*84e872a0SLloyd Pique * is raised.
3711*84e872a0SLloyd Pique */
3712*84e872a0SLloyd Pique static inline void
wl_surface_set_buffer_transform(struct wl_surface * wl_surface,int32_t transform)3713*84e872a0SLloyd Pique wl_surface_set_buffer_transform(struct wl_surface *wl_surface, int32_t transform)
3714*84e872a0SLloyd Pique {
3715*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3716*84e872a0SLloyd Pique WL_SURFACE_SET_BUFFER_TRANSFORM, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, transform);
3717*84e872a0SLloyd Pique }
3718*84e872a0SLloyd Pique
3719*84e872a0SLloyd Pique /**
3720*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3721*84e872a0SLloyd Pique *
3722*84e872a0SLloyd Pique * This request sets an optional scaling factor on how the compositor
3723*84e872a0SLloyd Pique * interprets the contents of the buffer attached to the window.
3724*84e872a0SLloyd Pique *
3725*84e872a0SLloyd Pique * Buffer scale is double-buffered state, see wl_surface.commit.
3726*84e872a0SLloyd Pique *
3727*84e872a0SLloyd Pique * A newly created surface has its buffer scale set to 1.
3728*84e872a0SLloyd Pique *
3729*84e872a0SLloyd Pique * wl_surface.set_buffer_scale changes the pending buffer scale.
3730*84e872a0SLloyd Pique * wl_surface.commit copies the pending buffer scale to the current one.
3731*84e872a0SLloyd Pique * Otherwise, the pending and current values are never changed.
3732*84e872a0SLloyd Pique *
3733*84e872a0SLloyd Pique * The purpose of this request is to allow clients to supply higher
3734*84e872a0SLloyd Pique * resolution buffer data for use on high resolution outputs. It is
3735*84e872a0SLloyd Pique * intended that you pick the same buffer scale as the scale of the
3736*84e872a0SLloyd Pique * output that the surface is displayed on. This means the compositor
3737*84e872a0SLloyd Pique * can avoid scaling when rendering the surface on that output.
3738*84e872a0SLloyd Pique *
3739*84e872a0SLloyd Pique * Note that if the scale is larger than 1, then you have to attach
3740*84e872a0SLloyd Pique * a buffer that is larger (by a factor of scale in each dimension)
3741*84e872a0SLloyd Pique * than the desired surface size.
3742*84e872a0SLloyd Pique *
3743*84e872a0SLloyd Pique * If scale is not positive the invalid_scale protocol error is
3744*84e872a0SLloyd Pique * raised.
3745*84e872a0SLloyd Pique */
3746*84e872a0SLloyd Pique static inline void
wl_surface_set_buffer_scale(struct wl_surface * wl_surface,int32_t scale)3747*84e872a0SLloyd Pique wl_surface_set_buffer_scale(struct wl_surface *wl_surface, int32_t scale)
3748*84e872a0SLloyd Pique {
3749*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3750*84e872a0SLloyd Pique WL_SURFACE_SET_BUFFER_SCALE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, scale);
3751*84e872a0SLloyd Pique }
3752*84e872a0SLloyd Pique
3753*84e872a0SLloyd Pique /**
3754*84e872a0SLloyd Pique * @ingroup iface_wl_surface
3755*84e872a0SLloyd Pique *
3756*84e872a0SLloyd Pique * This request is used to describe the regions where the pending
3757*84e872a0SLloyd Pique * buffer is different from the current surface contents, and where
3758*84e872a0SLloyd Pique * the surface therefore needs to be repainted. The compositor
3759*84e872a0SLloyd Pique * ignores the parts of the damage that fall outside of the surface.
3760*84e872a0SLloyd Pique *
3761*84e872a0SLloyd Pique * Damage is double-buffered state, see wl_surface.commit.
3762*84e872a0SLloyd Pique *
3763*84e872a0SLloyd Pique * The damage rectangle is specified in buffer coordinates,
3764*84e872a0SLloyd Pique * where x and y specify the upper left corner of the damage rectangle.
3765*84e872a0SLloyd Pique *
3766*84e872a0SLloyd Pique * The initial value for pending damage is empty: no damage.
3767*84e872a0SLloyd Pique * wl_surface.damage_buffer adds pending damage: the new pending
3768*84e872a0SLloyd Pique * damage is the union of old pending damage and the given rectangle.
3769*84e872a0SLloyd Pique *
3770*84e872a0SLloyd Pique * wl_surface.commit assigns pending damage as the current damage,
3771*84e872a0SLloyd Pique * and clears pending damage. The server will clear the current
3772*84e872a0SLloyd Pique * damage as it repaints the surface.
3773*84e872a0SLloyd Pique *
3774*84e872a0SLloyd Pique * This request differs from wl_surface.damage in only one way - it
3775*84e872a0SLloyd Pique * takes damage in buffer coordinates instead of surface-local
3776*84e872a0SLloyd Pique * coordinates. While this generally is more intuitive than surface
3777*84e872a0SLloyd Pique * coordinates, it is especially desirable when using wp_viewport
3778*84e872a0SLloyd Pique * or when a drawing library (like EGL) is unaware of buffer scale
3779*84e872a0SLloyd Pique * and buffer transform.
3780*84e872a0SLloyd Pique *
3781*84e872a0SLloyd Pique * Note: Because buffer transformation changes and damage requests may
3782*84e872a0SLloyd Pique * be interleaved in the protocol stream, it is impossible to determine
3783*84e872a0SLloyd Pique * the actual mapping between surface and buffer damage until
3784*84e872a0SLloyd Pique * wl_surface.commit time. Therefore, compositors wishing to take both
3785*84e872a0SLloyd Pique * kinds of damage into account will have to accumulate damage from the
3786*84e872a0SLloyd Pique * two requests separately and only transform from one to the other
3787*84e872a0SLloyd Pique * after receiving the wl_surface.commit.
3788*84e872a0SLloyd Pique */
3789*84e872a0SLloyd Pique static inline void
wl_surface_damage_buffer(struct wl_surface * wl_surface,int32_t x,int32_t y,int32_t width,int32_t height)3790*84e872a0SLloyd Pique wl_surface_damage_buffer(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
3791*84e872a0SLloyd Pique {
3792*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
3793*84e872a0SLloyd Pique WL_SURFACE_DAMAGE_BUFFER, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, x, y, width, height);
3794*84e872a0SLloyd Pique }
3795*84e872a0SLloyd Pique
3796*84e872a0SLloyd Pique #ifndef WL_SEAT_CAPABILITY_ENUM
3797*84e872a0SLloyd Pique #define WL_SEAT_CAPABILITY_ENUM
3798*84e872a0SLloyd Pique /**
3799*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3800*84e872a0SLloyd Pique * seat capability bitmask
3801*84e872a0SLloyd Pique *
3802*84e872a0SLloyd Pique * This is a bitmask of capabilities this seat has; if a member is
3803*84e872a0SLloyd Pique * set, then it is present on the seat.
3804*84e872a0SLloyd Pique */
3805*84e872a0SLloyd Pique enum wl_seat_capability {
3806*84e872a0SLloyd Pique /**
3807*84e872a0SLloyd Pique * the seat has pointer devices
3808*84e872a0SLloyd Pique */
3809*84e872a0SLloyd Pique WL_SEAT_CAPABILITY_POINTER = 1,
3810*84e872a0SLloyd Pique /**
3811*84e872a0SLloyd Pique * the seat has one or more keyboards
3812*84e872a0SLloyd Pique */
3813*84e872a0SLloyd Pique WL_SEAT_CAPABILITY_KEYBOARD = 2,
3814*84e872a0SLloyd Pique /**
3815*84e872a0SLloyd Pique * the seat has touch devices
3816*84e872a0SLloyd Pique */
3817*84e872a0SLloyd Pique WL_SEAT_CAPABILITY_TOUCH = 4,
3818*84e872a0SLloyd Pique };
3819*84e872a0SLloyd Pique #endif /* WL_SEAT_CAPABILITY_ENUM */
3820*84e872a0SLloyd Pique
3821*84e872a0SLloyd Pique /**
3822*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3823*84e872a0SLloyd Pique * @struct wl_seat_listener
3824*84e872a0SLloyd Pique */
3825*84e872a0SLloyd Pique struct wl_seat_listener {
3826*84e872a0SLloyd Pique /**
3827*84e872a0SLloyd Pique * seat capabilities changed
3828*84e872a0SLloyd Pique *
3829*84e872a0SLloyd Pique * This is emitted whenever a seat gains or loses the pointer,
3830*84e872a0SLloyd Pique * keyboard or touch capabilities. The argument is a capability
3831*84e872a0SLloyd Pique * enum containing the complete set of capabilities this seat has.
3832*84e872a0SLloyd Pique *
3833*84e872a0SLloyd Pique * When the pointer capability is added, a client may create a
3834*84e872a0SLloyd Pique * wl_pointer object using the wl_seat.get_pointer request. This
3835*84e872a0SLloyd Pique * object will receive pointer events until the capability is
3836*84e872a0SLloyd Pique * removed in the future.
3837*84e872a0SLloyd Pique *
3838*84e872a0SLloyd Pique * When the pointer capability is removed, a client should destroy
3839*84e872a0SLloyd Pique * the wl_pointer objects associated with the seat where the
3840*84e872a0SLloyd Pique * capability was removed, using the wl_pointer.release request. No
3841*84e872a0SLloyd Pique * further pointer events will be received on these objects.
3842*84e872a0SLloyd Pique *
3843*84e872a0SLloyd Pique * In some compositors, if a seat regains the pointer capability
3844*84e872a0SLloyd Pique * and a client has a previously obtained wl_pointer object of
3845*84e872a0SLloyd Pique * version 4 or less, that object may start sending pointer events
3846*84e872a0SLloyd Pique * again. This behavior is considered a misinterpretation of the
3847*84e872a0SLloyd Pique * intended behavior and must not be relied upon by the client.
3848*84e872a0SLloyd Pique * wl_pointer objects of version 5 or later must not send events if
3849*84e872a0SLloyd Pique * created before the most recent event notifying the client of an
3850*84e872a0SLloyd Pique * added pointer capability.
3851*84e872a0SLloyd Pique *
3852*84e872a0SLloyd Pique * The above behavior also applies to wl_keyboard and wl_touch with
3853*84e872a0SLloyd Pique * the keyboard and touch capabilities, respectively.
3854*84e872a0SLloyd Pique * @param capabilities capabilities of the seat
3855*84e872a0SLloyd Pique */
3856*84e872a0SLloyd Pique void (*capabilities)(void *data,
3857*84e872a0SLloyd Pique struct wl_seat *wl_seat,
3858*84e872a0SLloyd Pique uint32_t capabilities);
3859*84e872a0SLloyd Pique /**
3860*84e872a0SLloyd Pique * unique identifier for this seat
3861*84e872a0SLloyd Pique *
3862*84e872a0SLloyd Pique * In a multiseat configuration this can be used by the client to
3863*84e872a0SLloyd Pique * help identify which physical devices the seat represents. Based
3864*84e872a0SLloyd Pique * on the seat configuration used by the compositor.
3865*84e872a0SLloyd Pique * @param name seat identifier
3866*84e872a0SLloyd Pique * @since 2
3867*84e872a0SLloyd Pique */
3868*84e872a0SLloyd Pique void (*name)(void *data,
3869*84e872a0SLloyd Pique struct wl_seat *wl_seat,
3870*84e872a0SLloyd Pique const char *name);
3871*84e872a0SLloyd Pique };
3872*84e872a0SLloyd Pique
3873*84e872a0SLloyd Pique /**
3874*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3875*84e872a0SLloyd Pique */
3876*84e872a0SLloyd Pique static inline int
wl_seat_add_listener(struct wl_seat * wl_seat,const struct wl_seat_listener * listener,void * data)3877*84e872a0SLloyd Pique wl_seat_add_listener(struct wl_seat *wl_seat,
3878*84e872a0SLloyd Pique const struct wl_seat_listener *listener, void *data)
3879*84e872a0SLloyd Pique {
3880*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_seat,
3881*84e872a0SLloyd Pique (void (**)(void)) listener, data);
3882*84e872a0SLloyd Pique }
3883*84e872a0SLloyd Pique
3884*84e872a0SLloyd Pique #define WL_SEAT_GET_POINTER 0
3885*84e872a0SLloyd Pique #define WL_SEAT_GET_KEYBOARD 1
3886*84e872a0SLloyd Pique #define WL_SEAT_GET_TOUCH 2
3887*84e872a0SLloyd Pique #define WL_SEAT_RELEASE 3
3888*84e872a0SLloyd Pique
3889*84e872a0SLloyd Pique /**
3890*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3891*84e872a0SLloyd Pique */
3892*84e872a0SLloyd Pique #define WL_SEAT_CAPABILITIES_SINCE_VERSION 1
3893*84e872a0SLloyd Pique /**
3894*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3895*84e872a0SLloyd Pique */
3896*84e872a0SLloyd Pique #define WL_SEAT_NAME_SINCE_VERSION 2
3897*84e872a0SLloyd Pique
3898*84e872a0SLloyd Pique /**
3899*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3900*84e872a0SLloyd Pique */
3901*84e872a0SLloyd Pique #define WL_SEAT_GET_POINTER_SINCE_VERSION 1
3902*84e872a0SLloyd Pique /**
3903*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3904*84e872a0SLloyd Pique */
3905*84e872a0SLloyd Pique #define WL_SEAT_GET_KEYBOARD_SINCE_VERSION 1
3906*84e872a0SLloyd Pique /**
3907*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3908*84e872a0SLloyd Pique */
3909*84e872a0SLloyd Pique #define WL_SEAT_GET_TOUCH_SINCE_VERSION 1
3910*84e872a0SLloyd Pique /**
3911*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3912*84e872a0SLloyd Pique */
3913*84e872a0SLloyd Pique #define WL_SEAT_RELEASE_SINCE_VERSION 5
3914*84e872a0SLloyd Pique
3915*84e872a0SLloyd Pique /** @ingroup iface_wl_seat */
3916*84e872a0SLloyd Pique static inline void
wl_seat_set_user_data(struct wl_seat * wl_seat,void * user_data)3917*84e872a0SLloyd Pique wl_seat_set_user_data(struct wl_seat *wl_seat, void *user_data)
3918*84e872a0SLloyd Pique {
3919*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_seat, user_data);
3920*84e872a0SLloyd Pique }
3921*84e872a0SLloyd Pique
3922*84e872a0SLloyd Pique /** @ingroup iface_wl_seat */
3923*84e872a0SLloyd Pique static inline void *
wl_seat_get_user_data(struct wl_seat * wl_seat)3924*84e872a0SLloyd Pique wl_seat_get_user_data(struct wl_seat *wl_seat)
3925*84e872a0SLloyd Pique {
3926*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_seat);
3927*84e872a0SLloyd Pique }
3928*84e872a0SLloyd Pique
3929*84e872a0SLloyd Pique static inline uint32_t
wl_seat_get_version(struct wl_seat * wl_seat)3930*84e872a0SLloyd Pique wl_seat_get_version(struct wl_seat *wl_seat)
3931*84e872a0SLloyd Pique {
3932*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_seat);
3933*84e872a0SLloyd Pique }
3934*84e872a0SLloyd Pique
3935*84e872a0SLloyd Pique /** @ingroup iface_wl_seat */
3936*84e872a0SLloyd Pique static inline void
wl_seat_destroy(struct wl_seat * wl_seat)3937*84e872a0SLloyd Pique wl_seat_destroy(struct wl_seat *wl_seat)
3938*84e872a0SLloyd Pique {
3939*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_seat);
3940*84e872a0SLloyd Pique }
3941*84e872a0SLloyd Pique
3942*84e872a0SLloyd Pique /**
3943*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3944*84e872a0SLloyd Pique *
3945*84e872a0SLloyd Pique * The ID provided will be initialized to the wl_pointer interface
3946*84e872a0SLloyd Pique * for this seat.
3947*84e872a0SLloyd Pique *
3948*84e872a0SLloyd Pique * This request only takes effect if the seat has the pointer
3949*84e872a0SLloyd Pique * capability, or has had the pointer capability in the past.
3950*84e872a0SLloyd Pique * It is a protocol violation to issue this request on a seat that has
3951*84e872a0SLloyd Pique * never had the pointer capability.
3952*84e872a0SLloyd Pique */
3953*84e872a0SLloyd Pique static inline struct wl_pointer *
wl_seat_get_pointer(struct wl_seat * wl_seat)3954*84e872a0SLloyd Pique wl_seat_get_pointer(struct wl_seat *wl_seat)
3955*84e872a0SLloyd Pique {
3956*84e872a0SLloyd Pique struct wl_proxy *id;
3957*84e872a0SLloyd Pique
3958*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_seat,
3959*84e872a0SLloyd Pique WL_SEAT_GET_POINTER, &wl_pointer_interface, wl_proxy_get_version((struct wl_proxy *) wl_seat), 0, NULL);
3960*84e872a0SLloyd Pique
3961*84e872a0SLloyd Pique return (struct wl_pointer *) id;
3962*84e872a0SLloyd Pique }
3963*84e872a0SLloyd Pique
3964*84e872a0SLloyd Pique /**
3965*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3966*84e872a0SLloyd Pique *
3967*84e872a0SLloyd Pique * The ID provided will be initialized to the wl_keyboard interface
3968*84e872a0SLloyd Pique * for this seat.
3969*84e872a0SLloyd Pique *
3970*84e872a0SLloyd Pique * This request only takes effect if the seat has the keyboard
3971*84e872a0SLloyd Pique * capability, or has had the keyboard capability in the past.
3972*84e872a0SLloyd Pique * It is a protocol violation to issue this request on a seat that has
3973*84e872a0SLloyd Pique * never had the keyboard capability.
3974*84e872a0SLloyd Pique */
3975*84e872a0SLloyd Pique static inline struct wl_keyboard *
wl_seat_get_keyboard(struct wl_seat * wl_seat)3976*84e872a0SLloyd Pique wl_seat_get_keyboard(struct wl_seat *wl_seat)
3977*84e872a0SLloyd Pique {
3978*84e872a0SLloyd Pique struct wl_proxy *id;
3979*84e872a0SLloyd Pique
3980*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_seat,
3981*84e872a0SLloyd Pique WL_SEAT_GET_KEYBOARD, &wl_keyboard_interface, wl_proxy_get_version((struct wl_proxy *) wl_seat), 0, NULL);
3982*84e872a0SLloyd Pique
3983*84e872a0SLloyd Pique return (struct wl_keyboard *) id;
3984*84e872a0SLloyd Pique }
3985*84e872a0SLloyd Pique
3986*84e872a0SLloyd Pique /**
3987*84e872a0SLloyd Pique * @ingroup iface_wl_seat
3988*84e872a0SLloyd Pique *
3989*84e872a0SLloyd Pique * The ID provided will be initialized to the wl_touch interface
3990*84e872a0SLloyd Pique * for this seat.
3991*84e872a0SLloyd Pique *
3992*84e872a0SLloyd Pique * This request only takes effect if the seat has the touch
3993*84e872a0SLloyd Pique * capability, or has had the touch capability in the past.
3994*84e872a0SLloyd Pique * It is a protocol violation to issue this request on a seat that has
3995*84e872a0SLloyd Pique * never had the touch capability.
3996*84e872a0SLloyd Pique */
3997*84e872a0SLloyd Pique static inline struct wl_touch *
wl_seat_get_touch(struct wl_seat * wl_seat)3998*84e872a0SLloyd Pique wl_seat_get_touch(struct wl_seat *wl_seat)
3999*84e872a0SLloyd Pique {
4000*84e872a0SLloyd Pique struct wl_proxy *id;
4001*84e872a0SLloyd Pique
4002*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_seat,
4003*84e872a0SLloyd Pique WL_SEAT_GET_TOUCH, &wl_touch_interface, wl_proxy_get_version((struct wl_proxy *) wl_seat), 0, NULL);
4004*84e872a0SLloyd Pique
4005*84e872a0SLloyd Pique return (struct wl_touch *) id;
4006*84e872a0SLloyd Pique }
4007*84e872a0SLloyd Pique
4008*84e872a0SLloyd Pique /**
4009*84e872a0SLloyd Pique * @ingroup iface_wl_seat
4010*84e872a0SLloyd Pique *
4011*84e872a0SLloyd Pique * Using this request a client can tell the server that it is not going to
4012*84e872a0SLloyd Pique * use the seat object anymore.
4013*84e872a0SLloyd Pique */
4014*84e872a0SLloyd Pique static inline void
wl_seat_release(struct wl_seat * wl_seat)4015*84e872a0SLloyd Pique wl_seat_release(struct wl_seat *wl_seat)
4016*84e872a0SLloyd Pique {
4017*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_seat,
4018*84e872a0SLloyd Pique WL_SEAT_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_seat), WL_MARSHAL_FLAG_DESTROY);
4019*84e872a0SLloyd Pique }
4020*84e872a0SLloyd Pique
4021*84e872a0SLloyd Pique #ifndef WL_POINTER_ERROR_ENUM
4022*84e872a0SLloyd Pique #define WL_POINTER_ERROR_ENUM
4023*84e872a0SLloyd Pique enum wl_pointer_error {
4024*84e872a0SLloyd Pique /**
4025*84e872a0SLloyd Pique * given wl_surface has another role
4026*84e872a0SLloyd Pique */
4027*84e872a0SLloyd Pique WL_POINTER_ERROR_ROLE = 0,
4028*84e872a0SLloyd Pique };
4029*84e872a0SLloyd Pique #endif /* WL_POINTER_ERROR_ENUM */
4030*84e872a0SLloyd Pique
4031*84e872a0SLloyd Pique #ifndef WL_POINTER_BUTTON_STATE_ENUM
4032*84e872a0SLloyd Pique #define WL_POINTER_BUTTON_STATE_ENUM
4033*84e872a0SLloyd Pique /**
4034*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4035*84e872a0SLloyd Pique * physical button state
4036*84e872a0SLloyd Pique *
4037*84e872a0SLloyd Pique * Describes the physical state of a button that produced the button
4038*84e872a0SLloyd Pique * event.
4039*84e872a0SLloyd Pique */
4040*84e872a0SLloyd Pique enum wl_pointer_button_state {
4041*84e872a0SLloyd Pique /**
4042*84e872a0SLloyd Pique * the button is not pressed
4043*84e872a0SLloyd Pique */
4044*84e872a0SLloyd Pique WL_POINTER_BUTTON_STATE_RELEASED = 0,
4045*84e872a0SLloyd Pique /**
4046*84e872a0SLloyd Pique * the button is pressed
4047*84e872a0SLloyd Pique */
4048*84e872a0SLloyd Pique WL_POINTER_BUTTON_STATE_PRESSED = 1,
4049*84e872a0SLloyd Pique };
4050*84e872a0SLloyd Pique #endif /* WL_POINTER_BUTTON_STATE_ENUM */
4051*84e872a0SLloyd Pique
4052*84e872a0SLloyd Pique #ifndef WL_POINTER_AXIS_ENUM
4053*84e872a0SLloyd Pique #define WL_POINTER_AXIS_ENUM
4054*84e872a0SLloyd Pique /**
4055*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4056*84e872a0SLloyd Pique * axis types
4057*84e872a0SLloyd Pique *
4058*84e872a0SLloyd Pique * Describes the axis types of scroll events.
4059*84e872a0SLloyd Pique */
4060*84e872a0SLloyd Pique enum wl_pointer_axis {
4061*84e872a0SLloyd Pique /**
4062*84e872a0SLloyd Pique * vertical axis
4063*84e872a0SLloyd Pique */
4064*84e872a0SLloyd Pique WL_POINTER_AXIS_VERTICAL_SCROLL = 0,
4065*84e872a0SLloyd Pique /**
4066*84e872a0SLloyd Pique * horizontal axis
4067*84e872a0SLloyd Pique */
4068*84e872a0SLloyd Pique WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1,
4069*84e872a0SLloyd Pique };
4070*84e872a0SLloyd Pique #endif /* WL_POINTER_AXIS_ENUM */
4071*84e872a0SLloyd Pique
4072*84e872a0SLloyd Pique #ifndef WL_POINTER_AXIS_SOURCE_ENUM
4073*84e872a0SLloyd Pique #define WL_POINTER_AXIS_SOURCE_ENUM
4074*84e872a0SLloyd Pique /**
4075*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4076*84e872a0SLloyd Pique * axis source types
4077*84e872a0SLloyd Pique *
4078*84e872a0SLloyd Pique * Describes the source types for axis events. This indicates to the
4079*84e872a0SLloyd Pique * client how an axis event was physically generated; a client may
4080*84e872a0SLloyd Pique * adjust the user interface accordingly. For example, scroll events
4081*84e872a0SLloyd Pique * from a "finger" source may be in a smooth coordinate space with
4082*84e872a0SLloyd Pique * kinetic scrolling whereas a "wheel" source may be in discrete steps
4083*84e872a0SLloyd Pique * of a number of lines.
4084*84e872a0SLloyd Pique */
4085*84e872a0SLloyd Pique enum wl_pointer_axis_source {
4086*84e872a0SLloyd Pique /**
4087*84e872a0SLloyd Pique * a physical wheel rotation
4088*84e872a0SLloyd Pique */
4089*84e872a0SLloyd Pique WL_POINTER_AXIS_SOURCE_WHEEL = 0,
4090*84e872a0SLloyd Pique /**
4091*84e872a0SLloyd Pique * finger on a touch surface
4092*84e872a0SLloyd Pique */
4093*84e872a0SLloyd Pique WL_POINTER_AXIS_SOURCE_FINGER = 1,
4094*84e872a0SLloyd Pique /**
4095*84e872a0SLloyd Pique * continuous coordinate space
4096*84e872a0SLloyd Pique *
4097*84e872a0SLloyd Pique * A device generating events in a continuous coordinate space,
4098*84e872a0SLloyd Pique * but using something other than a finger. One example for this
4099*84e872a0SLloyd Pique * source is button-based scrolling where the vertical motion of a
4100*84e872a0SLloyd Pique * device is converted to scroll events while a button is held
4101*84e872a0SLloyd Pique * down.
4102*84e872a0SLloyd Pique */
4103*84e872a0SLloyd Pique WL_POINTER_AXIS_SOURCE_CONTINUOUS = 2,
4104*84e872a0SLloyd Pique /**
4105*84e872a0SLloyd Pique * a physical wheel tilt
4106*84e872a0SLloyd Pique *
4107*84e872a0SLloyd Pique * Indicates that the actual device is a wheel but the scroll
4108*84e872a0SLloyd Pique * event is not caused by a rotation but a (usually sideways) tilt
4109*84e872a0SLloyd Pique * of the wheel.
4110*84e872a0SLloyd Pique * @since 6
4111*84e872a0SLloyd Pique */
4112*84e872a0SLloyd Pique WL_POINTER_AXIS_SOURCE_WHEEL_TILT = 3,
4113*84e872a0SLloyd Pique };
4114*84e872a0SLloyd Pique /**
4115*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4116*84e872a0SLloyd Pique */
4117*84e872a0SLloyd Pique #define WL_POINTER_AXIS_SOURCE_WHEEL_TILT_SINCE_VERSION 6
4118*84e872a0SLloyd Pique #endif /* WL_POINTER_AXIS_SOURCE_ENUM */
4119*84e872a0SLloyd Pique
4120*84e872a0SLloyd Pique /**
4121*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4122*84e872a0SLloyd Pique * @struct wl_pointer_listener
4123*84e872a0SLloyd Pique */
4124*84e872a0SLloyd Pique struct wl_pointer_listener {
4125*84e872a0SLloyd Pique /**
4126*84e872a0SLloyd Pique * enter event
4127*84e872a0SLloyd Pique *
4128*84e872a0SLloyd Pique * Notification that this seat's pointer is focused on a certain
4129*84e872a0SLloyd Pique * surface.
4130*84e872a0SLloyd Pique *
4131*84e872a0SLloyd Pique * When a seat's focus enters a surface, the pointer image is
4132*84e872a0SLloyd Pique * undefined and a client should respond to this event by setting
4133*84e872a0SLloyd Pique * an appropriate pointer image with the set_cursor request.
4134*84e872a0SLloyd Pique * @param serial serial number of the enter event
4135*84e872a0SLloyd Pique * @param surface surface entered by the pointer
4136*84e872a0SLloyd Pique * @param surface_x surface-local x coordinate
4137*84e872a0SLloyd Pique * @param surface_y surface-local y coordinate
4138*84e872a0SLloyd Pique */
4139*84e872a0SLloyd Pique void (*enter)(void *data,
4140*84e872a0SLloyd Pique struct wl_pointer *wl_pointer,
4141*84e872a0SLloyd Pique uint32_t serial,
4142*84e872a0SLloyd Pique struct wl_surface *surface,
4143*84e872a0SLloyd Pique wl_fixed_t surface_x,
4144*84e872a0SLloyd Pique wl_fixed_t surface_y);
4145*84e872a0SLloyd Pique /**
4146*84e872a0SLloyd Pique * leave event
4147*84e872a0SLloyd Pique *
4148*84e872a0SLloyd Pique * Notification that this seat's pointer is no longer focused on
4149*84e872a0SLloyd Pique * a certain surface.
4150*84e872a0SLloyd Pique *
4151*84e872a0SLloyd Pique * The leave notification is sent before the enter notification for
4152*84e872a0SLloyd Pique * the new focus.
4153*84e872a0SLloyd Pique * @param serial serial number of the leave event
4154*84e872a0SLloyd Pique * @param surface surface left by the pointer
4155*84e872a0SLloyd Pique */
4156*84e872a0SLloyd Pique void (*leave)(void *data,
4157*84e872a0SLloyd Pique struct wl_pointer *wl_pointer,
4158*84e872a0SLloyd Pique uint32_t serial,
4159*84e872a0SLloyd Pique struct wl_surface *surface);
4160*84e872a0SLloyd Pique /**
4161*84e872a0SLloyd Pique * pointer motion event
4162*84e872a0SLloyd Pique *
4163*84e872a0SLloyd Pique * Notification of pointer location change. The arguments
4164*84e872a0SLloyd Pique * surface_x and surface_y are the location relative to the focused
4165*84e872a0SLloyd Pique * surface.
4166*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
4167*84e872a0SLloyd Pique * @param surface_x surface-local x coordinate
4168*84e872a0SLloyd Pique * @param surface_y surface-local y coordinate
4169*84e872a0SLloyd Pique */
4170*84e872a0SLloyd Pique void (*motion)(void *data,
4171*84e872a0SLloyd Pique struct wl_pointer *wl_pointer,
4172*84e872a0SLloyd Pique uint32_t time,
4173*84e872a0SLloyd Pique wl_fixed_t surface_x,
4174*84e872a0SLloyd Pique wl_fixed_t surface_y);
4175*84e872a0SLloyd Pique /**
4176*84e872a0SLloyd Pique * pointer button event
4177*84e872a0SLloyd Pique *
4178*84e872a0SLloyd Pique * Mouse button click and release notifications.
4179*84e872a0SLloyd Pique *
4180*84e872a0SLloyd Pique * The location of the click is given by the last motion or enter
4181*84e872a0SLloyd Pique * event. The time argument is a timestamp with millisecond
4182*84e872a0SLloyd Pique * granularity, with an undefined base.
4183*84e872a0SLloyd Pique *
4184*84e872a0SLloyd Pique * The button is a button code as defined in the Linux kernel's
4185*84e872a0SLloyd Pique * linux/input-event-codes.h header file, e.g. BTN_LEFT.
4186*84e872a0SLloyd Pique *
4187*84e872a0SLloyd Pique * Any 16-bit button code value is reserved for future additions to
4188*84e872a0SLloyd Pique * the kernel's event code list. All other button codes above
4189*84e872a0SLloyd Pique * 0xFFFF are currently undefined but may be used in future
4190*84e872a0SLloyd Pique * versions of this protocol.
4191*84e872a0SLloyd Pique * @param serial serial number of the button event
4192*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
4193*84e872a0SLloyd Pique * @param button button that produced the event
4194*84e872a0SLloyd Pique * @param state physical state of the button
4195*84e872a0SLloyd Pique */
4196*84e872a0SLloyd Pique void (*button)(void *data,
4197*84e872a0SLloyd Pique struct wl_pointer *wl_pointer,
4198*84e872a0SLloyd Pique uint32_t serial,
4199*84e872a0SLloyd Pique uint32_t time,
4200*84e872a0SLloyd Pique uint32_t button,
4201*84e872a0SLloyd Pique uint32_t state);
4202*84e872a0SLloyd Pique /**
4203*84e872a0SLloyd Pique * axis event
4204*84e872a0SLloyd Pique *
4205*84e872a0SLloyd Pique * Scroll and other axis notifications.
4206*84e872a0SLloyd Pique *
4207*84e872a0SLloyd Pique * For scroll events (vertical and horizontal scroll axes), the
4208*84e872a0SLloyd Pique * value parameter is the length of a vector along the specified
4209*84e872a0SLloyd Pique * axis in a coordinate space identical to those of motion events,
4210*84e872a0SLloyd Pique * representing a relative movement along the specified axis.
4211*84e872a0SLloyd Pique *
4212*84e872a0SLloyd Pique * For devices that support movements non-parallel to axes multiple
4213*84e872a0SLloyd Pique * axis events will be emitted.
4214*84e872a0SLloyd Pique *
4215*84e872a0SLloyd Pique * When applicable, for example for touch pads, the server can
4216*84e872a0SLloyd Pique * choose to emit scroll events where the motion vector is
4217*84e872a0SLloyd Pique * equivalent to a motion event vector.
4218*84e872a0SLloyd Pique *
4219*84e872a0SLloyd Pique * When applicable, a client can transform its content relative to
4220*84e872a0SLloyd Pique * the scroll distance.
4221*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
4222*84e872a0SLloyd Pique * @param axis axis type
4223*84e872a0SLloyd Pique * @param value length of vector in surface-local coordinate space
4224*84e872a0SLloyd Pique */
4225*84e872a0SLloyd Pique void (*axis)(void *data,
4226*84e872a0SLloyd Pique struct wl_pointer *wl_pointer,
4227*84e872a0SLloyd Pique uint32_t time,
4228*84e872a0SLloyd Pique uint32_t axis,
4229*84e872a0SLloyd Pique wl_fixed_t value);
4230*84e872a0SLloyd Pique /**
4231*84e872a0SLloyd Pique * end of a pointer event sequence
4232*84e872a0SLloyd Pique *
4233*84e872a0SLloyd Pique * Indicates the end of a set of events that logically belong
4234*84e872a0SLloyd Pique * together. A client is expected to accumulate the data in all
4235*84e872a0SLloyd Pique * events within the frame before proceeding.
4236*84e872a0SLloyd Pique *
4237*84e872a0SLloyd Pique * All wl_pointer events before a wl_pointer.frame event belong
4238*84e872a0SLloyd Pique * logically together. For example, in a diagonal scroll motion the
4239*84e872a0SLloyd Pique * compositor will send an optional wl_pointer.axis_source event,
4240*84e872a0SLloyd Pique * two wl_pointer.axis events (horizontal and vertical) and finally
4241*84e872a0SLloyd Pique * a wl_pointer.frame event. The client may use this information to
4242*84e872a0SLloyd Pique * calculate a diagonal vector for scrolling.
4243*84e872a0SLloyd Pique *
4244*84e872a0SLloyd Pique * When multiple wl_pointer.axis events occur within the same
4245*84e872a0SLloyd Pique * frame, the motion vector is the combined motion of all events.
4246*84e872a0SLloyd Pique * When a wl_pointer.axis and a wl_pointer.axis_stop event occur
4247*84e872a0SLloyd Pique * within the same frame, this indicates that axis movement in one
4248*84e872a0SLloyd Pique * axis has stopped but continues in the other axis. When multiple
4249*84e872a0SLloyd Pique * wl_pointer.axis_stop events occur within the same frame, this
4250*84e872a0SLloyd Pique * indicates that these axes stopped in the same instance.
4251*84e872a0SLloyd Pique *
4252*84e872a0SLloyd Pique * A wl_pointer.frame event is sent for every logical event group,
4253*84e872a0SLloyd Pique * even if the group only contains a single wl_pointer event.
4254*84e872a0SLloyd Pique * Specifically, a client may get a sequence: motion, frame,
4255*84e872a0SLloyd Pique * button, frame, axis, frame, axis_stop, frame.
4256*84e872a0SLloyd Pique *
4257*84e872a0SLloyd Pique * The wl_pointer.enter and wl_pointer.leave events are logical
4258*84e872a0SLloyd Pique * events generated by the compositor and not the hardware. These
4259*84e872a0SLloyd Pique * events are also grouped by a wl_pointer.frame. When a pointer
4260*84e872a0SLloyd Pique * moves from one surface to another, a compositor should group the
4261*84e872a0SLloyd Pique * wl_pointer.leave event within the same wl_pointer.frame.
4262*84e872a0SLloyd Pique * However, a client must not rely on wl_pointer.leave and
4263*84e872a0SLloyd Pique * wl_pointer.enter being in the same wl_pointer.frame.
4264*84e872a0SLloyd Pique * Compositor-specific policies may require the wl_pointer.leave
4265*84e872a0SLloyd Pique * and wl_pointer.enter event being split across multiple
4266*84e872a0SLloyd Pique * wl_pointer.frame groups.
4267*84e872a0SLloyd Pique * @since 5
4268*84e872a0SLloyd Pique */
4269*84e872a0SLloyd Pique void (*frame)(void *data,
4270*84e872a0SLloyd Pique struct wl_pointer *wl_pointer);
4271*84e872a0SLloyd Pique /**
4272*84e872a0SLloyd Pique * axis source event
4273*84e872a0SLloyd Pique *
4274*84e872a0SLloyd Pique * Source information for scroll and other axes.
4275*84e872a0SLloyd Pique *
4276*84e872a0SLloyd Pique * This event does not occur on its own. It is sent before a
4277*84e872a0SLloyd Pique * wl_pointer.frame event and carries the source information for
4278*84e872a0SLloyd Pique * all events within that frame.
4279*84e872a0SLloyd Pique *
4280*84e872a0SLloyd Pique * The source specifies how this event was generated. If the source
4281*84e872a0SLloyd Pique * is wl_pointer.axis_source.finger, a wl_pointer.axis_stop event
4282*84e872a0SLloyd Pique * will be sent when the user lifts the finger off the device.
4283*84e872a0SLloyd Pique *
4284*84e872a0SLloyd Pique * If the source is wl_pointer.axis_source.wheel,
4285*84e872a0SLloyd Pique * wl_pointer.axis_source.wheel_tilt or
4286*84e872a0SLloyd Pique * wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event
4287*84e872a0SLloyd Pique * may or may not be sent. Whether a compositor sends an axis_stop
4288*84e872a0SLloyd Pique * event for these sources is hardware-specific and
4289*84e872a0SLloyd Pique * implementation-dependent; clients must not rely on receiving an
4290*84e872a0SLloyd Pique * axis_stop event for these scroll sources and should treat scroll
4291*84e872a0SLloyd Pique * sequences from these scroll sources as unterminated by default.
4292*84e872a0SLloyd Pique *
4293*84e872a0SLloyd Pique * This event is optional. If the source is unknown for a
4294*84e872a0SLloyd Pique * particular axis event sequence, no event is sent. Only one
4295*84e872a0SLloyd Pique * wl_pointer.axis_source event is permitted per frame.
4296*84e872a0SLloyd Pique *
4297*84e872a0SLloyd Pique * The order of wl_pointer.axis_discrete and wl_pointer.axis_source
4298*84e872a0SLloyd Pique * is not guaranteed.
4299*84e872a0SLloyd Pique * @param axis_source source of the axis event
4300*84e872a0SLloyd Pique * @since 5
4301*84e872a0SLloyd Pique */
4302*84e872a0SLloyd Pique void (*axis_source)(void *data,
4303*84e872a0SLloyd Pique struct wl_pointer *wl_pointer,
4304*84e872a0SLloyd Pique uint32_t axis_source);
4305*84e872a0SLloyd Pique /**
4306*84e872a0SLloyd Pique * axis stop event
4307*84e872a0SLloyd Pique *
4308*84e872a0SLloyd Pique * Stop notification for scroll and other axes.
4309*84e872a0SLloyd Pique *
4310*84e872a0SLloyd Pique * For some wl_pointer.axis_source types, a wl_pointer.axis_stop
4311*84e872a0SLloyd Pique * event is sent to notify a client that the axis sequence has
4312*84e872a0SLloyd Pique * terminated. This enables the client to implement kinetic
4313*84e872a0SLloyd Pique * scrolling. See the wl_pointer.axis_source documentation for
4314*84e872a0SLloyd Pique * information on when this event may be generated.
4315*84e872a0SLloyd Pique *
4316*84e872a0SLloyd Pique * Any wl_pointer.axis events with the same axis_source after this
4317*84e872a0SLloyd Pique * event should be considered as the start of a new axis motion.
4318*84e872a0SLloyd Pique *
4319*84e872a0SLloyd Pique * The timestamp is to be interpreted identical to the timestamp in
4320*84e872a0SLloyd Pique * the wl_pointer.axis event. The timestamp value may be the same
4321*84e872a0SLloyd Pique * as a preceding wl_pointer.axis event.
4322*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
4323*84e872a0SLloyd Pique * @param axis the axis stopped with this event
4324*84e872a0SLloyd Pique * @since 5
4325*84e872a0SLloyd Pique */
4326*84e872a0SLloyd Pique void (*axis_stop)(void *data,
4327*84e872a0SLloyd Pique struct wl_pointer *wl_pointer,
4328*84e872a0SLloyd Pique uint32_t time,
4329*84e872a0SLloyd Pique uint32_t axis);
4330*84e872a0SLloyd Pique /**
4331*84e872a0SLloyd Pique * axis click event
4332*84e872a0SLloyd Pique *
4333*84e872a0SLloyd Pique * Discrete step information for scroll and other axes.
4334*84e872a0SLloyd Pique *
4335*84e872a0SLloyd Pique * This event carries the axis value of the wl_pointer.axis event
4336*84e872a0SLloyd Pique * in discrete steps (e.g. mouse wheel clicks).
4337*84e872a0SLloyd Pique *
4338*84e872a0SLloyd Pique * This event does not occur on its own, it is coupled with a
4339*84e872a0SLloyd Pique * wl_pointer.axis event that represents this axis value on a
4340*84e872a0SLloyd Pique * continuous scale. The protocol guarantees that each
4341*84e872a0SLloyd Pique * axis_discrete event is always followed by exactly one axis event
4342*84e872a0SLloyd Pique * with the same axis number within the same wl_pointer.frame. Note
4343*84e872a0SLloyd Pique * that the protocol allows for other events to occur between the
4344*84e872a0SLloyd Pique * axis_discrete and its coupled axis event, including other
4345*84e872a0SLloyd Pique * axis_discrete or axis events.
4346*84e872a0SLloyd Pique *
4347*84e872a0SLloyd Pique * This event is optional; continuous scrolling devices like
4348*84e872a0SLloyd Pique * two-finger scrolling on touchpads do not have discrete steps and
4349*84e872a0SLloyd Pique * do not generate this event.
4350*84e872a0SLloyd Pique *
4351*84e872a0SLloyd Pique * The discrete value carries the directional information. e.g. a
4352*84e872a0SLloyd Pique * value of -2 is two steps towards the negative direction of this
4353*84e872a0SLloyd Pique * axis.
4354*84e872a0SLloyd Pique *
4355*84e872a0SLloyd Pique * The axis number is identical to the axis number in the
4356*84e872a0SLloyd Pique * associated axis event.
4357*84e872a0SLloyd Pique *
4358*84e872a0SLloyd Pique * The order of wl_pointer.axis_discrete and wl_pointer.axis_source
4359*84e872a0SLloyd Pique * is not guaranteed.
4360*84e872a0SLloyd Pique * @param axis axis type
4361*84e872a0SLloyd Pique * @param discrete number of steps
4362*84e872a0SLloyd Pique * @since 5
4363*84e872a0SLloyd Pique */
4364*84e872a0SLloyd Pique void (*axis_discrete)(void *data,
4365*84e872a0SLloyd Pique struct wl_pointer *wl_pointer,
4366*84e872a0SLloyd Pique uint32_t axis,
4367*84e872a0SLloyd Pique int32_t discrete);
4368*84e872a0SLloyd Pique };
4369*84e872a0SLloyd Pique
4370*84e872a0SLloyd Pique /**
4371*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4372*84e872a0SLloyd Pique */
4373*84e872a0SLloyd Pique static inline int
wl_pointer_add_listener(struct wl_pointer * wl_pointer,const struct wl_pointer_listener * listener,void * data)4374*84e872a0SLloyd Pique wl_pointer_add_listener(struct wl_pointer *wl_pointer,
4375*84e872a0SLloyd Pique const struct wl_pointer_listener *listener, void *data)
4376*84e872a0SLloyd Pique {
4377*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_pointer,
4378*84e872a0SLloyd Pique (void (**)(void)) listener, data);
4379*84e872a0SLloyd Pique }
4380*84e872a0SLloyd Pique
4381*84e872a0SLloyd Pique #define WL_POINTER_SET_CURSOR 0
4382*84e872a0SLloyd Pique #define WL_POINTER_RELEASE 1
4383*84e872a0SLloyd Pique
4384*84e872a0SLloyd Pique /**
4385*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4386*84e872a0SLloyd Pique */
4387*84e872a0SLloyd Pique #define WL_POINTER_ENTER_SINCE_VERSION 1
4388*84e872a0SLloyd Pique /**
4389*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4390*84e872a0SLloyd Pique */
4391*84e872a0SLloyd Pique #define WL_POINTER_LEAVE_SINCE_VERSION 1
4392*84e872a0SLloyd Pique /**
4393*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4394*84e872a0SLloyd Pique */
4395*84e872a0SLloyd Pique #define WL_POINTER_MOTION_SINCE_VERSION 1
4396*84e872a0SLloyd Pique /**
4397*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4398*84e872a0SLloyd Pique */
4399*84e872a0SLloyd Pique #define WL_POINTER_BUTTON_SINCE_VERSION 1
4400*84e872a0SLloyd Pique /**
4401*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4402*84e872a0SLloyd Pique */
4403*84e872a0SLloyd Pique #define WL_POINTER_AXIS_SINCE_VERSION 1
4404*84e872a0SLloyd Pique /**
4405*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4406*84e872a0SLloyd Pique */
4407*84e872a0SLloyd Pique #define WL_POINTER_FRAME_SINCE_VERSION 5
4408*84e872a0SLloyd Pique /**
4409*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4410*84e872a0SLloyd Pique */
4411*84e872a0SLloyd Pique #define WL_POINTER_AXIS_SOURCE_SINCE_VERSION 5
4412*84e872a0SLloyd Pique /**
4413*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4414*84e872a0SLloyd Pique */
4415*84e872a0SLloyd Pique #define WL_POINTER_AXIS_STOP_SINCE_VERSION 5
4416*84e872a0SLloyd Pique /**
4417*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4418*84e872a0SLloyd Pique */
4419*84e872a0SLloyd Pique #define WL_POINTER_AXIS_DISCRETE_SINCE_VERSION 5
4420*84e872a0SLloyd Pique
4421*84e872a0SLloyd Pique /**
4422*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4423*84e872a0SLloyd Pique */
4424*84e872a0SLloyd Pique #define WL_POINTER_SET_CURSOR_SINCE_VERSION 1
4425*84e872a0SLloyd Pique /**
4426*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4427*84e872a0SLloyd Pique */
4428*84e872a0SLloyd Pique #define WL_POINTER_RELEASE_SINCE_VERSION 3
4429*84e872a0SLloyd Pique
4430*84e872a0SLloyd Pique /** @ingroup iface_wl_pointer */
4431*84e872a0SLloyd Pique static inline void
wl_pointer_set_user_data(struct wl_pointer * wl_pointer,void * user_data)4432*84e872a0SLloyd Pique wl_pointer_set_user_data(struct wl_pointer *wl_pointer, void *user_data)
4433*84e872a0SLloyd Pique {
4434*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_pointer, user_data);
4435*84e872a0SLloyd Pique }
4436*84e872a0SLloyd Pique
4437*84e872a0SLloyd Pique /** @ingroup iface_wl_pointer */
4438*84e872a0SLloyd Pique static inline void *
wl_pointer_get_user_data(struct wl_pointer * wl_pointer)4439*84e872a0SLloyd Pique wl_pointer_get_user_data(struct wl_pointer *wl_pointer)
4440*84e872a0SLloyd Pique {
4441*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_pointer);
4442*84e872a0SLloyd Pique }
4443*84e872a0SLloyd Pique
4444*84e872a0SLloyd Pique static inline uint32_t
wl_pointer_get_version(struct wl_pointer * wl_pointer)4445*84e872a0SLloyd Pique wl_pointer_get_version(struct wl_pointer *wl_pointer)
4446*84e872a0SLloyd Pique {
4447*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_pointer);
4448*84e872a0SLloyd Pique }
4449*84e872a0SLloyd Pique
4450*84e872a0SLloyd Pique /** @ingroup iface_wl_pointer */
4451*84e872a0SLloyd Pique static inline void
wl_pointer_destroy(struct wl_pointer * wl_pointer)4452*84e872a0SLloyd Pique wl_pointer_destroy(struct wl_pointer *wl_pointer)
4453*84e872a0SLloyd Pique {
4454*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_pointer);
4455*84e872a0SLloyd Pique }
4456*84e872a0SLloyd Pique
4457*84e872a0SLloyd Pique /**
4458*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4459*84e872a0SLloyd Pique *
4460*84e872a0SLloyd Pique * Set the pointer surface, i.e., the surface that contains the
4461*84e872a0SLloyd Pique * pointer image (cursor). This request gives the surface the role
4462*84e872a0SLloyd Pique * of a cursor. If the surface already has another role, it raises
4463*84e872a0SLloyd Pique * a protocol error.
4464*84e872a0SLloyd Pique *
4465*84e872a0SLloyd Pique * The cursor actually changes only if the pointer
4466*84e872a0SLloyd Pique * focus for this device is one of the requesting client's surfaces
4467*84e872a0SLloyd Pique * or the surface parameter is the current pointer surface. If
4468*84e872a0SLloyd Pique * there was a previous surface set with this request it is
4469*84e872a0SLloyd Pique * replaced. If surface is NULL, the pointer image is hidden.
4470*84e872a0SLloyd Pique *
4471*84e872a0SLloyd Pique * The parameters hotspot_x and hotspot_y define the position of
4472*84e872a0SLloyd Pique * the pointer surface relative to the pointer location. Its
4473*84e872a0SLloyd Pique * top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
4474*84e872a0SLloyd Pique * where (x, y) are the coordinates of the pointer location, in
4475*84e872a0SLloyd Pique * surface-local coordinates.
4476*84e872a0SLloyd Pique *
4477*84e872a0SLloyd Pique * On surface.attach requests to the pointer surface, hotspot_x
4478*84e872a0SLloyd Pique * and hotspot_y are decremented by the x and y parameters
4479*84e872a0SLloyd Pique * passed to the request. Attach must be confirmed by
4480*84e872a0SLloyd Pique * wl_surface.commit as usual.
4481*84e872a0SLloyd Pique *
4482*84e872a0SLloyd Pique * The hotspot can also be updated by passing the currently set
4483*84e872a0SLloyd Pique * pointer surface to this request with new values for hotspot_x
4484*84e872a0SLloyd Pique * and hotspot_y.
4485*84e872a0SLloyd Pique *
4486*84e872a0SLloyd Pique * The current and pending input regions of the wl_surface are
4487*84e872a0SLloyd Pique * cleared, and wl_surface.set_input_region is ignored until the
4488*84e872a0SLloyd Pique * wl_surface is no longer used as the cursor. When the use as a
4489*84e872a0SLloyd Pique * cursor ends, the current and pending input regions become
4490*84e872a0SLloyd Pique * undefined, and the wl_surface is unmapped.
4491*84e872a0SLloyd Pique */
4492*84e872a0SLloyd Pique static inline void
wl_pointer_set_cursor(struct wl_pointer * wl_pointer,uint32_t serial,struct wl_surface * surface,int32_t hotspot_x,int32_t hotspot_y)4493*84e872a0SLloyd Pique wl_pointer_set_cursor(struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, int32_t hotspot_x, int32_t hotspot_y)
4494*84e872a0SLloyd Pique {
4495*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_pointer,
4496*84e872a0SLloyd Pique WL_POINTER_SET_CURSOR, NULL, wl_proxy_get_version((struct wl_proxy *) wl_pointer), 0, serial, surface, hotspot_x, hotspot_y);
4497*84e872a0SLloyd Pique }
4498*84e872a0SLloyd Pique
4499*84e872a0SLloyd Pique /**
4500*84e872a0SLloyd Pique * @ingroup iface_wl_pointer
4501*84e872a0SLloyd Pique *
4502*84e872a0SLloyd Pique * Using this request a client can tell the server that it is not going to
4503*84e872a0SLloyd Pique * use the pointer object anymore.
4504*84e872a0SLloyd Pique *
4505*84e872a0SLloyd Pique * This request destroys the pointer proxy object, so clients must not call
4506*84e872a0SLloyd Pique * wl_pointer_destroy() after using this request.
4507*84e872a0SLloyd Pique */
4508*84e872a0SLloyd Pique static inline void
wl_pointer_release(struct wl_pointer * wl_pointer)4509*84e872a0SLloyd Pique wl_pointer_release(struct wl_pointer *wl_pointer)
4510*84e872a0SLloyd Pique {
4511*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_pointer,
4512*84e872a0SLloyd Pique WL_POINTER_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_pointer), WL_MARSHAL_FLAG_DESTROY);
4513*84e872a0SLloyd Pique }
4514*84e872a0SLloyd Pique
4515*84e872a0SLloyd Pique #ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM
4516*84e872a0SLloyd Pique #define WL_KEYBOARD_KEYMAP_FORMAT_ENUM
4517*84e872a0SLloyd Pique /**
4518*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4519*84e872a0SLloyd Pique * keyboard mapping format
4520*84e872a0SLloyd Pique *
4521*84e872a0SLloyd Pique * This specifies the format of the keymap provided to the
4522*84e872a0SLloyd Pique * client with the wl_keyboard.keymap event.
4523*84e872a0SLloyd Pique */
4524*84e872a0SLloyd Pique enum wl_keyboard_keymap_format {
4525*84e872a0SLloyd Pique /**
4526*84e872a0SLloyd Pique * no keymap; client must understand how to interpret the raw keycode
4527*84e872a0SLloyd Pique */
4528*84e872a0SLloyd Pique WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0,
4529*84e872a0SLloyd Pique /**
4530*84e872a0SLloyd Pique * libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode
4531*84e872a0SLloyd Pique */
4532*84e872a0SLloyd Pique WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1,
4533*84e872a0SLloyd Pique };
4534*84e872a0SLloyd Pique #endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */
4535*84e872a0SLloyd Pique
4536*84e872a0SLloyd Pique #ifndef WL_KEYBOARD_KEY_STATE_ENUM
4537*84e872a0SLloyd Pique #define WL_KEYBOARD_KEY_STATE_ENUM
4538*84e872a0SLloyd Pique /**
4539*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4540*84e872a0SLloyd Pique * physical key state
4541*84e872a0SLloyd Pique *
4542*84e872a0SLloyd Pique * Describes the physical state of a key that produced the key event.
4543*84e872a0SLloyd Pique */
4544*84e872a0SLloyd Pique enum wl_keyboard_key_state {
4545*84e872a0SLloyd Pique /**
4546*84e872a0SLloyd Pique * key is not pressed
4547*84e872a0SLloyd Pique */
4548*84e872a0SLloyd Pique WL_KEYBOARD_KEY_STATE_RELEASED = 0,
4549*84e872a0SLloyd Pique /**
4550*84e872a0SLloyd Pique * key is pressed
4551*84e872a0SLloyd Pique */
4552*84e872a0SLloyd Pique WL_KEYBOARD_KEY_STATE_PRESSED = 1,
4553*84e872a0SLloyd Pique };
4554*84e872a0SLloyd Pique #endif /* WL_KEYBOARD_KEY_STATE_ENUM */
4555*84e872a0SLloyd Pique
4556*84e872a0SLloyd Pique /**
4557*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4558*84e872a0SLloyd Pique * @struct wl_keyboard_listener
4559*84e872a0SLloyd Pique */
4560*84e872a0SLloyd Pique struct wl_keyboard_listener {
4561*84e872a0SLloyd Pique /**
4562*84e872a0SLloyd Pique * keyboard mapping
4563*84e872a0SLloyd Pique *
4564*84e872a0SLloyd Pique * This event provides a file descriptor to the client which can
4565*84e872a0SLloyd Pique * be memory-mapped to provide a keyboard mapping description.
4566*84e872a0SLloyd Pique * @param format keymap format
4567*84e872a0SLloyd Pique * @param fd keymap file descriptor
4568*84e872a0SLloyd Pique * @param size keymap size, in bytes
4569*84e872a0SLloyd Pique */
4570*84e872a0SLloyd Pique void (*keymap)(void *data,
4571*84e872a0SLloyd Pique struct wl_keyboard *wl_keyboard,
4572*84e872a0SLloyd Pique uint32_t format,
4573*84e872a0SLloyd Pique int32_t fd,
4574*84e872a0SLloyd Pique uint32_t size);
4575*84e872a0SLloyd Pique /**
4576*84e872a0SLloyd Pique * enter event
4577*84e872a0SLloyd Pique *
4578*84e872a0SLloyd Pique * Notification that this seat's keyboard focus is on a certain
4579*84e872a0SLloyd Pique * surface.
4580*84e872a0SLloyd Pique * @param serial serial number of the enter event
4581*84e872a0SLloyd Pique * @param surface surface gaining keyboard focus
4582*84e872a0SLloyd Pique * @param keys the currently pressed keys
4583*84e872a0SLloyd Pique */
4584*84e872a0SLloyd Pique void (*enter)(void *data,
4585*84e872a0SLloyd Pique struct wl_keyboard *wl_keyboard,
4586*84e872a0SLloyd Pique uint32_t serial,
4587*84e872a0SLloyd Pique struct wl_surface *surface,
4588*84e872a0SLloyd Pique struct wl_array *keys);
4589*84e872a0SLloyd Pique /**
4590*84e872a0SLloyd Pique * leave event
4591*84e872a0SLloyd Pique *
4592*84e872a0SLloyd Pique * Notification that this seat's keyboard focus is no longer on a
4593*84e872a0SLloyd Pique * certain surface.
4594*84e872a0SLloyd Pique *
4595*84e872a0SLloyd Pique * The leave notification is sent before the enter notification for
4596*84e872a0SLloyd Pique * the new focus.
4597*84e872a0SLloyd Pique * @param serial serial number of the leave event
4598*84e872a0SLloyd Pique * @param surface surface that lost keyboard focus
4599*84e872a0SLloyd Pique */
4600*84e872a0SLloyd Pique void (*leave)(void *data,
4601*84e872a0SLloyd Pique struct wl_keyboard *wl_keyboard,
4602*84e872a0SLloyd Pique uint32_t serial,
4603*84e872a0SLloyd Pique struct wl_surface *surface);
4604*84e872a0SLloyd Pique /**
4605*84e872a0SLloyd Pique * key event
4606*84e872a0SLloyd Pique *
4607*84e872a0SLloyd Pique * A key was pressed or released. The time argument is a
4608*84e872a0SLloyd Pique * timestamp with millisecond granularity, with an undefined base.
4609*84e872a0SLloyd Pique * @param serial serial number of the key event
4610*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
4611*84e872a0SLloyd Pique * @param key key that produced the event
4612*84e872a0SLloyd Pique * @param state physical state of the key
4613*84e872a0SLloyd Pique */
4614*84e872a0SLloyd Pique void (*key)(void *data,
4615*84e872a0SLloyd Pique struct wl_keyboard *wl_keyboard,
4616*84e872a0SLloyd Pique uint32_t serial,
4617*84e872a0SLloyd Pique uint32_t time,
4618*84e872a0SLloyd Pique uint32_t key,
4619*84e872a0SLloyd Pique uint32_t state);
4620*84e872a0SLloyd Pique /**
4621*84e872a0SLloyd Pique * modifier and group state
4622*84e872a0SLloyd Pique *
4623*84e872a0SLloyd Pique * Notifies clients that the modifier and/or group state has
4624*84e872a0SLloyd Pique * changed, and it should update its local state.
4625*84e872a0SLloyd Pique * @param serial serial number of the modifiers event
4626*84e872a0SLloyd Pique * @param mods_depressed depressed modifiers
4627*84e872a0SLloyd Pique * @param mods_latched latched modifiers
4628*84e872a0SLloyd Pique * @param mods_locked locked modifiers
4629*84e872a0SLloyd Pique * @param group keyboard layout
4630*84e872a0SLloyd Pique */
4631*84e872a0SLloyd Pique void (*modifiers)(void *data,
4632*84e872a0SLloyd Pique struct wl_keyboard *wl_keyboard,
4633*84e872a0SLloyd Pique uint32_t serial,
4634*84e872a0SLloyd Pique uint32_t mods_depressed,
4635*84e872a0SLloyd Pique uint32_t mods_latched,
4636*84e872a0SLloyd Pique uint32_t mods_locked,
4637*84e872a0SLloyd Pique uint32_t group);
4638*84e872a0SLloyd Pique /**
4639*84e872a0SLloyd Pique * repeat rate and delay
4640*84e872a0SLloyd Pique *
4641*84e872a0SLloyd Pique * Informs the client about the keyboard's repeat rate and delay.
4642*84e872a0SLloyd Pique *
4643*84e872a0SLloyd Pique * This event is sent as soon as the wl_keyboard object has been
4644*84e872a0SLloyd Pique * created, and is guaranteed to be received by the client before
4645*84e872a0SLloyd Pique * any key press event.
4646*84e872a0SLloyd Pique *
4647*84e872a0SLloyd Pique * Negative values for either rate or delay are illegal. A rate of
4648*84e872a0SLloyd Pique * zero will disable any repeating (regardless of the value of
4649*84e872a0SLloyd Pique * delay).
4650*84e872a0SLloyd Pique *
4651*84e872a0SLloyd Pique * This event can be sent later on as well with a new value if
4652*84e872a0SLloyd Pique * necessary, so clients should continue listening for the event
4653*84e872a0SLloyd Pique * past the creation of wl_keyboard.
4654*84e872a0SLloyd Pique * @param rate the rate of repeating keys in characters per second
4655*84e872a0SLloyd Pique * @param delay delay in milliseconds since key down until repeating starts
4656*84e872a0SLloyd Pique * @since 4
4657*84e872a0SLloyd Pique */
4658*84e872a0SLloyd Pique void (*repeat_info)(void *data,
4659*84e872a0SLloyd Pique struct wl_keyboard *wl_keyboard,
4660*84e872a0SLloyd Pique int32_t rate,
4661*84e872a0SLloyd Pique int32_t delay);
4662*84e872a0SLloyd Pique };
4663*84e872a0SLloyd Pique
4664*84e872a0SLloyd Pique /**
4665*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4666*84e872a0SLloyd Pique */
4667*84e872a0SLloyd Pique static inline int
wl_keyboard_add_listener(struct wl_keyboard * wl_keyboard,const struct wl_keyboard_listener * listener,void * data)4668*84e872a0SLloyd Pique wl_keyboard_add_listener(struct wl_keyboard *wl_keyboard,
4669*84e872a0SLloyd Pique const struct wl_keyboard_listener *listener, void *data)
4670*84e872a0SLloyd Pique {
4671*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_keyboard,
4672*84e872a0SLloyd Pique (void (**)(void)) listener, data);
4673*84e872a0SLloyd Pique }
4674*84e872a0SLloyd Pique
4675*84e872a0SLloyd Pique #define WL_KEYBOARD_RELEASE 0
4676*84e872a0SLloyd Pique
4677*84e872a0SLloyd Pique /**
4678*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4679*84e872a0SLloyd Pique */
4680*84e872a0SLloyd Pique #define WL_KEYBOARD_KEYMAP_SINCE_VERSION 1
4681*84e872a0SLloyd Pique /**
4682*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4683*84e872a0SLloyd Pique */
4684*84e872a0SLloyd Pique #define WL_KEYBOARD_ENTER_SINCE_VERSION 1
4685*84e872a0SLloyd Pique /**
4686*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4687*84e872a0SLloyd Pique */
4688*84e872a0SLloyd Pique #define WL_KEYBOARD_LEAVE_SINCE_VERSION 1
4689*84e872a0SLloyd Pique /**
4690*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4691*84e872a0SLloyd Pique */
4692*84e872a0SLloyd Pique #define WL_KEYBOARD_KEY_SINCE_VERSION 1
4693*84e872a0SLloyd Pique /**
4694*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4695*84e872a0SLloyd Pique */
4696*84e872a0SLloyd Pique #define WL_KEYBOARD_MODIFIERS_SINCE_VERSION 1
4697*84e872a0SLloyd Pique /**
4698*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4699*84e872a0SLloyd Pique */
4700*84e872a0SLloyd Pique #define WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION 4
4701*84e872a0SLloyd Pique
4702*84e872a0SLloyd Pique /**
4703*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4704*84e872a0SLloyd Pique */
4705*84e872a0SLloyd Pique #define WL_KEYBOARD_RELEASE_SINCE_VERSION 3
4706*84e872a0SLloyd Pique
4707*84e872a0SLloyd Pique /** @ingroup iface_wl_keyboard */
4708*84e872a0SLloyd Pique static inline void
wl_keyboard_set_user_data(struct wl_keyboard * wl_keyboard,void * user_data)4709*84e872a0SLloyd Pique wl_keyboard_set_user_data(struct wl_keyboard *wl_keyboard, void *user_data)
4710*84e872a0SLloyd Pique {
4711*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_keyboard, user_data);
4712*84e872a0SLloyd Pique }
4713*84e872a0SLloyd Pique
4714*84e872a0SLloyd Pique /** @ingroup iface_wl_keyboard */
4715*84e872a0SLloyd Pique static inline void *
wl_keyboard_get_user_data(struct wl_keyboard * wl_keyboard)4716*84e872a0SLloyd Pique wl_keyboard_get_user_data(struct wl_keyboard *wl_keyboard)
4717*84e872a0SLloyd Pique {
4718*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_keyboard);
4719*84e872a0SLloyd Pique }
4720*84e872a0SLloyd Pique
4721*84e872a0SLloyd Pique static inline uint32_t
wl_keyboard_get_version(struct wl_keyboard * wl_keyboard)4722*84e872a0SLloyd Pique wl_keyboard_get_version(struct wl_keyboard *wl_keyboard)
4723*84e872a0SLloyd Pique {
4724*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_keyboard);
4725*84e872a0SLloyd Pique }
4726*84e872a0SLloyd Pique
4727*84e872a0SLloyd Pique /** @ingroup iface_wl_keyboard */
4728*84e872a0SLloyd Pique static inline void
wl_keyboard_destroy(struct wl_keyboard * wl_keyboard)4729*84e872a0SLloyd Pique wl_keyboard_destroy(struct wl_keyboard *wl_keyboard)
4730*84e872a0SLloyd Pique {
4731*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_keyboard);
4732*84e872a0SLloyd Pique }
4733*84e872a0SLloyd Pique
4734*84e872a0SLloyd Pique /**
4735*84e872a0SLloyd Pique * @ingroup iface_wl_keyboard
4736*84e872a0SLloyd Pique */
4737*84e872a0SLloyd Pique static inline void
wl_keyboard_release(struct wl_keyboard * wl_keyboard)4738*84e872a0SLloyd Pique wl_keyboard_release(struct wl_keyboard *wl_keyboard)
4739*84e872a0SLloyd Pique {
4740*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_keyboard,
4741*84e872a0SLloyd Pique WL_KEYBOARD_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_keyboard), WL_MARSHAL_FLAG_DESTROY);
4742*84e872a0SLloyd Pique }
4743*84e872a0SLloyd Pique
4744*84e872a0SLloyd Pique /**
4745*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4746*84e872a0SLloyd Pique * @struct wl_touch_listener
4747*84e872a0SLloyd Pique */
4748*84e872a0SLloyd Pique struct wl_touch_listener {
4749*84e872a0SLloyd Pique /**
4750*84e872a0SLloyd Pique * touch down event and beginning of a touch sequence
4751*84e872a0SLloyd Pique *
4752*84e872a0SLloyd Pique * A new touch point has appeared on the surface. This touch
4753*84e872a0SLloyd Pique * point is assigned a unique ID. Future events from this touch
4754*84e872a0SLloyd Pique * point reference this ID. The ID ceases to be valid after a touch
4755*84e872a0SLloyd Pique * up event and may be reused in the future.
4756*84e872a0SLloyd Pique * @param serial serial number of the touch down event
4757*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
4758*84e872a0SLloyd Pique * @param surface surface touched
4759*84e872a0SLloyd Pique * @param id the unique ID of this touch point
4760*84e872a0SLloyd Pique * @param x surface-local x coordinate
4761*84e872a0SLloyd Pique * @param y surface-local y coordinate
4762*84e872a0SLloyd Pique */
4763*84e872a0SLloyd Pique void (*down)(void *data,
4764*84e872a0SLloyd Pique struct wl_touch *wl_touch,
4765*84e872a0SLloyd Pique uint32_t serial,
4766*84e872a0SLloyd Pique uint32_t time,
4767*84e872a0SLloyd Pique struct wl_surface *surface,
4768*84e872a0SLloyd Pique int32_t id,
4769*84e872a0SLloyd Pique wl_fixed_t x,
4770*84e872a0SLloyd Pique wl_fixed_t y);
4771*84e872a0SLloyd Pique /**
4772*84e872a0SLloyd Pique * end of a touch event sequence
4773*84e872a0SLloyd Pique *
4774*84e872a0SLloyd Pique * The touch point has disappeared. No further events will be
4775*84e872a0SLloyd Pique * sent for this touch point and the touch point's ID is released
4776*84e872a0SLloyd Pique * and may be reused in a future touch down event.
4777*84e872a0SLloyd Pique * @param serial serial number of the touch up event
4778*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
4779*84e872a0SLloyd Pique * @param id the unique ID of this touch point
4780*84e872a0SLloyd Pique */
4781*84e872a0SLloyd Pique void (*up)(void *data,
4782*84e872a0SLloyd Pique struct wl_touch *wl_touch,
4783*84e872a0SLloyd Pique uint32_t serial,
4784*84e872a0SLloyd Pique uint32_t time,
4785*84e872a0SLloyd Pique int32_t id);
4786*84e872a0SLloyd Pique /**
4787*84e872a0SLloyd Pique * update of touch point coordinates
4788*84e872a0SLloyd Pique *
4789*84e872a0SLloyd Pique * A touch point has changed coordinates.
4790*84e872a0SLloyd Pique * @param time timestamp with millisecond granularity
4791*84e872a0SLloyd Pique * @param id the unique ID of this touch point
4792*84e872a0SLloyd Pique * @param x surface-local x coordinate
4793*84e872a0SLloyd Pique * @param y surface-local y coordinate
4794*84e872a0SLloyd Pique */
4795*84e872a0SLloyd Pique void (*motion)(void *data,
4796*84e872a0SLloyd Pique struct wl_touch *wl_touch,
4797*84e872a0SLloyd Pique uint32_t time,
4798*84e872a0SLloyd Pique int32_t id,
4799*84e872a0SLloyd Pique wl_fixed_t x,
4800*84e872a0SLloyd Pique wl_fixed_t y);
4801*84e872a0SLloyd Pique /**
4802*84e872a0SLloyd Pique * end of touch frame event
4803*84e872a0SLloyd Pique *
4804*84e872a0SLloyd Pique * Indicates the end of a set of events that logically belong
4805*84e872a0SLloyd Pique * together. A client is expected to accumulate the data in all
4806*84e872a0SLloyd Pique * events within the frame before proceeding.
4807*84e872a0SLloyd Pique *
4808*84e872a0SLloyd Pique * A wl_touch.frame terminates at least one event but otherwise no
4809*84e872a0SLloyd Pique * guarantee is provided about the set of events within a frame. A
4810*84e872a0SLloyd Pique * client must assume that any state not updated in a frame is
4811*84e872a0SLloyd Pique * unchanged from the previously known state.
4812*84e872a0SLloyd Pique */
4813*84e872a0SLloyd Pique void (*frame)(void *data,
4814*84e872a0SLloyd Pique struct wl_touch *wl_touch);
4815*84e872a0SLloyd Pique /**
4816*84e872a0SLloyd Pique * touch session cancelled
4817*84e872a0SLloyd Pique *
4818*84e872a0SLloyd Pique * Sent if the compositor decides the touch stream is a global
4819*84e872a0SLloyd Pique * gesture. No further events are sent to the clients from that
4820*84e872a0SLloyd Pique * particular gesture. Touch cancellation applies to all touch
4821*84e872a0SLloyd Pique * points currently active on this client's surface. The client is
4822*84e872a0SLloyd Pique * responsible for finalizing the touch points, future touch points
4823*84e872a0SLloyd Pique * on this surface may reuse the touch point ID.
4824*84e872a0SLloyd Pique */
4825*84e872a0SLloyd Pique void (*cancel)(void *data,
4826*84e872a0SLloyd Pique struct wl_touch *wl_touch);
4827*84e872a0SLloyd Pique /**
4828*84e872a0SLloyd Pique * update shape of touch point
4829*84e872a0SLloyd Pique *
4830*84e872a0SLloyd Pique * Sent when a touchpoint has changed its shape.
4831*84e872a0SLloyd Pique *
4832*84e872a0SLloyd Pique * This event does not occur on its own. It is sent before a
4833*84e872a0SLloyd Pique * wl_touch.frame event and carries the new shape information for
4834*84e872a0SLloyd Pique * any previously reported, or new touch points of that frame.
4835*84e872a0SLloyd Pique *
4836*84e872a0SLloyd Pique * Other events describing the touch point such as wl_touch.down,
4837*84e872a0SLloyd Pique * wl_touch.motion or wl_touch.orientation may be sent within the
4838*84e872a0SLloyd Pique * same wl_touch.frame. A client should treat these events as a
4839*84e872a0SLloyd Pique * single logical touch point update. The order of wl_touch.shape,
4840*84e872a0SLloyd Pique * wl_touch.orientation and wl_touch.motion is not guaranteed. A
4841*84e872a0SLloyd Pique * wl_touch.down event is guaranteed to occur before the first
4842*84e872a0SLloyd Pique * wl_touch.shape event for this touch ID but both events may occur
4843*84e872a0SLloyd Pique * within the same wl_touch.frame.
4844*84e872a0SLloyd Pique *
4845*84e872a0SLloyd Pique * A touchpoint shape is approximated by an ellipse through the
4846*84e872a0SLloyd Pique * major and minor axis length. The major axis length describes the
4847*84e872a0SLloyd Pique * longer diameter of the ellipse, while the minor axis length
4848*84e872a0SLloyd Pique * describes the shorter diameter. Major and minor are orthogonal
4849*84e872a0SLloyd Pique * and both are specified in surface-local coordinates. The center
4850*84e872a0SLloyd Pique * of the ellipse is always at the touchpoint location as reported
4851*84e872a0SLloyd Pique * by wl_touch.down or wl_touch.move.
4852*84e872a0SLloyd Pique *
4853*84e872a0SLloyd Pique * This event is only sent by the compositor if the touch device
4854*84e872a0SLloyd Pique * supports shape reports. The client has to make reasonable
4855*84e872a0SLloyd Pique * assumptions about the shape if it did not receive this event.
4856*84e872a0SLloyd Pique * @param id the unique ID of this touch point
4857*84e872a0SLloyd Pique * @param major length of the major axis in surface-local coordinates
4858*84e872a0SLloyd Pique * @param minor length of the minor axis in surface-local coordinates
4859*84e872a0SLloyd Pique * @since 6
4860*84e872a0SLloyd Pique */
4861*84e872a0SLloyd Pique void (*shape)(void *data,
4862*84e872a0SLloyd Pique struct wl_touch *wl_touch,
4863*84e872a0SLloyd Pique int32_t id,
4864*84e872a0SLloyd Pique wl_fixed_t major,
4865*84e872a0SLloyd Pique wl_fixed_t minor);
4866*84e872a0SLloyd Pique /**
4867*84e872a0SLloyd Pique * update orientation of touch point
4868*84e872a0SLloyd Pique *
4869*84e872a0SLloyd Pique * Sent when a touchpoint has changed its orientation.
4870*84e872a0SLloyd Pique *
4871*84e872a0SLloyd Pique * This event does not occur on its own. It is sent before a
4872*84e872a0SLloyd Pique * wl_touch.frame event and carries the new shape information for
4873*84e872a0SLloyd Pique * any previously reported, or new touch points of that frame.
4874*84e872a0SLloyd Pique *
4875*84e872a0SLloyd Pique * Other events describing the touch point such as wl_touch.down,
4876*84e872a0SLloyd Pique * wl_touch.motion or wl_touch.shape may be sent within the same
4877*84e872a0SLloyd Pique * wl_touch.frame. A client should treat these events as a single
4878*84e872a0SLloyd Pique * logical touch point update. The order of wl_touch.shape,
4879*84e872a0SLloyd Pique * wl_touch.orientation and wl_touch.motion is not guaranteed. A
4880*84e872a0SLloyd Pique * wl_touch.down event is guaranteed to occur before the first
4881*84e872a0SLloyd Pique * wl_touch.orientation event for this touch ID but both events may
4882*84e872a0SLloyd Pique * occur within the same wl_touch.frame.
4883*84e872a0SLloyd Pique *
4884*84e872a0SLloyd Pique * The orientation describes the clockwise angle of a touchpoint's
4885*84e872a0SLloyd Pique * major axis to the positive surface y-axis and is normalized to
4886*84e872a0SLloyd Pique * the -180 to +180 degree range. The granularity of orientation
4887*84e872a0SLloyd Pique * depends on the touch device, some devices only support binary
4888*84e872a0SLloyd Pique * rotation values between 0 and 90 degrees.
4889*84e872a0SLloyd Pique *
4890*84e872a0SLloyd Pique * This event is only sent by the compositor if the touch device
4891*84e872a0SLloyd Pique * supports orientation reports.
4892*84e872a0SLloyd Pique * @param id the unique ID of this touch point
4893*84e872a0SLloyd Pique * @param orientation angle between major axis and positive surface y-axis in degrees
4894*84e872a0SLloyd Pique * @since 6
4895*84e872a0SLloyd Pique */
4896*84e872a0SLloyd Pique void (*orientation)(void *data,
4897*84e872a0SLloyd Pique struct wl_touch *wl_touch,
4898*84e872a0SLloyd Pique int32_t id,
4899*84e872a0SLloyd Pique wl_fixed_t orientation);
4900*84e872a0SLloyd Pique };
4901*84e872a0SLloyd Pique
4902*84e872a0SLloyd Pique /**
4903*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4904*84e872a0SLloyd Pique */
4905*84e872a0SLloyd Pique static inline int
wl_touch_add_listener(struct wl_touch * wl_touch,const struct wl_touch_listener * listener,void * data)4906*84e872a0SLloyd Pique wl_touch_add_listener(struct wl_touch *wl_touch,
4907*84e872a0SLloyd Pique const struct wl_touch_listener *listener, void *data)
4908*84e872a0SLloyd Pique {
4909*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_touch,
4910*84e872a0SLloyd Pique (void (**)(void)) listener, data);
4911*84e872a0SLloyd Pique }
4912*84e872a0SLloyd Pique
4913*84e872a0SLloyd Pique #define WL_TOUCH_RELEASE 0
4914*84e872a0SLloyd Pique
4915*84e872a0SLloyd Pique /**
4916*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4917*84e872a0SLloyd Pique */
4918*84e872a0SLloyd Pique #define WL_TOUCH_DOWN_SINCE_VERSION 1
4919*84e872a0SLloyd Pique /**
4920*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4921*84e872a0SLloyd Pique */
4922*84e872a0SLloyd Pique #define WL_TOUCH_UP_SINCE_VERSION 1
4923*84e872a0SLloyd Pique /**
4924*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4925*84e872a0SLloyd Pique */
4926*84e872a0SLloyd Pique #define WL_TOUCH_MOTION_SINCE_VERSION 1
4927*84e872a0SLloyd Pique /**
4928*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4929*84e872a0SLloyd Pique */
4930*84e872a0SLloyd Pique #define WL_TOUCH_FRAME_SINCE_VERSION 1
4931*84e872a0SLloyd Pique /**
4932*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4933*84e872a0SLloyd Pique */
4934*84e872a0SLloyd Pique #define WL_TOUCH_CANCEL_SINCE_VERSION 1
4935*84e872a0SLloyd Pique /**
4936*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4937*84e872a0SLloyd Pique */
4938*84e872a0SLloyd Pique #define WL_TOUCH_SHAPE_SINCE_VERSION 6
4939*84e872a0SLloyd Pique /**
4940*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4941*84e872a0SLloyd Pique */
4942*84e872a0SLloyd Pique #define WL_TOUCH_ORIENTATION_SINCE_VERSION 6
4943*84e872a0SLloyd Pique
4944*84e872a0SLloyd Pique /**
4945*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4946*84e872a0SLloyd Pique */
4947*84e872a0SLloyd Pique #define WL_TOUCH_RELEASE_SINCE_VERSION 3
4948*84e872a0SLloyd Pique
4949*84e872a0SLloyd Pique /** @ingroup iface_wl_touch */
4950*84e872a0SLloyd Pique static inline void
wl_touch_set_user_data(struct wl_touch * wl_touch,void * user_data)4951*84e872a0SLloyd Pique wl_touch_set_user_data(struct wl_touch *wl_touch, void *user_data)
4952*84e872a0SLloyd Pique {
4953*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_touch, user_data);
4954*84e872a0SLloyd Pique }
4955*84e872a0SLloyd Pique
4956*84e872a0SLloyd Pique /** @ingroup iface_wl_touch */
4957*84e872a0SLloyd Pique static inline void *
wl_touch_get_user_data(struct wl_touch * wl_touch)4958*84e872a0SLloyd Pique wl_touch_get_user_data(struct wl_touch *wl_touch)
4959*84e872a0SLloyd Pique {
4960*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_touch);
4961*84e872a0SLloyd Pique }
4962*84e872a0SLloyd Pique
4963*84e872a0SLloyd Pique static inline uint32_t
wl_touch_get_version(struct wl_touch * wl_touch)4964*84e872a0SLloyd Pique wl_touch_get_version(struct wl_touch *wl_touch)
4965*84e872a0SLloyd Pique {
4966*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_touch);
4967*84e872a0SLloyd Pique }
4968*84e872a0SLloyd Pique
4969*84e872a0SLloyd Pique /** @ingroup iface_wl_touch */
4970*84e872a0SLloyd Pique static inline void
wl_touch_destroy(struct wl_touch * wl_touch)4971*84e872a0SLloyd Pique wl_touch_destroy(struct wl_touch *wl_touch)
4972*84e872a0SLloyd Pique {
4973*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_touch);
4974*84e872a0SLloyd Pique }
4975*84e872a0SLloyd Pique
4976*84e872a0SLloyd Pique /**
4977*84e872a0SLloyd Pique * @ingroup iface_wl_touch
4978*84e872a0SLloyd Pique */
4979*84e872a0SLloyd Pique static inline void
wl_touch_release(struct wl_touch * wl_touch)4980*84e872a0SLloyd Pique wl_touch_release(struct wl_touch *wl_touch)
4981*84e872a0SLloyd Pique {
4982*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_touch,
4983*84e872a0SLloyd Pique WL_TOUCH_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_touch), WL_MARSHAL_FLAG_DESTROY);
4984*84e872a0SLloyd Pique }
4985*84e872a0SLloyd Pique
4986*84e872a0SLloyd Pique #ifndef WL_OUTPUT_SUBPIXEL_ENUM
4987*84e872a0SLloyd Pique #define WL_OUTPUT_SUBPIXEL_ENUM
4988*84e872a0SLloyd Pique /**
4989*84e872a0SLloyd Pique * @ingroup iface_wl_output
4990*84e872a0SLloyd Pique * subpixel geometry information
4991*84e872a0SLloyd Pique *
4992*84e872a0SLloyd Pique * This enumeration describes how the physical
4993*84e872a0SLloyd Pique * pixels on an output are laid out.
4994*84e872a0SLloyd Pique */
4995*84e872a0SLloyd Pique enum wl_output_subpixel {
4996*84e872a0SLloyd Pique /**
4997*84e872a0SLloyd Pique * unknown geometry
4998*84e872a0SLloyd Pique */
4999*84e872a0SLloyd Pique WL_OUTPUT_SUBPIXEL_UNKNOWN = 0,
5000*84e872a0SLloyd Pique /**
5001*84e872a0SLloyd Pique * no geometry
5002*84e872a0SLloyd Pique */
5003*84e872a0SLloyd Pique WL_OUTPUT_SUBPIXEL_NONE = 1,
5004*84e872a0SLloyd Pique /**
5005*84e872a0SLloyd Pique * horizontal RGB
5006*84e872a0SLloyd Pique */
5007*84e872a0SLloyd Pique WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2,
5008*84e872a0SLloyd Pique /**
5009*84e872a0SLloyd Pique * horizontal BGR
5010*84e872a0SLloyd Pique */
5011*84e872a0SLloyd Pique WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3,
5012*84e872a0SLloyd Pique /**
5013*84e872a0SLloyd Pique * vertical RGB
5014*84e872a0SLloyd Pique */
5015*84e872a0SLloyd Pique WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4,
5016*84e872a0SLloyd Pique /**
5017*84e872a0SLloyd Pique * vertical BGR
5018*84e872a0SLloyd Pique */
5019*84e872a0SLloyd Pique WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5,
5020*84e872a0SLloyd Pique };
5021*84e872a0SLloyd Pique #endif /* WL_OUTPUT_SUBPIXEL_ENUM */
5022*84e872a0SLloyd Pique
5023*84e872a0SLloyd Pique #ifndef WL_OUTPUT_TRANSFORM_ENUM
5024*84e872a0SLloyd Pique #define WL_OUTPUT_TRANSFORM_ENUM
5025*84e872a0SLloyd Pique /**
5026*84e872a0SLloyd Pique * @ingroup iface_wl_output
5027*84e872a0SLloyd Pique * transform from framebuffer to output
5028*84e872a0SLloyd Pique *
5029*84e872a0SLloyd Pique * This describes the transform that a compositor will apply to a
5030*84e872a0SLloyd Pique * surface to compensate for the rotation or mirroring of an
5031*84e872a0SLloyd Pique * output device.
5032*84e872a0SLloyd Pique *
5033*84e872a0SLloyd Pique * The flipped values correspond to an initial flip around a
5034*84e872a0SLloyd Pique * vertical axis followed by rotation.
5035*84e872a0SLloyd Pique *
5036*84e872a0SLloyd Pique * The purpose is mainly to allow clients to render accordingly and
5037*84e872a0SLloyd Pique * tell the compositor, so that for fullscreen surfaces, the
5038*84e872a0SLloyd Pique * compositor will still be able to scan out directly from client
5039*84e872a0SLloyd Pique * surfaces.
5040*84e872a0SLloyd Pique */
5041*84e872a0SLloyd Pique enum wl_output_transform {
5042*84e872a0SLloyd Pique /**
5043*84e872a0SLloyd Pique * no transform
5044*84e872a0SLloyd Pique */
5045*84e872a0SLloyd Pique WL_OUTPUT_TRANSFORM_NORMAL = 0,
5046*84e872a0SLloyd Pique /**
5047*84e872a0SLloyd Pique * 90 degrees counter-clockwise
5048*84e872a0SLloyd Pique */
5049*84e872a0SLloyd Pique WL_OUTPUT_TRANSFORM_90 = 1,
5050*84e872a0SLloyd Pique /**
5051*84e872a0SLloyd Pique * 180 degrees counter-clockwise
5052*84e872a0SLloyd Pique */
5053*84e872a0SLloyd Pique WL_OUTPUT_TRANSFORM_180 = 2,
5054*84e872a0SLloyd Pique /**
5055*84e872a0SLloyd Pique * 270 degrees counter-clockwise
5056*84e872a0SLloyd Pique */
5057*84e872a0SLloyd Pique WL_OUTPUT_TRANSFORM_270 = 3,
5058*84e872a0SLloyd Pique /**
5059*84e872a0SLloyd Pique * 180 degree flip around a vertical axis
5060*84e872a0SLloyd Pique */
5061*84e872a0SLloyd Pique WL_OUTPUT_TRANSFORM_FLIPPED = 4,
5062*84e872a0SLloyd Pique /**
5063*84e872a0SLloyd Pique * flip and rotate 90 degrees counter-clockwise
5064*84e872a0SLloyd Pique */
5065*84e872a0SLloyd Pique WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5,
5066*84e872a0SLloyd Pique /**
5067*84e872a0SLloyd Pique * flip and rotate 180 degrees counter-clockwise
5068*84e872a0SLloyd Pique */
5069*84e872a0SLloyd Pique WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6,
5070*84e872a0SLloyd Pique /**
5071*84e872a0SLloyd Pique * flip and rotate 270 degrees counter-clockwise
5072*84e872a0SLloyd Pique */
5073*84e872a0SLloyd Pique WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7,
5074*84e872a0SLloyd Pique };
5075*84e872a0SLloyd Pique #endif /* WL_OUTPUT_TRANSFORM_ENUM */
5076*84e872a0SLloyd Pique
5077*84e872a0SLloyd Pique #ifndef WL_OUTPUT_MODE_ENUM
5078*84e872a0SLloyd Pique #define WL_OUTPUT_MODE_ENUM
5079*84e872a0SLloyd Pique /**
5080*84e872a0SLloyd Pique * @ingroup iface_wl_output
5081*84e872a0SLloyd Pique * mode information
5082*84e872a0SLloyd Pique *
5083*84e872a0SLloyd Pique * These flags describe properties of an output mode.
5084*84e872a0SLloyd Pique * They are used in the flags bitfield of the mode event.
5085*84e872a0SLloyd Pique */
5086*84e872a0SLloyd Pique enum wl_output_mode {
5087*84e872a0SLloyd Pique /**
5088*84e872a0SLloyd Pique * indicates this is the current mode
5089*84e872a0SLloyd Pique */
5090*84e872a0SLloyd Pique WL_OUTPUT_MODE_CURRENT = 0x1,
5091*84e872a0SLloyd Pique /**
5092*84e872a0SLloyd Pique * indicates this is the preferred mode
5093*84e872a0SLloyd Pique */
5094*84e872a0SLloyd Pique WL_OUTPUT_MODE_PREFERRED = 0x2,
5095*84e872a0SLloyd Pique };
5096*84e872a0SLloyd Pique #endif /* WL_OUTPUT_MODE_ENUM */
5097*84e872a0SLloyd Pique
5098*84e872a0SLloyd Pique /**
5099*84e872a0SLloyd Pique * @ingroup iface_wl_output
5100*84e872a0SLloyd Pique * @struct wl_output_listener
5101*84e872a0SLloyd Pique */
5102*84e872a0SLloyd Pique struct wl_output_listener {
5103*84e872a0SLloyd Pique /**
5104*84e872a0SLloyd Pique * properties of the output
5105*84e872a0SLloyd Pique *
5106*84e872a0SLloyd Pique * The geometry event describes geometric properties of the
5107*84e872a0SLloyd Pique * output. The event is sent when binding to the output object and
5108*84e872a0SLloyd Pique * whenever any of the properties change.
5109*84e872a0SLloyd Pique * @param x x position within the global compositor space
5110*84e872a0SLloyd Pique * @param y y position within the global compositor space
5111*84e872a0SLloyd Pique * @param physical_width width in millimeters of the output
5112*84e872a0SLloyd Pique * @param physical_height height in millimeters of the output
5113*84e872a0SLloyd Pique * @param subpixel subpixel orientation of the output
5114*84e872a0SLloyd Pique * @param make textual description of the manufacturer
5115*84e872a0SLloyd Pique * @param model textual description of the model
5116*84e872a0SLloyd Pique * @param transform transform that maps framebuffer to output
5117*84e872a0SLloyd Pique */
5118*84e872a0SLloyd Pique void (*geometry)(void *data,
5119*84e872a0SLloyd Pique struct wl_output *wl_output,
5120*84e872a0SLloyd Pique int32_t x,
5121*84e872a0SLloyd Pique int32_t y,
5122*84e872a0SLloyd Pique int32_t physical_width,
5123*84e872a0SLloyd Pique int32_t physical_height,
5124*84e872a0SLloyd Pique int32_t subpixel,
5125*84e872a0SLloyd Pique const char *make,
5126*84e872a0SLloyd Pique const char *model,
5127*84e872a0SLloyd Pique int32_t transform);
5128*84e872a0SLloyd Pique /**
5129*84e872a0SLloyd Pique * advertise available modes for the output
5130*84e872a0SLloyd Pique *
5131*84e872a0SLloyd Pique * The mode event describes an available mode for the output.
5132*84e872a0SLloyd Pique *
5133*84e872a0SLloyd Pique * The event is sent when binding to the output object and there
5134*84e872a0SLloyd Pique * will always be one mode, the current mode. The event is sent
5135*84e872a0SLloyd Pique * again if an output changes mode, for the mode that is now
5136*84e872a0SLloyd Pique * current. In other words, the current mode is always the last
5137*84e872a0SLloyd Pique * mode that was received with the current flag set.
5138*84e872a0SLloyd Pique *
5139*84e872a0SLloyd Pique * The size of a mode is given in physical hardware units of the
5140*84e872a0SLloyd Pique * output device. This is not necessarily the same as the output
5141*84e872a0SLloyd Pique * size in the global compositor space. For instance, the output
5142*84e872a0SLloyd Pique * may be scaled, as described in wl_output.scale, or transformed,
5143*84e872a0SLloyd Pique * as described in wl_output.transform.
5144*84e872a0SLloyd Pique * @param flags bitfield of mode flags
5145*84e872a0SLloyd Pique * @param width width of the mode in hardware units
5146*84e872a0SLloyd Pique * @param height height of the mode in hardware units
5147*84e872a0SLloyd Pique * @param refresh vertical refresh rate in mHz
5148*84e872a0SLloyd Pique */
5149*84e872a0SLloyd Pique void (*mode)(void *data,
5150*84e872a0SLloyd Pique struct wl_output *wl_output,
5151*84e872a0SLloyd Pique uint32_t flags,
5152*84e872a0SLloyd Pique int32_t width,
5153*84e872a0SLloyd Pique int32_t height,
5154*84e872a0SLloyd Pique int32_t refresh);
5155*84e872a0SLloyd Pique /**
5156*84e872a0SLloyd Pique * sent all information about output
5157*84e872a0SLloyd Pique *
5158*84e872a0SLloyd Pique * This event is sent after all other properties have been sent
5159*84e872a0SLloyd Pique * after binding to the output object and after any other property
5160*84e872a0SLloyd Pique * changes done after that. This allows changes to the output
5161*84e872a0SLloyd Pique * properties to be seen as atomic, even if they happen via
5162*84e872a0SLloyd Pique * multiple events.
5163*84e872a0SLloyd Pique * @since 2
5164*84e872a0SLloyd Pique */
5165*84e872a0SLloyd Pique void (*done)(void *data,
5166*84e872a0SLloyd Pique struct wl_output *wl_output);
5167*84e872a0SLloyd Pique /**
5168*84e872a0SLloyd Pique * output scaling properties
5169*84e872a0SLloyd Pique *
5170*84e872a0SLloyd Pique * This event contains scaling geometry information that is not
5171*84e872a0SLloyd Pique * in the geometry event. It may be sent after binding the output
5172*84e872a0SLloyd Pique * object or if the output scale changes later. If it is not sent,
5173*84e872a0SLloyd Pique * the client should assume a scale of 1.
5174*84e872a0SLloyd Pique *
5175*84e872a0SLloyd Pique * A scale larger than 1 means that the compositor will
5176*84e872a0SLloyd Pique * automatically scale surface buffers by this amount when
5177*84e872a0SLloyd Pique * rendering. This is used for very high resolution displays where
5178*84e872a0SLloyd Pique * applications rendering at the native resolution would be too
5179*84e872a0SLloyd Pique * small to be legible.
5180*84e872a0SLloyd Pique *
5181*84e872a0SLloyd Pique * It is intended that scaling aware clients track the current
5182*84e872a0SLloyd Pique * output of a surface, and if it is on a scaled output it should
5183*84e872a0SLloyd Pique * use wl_surface.set_buffer_scale with the scale of the output.
5184*84e872a0SLloyd Pique * That way the compositor can avoid scaling the surface, and the
5185*84e872a0SLloyd Pique * client can supply a higher detail image.
5186*84e872a0SLloyd Pique * @param factor scaling factor of output
5187*84e872a0SLloyd Pique * @since 2
5188*84e872a0SLloyd Pique */
5189*84e872a0SLloyd Pique void (*scale)(void *data,
5190*84e872a0SLloyd Pique struct wl_output *wl_output,
5191*84e872a0SLloyd Pique int32_t factor);
5192*84e872a0SLloyd Pique };
5193*84e872a0SLloyd Pique
5194*84e872a0SLloyd Pique /**
5195*84e872a0SLloyd Pique * @ingroup iface_wl_output
5196*84e872a0SLloyd Pique */
5197*84e872a0SLloyd Pique static inline int
wl_output_add_listener(struct wl_output * wl_output,const struct wl_output_listener * listener,void * data)5198*84e872a0SLloyd Pique wl_output_add_listener(struct wl_output *wl_output,
5199*84e872a0SLloyd Pique const struct wl_output_listener *listener, void *data)
5200*84e872a0SLloyd Pique {
5201*84e872a0SLloyd Pique return wl_proxy_add_listener((struct wl_proxy *) wl_output,
5202*84e872a0SLloyd Pique (void (**)(void)) listener, data);
5203*84e872a0SLloyd Pique }
5204*84e872a0SLloyd Pique
5205*84e872a0SLloyd Pique #define WL_OUTPUT_RELEASE 0
5206*84e872a0SLloyd Pique
5207*84e872a0SLloyd Pique /**
5208*84e872a0SLloyd Pique * @ingroup iface_wl_output
5209*84e872a0SLloyd Pique */
5210*84e872a0SLloyd Pique #define WL_OUTPUT_GEOMETRY_SINCE_VERSION 1
5211*84e872a0SLloyd Pique /**
5212*84e872a0SLloyd Pique * @ingroup iface_wl_output
5213*84e872a0SLloyd Pique */
5214*84e872a0SLloyd Pique #define WL_OUTPUT_MODE_SINCE_VERSION 1
5215*84e872a0SLloyd Pique /**
5216*84e872a0SLloyd Pique * @ingroup iface_wl_output
5217*84e872a0SLloyd Pique */
5218*84e872a0SLloyd Pique #define WL_OUTPUT_DONE_SINCE_VERSION 2
5219*84e872a0SLloyd Pique /**
5220*84e872a0SLloyd Pique * @ingroup iface_wl_output
5221*84e872a0SLloyd Pique */
5222*84e872a0SLloyd Pique #define WL_OUTPUT_SCALE_SINCE_VERSION 2
5223*84e872a0SLloyd Pique
5224*84e872a0SLloyd Pique /**
5225*84e872a0SLloyd Pique * @ingroup iface_wl_output
5226*84e872a0SLloyd Pique */
5227*84e872a0SLloyd Pique #define WL_OUTPUT_RELEASE_SINCE_VERSION 3
5228*84e872a0SLloyd Pique
5229*84e872a0SLloyd Pique /** @ingroup iface_wl_output */
5230*84e872a0SLloyd Pique static inline void
wl_output_set_user_data(struct wl_output * wl_output,void * user_data)5231*84e872a0SLloyd Pique wl_output_set_user_data(struct wl_output *wl_output, void *user_data)
5232*84e872a0SLloyd Pique {
5233*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_output, user_data);
5234*84e872a0SLloyd Pique }
5235*84e872a0SLloyd Pique
5236*84e872a0SLloyd Pique /** @ingroup iface_wl_output */
5237*84e872a0SLloyd Pique static inline void *
wl_output_get_user_data(struct wl_output * wl_output)5238*84e872a0SLloyd Pique wl_output_get_user_data(struct wl_output *wl_output)
5239*84e872a0SLloyd Pique {
5240*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_output);
5241*84e872a0SLloyd Pique }
5242*84e872a0SLloyd Pique
5243*84e872a0SLloyd Pique static inline uint32_t
wl_output_get_version(struct wl_output * wl_output)5244*84e872a0SLloyd Pique wl_output_get_version(struct wl_output *wl_output)
5245*84e872a0SLloyd Pique {
5246*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_output);
5247*84e872a0SLloyd Pique }
5248*84e872a0SLloyd Pique
5249*84e872a0SLloyd Pique /** @ingroup iface_wl_output */
5250*84e872a0SLloyd Pique static inline void
wl_output_destroy(struct wl_output * wl_output)5251*84e872a0SLloyd Pique wl_output_destroy(struct wl_output *wl_output)
5252*84e872a0SLloyd Pique {
5253*84e872a0SLloyd Pique wl_proxy_destroy((struct wl_proxy *) wl_output);
5254*84e872a0SLloyd Pique }
5255*84e872a0SLloyd Pique
5256*84e872a0SLloyd Pique /**
5257*84e872a0SLloyd Pique * @ingroup iface_wl_output
5258*84e872a0SLloyd Pique *
5259*84e872a0SLloyd Pique * Using this request a client can tell the server that it is not going to
5260*84e872a0SLloyd Pique * use the output object anymore.
5261*84e872a0SLloyd Pique */
5262*84e872a0SLloyd Pique static inline void
wl_output_release(struct wl_output * wl_output)5263*84e872a0SLloyd Pique wl_output_release(struct wl_output *wl_output)
5264*84e872a0SLloyd Pique {
5265*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_output,
5266*84e872a0SLloyd Pique WL_OUTPUT_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_output), WL_MARSHAL_FLAG_DESTROY);
5267*84e872a0SLloyd Pique }
5268*84e872a0SLloyd Pique
5269*84e872a0SLloyd Pique #define WL_REGION_DESTROY 0
5270*84e872a0SLloyd Pique #define WL_REGION_ADD 1
5271*84e872a0SLloyd Pique #define WL_REGION_SUBTRACT 2
5272*84e872a0SLloyd Pique
5273*84e872a0SLloyd Pique
5274*84e872a0SLloyd Pique /**
5275*84e872a0SLloyd Pique * @ingroup iface_wl_region
5276*84e872a0SLloyd Pique */
5277*84e872a0SLloyd Pique #define WL_REGION_DESTROY_SINCE_VERSION 1
5278*84e872a0SLloyd Pique /**
5279*84e872a0SLloyd Pique * @ingroup iface_wl_region
5280*84e872a0SLloyd Pique */
5281*84e872a0SLloyd Pique #define WL_REGION_ADD_SINCE_VERSION 1
5282*84e872a0SLloyd Pique /**
5283*84e872a0SLloyd Pique * @ingroup iface_wl_region
5284*84e872a0SLloyd Pique */
5285*84e872a0SLloyd Pique #define WL_REGION_SUBTRACT_SINCE_VERSION 1
5286*84e872a0SLloyd Pique
5287*84e872a0SLloyd Pique /** @ingroup iface_wl_region */
5288*84e872a0SLloyd Pique static inline void
wl_region_set_user_data(struct wl_region * wl_region,void * user_data)5289*84e872a0SLloyd Pique wl_region_set_user_data(struct wl_region *wl_region, void *user_data)
5290*84e872a0SLloyd Pique {
5291*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_region, user_data);
5292*84e872a0SLloyd Pique }
5293*84e872a0SLloyd Pique
5294*84e872a0SLloyd Pique /** @ingroup iface_wl_region */
5295*84e872a0SLloyd Pique static inline void *
wl_region_get_user_data(struct wl_region * wl_region)5296*84e872a0SLloyd Pique wl_region_get_user_data(struct wl_region *wl_region)
5297*84e872a0SLloyd Pique {
5298*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_region);
5299*84e872a0SLloyd Pique }
5300*84e872a0SLloyd Pique
5301*84e872a0SLloyd Pique static inline uint32_t
wl_region_get_version(struct wl_region * wl_region)5302*84e872a0SLloyd Pique wl_region_get_version(struct wl_region *wl_region)
5303*84e872a0SLloyd Pique {
5304*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_region);
5305*84e872a0SLloyd Pique }
5306*84e872a0SLloyd Pique
5307*84e872a0SLloyd Pique /**
5308*84e872a0SLloyd Pique * @ingroup iface_wl_region
5309*84e872a0SLloyd Pique *
5310*84e872a0SLloyd Pique * Destroy the region. This will invalidate the object ID.
5311*84e872a0SLloyd Pique */
5312*84e872a0SLloyd Pique static inline void
wl_region_destroy(struct wl_region * wl_region)5313*84e872a0SLloyd Pique wl_region_destroy(struct wl_region *wl_region)
5314*84e872a0SLloyd Pique {
5315*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_region,
5316*84e872a0SLloyd Pique WL_REGION_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_region), WL_MARSHAL_FLAG_DESTROY);
5317*84e872a0SLloyd Pique }
5318*84e872a0SLloyd Pique
5319*84e872a0SLloyd Pique /**
5320*84e872a0SLloyd Pique * @ingroup iface_wl_region
5321*84e872a0SLloyd Pique *
5322*84e872a0SLloyd Pique * Add the specified rectangle to the region.
5323*84e872a0SLloyd Pique */
5324*84e872a0SLloyd Pique static inline void
wl_region_add(struct wl_region * wl_region,int32_t x,int32_t y,int32_t width,int32_t height)5325*84e872a0SLloyd Pique wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
5326*84e872a0SLloyd Pique {
5327*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_region,
5328*84e872a0SLloyd Pique WL_REGION_ADD, NULL, wl_proxy_get_version((struct wl_proxy *) wl_region), 0, x, y, width, height);
5329*84e872a0SLloyd Pique }
5330*84e872a0SLloyd Pique
5331*84e872a0SLloyd Pique /**
5332*84e872a0SLloyd Pique * @ingroup iface_wl_region
5333*84e872a0SLloyd Pique *
5334*84e872a0SLloyd Pique * Subtract the specified rectangle from the region.
5335*84e872a0SLloyd Pique */
5336*84e872a0SLloyd Pique static inline void
wl_region_subtract(struct wl_region * wl_region,int32_t x,int32_t y,int32_t width,int32_t height)5337*84e872a0SLloyd Pique wl_region_subtract(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
5338*84e872a0SLloyd Pique {
5339*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_region,
5340*84e872a0SLloyd Pique WL_REGION_SUBTRACT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_region), 0, x, y, width, height);
5341*84e872a0SLloyd Pique }
5342*84e872a0SLloyd Pique
5343*84e872a0SLloyd Pique #ifndef WL_SUBCOMPOSITOR_ERROR_ENUM
5344*84e872a0SLloyd Pique #define WL_SUBCOMPOSITOR_ERROR_ENUM
5345*84e872a0SLloyd Pique enum wl_subcompositor_error {
5346*84e872a0SLloyd Pique /**
5347*84e872a0SLloyd Pique * the to-be sub-surface is invalid
5348*84e872a0SLloyd Pique */
5349*84e872a0SLloyd Pique WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0,
5350*84e872a0SLloyd Pique };
5351*84e872a0SLloyd Pique #endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */
5352*84e872a0SLloyd Pique
5353*84e872a0SLloyd Pique #define WL_SUBCOMPOSITOR_DESTROY 0
5354*84e872a0SLloyd Pique #define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1
5355*84e872a0SLloyd Pique
5356*84e872a0SLloyd Pique
5357*84e872a0SLloyd Pique /**
5358*84e872a0SLloyd Pique * @ingroup iface_wl_subcompositor
5359*84e872a0SLloyd Pique */
5360*84e872a0SLloyd Pique #define WL_SUBCOMPOSITOR_DESTROY_SINCE_VERSION 1
5361*84e872a0SLloyd Pique /**
5362*84e872a0SLloyd Pique * @ingroup iface_wl_subcompositor
5363*84e872a0SLloyd Pique */
5364*84e872a0SLloyd Pique #define WL_SUBCOMPOSITOR_GET_SUBSURFACE_SINCE_VERSION 1
5365*84e872a0SLloyd Pique
5366*84e872a0SLloyd Pique /** @ingroup iface_wl_subcompositor */
5367*84e872a0SLloyd Pique static inline void
wl_subcompositor_set_user_data(struct wl_subcompositor * wl_subcompositor,void * user_data)5368*84e872a0SLloyd Pique wl_subcompositor_set_user_data(struct wl_subcompositor *wl_subcompositor, void *user_data)
5369*84e872a0SLloyd Pique {
5370*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_subcompositor, user_data);
5371*84e872a0SLloyd Pique }
5372*84e872a0SLloyd Pique
5373*84e872a0SLloyd Pique /** @ingroup iface_wl_subcompositor */
5374*84e872a0SLloyd Pique static inline void *
wl_subcompositor_get_user_data(struct wl_subcompositor * wl_subcompositor)5375*84e872a0SLloyd Pique wl_subcompositor_get_user_data(struct wl_subcompositor *wl_subcompositor)
5376*84e872a0SLloyd Pique {
5377*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_subcompositor);
5378*84e872a0SLloyd Pique }
5379*84e872a0SLloyd Pique
5380*84e872a0SLloyd Pique static inline uint32_t
wl_subcompositor_get_version(struct wl_subcompositor * wl_subcompositor)5381*84e872a0SLloyd Pique wl_subcompositor_get_version(struct wl_subcompositor *wl_subcompositor)
5382*84e872a0SLloyd Pique {
5383*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_subcompositor);
5384*84e872a0SLloyd Pique }
5385*84e872a0SLloyd Pique
5386*84e872a0SLloyd Pique /**
5387*84e872a0SLloyd Pique * @ingroup iface_wl_subcompositor
5388*84e872a0SLloyd Pique *
5389*84e872a0SLloyd Pique * Informs the server that the client will not be using this
5390*84e872a0SLloyd Pique * protocol object anymore. This does not affect any other
5391*84e872a0SLloyd Pique * objects, wl_subsurface objects included.
5392*84e872a0SLloyd Pique */
5393*84e872a0SLloyd Pique static inline void
wl_subcompositor_destroy(struct wl_subcompositor * wl_subcompositor)5394*84e872a0SLloyd Pique wl_subcompositor_destroy(struct wl_subcompositor *wl_subcompositor)
5395*84e872a0SLloyd Pique {
5396*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_subcompositor,
5397*84e872a0SLloyd Pique WL_SUBCOMPOSITOR_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subcompositor), WL_MARSHAL_FLAG_DESTROY);
5398*84e872a0SLloyd Pique }
5399*84e872a0SLloyd Pique
5400*84e872a0SLloyd Pique /**
5401*84e872a0SLloyd Pique * @ingroup iface_wl_subcompositor
5402*84e872a0SLloyd Pique *
5403*84e872a0SLloyd Pique * Create a sub-surface interface for the given surface, and
5404*84e872a0SLloyd Pique * associate it with the given parent surface. This turns a
5405*84e872a0SLloyd Pique * plain wl_surface into a sub-surface.
5406*84e872a0SLloyd Pique *
5407*84e872a0SLloyd Pique * The to-be sub-surface must not already have another role, and it
5408*84e872a0SLloyd Pique * must not have an existing wl_subsurface object. Otherwise a protocol
5409*84e872a0SLloyd Pique * error is raised.
5410*84e872a0SLloyd Pique */
5411*84e872a0SLloyd Pique static inline struct wl_subsurface *
wl_subcompositor_get_subsurface(struct wl_subcompositor * wl_subcompositor,struct wl_surface * surface,struct wl_surface * parent)5412*84e872a0SLloyd Pique wl_subcompositor_get_subsurface(struct wl_subcompositor *wl_subcompositor, struct wl_surface *surface, struct wl_surface *parent)
5413*84e872a0SLloyd Pique {
5414*84e872a0SLloyd Pique struct wl_proxy *id;
5415*84e872a0SLloyd Pique
5416*84e872a0SLloyd Pique id = wl_proxy_marshal_flags((struct wl_proxy *) wl_subcompositor,
5417*84e872a0SLloyd Pique WL_SUBCOMPOSITOR_GET_SUBSURFACE, &wl_subsurface_interface, wl_proxy_get_version((struct wl_proxy *) wl_subcompositor), 0, NULL, surface, parent);
5418*84e872a0SLloyd Pique
5419*84e872a0SLloyd Pique return (struct wl_subsurface *) id;
5420*84e872a0SLloyd Pique }
5421*84e872a0SLloyd Pique
5422*84e872a0SLloyd Pique #ifndef WL_SUBSURFACE_ERROR_ENUM
5423*84e872a0SLloyd Pique #define WL_SUBSURFACE_ERROR_ENUM
5424*84e872a0SLloyd Pique enum wl_subsurface_error {
5425*84e872a0SLloyd Pique /**
5426*84e872a0SLloyd Pique * wl_surface is not a sibling or the parent
5427*84e872a0SLloyd Pique */
5428*84e872a0SLloyd Pique WL_SUBSURFACE_ERROR_BAD_SURFACE = 0,
5429*84e872a0SLloyd Pique };
5430*84e872a0SLloyd Pique #endif /* WL_SUBSURFACE_ERROR_ENUM */
5431*84e872a0SLloyd Pique
5432*84e872a0SLloyd Pique #define WL_SUBSURFACE_DESTROY 0
5433*84e872a0SLloyd Pique #define WL_SUBSURFACE_SET_POSITION 1
5434*84e872a0SLloyd Pique #define WL_SUBSURFACE_PLACE_ABOVE 2
5435*84e872a0SLloyd Pique #define WL_SUBSURFACE_PLACE_BELOW 3
5436*84e872a0SLloyd Pique #define WL_SUBSURFACE_SET_SYNC 4
5437*84e872a0SLloyd Pique #define WL_SUBSURFACE_SET_DESYNC 5
5438*84e872a0SLloyd Pique
5439*84e872a0SLloyd Pique
5440*84e872a0SLloyd Pique /**
5441*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5442*84e872a0SLloyd Pique */
5443*84e872a0SLloyd Pique #define WL_SUBSURFACE_DESTROY_SINCE_VERSION 1
5444*84e872a0SLloyd Pique /**
5445*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5446*84e872a0SLloyd Pique */
5447*84e872a0SLloyd Pique #define WL_SUBSURFACE_SET_POSITION_SINCE_VERSION 1
5448*84e872a0SLloyd Pique /**
5449*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5450*84e872a0SLloyd Pique */
5451*84e872a0SLloyd Pique #define WL_SUBSURFACE_PLACE_ABOVE_SINCE_VERSION 1
5452*84e872a0SLloyd Pique /**
5453*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5454*84e872a0SLloyd Pique */
5455*84e872a0SLloyd Pique #define WL_SUBSURFACE_PLACE_BELOW_SINCE_VERSION 1
5456*84e872a0SLloyd Pique /**
5457*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5458*84e872a0SLloyd Pique */
5459*84e872a0SLloyd Pique #define WL_SUBSURFACE_SET_SYNC_SINCE_VERSION 1
5460*84e872a0SLloyd Pique /**
5461*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5462*84e872a0SLloyd Pique */
5463*84e872a0SLloyd Pique #define WL_SUBSURFACE_SET_DESYNC_SINCE_VERSION 1
5464*84e872a0SLloyd Pique
5465*84e872a0SLloyd Pique /** @ingroup iface_wl_subsurface */
5466*84e872a0SLloyd Pique static inline void
wl_subsurface_set_user_data(struct wl_subsurface * wl_subsurface,void * user_data)5467*84e872a0SLloyd Pique wl_subsurface_set_user_data(struct wl_subsurface *wl_subsurface, void *user_data)
5468*84e872a0SLloyd Pique {
5469*84e872a0SLloyd Pique wl_proxy_set_user_data((struct wl_proxy *) wl_subsurface, user_data);
5470*84e872a0SLloyd Pique }
5471*84e872a0SLloyd Pique
5472*84e872a0SLloyd Pique /** @ingroup iface_wl_subsurface */
5473*84e872a0SLloyd Pique static inline void *
wl_subsurface_get_user_data(struct wl_subsurface * wl_subsurface)5474*84e872a0SLloyd Pique wl_subsurface_get_user_data(struct wl_subsurface *wl_subsurface)
5475*84e872a0SLloyd Pique {
5476*84e872a0SLloyd Pique return wl_proxy_get_user_data((struct wl_proxy *) wl_subsurface);
5477*84e872a0SLloyd Pique }
5478*84e872a0SLloyd Pique
5479*84e872a0SLloyd Pique static inline uint32_t
wl_subsurface_get_version(struct wl_subsurface * wl_subsurface)5480*84e872a0SLloyd Pique wl_subsurface_get_version(struct wl_subsurface *wl_subsurface)
5481*84e872a0SLloyd Pique {
5482*84e872a0SLloyd Pique return wl_proxy_get_version((struct wl_proxy *) wl_subsurface);
5483*84e872a0SLloyd Pique }
5484*84e872a0SLloyd Pique
5485*84e872a0SLloyd Pique /**
5486*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5487*84e872a0SLloyd Pique *
5488*84e872a0SLloyd Pique * The sub-surface interface is removed from the wl_surface object
5489*84e872a0SLloyd Pique * that was turned into a sub-surface with a
5490*84e872a0SLloyd Pique * wl_subcompositor.get_subsurface request. The wl_surface's association
5491*84e872a0SLloyd Pique * to the parent is deleted, and the wl_surface loses its role as
5492*84e872a0SLloyd Pique * a sub-surface. The wl_surface is unmapped.
5493*84e872a0SLloyd Pique */
5494*84e872a0SLloyd Pique static inline void
wl_subsurface_destroy(struct wl_subsurface * wl_subsurface)5495*84e872a0SLloyd Pique wl_subsurface_destroy(struct wl_subsurface *wl_subsurface)
5496*84e872a0SLloyd Pique {
5497*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
5498*84e872a0SLloyd Pique WL_SUBSURFACE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), WL_MARSHAL_FLAG_DESTROY);
5499*84e872a0SLloyd Pique }
5500*84e872a0SLloyd Pique
5501*84e872a0SLloyd Pique /**
5502*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5503*84e872a0SLloyd Pique *
5504*84e872a0SLloyd Pique * This schedules a sub-surface position change.
5505*84e872a0SLloyd Pique * The sub-surface will be moved so that its origin (top left
5506*84e872a0SLloyd Pique * corner pixel) will be at the location x, y of the parent surface
5507*84e872a0SLloyd Pique * coordinate system. The coordinates are not restricted to the parent
5508*84e872a0SLloyd Pique * surface area. Negative values are allowed.
5509*84e872a0SLloyd Pique *
5510*84e872a0SLloyd Pique * The scheduled coordinates will take effect whenever the state of the
5511*84e872a0SLloyd Pique * parent surface is applied. When this happens depends on whether the
5512*84e872a0SLloyd Pique * parent surface is in synchronized mode or not. See
5513*84e872a0SLloyd Pique * wl_subsurface.set_sync and wl_subsurface.set_desync for details.
5514*84e872a0SLloyd Pique *
5515*84e872a0SLloyd Pique * If more than one set_position request is invoked by the client before
5516*84e872a0SLloyd Pique * the commit of the parent surface, the position of a new request always
5517*84e872a0SLloyd Pique * replaces the scheduled position from any previous request.
5518*84e872a0SLloyd Pique *
5519*84e872a0SLloyd Pique * The initial position is 0, 0.
5520*84e872a0SLloyd Pique */
5521*84e872a0SLloyd Pique static inline void
wl_subsurface_set_position(struct wl_subsurface * wl_subsurface,int32_t x,int32_t y)5522*84e872a0SLloyd Pique wl_subsurface_set_position(struct wl_subsurface *wl_subsurface, int32_t x, int32_t y)
5523*84e872a0SLloyd Pique {
5524*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
5525*84e872a0SLloyd Pique WL_SUBSURFACE_SET_POSITION, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0, x, y);
5526*84e872a0SLloyd Pique }
5527*84e872a0SLloyd Pique
5528*84e872a0SLloyd Pique /**
5529*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5530*84e872a0SLloyd Pique *
5531*84e872a0SLloyd Pique * This sub-surface is taken from the stack, and put back just
5532*84e872a0SLloyd Pique * above the reference surface, changing the z-order of the sub-surfaces.
5533*84e872a0SLloyd Pique * The reference surface must be one of the sibling surfaces, or the
5534*84e872a0SLloyd Pique * parent surface. Using any other surface, including this sub-surface,
5535*84e872a0SLloyd Pique * will cause a protocol error.
5536*84e872a0SLloyd Pique *
5537*84e872a0SLloyd Pique * The z-order is double-buffered. Requests are handled in order and
5538*84e872a0SLloyd Pique * applied immediately to a pending state. The final pending state is
5539*84e872a0SLloyd Pique * copied to the active state the next time the state of the parent
5540*84e872a0SLloyd Pique * surface is applied. When this happens depends on whether the parent
5541*84e872a0SLloyd Pique * surface is in synchronized mode or not. See wl_subsurface.set_sync and
5542*84e872a0SLloyd Pique * wl_subsurface.set_desync for details.
5543*84e872a0SLloyd Pique *
5544*84e872a0SLloyd Pique * A new sub-surface is initially added as the top-most in the stack
5545*84e872a0SLloyd Pique * of its siblings and parent.
5546*84e872a0SLloyd Pique */
5547*84e872a0SLloyd Pique static inline void
wl_subsurface_place_above(struct wl_subsurface * wl_subsurface,struct wl_surface * sibling)5548*84e872a0SLloyd Pique wl_subsurface_place_above(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
5549*84e872a0SLloyd Pique {
5550*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
5551*84e872a0SLloyd Pique WL_SUBSURFACE_PLACE_ABOVE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0, sibling);
5552*84e872a0SLloyd Pique }
5553*84e872a0SLloyd Pique
5554*84e872a0SLloyd Pique /**
5555*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5556*84e872a0SLloyd Pique *
5557*84e872a0SLloyd Pique * The sub-surface is placed just below the reference surface.
5558*84e872a0SLloyd Pique * See wl_subsurface.place_above.
5559*84e872a0SLloyd Pique */
5560*84e872a0SLloyd Pique static inline void
wl_subsurface_place_below(struct wl_subsurface * wl_subsurface,struct wl_surface * sibling)5561*84e872a0SLloyd Pique wl_subsurface_place_below(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
5562*84e872a0SLloyd Pique {
5563*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
5564*84e872a0SLloyd Pique WL_SUBSURFACE_PLACE_BELOW, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0, sibling);
5565*84e872a0SLloyd Pique }
5566*84e872a0SLloyd Pique
5567*84e872a0SLloyd Pique /**
5568*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5569*84e872a0SLloyd Pique *
5570*84e872a0SLloyd Pique * Change the commit behaviour of the sub-surface to synchronized
5571*84e872a0SLloyd Pique * mode, also described as the parent dependent mode.
5572*84e872a0SLloyd Pique *
5573*84e872a0SLloyd Pique * In synchronized mode, wl_surface.commit on a sub-surface will
5574*84e872a0SLloyd Pique * accumulate the committed state in a cache, but the state will
5575*84e872a0SLloyd Pique * not be applied and hence will not change the compositor output.
5576*84e872a0SLloyd Pique * The cached state is applied to the sub-surface immediately after
5577*84e872a0SLloyd Pique * the parent surface's state is applied. This ensures atomic
5578*84e872a0SLloyd Pique * updates of the parent and all its synchronized sub-surfaces.
5579*84e872a0SLloyd Pique * Applying the cached state will invalidate the cache, so further
5580*84e872a0SLloyd Pique * parent surface commits do not (re-)apply old state.
5581*84e872a0SLloyd Pique *
5582*84e872a0SLloyd Pique * See wl_subsurface for the recursive effect of this mode.
5583*84e872a0SLloyd Pique */
5584*84e872a0SLloyd Pique static inline void
wl_subsurface_set_sync(struct wl_subsurface * wl_subsurface)5585*84e872a0SLloyd Pique wl_subsurface_set_sync(struct wl_subsurface *wl_subsurface)
5586*84e872a0SLloyd Pique {
5587*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
5588*84e872a0SLloyd Pique WL_SUBSURFACE_SET_SYNC, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0);
5589*84e872a0SLloyd Pique }
5590*84e872a0SLloyd Pique
5591*84e872a0SLloyd Pique /**
5592*84e872a0SLloyd Pique * @ingroup iface_wl_subsurface
5593*84e872a0SLloyd Pique *
5594*84e872a0SLloyd Pique * Change the commit behaviour of the sub-surface to desynchronized
5595*84e872a0SLloyd Pique * mode, also described as independent or freely running mode.
5596*84e872a0SLloyd Pique *
5597*84e872a0SLloyd Pique * In desynchronized mode, wl_surface.commit on a sub-surface will
5598*84e872a0SLloyd Pique * apply the pending state directly, without caching, as happens
5599*84e872a0SLloyd Pique * normally with a wl_surface. Calling wl_surface.commit on the
5600*84e872a0SLloyd Pique * parent surface has no effect on the sub-surface's wl_surface
5601*84e872a0SLloyd Pique * state. This mode allows a sub-surface to be updated on its own.
5602*84e872a0SLloyd Pique *
5603*84e872a0SLloyd Pique * If cached state exists when wl_surface.commit is called in
5604*84e872a0SLloyd Pique * desynchronized mode, the pending state is added to the cached
5605*84e872a0SLloyd Pique * state, and applied as a whole. This invalidates the cache.
5606*84e872a0SLloyd Pique *
5607*84e872a0SLloyd Pique * Note: even if a sub-surface is set to desynchronized, a parent
5608*84e872a0SLloyd Pique * sub-surface may override it to behave as synchronized. For details,
5609*84e872a0SLloyd Pique * see wl_subsurface.
5610*84e872a0SLloyd Pique *
5611*84e872a0SLloyd Pique * If a surface's parent surface behaves as desynchronized, then
5612*84e872a0SLloyd Pique * the cached state is applied on set_desync.
5613*84e872a0SLloyd Pique */
5614*84e872a0SLloyd Pique static inline void
wl_subsurface_set_desync(struct wl_subsurface * wl_subsurface)5615*84e872a0SLloyd Pique wl_subsurface_set_desync(struct wl_subsurface *wl_subsurface)
5616*84e872a0SLloyd Pique {
5617*84e872a0SLloyd Pique wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
5618*84e872a0SLloyd Pique WL_SUBSURFACE_SET_DESYNC, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0);
5619*84e872a0SLloyd Pique }
5620*84e872a0SLloyd Pique
5621*84e872a0SLloyd Pique #ifdef __cplusplus
5622*84e872a0SLloyd Pique }
5623*84e872a0SLloyd Pique #endif
5624*84e872a0SLloyd Pique
5625*84e872a0SLloyd Pique #endif
5626