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