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