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