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