OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright © 2008-2011 Kristian Høgsberg |
| 3 * Copyright © 2010-2011 Intel Corporation |
| 4 * Copyright © 2012-2013 Collabora, Ltd. |
| 5 * |
| 6 * Permission is hereby granted, free of charge, to any person |
| 7 * obtaining a copy of this software and associated documentation files |
| 8 * (the "Software"), to deal in the Software without restriction, |
| 9 * including without limitation the rights to use, copy, modify, merge, |
| 10 * publish, distribute, sublicense, and/or sell copies of the Software, |
| 11 * and to permit persons to whom the Software is furnished to do so, |
| 12 * subject to the following conditions: |
| 13 * |
| 14 * The above copyright notice and this permission notice (including the |
| 15 * next paragraph) shall be included in all copies or substantial |
| 16 * portions of the Software. |
| 17 * |
| 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 22 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 23 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 25 * SOFTWARE. |
| 26 */ |
| 27 |
| 28 #ifndef WAYLAND_CLIENT_PROTOCOL_H |
| 29 #define WAYLAND_CLIENT_PROTOCOL_H |
| 30 |
| 31 #ifdef __cplusplus |
| 32 extern "C" { |
| 33 #endif |
| 34 |
| 35 #include <stdint.h> |
| 36 #include <stddef.h> |
| 37 #include "wayland-client.h" |
| 38 |
| 39 struct wl_client; |
| 40 struct wl_resource; |
| 41 |
| 42 struct wl_buffer; |
| 43 struct wl_callback; |
| 44 struct wl_compositor; |
| 45 struct wl_data_device; |
| 46 struct wl_data_device_manager; |
| 47 struct wl_data_offer; |
| 48 struct wl_data_source; |
| 49 struct wl_display; |
| 50 struct wl_keyboard; |
| 51 struct wl_output; |
| 52 struct wl_pointer; |
| 53 struct wl_region; |
| 54 struct wl_registry; |
| 55 struct wl_seat; |
| 56 struct wl_shell; |
| 57 struct wl_shell_surface; |
| 58 struct wl_shm; |
| 59 struct wl_shm_pool; |
| 60 struct wl_subcompositor; |
| 61 struct wl_subsurface; |
| 62 struct wl_surface; |
| 63 struct wl_touch; |
| 64 |
| 65 extern const struct wl_interface wl_display_interface; |
| 66 extern const struct wl_interface wl_registry_interface; |
| 67 extern const struct wl_interface wl_callback_interface; |
| 68 extern const struct wl_interface wl_compositor_interface; |
| 69 extern const struct wl_interface wl_shm_pool_interface; |
| 70 extern const struct wl_interface wl_shm_interface; |
| 71 extern const struct wl_interface wl_buffer_interface; |
| 72 extern const struct wl_interface wl_data_offer_interface; |
| 73 extern const struct wl_interface wl_data_source_interface; |
| 74 extern const struct wl_interface wl_data_device_interface; |
| 75 extern const struct wl_interface wl_data_device_manager_interface; |
| 76 extern const struct wl_interface wl_shell_interface; |
| 77 extern const struct wl_interface wl_shell_surface_interface; |
| 78 extern const struct wl_interface wl_surface_interface; |
| 79 extern const struct wl_interface wl_seat_interface; |
| 80 extern const struct wl_interface wl_pointer_interface; |
| 81 extern const struct wl_interface wl_keyboard_interface; |
| 82 extern const struct wl_interface wl_touch_interface; |
| 83 extern const struct wl_interface wl_output_interface; |
| 84 extern const struct wl_interface wl_region_interface; |
| 85 extern const struct wl_interface wl_subcompositor_interface; |
| 86 extern const struct wl_interface wl_subsurface_interface; |
| 87 |
| 88 #ifndef WL_DISPLAY_ERROR_ENUM |
| 89 #define WL_DISPLAY_ERROR_ENUM |
| 90 /** |
| 91 * wl_display_error - global error values |
| 92 * @WL_DISPLAY_ERROR_INVALID_OBJECT: server couldn't find object |
| 93 * @WL_DISPLAY_ERROR_INVALID_METHOD: method doesn't exist on the |
| 94 * specified interface |
| 95 * @WL_DISPLAY_ERROR_NO_MEMORY: server is out of memory |
| 96 * |
| 97 * These errors are global and can be emitted in response to any server |
| 98 * request. |
| 99 */ |
| 100 enum wl_display_error { |
| 101 WL_DISPLAY_ERROR_INVALID_OBJECT = 0, |
| 102 WL_DISPLAY_ERROR_INVALID_METHOD = 1, |
| 103 WL_DISPLAY_ERROR_NO_MEMORY = 2, |
| 104 }; |
| 105 #endif /* WL_DISPLAY_ERROR_ENUM */ |
| 106 |
| 107 /** |
| 108 * wl_display - core global object |
| 109 * @error: fatal error event |
| 110 * @delete_id: acknowledge object ID deletion |
| 111 * |
| 112 * The core global object. This is a special singleton object. It is used |
| 113 * for internal Wayland protocol features. |
| 114 */ |
| 115 struct wl_display_listener { |
| 116 /** |
| 117 * error - fatal error event |
| 118 * @object_id: (none) |
| 119 * @code: (none) |
| 120 * @message: (none) |
| 121 * |
| 122 * The error event is sent out when a fatal (non-recoverable) |
| 123 * error has occurred. The object_id argument is the object where |
| 124 * the error occurred, most often in response to a request to that |
| 125 * object. The code identifies the error and is defined by the |
| 126 * object interface. As such, each interface defines its own set of |
| 127 * error codes. The message is an brief description of the error, |
| 128 * for (debugging) convenience. |
| 129 */ |
| 130 void (*error)(void *data, |
| 131 struct wl_display *wl_display, |
| 132 void *object_id, |
| 133 uint32_t code, |
| 134 const char *message); |
| 135 /** |
| 136 * delete_id - acknowledge object ID deletion |
| 137 * @id: (none) |
| 138 * |
| 139 * This event is used internally by the object ID management |
| 140 * logic. When a client deletes an object, the server will send |
| 141 * this event to acknowledge that it has seen the delete request. |
| 142 * When the client receive this event, it will know that it can |
| 143 * safely reuse the object ID. |
| 144 */ |
| 145 void (*delete_id)(void *data, |
| 146 struct wl_display *wl_display, |
| 147 uint32_t id); |
| 148 }; |
| 149 |
| 150 static inline int |
| 151 wl_display_add_listener(struct wl_display *wl_display, |
| 152 const struct wl_display_listener *listener, void *data) |
| 153 { |
| 154 return wl_proxy_add_listener((struct wl_proxy *) wl_display, |
| 155 (void (**)(void)) listener, data); |
| 156 } |
| 157 |
| 158 #define WL_DISPLAY_SYNC 0 |
| 159 #define WL_DISPLAY_GET_REGISTRY 1 |
| 160 |
| 161 static inline void |
| 162 wl_display_set_user_data(struct wl_display *wl_display, void *user_data) |
| 163 { |
| 164 wl_proxy_set_user_data((struct wl_proxy *) wl_display, user_data); |
| 165 } |
| 166 |
| 167 static inline void * |
| 168 wl_display_get_user_data(struct wl_display *wl_display) |
| 169 { |
| 170 return wl_proxy_get_user_data((struct wl_proxy *) wl_display); |
| 171 } |
| 172 |
| 173 static inline struct wl_callback * |
| 174 wl_display_sync(struct wl_display *wl_display) |
| 175 { |
| 176 struct wl_proxy *callback; |
| 177 |
| 178 callback = wl_proxy_marshal_constructor((struct wl_proxy *) wl_display, |
| 179 WL_DISPLAY_SYNC, &wl_callback_interface, NULL); |
| 180 |
| 181 return (struct wl_callback *) callback; |
| 182 } |
| 183 |
| 184 static inline struct wl_registry * |
| 185 wl_display_get_registry(struct wl_display *wl_display) |
| 186 { |
| 187 struct wl_proxy *registry; |
| 188 |
| 189 registry = wl_proxy_marshal_constructor((struct wl_proxy *) wl_display, |
| 190 WL_DISPLAY_GET_REGISTRY, &wl_registry_interface, NULL); |
| 191 |
| 192 return (struct wl_registry *) registry; |
| 193 } |
| 194 |
| 195 /** |
| 196 * wl_registry - global registry object |
| 197 * @global: announce global object |
| 198 * @global_remove: announce removal of global object |
| 199 * |
| 200 * The global registry object. The server has a number of global objects |
| 201 * that are available to all clients. These objects typically represent an |
| 202 * actual object in the server (for example, an input device) or they are |
| 203 * singleton objects that provide extension functionality. |
| 204 * |
| 205 * When a client creates a registry object, the registry object will emit a |
| 206 * global event for each global currently in the registry. Globals come and |
| 207 * go as a result of device or monitor hotplugs, reconfiguration or other |
| 208 * events, and the registry will send out global and global_remove events |
| 209 * to keep the client up to date with the changes. To mark the end of the |
| 210 * initial burst of events, the client can use the wl_display.sync request |
| 211 * immediately after calling wl_display.get_registry. |
| 212 * |
| 213 * A client can bind to a global object by using the bind request. This |
| 214 * creates a client-side handle that lets the object emit events to the |
| 215 * client and lets the client invoke requests on the object. |
| 216 */ |
| 217 struct wl_registry_listener { |
| 218 /** |
| 219 * global - announce global object |
| 220 * @name: (none) |
| 221 * @interface: (none) |
| 222 * @version: (none) |
| 223 * |
| 224 * Notify the client of global objects. |
| 225 * |
| 226 * The event notifies the client that a global object with the |
| 227 * given name is now available, and it implements the given version |
| 228 * of the given interface. |
| 229 */ |
| 230 void (*global)(void *data, |
| 231 struct wl_registry *wl_registry, |
| 232 uint32_t name, |
| 233 const char *interface, |
| 234 uint32_t version); |
| 235 /** |
| 236 * global_remove - announce removal of global object |
| 237 * @name: (none) |
| 238 * |
| 239 * Notify the client of removed global objects. |
| 240 * |
| 241 * This event notifies the client that the global identified by |
| 242 * name is no longer available. If the client bound to the global |
| 243 * using the bind request, the client should now destroy that |
| 244 * object. |
| 245 * |
| 246 * The object remains valid and requests to the object will be |
| 247 * ignored until the client destroys it, to avoid races between the |
| 248 * global going away and a client sending a request to it. |
| 249 */ |
| 250 void (*global_remove)(void *data, |
| 251 struct wl_registry *wl_registry, |
| 252 uint32_t name); |
| 253 }; |
| 254 |
| 255 static inline int |
| 256 wl_registry_add_listener(struct wl_registry *wl_registry, |
| 257 const struct wl_registry_listener *listener, void *data
) |
| 258 { |
| 259 return wl_proxy_add_listener((struct wl_proxy *) wl_registry, |
| 260 (void (**)(void)) listener, data); |
| 261 } |
| 262 |
| 263 #define WL_REGISTRY_BIND 0 |
| 264 |
| 265 static inline void |
| 266 wl_registry_set_user_data(struct wl_registry *wl_registry, void *user_data) |
| 267 { |
| 268 wl_proxy_set_user_data((struct wl_proxy *) wl_registry, user_data); |
| 269 } |
| 270 |
| 271 static inline void * |
| 272 wl_registry_get_user_data(struct wl_registry *wl_registry) |
| 273 { |
| 274 return wl_proxy_get_user_data((struct wl_proxy *) wl_registry); |
| 275 } |
| 276 |
| 277 static inline void |
| 278 wl_registry_destroy(struct wl_registry *wl_registry) |
| 279 { |
| 280 wl_proxy_destroy((struct wl_proxy *) wl_registry); |
| 281 } |
| 282 |
| 283 static inline void * |
| 284 wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl
_interface *interface, uint32_t version) |
| 285 { |
| 286 struct wl_proxy *id; |
| 287 |
| 288 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_registry, |
| 289 WL_REGISTRY_BIND, interface, name, interface->name, ver
sion, NULL); |
| 290 |
| 291 return (void *) id; |
| 292 } |
| 293 |
| 294 /** |
| 295 * wl_callback - callback object |
| 296 * @done: done event |
| 297 * |
| 298 * Clients can handle the 'done' event to get notified when the related |
| 299 * request is done. |
| 300 */ |
| 301 struct wl_callback_listener { |
| 302 /** |
| 303 * done - done event |
| 304 * @callback_data: request-specific data for the wl_callback |
| 305 * |
| 306 * Notify the client when the related request is done. |
| 307 */ |
| 308 void (*done)(void *data, |
| 309 struct wl_callback *wl_callback, |
| 310 uint32_t callback_data); |
| 311 }; |
| 312 |
| 313 static inline int |
| 314 wl_callback_add_listener(struct wl_callback *wl_callback, |
| 315 const struct wl_callback_listener *listener, void *data
) |
| 316 { |
| 317 return wl_proxy_add_listener((struct wl_proxy *) wl_callback, |
| 318 (void (**)(void)) listener, data); |
| 319 } |
| 320 |
| 321 static inline void |
| 322 wl_callback_set_user_data(struct wl_callback *wl_callback, void *user_data) |
| 323 { |
| 324 wl_proxy_set_user_data((struct wl_proxy *) wl_callback, user_data); |
| 325 } |
| 326 |
| 327 static inline void * |
| 328 wl_callback_get_user_data(struct wl_callback *wl_callback) |
| 329 { |
| 330 return wl_proxy_get_user_data((struct wl_proxy *) wl_callback); |
| 331 } |
| 332 |
| 333 static inline void |
| 334 wl_callback_destroy(struct wl_callback *wl_callback) |
| 335 { |
| 336 wl_proxy_destroy((struct wl_proxy *) wl_callback); |
| 337 } |
| 338 |
| 339 #define WL_COMPOSITOR_CREATE_SURFACE 0 |
| 340 #define WL_COMPOSITOR_CREATE_REGION 1 |
| 341 |
| 342 static inline void |
| 343 wl_compositor_set_user_data(struct wl_compositor *wl_compositor, void *user_data
) |
| 344 { |
| 345 wl_proxy_set_user_data((struct wl_proxy *) wl_compositor, user_data); |
| 346 } |
| 347 |
| 348 static inline void * |
| 349 wl_compositor_get_user_data(struct wl_compositor *wl_compositor) |
| 350 { |
| 351 return wl_proxy_get_user_data((struct wl_proxy *) wl_compositor); |
| 352 } |
| 353 |
| 354 static inline void |
| 355 wl_compositor_destroy(struct wl_compositor *wl_compositor) |
| 356 { |
| 357 wl_proxy_destroy((struct wl_proxy *) wl_compositor); |
| 358 } |
| 359 |
| 360 static inline struct wl_surface * |
| 361 wl_compositor_create_surface(struct wl_compositor *wl_compositor) |
| 362 { |
| 363 struct wl_proxy *id; |
| 364 |
| 365 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_compositor, |
| 366 WL_COMPOSITOR_CREATE_SURFACE, &wl_surface_interface, NU
LL); |
| 367 |
| 368 return (struct wl_surface *) id; |
| 369 } |
| 370 |
| 371 static inline struct wl_region * |
| 372 wl_compositor_create_region(struct wl_compositor *wl_compositor) |
| 373 { |
| 374 struct wl_proxy *id; |
| 375 |
| 376 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_compositor, |
| 377 WL_COMPOSITOR_CREATE_REGION, &wl_region_interface, NULL
); |
| 378 |
| 379 return (struct wl_region *) id; |
| 380 } |
| 381 |
| 382 #define WL_SHM_POOL_CREATE_BUFFER 0 |
| 383 #define WL_SHM_POOL_DESTROY 1 |
| 384 #define WL_SHM_POOL_RESIZE 2 |
| 385 |
| 386 static inline void |
| 387 wl_shm_pool_set_user_data(struct wl_shm_pool *wl_shm_pool, void *user_data) |
| 388 { |
| 389 wl_proxy_set_user_data((struct wl_proxy *) wl_shm_pool, user_data); |
| 390 } |
| 391 |
| 392 static inline void * |
| 393 wl_shm_pool_get_user_data(struct wl_shm_pool *wl_shm_pool) |
| 394 { |
| 395 return wl_proxy_get_user_data((struct wl_proxy *) wl_shm_pool); |
| 396 } |
| 397 |
| 398 static inline struct wl_buffer * |
| 399 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) |
| 400 { |
| 401 struct wl_proxy *id; |
| 402 |
| 403 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shm_pool, |
| 404 WL_SHM_POOL_CREATE_BUFFER, &wl_buffer_interface, NULL,
offset, width, height, stride, format); |
| 405 |
| 406 return (struct wl_buffer *) id; |
| 407 } |
| 408 |
| 409 static inline void |
| 410 wl_shm_pool_destroy(struct wl_shm_pool *wl_shm_pool) |
| 411 { |
| 412 wl_proxy_marshal((struct wl_proxy *) wl_shm_pool, |
| 413 WL_SHM_POOL_DESTROY); |
| 414 |
| 415 wl_proxy_destroy((struct wl_proxy *) wl_shm_pool); |
| 416 } |
| 417 |
| 418 static inline void |
| 419 wl_shm_pool_resize(struct wl_shm_pool *wl_shm_pool, int32_t size) |
| 420 { |
| 421 wl_proxy_marshal((struct wl_proxy *) wl_shm_pool, |
| 422 WL_SHM_POOL_RESIZE, size); |
| 423 } |
| 424 |
| 425 #ifndef WL_SHM_ERROR_ENUM |
| 426 #define WL_SHM_ERROR_ENUM |
| 427 /** |
| 428 * wl_shm_error - wl_shm error values |
| 429 * @WL_SHM_ERROR_INVALID_FORMAT: buffer format is not known |
| 430 * @WL_SHM_ERROR_INVALID_STRIDE: invalid size or stride during pool or |
| 431 * buffer creation |
| 432 * @WL_SHM_ERROR_INVALID_FD: mmapping the file descriptor failed |
| 433 * |
| 434 * These errors can be emitted in response to wl_shm requests. |
| 435 */ |
| 436 enum wl_shm_error { |
| 437 WL_SHM_ERROR_INVALID_FORMAT = 0, |
| 438 WL_SHM_ERROR_INVALID_STRIDE = 1, |
| 439 WL_SHM_ERROR_INVALID_FD = 2, |
| 440 }; |
| 441 #endif /* WL_SHM_ERROR_ENUM */ |
| 442 |
| 443 #ifndef WL_SHM_FORMAT_ENUM |
| 444 #define WL_SHM_FORMAT_ENUM |
| 445 /** |
| 446 * wl_shm_format - pixel formats |
| 447 * @WL_SHM_FORMAT_ARGB8888: 32-bit ARGB format |
| 448 * @WL_SHM_FORMAT_XRGB8888: 32-bit RGB format |
| 449 * @WL_SHM_FORMAT_C8: (none) |
| 450 * @WL_SHM_FORMAT_RGB332: (none) |
| 451 * @WL_SHM_FORMAT_BGR233: (none) |
| 452 * @WL_SHM_FORMAT_XRGB4444: (none) |
| 453 * @WL_SHM_FORMAT_XBGR4444: (none) |
| 454 * @WL_SHM_FORMAT_RGBX4444: (none) |
| 455 * @WL_SHM_FORMAT_BGRX4444: (none) |
| 456 * @WL_SHM_FORMAT_ARGB4444: (none) |
| 457 * @WL_SHM_FORMAT_ABGR4444: (none) |
| 458 * @WL_SHM_FORMAT_RGBA4444: (none) |
| 459 * @WL_SHM_FORMAT_BGRA4444: (none) |
| 460 * @WL_SHM_FORMAT_XRGB1555: (none) |
| 461 * @WL_SHM_FORMAT_XBGR1555: (none) |
| 462 * @WL_SHM_FORMAT_RGBX5551: (none) |
| 463 * @WL_SHM_FORMAT_BGRX5551: (none) |
| 464 * @WL_SHM_FORMAT_ARGB1555: (none) |
| 465 * @WL_SHM_FORMAT_ABGR1555: (none) |
| 466 * @WL_SHM_FORMAT_RGBA5551: (none) |
| 467 * @WL_SHM_FORMAT_BGRA5551: (none) |
| 468 * @WL_SHM_FORMAT_RGB565: (none) |
| 469 * @WL_SHM_FORMAT_BGR565: (none) |
| 470 * @WL_SHM_FORMAT_RGB888: (none) |
| 471 * @WL_SHM_FORMAT_BGR888: (none) |
| 472 * @WL_SHM_FORMAT_XBGR8888: (none) |
| 473 * @WL_SHM_FORMAT_RGBX8888: (none) |
| 474 * @WL_SHM_FORMAT_BGRX8888: (none) |
| 475 * @WL_SHM_FORMAT_ABGR8888: (none) |
| 476 * @WL_SHM_FORMAT_RGBA8888: (none) |
| 477 * @WL_SHM_FORMAT_BGRA8888: (none) |
| 478 * @WL_SHM_FORMAT_XRGB2101010: (none) |
| 479 * @WL_SHM_FORMAT_XBGR2101010: (none) |
| 480 * @WL_SHM_FORMAT_RGBX1010102: (none) |
| 481 * @WL_SHM_FORMAT_BGRX1010102: (none) |
| 482 * @WL_SHM_FORMAT_ARGB2101010: (none) |
| 483 * @WL_SHM_FORMAT_ABGR2101010: (none) |
| 484 * @WL_SHM_FORMAT_RGBA1010102: (none) |
| 485 * @WL_SHM_FORMAT_BGRA1010102: (none) |
| 486 * @WL_SHM_FORMAT_YUYV: (none) |
| 487 * @WL_SHM_FORMAT_YVYU: (none) |
| 488 * @WL_SHM_FORMAT_UYVY: (none) |
| 489 * @WL_SHM_FORMAT_VYUY: (none) |
| 490 * @WL_SHM_FORMAT_AYUV: (none) |
| 491 * @WL_SHM_FORMAT_NV12: (none) |
| 492 * @WL_SHM_FORMAT_NV21: (none) |
| 493 * @WL_SHM_FORMAT_NV16: (none) |
| 494 * @WL_SHM_FORMAT_NV61: (none) |
| 495 * @WL_SHM_FORMAT_YUV410: (none) |
| 496 * @WL_SHM_FORMAT_YVU410: (none) |
| 497 * @WL_SHM_FORMAT_YUV411: (none) |
| 498 * @WL_SHM_FORMAT_YVU411: (none) |
| 499 * @WL_SHM_FORMAT_YUV420: (none) |
| 500 * @WL_SHM_FORMAT_YVU420: (none) |
| 501 * @WL_SHM_FORMAT_YUV422: (none) |
| 502 * @WL_SHM_FORMAT_YVU422: (none) |
| 503 * @WL_SHM_FORMAT_YUV444: (none) |
| 504 * @WL_SHM_FORMAT_YVU444: (none) |
| 505 * |
| 506 * This describes the memory layout of an individual pixel. |
| 507 * |
| 508 * All renderers should support argb8888 and xrgb8888 but any other formats |
| 509 * are optional and may not be supported by the particular renderer in use. |
| 510 */ |
| 511 enum wl_shm_format { |
| 512 WL_SHM_FORMAT_ARGB8888 = 0, |
| 513 WL_SHM_FORMAT_XRGB8888 = 1, |
| 514 WL_SHM_FORMAT_C8 = 0x20203843, |
| 515 WL_SHM_FORMAT_RGB332 = 0x38424752, |
| 516 WL_SHM_FORMAT_BGR233 = 0x38524742, |
| 517 WL_SHM_FORMAT_XRGB4444 = 0x32315258, |
| 518 WL_SHM_FORMAT_XBGR4444 = 0x32314258, |
| 519 WL_SHM_FORMAT_RGBX4444 = 0x32315852, |
| 520 WL_SHM_FORMAT_BGRX4444 = 0x32315842, |
| 521 WL_SHM_FORMAT_ARGB4444 = 0x32315241, |
| 522 WL_SHM_FORMAT_ABGR4444 = 0x32314241, |
| 523 WL_SHM_FORMAT_RGBA4444 = 0x32314152, |
| 524 WL_SHM_FORMAT_BGRA4444 = 0x32314142, |
| 525 WL_SHM_FORMAT_XRGB1555 = 0x35315258, |
| 526 WL_SHM_FORMAT_XBGR1555 = 0x35314258, |
| 527 WL_SHM_FORMAT_RGBX5551 = 0x35315852, |
| 528 WL_SHM_FORMAT_BGRX5551 = 0x35315842, |
| 529 WL_SHM_FORMAT_ARGB1555 = 0x35315241, |
| 530 WL_SHM_FORMAT_ABGR1555 = 0x35314241, |
| 531 WL_SHM_FORMAT_RGBA5551 = 0x35314152, |
| 532 WL_SHM_FORMAT_BGRA5551 = 0x35314142, |
| 533 WL_SHM_FORMAT_RGB565 = 0x36314752, |
| 534 WL_SHM_FORMAT_BGR565 = 0x36314742, |
| 535 WL_SHM_FORMAT_RGB888 = 0x34324752, |
| 536 WL_SHM_FORMAT_BGR888 = 0x34324742, |
| 537 WL_SHM_FORMAT_XBGR8888 = 0x34324258, |
| 538 WL_SHM_FORMAT_RGBX8888 = 0x34325852, |
| 539 WL_SHM_FORMAT_BGRX8888 = 0x34325842, |
| 540 WL_SHM_FORMAT_ABGR8888 = 0x34324241, |
| 541 WL_SHM_FORMAT_RGBA8888 = 0x34324152, |
| 542 WL_SHM_FORMAT_BGRA8888 = 0x34324142, |
| 543 WL_SHM_FORMAT_XRGB2101010 = 0x30335258, |
| 544 WL_SHM_FORMAT_XBGR2101010 = 0x30334258, |
| 545 WL_SHM_FORMAT_RGBX1010102 = 0x30335852, |
| 546 WL_SHM_FORMAT_BGRX1010102 = 0x30335842, |
| 547 WL_SHM_FORMAT_ARGB2101010 = 0x30335241, |
| 548 WL_SHM_FORMAT_ABGR2101010 = 0x30334241, |
| 549 WL_SHM_FORMAT_RGBA1010102 = 0x30334152, |
| 550 WL_SHM_FORMAT_BGRA1010102 = 0x30334142, |
| 551 WL_SHM_FORMAT_YUYV = 0x56595559, |
| 552 WL_SHM_FORMAT_YVYU = 0x55595659, |
| 553 WL_SHM_FORMAT_UYVY = 0x59565955, |
| 554 WL_SHM_FORMAT_VYUY = 0x59555956, |
| 555 WL_SHM_FORMAT_AYUV = 0x56555941, |
| 556 WL_SHM_FORMAT_NV12 = 0x3231564e, |
| 557 WL_SHM_FORMAT_NV21 = 0x3132564e, |
| 558 WL_SHM_FORMAT_NV16 = 0x3631564e, |
| 559 WL_SHM_FORMAT_NV61 = 0x3136564e, |
| 560 WL_SHM_FORMAT_YUV410 = 0x39565559, |
| 561 WL_SHM_FORMAT_YVU410 = 0x39555659, |
| 562 WL_SHM_FORMAT_YUV411 = 0x31315559, |
| 563 WL_SHM_FORMAT_YVU411 = 0x31315659, |
| 564 WL_SHM_FORMAT_YUV420 = 0x32315559, |
| 565 WL_SHM_FORMAT_YVU420 = 0x32315659, |
| 566 WL_SHM_FORMAT_YUV422 = 0x36315559, |
| 567 WL_SHM_FORMAT_YVU422 = 0x36315659, |
| 568 WL_SHM_FORMAT_YUV444 = 0x34325559, |
| 569 WL_SHM_FORMAT_YVU444 = 0x34325659, |
| 570 }; |
| 571 #endif /* WL_SHM_FORMAT_ENUM */ |
| 572 |
| 573 /** |
| 574 * wl_shm - shared memory support |
| 575 * @format: pixel format description |
| 576 * |
| 577 * A global singleton object that provides support for shared memory. |
| 578 * |
| 579 * Clients can create wl_shm_pool objects using the create_pool request. |
| 580 * |
| 581 * At connection setup time, the wl_shm object emits one or more format |
| 582 * events to inform clients about the valid pixel formats that can be used |
| 583 * for buffers. |
| 584 */ |
| 585 struct wl_shm_listener { |
| 586 /** |
| 587 * format - pixel format description |
| 588 * @format: (none) |
| 589 * |
| 590 * Informs the client about a valid pixel format that can be used |
| 591 * for buffers. Known formats include argb8888 and xrgb8888. |
| 592 */ |
| 593 void (*format)(void *data, |
| 594 struct wl_shm *wl_shm, |
| 595 uint32_t format); |
| 596 }; |
| 597 |
| 598 static inline int |
| 599 wl_shm_add_listener(struct wl_shm *wl_shm, |
| 600 const struct wl_shm_listener *listener, void *data) |
| 601 { |
| 602 return wl_proxy_add_listener((struct wl_proxy *) wl_shm, |
| 603 (void (**)(void)) listener, data); |
| 604 } |
| 605 |
| 606 #define WL_SHM_CREATE_POOL 0 |
| 607 |
| 608 static inline void |
| 609 wl_shm_set_user_data(struct wl_shm *wl_shm, void *user_data) |
| 610 { |
| 611 wl_proxy_set_user_data((struct wl_proxy *) wl_shm, user_data); |
| 612 } |
| 613 |
| 614 static inline void * |
| 615 wl_shm_get_user_data(struct wl_shm *wl_shm) |
| 616 { |
| 617 return wl_proxy_get_user_data((struct wl_proxy *) wl_shm); |
| 618 } |
| 619 |
| 620 static inline void |
| 621 wl_shm_destroy(struct wl_shm *wl_shm) |
| 622 { |
| 623 wl_proxy_destroy((struct wl_proxy *) wl_shm); |
| 624 } |
| 625 |
| 626 static inline struct wl_shm_pool * |
| 627 wl_shm_create_pool(struct wl_shm *wl_shm, int32_t fd, int32_t size) |
| 628 { |
| 629 struct wl_proxy *id; |
| 630 |
| 631 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shm, |
| 632 WL_SHM_CREATE_POOL, &wl_shm_pool_interface, NULL, fd, s
ize); |
| 633 |
| 634 return (struct wl_shm_pool *) id; |
| 635 } |
| 636 |
| 637 /** |
| 638 * wl_buffer - content for a wl_surface |
| 639 * @release: compositor releases buffer |
| 640 * |
| 641 * A buffer provides the content for a wl_surface. Buffers are created |
| 642 * through factory interfaces such as wl_drm, wl_shm or similar. It has a |
| 643 * width and a height and can be attached to a wl_surface, but the |
| 644 * mechanism by which a client provides and updates the contents is defined |
| 645 * by the buffer factory interface. |
| 646 */ |
| 647 struct wl_buffer_listener { |
| 648 /** |
| 649 * release - compositor releases buffer |
| 650 * |
| 651 * Sent when this wl_buffer is no longer used by the compositor. |
| 652 * The client is now free to re-use or destroy this buffer and its |
| 653 * backing storage. |
| 654 * |
| 655 * If a client receives a release event before the frame callback |
| 656 * requested in the same wl_surface.commit that attaches this |
| 657 * wl_buffer to a surface, then the client is immediately free to |
| 658 * re-use the buffer and its backing storage, and does not need a |
| 659 * second buffer for the next surface content update. Typically |
| 660 * this is possible, when the compositor maintains a copy of the |
| 661 * wl_surface contents, e.g. as a GL texture. This is an important |
| 662 * optimization for GL(ES) compositors with wl_shm clients. |
| 663 */ |
| 664 void (*release)(void *data, |
| 665 struct wl_buffer *wl_buffer); |
| 666 }; |
| 667 |
| 668 static inline int |
| 669 wl_buffer_add_listener(struct wl_buffer *wl_buffer, |
| 670 const struct wl_buffer_listener *listener, void *data) |
| 671 { |
| 672 return wl_proxy_add_listener((struct wl_proxy *) wl_buffer, |
| 673 (void (**)(void)) listener, data); |
| 674 } |
| 675 |
| 676 #define WL_BUFFER_DESTROY 0 |
| 677 |
| 678 static inline void |
| 679 wl_buffer_set_user_data(struct wl_buffer *wl_buffer, void *user_data) |
| 680 { |
| 681 wl_proxy_set_user_data((struct wl_proxy *) wl_buffer, user_data); |
| 682 } |
| 683 |
| 684 static inline void * |
| 685 wl_buffer_get_user_data(struct wl_buffer *wl_buffer) |
| 686 { |
| 687 return wl_proxy_get_user_data((struct wl_proxy *) wl_buffer); |
| 688 } |
| 689 |
| 690 static inline void |
| 691 wl_buffer_destroy(struct wl_buffer *wl_buffer) |
| 692 { |
| 693 wl_proxy_marshal((struct wl_proxy *) wl_buffer, |
| 694 WL_BUFFER_DESTROY); |
| 695 |
| 696 wl_proxy_destroy((struct wl_proxy *) wl_buffer); |
| 697 } |
| 698 |
| 699 /** |
| 700 * wl_data_offer - offer to transfer data |
| 701 * @offer: advertise offered mime type |
| 702 * |
| 703 * A wl_data_offer represents a piece of data offered for transfer by |
| 704 * another client (the source client). It is used by the copy-and-paste and |
| 705 * drag-and-drop mechanisms. The offer describes the different mime types |
| 706 * that the data can be converted to and provides the mechanism for |
| 707 * transferring the data directly from the source client. |
| 708 */ |
| 709 struct wl_data_offer_listener { |
| 710 /** |
| 711 * offer - advertise offered mime type |
| 712 * @mime_type: (none) |
| 713 * |
| 714 * Sent immediately after creating the wl_data_offer object. One |
| 715 * event per offered mime type. |
| 716 */ |
| 717 void (*offer)(void *data, |
| 718 struct wl_data_offer *wl_data_offer, |
| 719 const char *mime_type); |
| 720 }; |
| 721 |
| 722 static inline int |
| 723 wl_data_offer_add_listener(struct wl_data_offer *wl_data_offer, |
| 724 const struct wl_data_offer_listener *listener, void *
data) |
| 725 { |
| 726 return wl_proxy_add_listener((struct wl_proxy *) wl_data_offer, |
| 727 (void (**)(void)) listener, data); |
| 728 } |
| 729 |
| 730 #define WL_DATA_OFFER_ACCEPT 0 |
| 731 #define WL_DATA_OFFER_RECEIVE 1 |
| 732 #define WL_DATA_OFFER_DESTROY 2 |
| 733 |
| 734 static inline void |
| 735 wl_data_offer_set_user_data(struct wl_data_offer *wl_data_offer, void *user_data
) |
| 736 { |
| 737 wl_proxy_set_user_data((struct wl_proxy *) wl_data_offer, user_data); |
| 738 } |
| 739 |
| 740 static inline void * |
| 741 wl_data_offer_get_user_data(struct wl_data_offer *wl_data_offer) |
| 742 { |
| 743 return wl_proxy_get_user_data((struct wl_proxy *) wl_data_offer); |
| 744 } |
| 745 |
| 746 static inline void |
| 747 wl_data_offer_accept(struct wl_data_offer *wl_data_offer, uint32_t serial, const
char *mime_type) |
| 748 { |
| 749 wl_proxy_marshal((struct wl_proxy *) wl_data_offer, |
| 750 WL_DATA_OFFER_ACCEPT, serial, mime_type); |
| 751 } |
| 752 |
| 753 static inline void |
| 754 wl_data_offer_receive(struct wl_data_offer *wl_data_offer, const char *mime_type
, int32_t fd) |
| 755 { |
| 756 wl_proxy_marshal((struct wl_proxy *) wl_data_offer, |
| 757 WL_DATA_OFFER_RECEIVE, mime_type, fd); |
| 758 } |
| 759 |
| 760 static inline void |
| 761 wl_data_offer_destroy(struct wl_data_offer *wl_data_offer) |
| 762 { |
| 763 wl_proxy_marshal((struct wl_proxy *) wl_data_offer, |
| 764 WL_DATA_OFFER_DESTROY); |
| 765 |
| 766 wl_proxy_destroy((struct wl_proxy *) wl_data_offer); |
| 767 } |
| 768 |
| 769 /** |
| 770 * wl_data_source - offer to transfer data |
| 771 * @target: a target accepts an offered mime type |
| 772 * @send: send the data |
| 773 * @cancelled: selection was cancelled |
| 774 * |
| 775 * The wl_data_source object is the source side of a wl_data_offer. It is |
| 776 * created by the source client in a data transfer and provides a way to |
| 777 * describe the offered data and a way to respond to requests to transfer |
| 778 * the data. |
| 779 */ |
| 780 struct wl_data_source_listener { |
| 781 /** |
| 782 * target - a target accepts an offered mime type |
| 783 * @mime_type: (none) |
| 784 * |
| 785 * Sent when a target accepts pointer_focus or motion events. If |
| 786 * a target does not accept any of the offered types, type is NULL. |
| 787 * |
| 788 * Used for feedback during drag-and-drop. |
| 789 */ |
| 790 void (*target)(void *data, |
| 791 struct wl_data_source *wl_data_source, |
| 792 const char *mime_type); |
| 793 /** |
| 794 * send - send the data |
| 795 * @mime_type: (none) |
| 796 * @fd: (none) |
| 797 * |
| 798 * Request for data from the client. Send the data as the |
| 799 * specified mime type over the passed file descriptor, then close |
| 800 * it. |
| 801 */ |
| 802 void (*send)(void *data, |
| 803 struct wl_data_source *wl_data_source, |
| 804 const char *mime_type, |
| 805 int32_t fd); |
| 806 /** |
| 807 * cancelled - selection was cancelled |
| 808 * |
| 809 * This data source has been replaced by another data source. The |
| 810 * client should clean up and destroy this data source. |
| 811 */ |
| 812 void (*cancelled)(void *data, |
| 813 struct wl_data_source *wl_data_source); |
| 814 }; |
| 815 |
| 816 static inline int |
| 817 wl_data_source_add_listener(struct wl_data_source *wl_data_source, |
| 818 const struct wl_data_source_listener *listener, void
*data) |
| 819 { |
| 820 return wl_proxy_add_listener((struct wl_proxy *) wl_data_source, |
| 821 (void (**)(void)) listener, data); |
| 822 } |
| 823 |
| 824 #define WL_DATA_SOURCE_OFFER 0 |
| 825 #define WL_DATA_SOURCE_DESTROY 1 |
| 826 |
| 827 static inline void |
| 828 wl_data_source_set_user_data(struct wl_data_source *wl_data_source, void *user_d
ata) |
| 829 { |
| 830 wl_proxy_set_user_data((struct wl_proxy *) wl_data_source, user_data); |
| 831 } |
| 832 |
| 833 static inline void * |
| 834 wl_data_source_get_user_data(struct wl_data_source *wl_data_source) |
| 835 { |
| 836 return wl_proxy_get_user_data((struct wl_proxy *) wl_data_source); |
| 837 } |
| 838 |
| 839 static inline void |
| 840 wl_data_source_offer(struct wl_data_source *wl_data_source, const char *mime_typ
e) |
| 841 { |
| 842 wl_proxy_marshal((struct wl_proxy *) wl_data_source, |
| 843 WL_DATA_SOURCE_OFFER, mime_type); |
| 844 } |
| 845 |
| 846 static inline void |
| 847 wl_data_source_destroy(struct wl_data_source *wl_data_source) |
| 848 { |
| 849 wl_proxy_marshal((struct wl_proxy *) wl_data_source, |
| 850 WL_DATA_SOURCE_DESTROY); |
| 851 |
| 852 wl_proxy_destroy((struct wl_proxy *) wl_data_source); |
| 853 } |
| 854 |
| 855 #ifndef WL_DATA_DEVICE_ERROR_ENUM |
| 856 #define WL_DATA_DEVICE_ERROR_ENUM |
| 857 enum wl_data_device_error { |
| 858 WL_DATA_DEVICE_ERROR_ROLE = 0, |
| 859 }; |
| 860 #endif /* WL_DATA_DEVICE_ERROR_ENUM */ |
| 861 |
| 862 /** |
| 863 * wl_data_device - data transfer device |
| 864 * @data_offer: introduce a new wl_data_offer |
| 865 * @enter: initiate drag-and-drop session |
| 866 * @leave: end drag-and-drop session |
| 867 * @motion: drag-and-drop session motion |
| 868 * @drop: end drag-and-drag session successfully |
| 869 * @selection: advertise new selection |
| 870 * |
| 871 * There is one wl_data_device per seat which can be obtained from the |
| 872 * global wl_data_device_manager singleton. |
| 873 * |
| 874 * A wl_data_device provides access to inter-client data transfer |
| 875 * mechanisms such as copy-and-paste and drag-and-drop. |
| 876 */ |
| 877 struct wl_data_device_listener { |
| 878 /** |
| 879 * data_offer - introduce a new wl_data_offer |
| 880 * @id: (none) |
| 881 * |
| 882 * The data_offer event introduces a new wl_data_offer object, |
| 883 * which will subsequently be used in either the data_device.enter |
| 884 * event (for drag-and-drop) or the data_device.selection event |
| 885 * (for selections). Immediately following the |
| 886 * data_device_data_offer event, the new data_offer object will |
| 887 * send out data_offer.offer events to describe the mime types it |
| 888 * offers. |
| 889 */ |
| 890 void (*data_offer)(void *data, |
| 891 struct wl_data_device *wl_data_device, |
| 892 struct wl_data_offer *id); |
| 893 /** |
| 894 * enter - initiate drag-and-drop session |
| 895 * @serial: (none) |
| 896 * @surface: (none) |
| 897 * @x: (none) |
| 898 * @y: (none) |
| 899 * @id: (none) |
| 900 * |
| 901 * This event is sent when an active drag-and-drop pointer enters |
| 902 * a surface owned by the client. The position of the pointer at |
| 903 * enter time is provided by the x and y arguments, in surface |
| 904 * local coordinates. |
| 905 */ |
| 906 void (*enter)(void *data, |
| 907 struct wl_data_device *wl_data_device, |
| 908 uint32_t serial, |
| 909 struct wl_surface *surface, |
| 910 wl_fixed_t x, |
| 911 wl_fixed_t y, |
| 912 struct wl_data_offer *id); |
| 913 /** |
| 914 * leave - end drag-and-drop session |
| 915 * |
| 916 * This event is sent when the drag-and-drop pointer leaves the |
| 917 * surface and the session ends. The client must destroy the |
| 918 * wl_data_offer introduced at enter time at this point. |
| 919 */ |
| 920 void (*leave)(void *data, |
| 921 struct wl_data_device *wl_data_device); |
| 922 /** |
| 923 * motion - drag-and-drop session motion |
| 924 * @time: timestamp with millisecond granularity |
| 925 * @x: (none) |
| 926 * @y: (none) |
| 927 * |
| 928 * This event is sent when the drag-and-drop pointer moves within |
| 929 * the currently focused surface. The new position of the pointer |
| 930 * is provided by the x and y arguments, in surface local |
| 931 * coordinates. |
| 932 */ |
| 933 void (*motion)(void *data, |
| 934 struct wl_data_device *wl_data_device, |
| 935 uint32_t time, |
| 936 wl_fixed_t x, |
| 937 wl_fixed_t y); |
| 938 /** |
| 939 * drop - end drag-and-drag session successfully |
| 940 * |
| 941 * The event is sent when a drag-and-drop operation is ended |
| 942 * because the implicit grab is removed. |
| 943 */ |
| 944 void (*drop)(void *data, |
| 945 struct wl_data_device *wl_data_device); |
| 946 /** |
| 947 * selection - advertise new selection |
| 948 * @id: (none) |
| 949 * |
| 950 * The selection event is sent out to notify the client of a new |
| 951 * wl_data_offer for the selection for this device. The |
| 952 * data_device.data_offer and the data_offer.offer events are sent |
| 953 * out immediately before this event to introduce the data offer |
| 954 * object. The selection event is sent to a client immediately |
| 955 * before receiving keyboard focus and when a new selection is set |
| 956 * while the client has keyboard focus. The data_offer is valid |
| 957 * until a new data_offer or NULL is received or until the client |
| 958 * loses keyboard focus. The client must destroy the previous |
| 959 * selection data_offer, if any, upon receiving this event. |
| 960 */ |
| 961 void (*selection)(void *data, |
| 962 struct wl_data_device *wl_data_device, |
| 963 struct wl_data_offer *id); |
| 964 }; |
| 965 |
| 966 static inline int |
| 967 wl_data_device_add_listener(struct wl_data_device *wl_data_device, |
| 968 const struct wl_data_device_listener *listener, void
*data) |
| 969 { |
| 970 return wl_proxy_add_listener((struct wl_proxy *) wl_data_device, |
| 971 (void (**)(void)) listener, data); |
| 972 } |
| 973 |
| 974 #define WL_DATA_DEVICE_START_DRAG 0 |
| 975 #define WL_DATA_DEVICE_SET_SELECTION 1 |
| 976 #define WL_DATA_DEVICE_RELEASE 2 |
| 977 |
| 978 static inline void |
| 979 wl_data_device_set_user_data(struct wl_data_device *wl_data_device, void *user_d
ata) |
| 980 { |
| 981 wl_proxy_set_user_data((struct wl_proxy *) wl_data_device, user_data); |
| 982 } |
| 983 |
| 984 static inline void * |
| 985 wl_data_device_get_user_data(struct wl_data_device *wl_data_device) |
| 986 { |
| 987 return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device); |
| 988 } |
| 989 |
| 990 static inline void |
| 991 wl_data_device_destroy(struct wl_data_device *wl_data_device) |
| 992 { |
| 993 wl_proxy_destroy((struct wl_proxy *) wl_data_device); |
| 994 } |
| 995 |
| 996 static inline void |
| 997 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 ser
ial) |
| 998 { |
| 999 wl_proxy_marshal((struct wl_proxy *) wl_data_device, |
| 1000 WL_DATA_DEVICE_START_DRAG, source, origin, icon, serial
); |
| 1001 } |
| 1002 |
| 1003 static inline void |
| 1004 wl_data_device_set_selection(struct wl_data_device *wl_data_device, struct wl_da
ta_source *source, uint32_t serial) |
| 1005 { |
| 1006 wl_proxy_marshal((struct wl_proxy *) wl_data_device, |
| 1007 WL_DATA_DEVICE_SET_SELECTION, source, serial); |
| 1008 } |
| 1009 |
| 1010 static inline void |
| 1011 wl_data_device_release(struct wl_data_device *wl_data_device) |
| 1012 { |
| 1013 wl_proxy_marshal((struct wl_proxy *) wl_data_device, |
| 1014 WL_DATA_DEVICE_RELEASE); |
| 1015 |
| 1016 wl_proxy_destroy((struct wl_proxy *) wl_data_device); |
| 1017 } |
| 1018 |
| 1019 #define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE 0 |
| 1020 #define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE 1 |
| 1021 |
| 1022 static inline void |
| 1023 wl_data_device_manager_set_user_data(struct wl_data_device_manager *wl_data_devi
ce_manager, void *user_data) |
| 1024 { |
| 1025 wl_proxy_set_user_data((struct wl_proxy *) wl_data_device_manager, user_
data); |
| 1026 } |
| 1027 |
| 1028 static inline void * |
| 1029 wl_data_device_manager_get_user_data(struct wl_data_device_manager *wl_data_devi
ce_manager) |
| 1030 { |
| 1031 return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device_manager
); |
| 1032 } |
| 1033 |
| 1034 static inline void |
| 1035 wl_data_device_manager_destroy(struct wl_data_device_manager *wl_data_device_man
ager) |
| 1036 { |
| 1037 wl_proxy_destroy((struct wl_proxy *) wl_data_device_manager); |
| 1038 } |
| 1039 |
| 1040 static inline struct wl_data_source * |
| 1041 wl_data_device_manager_create_data_source(struct wl_data_device_manager *wl_data
_device_manager) |
| 1042 { |
| 1043 struct wl_proxy *id; |
| 1044 |
| 1045 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_data_device_man
ager, |
| 1046 WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE, &wl_data_sou
rce_interface, NULL); |
| 1047 |
| 1048 return (struct wl_data_source *) id; |
| 1049 } |
| 1050 |
| 1051 static inline struct wl_data_device * |
| 1052 wl_data_device_manager_get_data_device(struct wl_data_device_manager *wl_data_de
vice_manager, struct wl_seat *seat) |
| 1053 { |
| 1054 struct wl_proxy *id; |
| 1055 |
| 1056 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_data_device_man
ager, |
| 1057 WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE, &wl_data_device
_interface, NULL, seat); |
| 1058 |
| 1059 return (struct wl_data_device *) id; |
| 1060 } |
| 1061 |
| 1062 #ifndef WL_SHELL_ERROR_ENUM |
| 1063 #define WL_SHELL_ERROR_ENUM |
| 1064 enum wl_shell_error { |
| 1065 WL_SHELL_ERROR_ROLE = 0, |
| 1066 }; |
| 1067 #endif /* WL_SHELL_ERROR_ENUM */ |
| 1068 |
| 1069 #define WL_SHELL_GET_SHELL_SURFACE 0 |
| 1070 |
| 1071 static inline void |
| 1072 wl_shell_set_user_data(struct wl_shell *wl_shell, void *user_data) |
| 1073 { |
| 1074 wl_proxy_set_user_data((struct wl_proxy *) wl_shell, user_data); |
| 1075 } |
| 1076 |
| 1077 static inline void * |
| 1078 wl_shell_get_user_data(struct wl_shell *wl_shell) |
| 1079 { |
| 1080 return wl_proxy_get_user_data((struct wl_proxy *) wl_shell); |
| 1081 } |
| 1082 |
| 1083 static inline void |
| 1084 wl_shell_destroy(struct wl_shell *wl_shell) |
| 1085 { |
| 1086 wl_proxy_destroy((struct wl_proxy *) wl_shell); |
| 1087 } |
| 1088 |
| 1089 static inline struct wl_shell_surface * |
| 1090 wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface
) |
| 1091 { |
| 1092 struct wl_proxy *id; |
| 1093 |
| 1094 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shell, |
| 1095 WL_SHELL_GET_SHELL_SURFACE, &wl_shell_surface_interface
, NULL, surface); |
| 1096 |
| 1097 return (struct wl_shell_surface *) id; |
| 1098 } |
| 1099 |
| 1100 #ifndef WL_SHELL_SURFACE_RESIZE_ENUM |
| 1101 #define WL_SHELL_SURFACE_RESIZE_ENUM |
| 1102 /** |
| 1103 * wl_shell_surface_resize - edge values for resizing |
| 1104 * @WL_SHELL_SURFACE_RESIZE_NONE: (none) |
| 1105 * @WL_SHELL_SURFACE_RESIZE_TOP: (none) |
| 1106 * @WL_SHELL_SURFACE_RESIZE_BOTTOM: (none) |
| 1107 * @WL_SHELL_SURFACE_RESIZE_LEFT: (none) |
| 1108 * @WL_SHELL_SURFACE_RESIZE_TOP_LEFT: (none) |
| 1109 * @WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT: (none) |
| 1110 * @WL_SHELL_SURFACE_RESIZE_RIGHT: (none) |
| 1111 * @WL_SHELL_SURFACE_RESIZE_TOP_RIGHT: (none) |
| 1112 * @WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT: (none) |
| 1113 * |
| 1114 * These values are used to indicate which edge of a surface is being |
| 1115 * dragged in a resize operation. The server may use this information to |
| 1116 * adapt its behavior, e.g. choose an appropriate cursor image. |
| 1117 */ |
| 1118 enum wl_shell_surface_resize { |
| 1119 WL_SHELL_SURFACE_RESIZE_NONE = 0, |
| 1120 WL_SHELL_SURFACE_RESIZE_TOP = 1, |
| 1121 WL_SHELL_SURFACE_RESIZE_BOTTOM = 2, |
| 1122 WL_SHELL_SURFACE_RESIZE_LEFT = 4, |
| 1123 WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5, |
| 1124 WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6, |
| 1125 WL_SHELL_SURFACE_RESIZE_RIGHT = 8, |
| 1126 WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9, |
| 1127 WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10, |
| 1128 }; |
| 1129 #endif /* WL_SHELL_SURFACE_RESIZE_ENUM */ |
| 1130 |
| 1131 #ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM |
| 1132 #define WL_SHELL_SURFACE_TRANSIENT_ENUM |
| 1133 /** |
| 1134 * wl_shell_surface_transient - details of transient behaviour |
| 1135 * @WL_SHELL_SURFACE_TRANSIENT_INACTIVE: do not set keyboard focus |
| 1136 * |
| 1137 * These flags specify details of the expected behaviour of transient |
| 1138 * surfaces. Used in the set_transient request. |
| 1139 */ |
| 1140 enum wl_shell_surface_transient { |
| 1141 WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1, |
| 1142 }; |
| 1143 #endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */ |
| 1144 |
| 1145 #ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM |
| 1146 #define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM |
| 1147 /** |
| 1148 * wl_shell_surface_fullscreen_method - different method to set the |
| 1149 * surface fullscreen |
| 1150 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT: no preference, apply |
| 1151 * default policy |
| 1152 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE: scale, preserve the |
| 1153 * surface's aspect ratio and center on output |
| 1154 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER: switch output mode to the |
| 1155 * smallest mode that can fit the surface, add black borders to compensate |
| 1156 * size mismatch |
| 1157 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL: no upscaling, center on |
| 1158 * output and add black borders to compensate size mismatch |
| 1159 * |
| 1160 * Hints to indicate to the compositor how to deal with a conflict |
| 1161 * between the dimensions of the surface and the dimensions of the output. |
| 1162 * The compositor is free to ignore this parameter. |
| 1163 */ |
| 1164 enum wl_shell_surface_fullscreen_method { |
| 1165 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0, |
| 1166 WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1, |
| 1167 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2, |
| 1168 WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3, |
| 1169 }; |
| 1170 #endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */ |
| 1171 |
| 1172 /** |
| 1173 * wl_shell_surface - desktop-style metadata interface |
| 1174 * @ping: ping client |
| 1175 * @configure: suggest resize |
| 1176 * @popup_done: popup interaction is done |
| 1177 * |
| 1178 * An interface that may be implemented by a wl_surface, for |
| 1179 * implementations that provide a desktop-style user interface. |
| 1180 * |
| 1181 * It provides requests to treat surfaces like toplevel, fullscreen or |
| 1182 * popup windows, move, resize or maximize them, associate metadata like |
| 1183 * title and class, etc. |
| 1184 * |
| 1185 * On the server side the object is automatically destroyed when the |
| 1186 * related wl_surface is destroyed. On client side, |
| 1187 * wl_shell_surface_destroy() must be called before destroying the |
| 1188 * wl_surface object. |
| 1189 */ |
| 1190 struct wl_shell_surface_listener { |
| 1191 /** |
| 1192 * ping - ping client |
| 1193 * @serial: (none) |
| 1194 * |
| 1195 * Ping a client to check if it is receiving events and sending |
| 1196 * requests. A client is expected to reply with a pong request. |
| 1197 */ |
| 1198 void (*ping)(void *data, |
| 1199 struct wl_shell_surface *wl_shell_surface, |
| 1200 uint32_t serial); |
| 1201 /** |
| 1202 * configure - suggest resize |
| 1203 * @edges: (none) |
| 1204 * @width: (none) |
| 1205 * @height: (none) |
| 1206 * |
| 1207 * The configure event asks the client to resize its surface. |
| 1208 * |
| 1209 * The size is a hint, in the sense that the client is free to |
| 1210 * ignore it if it doesn't resize, pick a smaller size (to satisfy |
| 1211 * aspect ratio or resize in steps of NxM pixels). |
| 1212 * |
| 1213 * The edges parameter provides a hint about how the surface was |
| 1214 * resized. The client may use this information to decide how to |
| 1215 * adjust its content to the new size (e.g. a scrolling area might |
| 1216 * adjust its content position to leave the viewable content |
| 1217 * unmoved). |
| 1218 * |
| 1219 * The client is free to dismiss all but the last configure event |
| 1220 * it received. |
| 1221 * |
| 1222 * The width and height arguments specify the size of the window in |
| 1223 * surface local coordinates. |
| 1224 */ |
| 1225 void (*configure)(void *data, |
| 1226 struct wl_shell_surface *wl_shell_surface, |
| 1227 uint32_t edges, |
| 1228 int32_t width, |
| 1229 int32_t height); |
| 1230 /** |
| 1231 * popup_done - popup interaction is done |
| 1232 * |
| 1233 * The popup_done event is sent out when a popup grab is broken, |
| 1234 * that is, when the user clicks a surface that doesn't belong to |
| 1235 * the client owning the popup surface. |
| 1236 */ |
| 1237 void (*popup_done)(void *data, |
| 1238 struct wl_shell_surface *wl_shell_surface); |
| 1239 }; |
| 1240 |
| 1241 static inline int |
| 1242 wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface, |
| 1243 const struct wl_shell_surface_listener *listener,
void *data) |
| 1244 { |
| 1245 return wl_proxy_add_listener((struct wl_proxy *) wl_shell_surface, |
| 1246 (void (**)(void)) listener, data); |
| 1247 } |
| 1248 |
| 1249 #define WL_SHELL_SURFACE_PONG 0 |
| 1250 #define WL_SHELL_SURFACE_MOVE 1 |
| 1251 #define WL_SHELL_SURFACE_RESIZE 2 |
| 1252 #define WL_SHELL_SURFACE_SET_TOPLEVEL 3 |
| 1253 #define WL_SHELL_SURFACE_SET_TRANSIENT 4 |
| 1254 #define WL_SHELL_SURFACE_SET_FULLSCREEN 5 |
| 1255 #define WL_SHELL_SURFACE_SET_POPUP 6 |
| 1256 #define WL_SHELL_SURFACE_SET_MAXIMIZED 7 |
| 1257 #define WL_SHELL_SURFACE_SET_TITLE 8 |
| 1258 #define WL_SHELL_SURFACE_SET_CLASS 9 |
| 1259 |
| 1260 static inline void |
| 1261 wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *
user_data) |
| 1262 { |
| 1263 wl_proxy_set_user_data((struct wl_proxy *) wl_shell_surface, user_data); |
| 1264 } |
| 1265 |
| 1266 static inline void * |
| 1267 wl_shell_surface_get_user_data(struct wl_shell_surface *wl_shell_surface) |
| 1268 { |
| 1269 return wl_proxy_get_user_data((struct wl_proxy *) wl_shell_surface); |
| 1270 } |
| 1271 |
| 1272 static inline void |
| 1273 wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface) |
| 1274 { |
| 1275 wl_proxy_destroy((struct wl_proxy *) wl_shell_surface); |
| 1276 } |
| 1277 |
| 1278 static inline void |
| 1279 wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial
) |
| 1280 { |
| 1281 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1282 WL_SHELL_SURFACE_PONG, serial); |
| 1283 } |
| 1284 |
| 1285 static inline void |
| 1286 wl_shell_surface_move(struct wl_shell_surface *wl_shell_surface, struct wl_seat
*seat, uint32_t serial) |
| 1287 { |
| 1288 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1289 WL_SHELL_SURFACE_MOVE, seat, serial); |
| 1290 } |
| 1291 |
| 1292 static inline void |
| 1293 wl_shell_surface_resize(struct wl_shell_surface *wl_shell_surface, struct wl_sea
t *seat, uint32_t serial, uint32_t edges) |
| 1294 { |
| 1295 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1296 WL_SHELL_SURFACE_RESIZE, seat, serial, edges); |
| 1297 } |
| 1298 |
| 1299 static inline void |
| 1300 wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface) |
| 1301 { |
| 1302 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1303 WL_SHELL_SURFACE_SET_TOPLEVEL); |
| 1304 } |
| 1305 |
| 1306 static inline void |
| 1307 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) |
| 1308 { |
| 1309 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1310 WL_SHELL_SURFACE_SET_TRANSIENT, parent, x, y, flags); |
| 1311 } |
| 1312 |
| 1313 static inline void |
| 1314 wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint3
2_t method, uint32_t framerate, struct wl_output *output) |
| 1315 { |
| 1316 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1317 WL_SHELL_SURFACE_SET_FULLSCREEN, method, framerate, out
put); |
| 1318 } |
| 1319 |
| 1320 static inline void |
| 1321 wl_shell_surface_set_popup(struct wl_shell_surface *wl_shell_surface, struct wl_
seat *seat, uint32_t serial, struct wl_surface *parent, int32_t x, int32_t y, ui
nt32_t flags) |
| 1322 { |
| 1323 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1324 WL_SHELL_SURFACE_SET_POPUP, seat, serial, parent, x, y,
flags); |
| 1325 } |
| 1326 |
| 1327 static inline void |
| 1328 wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct
wl_output *output) |
| 1329 { |
| 1330 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1331 WL_SHELL_SURFACE_SET_MAXIMIZED, output); |
| 1332 } |
| 1333 |
| 1334 static inline void |
| 1335 wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char
*title) |
| 1336 { |
| 1337 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1338 WL_SHELL_SURFACE_SET_TITLE, title); |
| 1339 } |
| 1340 |
| 1341 static inline void |
| 1342 wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char
*class_) |
| 1343 { |
| 1344 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface, |
| 1345 WL_SHELL_SURFACE_SET_CLASS, class_); |
| 1346 } |
| 1347 |
| 1348 #ifndef WL_SURFACE_ERROR_ENUM |
| 1349 #define WL_SURFACE_ERROR_ENUM |
| 1350 /** |
| 1351 * wl_surface_error - wl_surface error values |
| 1352 * @WL_SURFACE_ERROR_INVALID_SCALE: buffer scale value is invalid |
| 1353 * @WL_SURFACE_ERROR_INVALID_TRANSFORM: buffer transform value is invalid |
| 1354 * |
| 1355 * These errors can be emitted in response to wl_surface requests. |
| 1356 */ |
| 1357 enum wl_surface_error { |
| 1358 WL_SURFACE_ERROR_INVALID_SCALE = 0, |
| 1359 WL_SURFACE_ERROR_INVALID_TRANSFORM = 1, |
| 1360 }; |
| 1361 #endif /* WL_SURFACE_ERROR_ENUM */ |
| 1362 |
| 1363 /** |
| 1364 * wl_surface - an onscreen surface |
| 1365 * @enter: surface enters an output |
| 1366 * @leave: surface leaves an output |
| 1367 * |
| 1368 * A surface is a rectangular area that is displayed on the screen. It |
| 1369 * has a location, size and pixel contents. |
| 1370 * |
| 1371 * The size of a surface (and relative positions on it) is described in |
| 1372 * surface local coordinates, which may differ from the buffer local |
| 1373 * coordinates of the pixel content, in case a buffer_transform or a |
| 1374 * buffer_scale is used. |
| 1375 * |
| 1376 * A surface without a "role" is fairly useless, a compositor does not know |
| 1377 * where, when or how to present it. The role is the purpose of a |
| 1378 * wl_surface. Examples of roles are a cursor for a pointer (as set by |
| 1379 * wl_pointer.set_cursor), a drag icon (wl_data_device.start_drag), a |
| 1380 * sub-surface (wl_subcompositor.get_subsurface), and a window as defined |
| 1381 * by a shell protocol (e.g. wl_shell.get_shell_surface). |
| 1382 * |
| 1383 * A surface can have only one role at a time. Initially a wl_surface does |
| 1384 * not have a role. Once a wl_surface is given a role, it is set |
| 1385 * permanently for the whole lifetime of the wl_surface object. Giving the |
| 1386 * current role again is allowed, unless explicitly forbidden by the |
| 1387 * relevant interface specification. |
| 1388 * |
| 1389 * Surface roles are given by requests in other interfaces such as |
| 1390 * wl_pointer.set_cursor. The request should explicitly mention that this |
| 1391 * request gives a role to a wl_surface. Often, this request also creates a |
| 1392 * new protocol object that represents the role and adds additional |
| 1393 * functionality to wl_surface. When a client wants to destroy a |
| 1394 * wl_surface, they must destroy this 'role object' before the wl_surface. |
| 1395 * |
| 1396 * Destroying the role object does not remove the role from the wl_surface, |
| 1397 * but it may stop the wl_surface from "playing the role". For instance, if |
| 1398 * a wl_subsurface object is destroyed, the wl_surface it was created for |
| 1399 * will be unmapped and forget its position and z-order. It is allowed to |
| 1400 * create a wl_subsurface for the same wl_surface again, but it is not |
| 1401 * allowed to use the wl_surface as a cursor (cursor is a different role |
| 1402 * than sub-surface, and role switching is not allowed). |
| 1403 */ |
| 1404 struct wl_surface_listener { |
| 1405 /** |
| 1406 * enter - surface enters an output |
| 1407 * @output: (none) |
| 1408 * |
| 1409 * This is emitted whenever a surface's creation, movement, or |
| 1410 * resizing results in some part of it being within the scanout |
| 1411 * region of an output. |
| 1412 * |
| 1413 * Note that a surface may be overlapping with zero or more |
| 1414 * outputs. |
| 1415 */ |
| 1416 void (*enter)(void *data, |
| 1417 struct wl_surface *wl_surface, |
| 1418 struct wl_output *output); |
| 1419 /** |
| 1420 * leave - surface leaves an output |
| 1421 * @output: (none) |
| 1422 * |
| 1423 * This is emitted whenever a surface's creation, movement, or |
| 1424 * resizing results in it no longer having any part of it within |
| 1425 * the scanout region of an output. |
| 1426 */ |
| 1427 void (*leave)(void *data, |
| 1428 struct wl_surface *wl_surface, |
| 1429 struct wl_output *output); |
| 1430 }; |
| 1431 |
| 1432 static inline int |
| 1433 wl_surface_add_listener(struct wl_surface *wl_surface, |
| 1434 const struct wl_surface_listener *listener, void *data) |
| 1435 { |
| 1436 return wl_proxy_add_listener((struct wl_proxy *) wl_surface, |
| 1437 (void (**)(void)) listener, data); |
| 1438 } |
| 1439 |
| 1440 #define WL_SURFACE_DESTROY 0 |
| 1441 #define WL_SURFACE_ATTACH 1 |
| 1442 #define WL_SURFACE_DAMAGE 2 |
| 1443 #define WL_SURFACE_FRAME 3 |
| 1444 #define WL_SURFACE_SET_OPAQUE_REGION 4 |
| 1445 #define WL_SURFACE_SET_INPUT_REGION 5 |
| 1446 #define WL_SURFACE_COMMIT 6 |
| 1447 #define WL_SURFACE_SET_BUFFER_TRANSFORM 7 |
| 1448 #define WL_SURFACE_SET_BUFFER_SCALE 8 |
| 1449 |
| 1450 static inline void |
| 1451 wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data) |
| 1452 { |
| 1453 wl_proxy_set_user_data((struct wl_proxy *) wl_surface, user_data); |
| 1454 } |
| 1455 |
| 1456 static inline void * |
| 1457 wl_surface_get_user_data(struct wl_surface *wl_surface) |
| 1458 { |
| 1459 return wl_proxy_get_user_data((struct wl_proxy *) wl_surface); |
| 1460 } |
| 1461 |
| 1462 static inline void |
| 1463 wl_surface_destroy(struct wl_surface *wl_surface) |
| 1464 { |
| 1465 wl_proxy_marshal((struct wl_proxy *) wl_surface, |
| 1466 WL_SURFACE_DESTROY); |
| 1467 |
| 1468 wl_proxy_destroy((struct wl_proxy *) wl_surface); |
| 1469 } |
| 1470 |
| 1471 static inline void |
| 1472 wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int32
_t x, int32_t y) |
| 1473 { |
| 1474 wl_proxy_marshal((struct wl_proxy *) wl_surface, |
| 1475 WL_SURFACE_ATTACH, buffer, x, y); |
| 1476 } |
| 1477 |
| 1478 static inline void |
| 1479 wl_surface_damage(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t w
idth, int32_t height) |
| 1480 { |
| 1481 wl_proxy_marshal((struct wl_proxy *) wl_surface, |
| 1482 WL_SURFACE_DAMAGE, x, y, width, height); |
| 1483 } |
| 1484 |
| 1485 static inline struct wl_callback * |
| 1486 wl_surface_frame(struct wl_surface *wl_surface) |
| 1487 { |
| 1488 struct wl_proxy *callback; |
| 1489 |
| 1490 callback = wl_proxy_marshal_constructor((struct wl_proxy *) wl_surface, |
| 1491 WL_SURFACE_FRAME, &wl_callback_interface, NULL); |
| 1492 |
| 1493 return (struct wl_callback *) callback; |
| 1494 } |
| 1495 |
| 1496 static inline void |
| 1497 wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *re
gion) |
| 1498 { |
| 1499 wl_proxy_marshal((struct wl_proxy *) wl_surface, |
| 1500 WL_SURFACE_SET_OPAQUE_REGION, region); |
| 1501 } |
| 1502 |
| 1503 static inline void |
| 1504 wl_surface_set_input_region(struct wl_surface *wl_surface, struct wl_region *reg
ion) |
| 1505 { |
| 1506 wl_proxy_marshal((struct wl_proxy *) wl_surface, |
| 1507 WL_SURFACE_SET_INPUT_REGION, region); |
| 1508 } |
| 1509 |
| 1510 static inline void |
| 1511 wl_surface_commit(struct wl_surface *wl_surface) |
| 1512 { |
| 1513 wl_proxy_marshal((struct wl_proxy *) wl_surface, |
| 1514 WL_SURFACE_COMMIT); |
| 1515 } |
| 1516 |
| 1517 static inline void |
| 1518 wl_surface_set_buffer_transform(struct wl_surface *wl_surface, int32_t transform
) |
| 1519 { |
| 1520 wl_proxy_marshal((struct wl_proxy *) wl_surface, |
| 1521 WL_SURFACE_SET_BUFFER_TRANSFORM, transform); |
| 1522 } |
| 1523 |
| 1524 static inline void |
| 1525 wl_surface_set_buffer_scale(struct wl_surface *wl_surface, int32_t scale) |
| 1526 { |
| 1527 wl_proxy_marshal((struct wl_proxy *) wl_surface, |
| 1528 WL_SURFACE_SET_BUFFER_SCALE, scale); |
| 1529 } |
| 1530 |
| 1531 #ifndef WL_SEAT_CAPABILITY_ENUM |
| 1532 #define WL_SEAT_CAPABILITY_ENUM |
| 1533 /** |
| 1534 * wl_seat_capability - seat capability bitmask |
| 1535 * @WL_SEAT_CAPABILITY_POINTER: The seat has pointer devices |
| 1536 * @WL_SEAT_CAPABILITY_KEYBOARD: The seat has one or more keyboards |
| 1537 * @WL_SEAT_CAPABILITY_TOUCH: The seat has touch devices |
| 1538 * |
| 1539 * This is a bitmask of capabilities this seat has; if a member is set, |
| 1540 * then it is present on the seat. |
| 1541 */ |
| 1542 enum wl_seat_capability { |
| 1543 WL_SEAT_CAPABILITY_POINTER = 1, |
| 1544 WL_SEAT_CAPABILITY_KEYBOARD = 2, |
| 1545 WL_SEAT_CAPABILITY_TOUCH = 4, |
| 1546 }; |
| 1547 #endif /* WL_SEAT_CAPABILITY_ENUM */ |
| 1548 |
| 1549 /** |
| 1550 * wl_seat - group of input devices |
| 1551 * @capabilities: seat capabilities changed |
| 1552 * @name: unique identifier for this seat |
| 1553 * |
| 1554 * A seat is a group of keyboards, pointer and touch devices. This object |
| 1555 * is published as a global during start up, or when such a device is hot |
| 1556 * plugged. A seat typically has a pointer and maintains a keyboard focus |
| 1557 * and a pointer focus. |
| 1558 */ |
| 1559 struct wl_seat_listener { |
| 1560 /** |
| 1561 * capabilities - seat capabilities changed |
| 1562 * @capabilities: (none) |
| 1563 * |
| 1564 * This is emitted whenever a seat gains or loses the pointer, |
| 1565 * keyboard or touch capabilities. The argument is a capability |
| 1566 * enum containing the complete set of capabilities this seat has. |
| 1567 */ |
| 1568 void (*capabilities)(void *data, |
| 1569 struct wl_seat *wl_seat, |
| 1570 uint32_t capabilities); |
| 1571 /** |
| 1572 * name - unique identifier for this seat |
| 1573 * @name: (none) |
| 1574 * |
| 1575 * In a multiseat configuration this can be used by the client to |
| 1576 * help identify which physical devices the seat represents. Based |
| 1577 * on the seat configuration used by the compositor. |
| 1578 * @since: 2 |
| 1579 */ |
| 1580 void (*name)(void *data, |
| 1581 struct wl_seat *wl_seat, |
| 1582 const char *name); |
| 1583 }; |
| 1584 |
| 1585 static inline int |
| 1586 wl_seat_add_listener(struct wl_seat *wl_seat, |
| 1587 const struct wl_seat_listener *listener, void *data) |
| 1588 { |
| 1589 return wl_proxy_add_listener((struct wl_proxy *) wl_seat, |
| 1590 (void (**)(void)) listener, data); |
| 1591 } |
| 1592 |
| 1593 #define WL_SEAT_GET_POINTER 0 |
| 1594 #define WL_SEAT_GET_KEYBOARD 1 |
| 1595 #define WL_SEAT_GET_TOUCH 2 |
| 1596 |
| 1597 static inline void |
| 1598 wl_seat_set_user_data(struct wl_seat *wl_seat, void *user_data) |
| 1599 { |
| 1600 wl_proxy_set_user_data((struct wl_proxy *) wl_seat, user_data); |
| 1601 } |
| 1602 |
| 1603 static inline void * |
| 1604 wl_seat_get_user_data(struct wl_seat *wl_seat) |
| 1605 { |
| 1606 return wl_proxy_get_user_data((struct wl_proxy *) wl_seat); |
| 1607 } |
| 1608 |
| 1609 static inline void |
| 1610 wl_seat_destroy(struct wl_seat *wl_seat) |
| 1611 { |
| 1612 wl_proxy_destroy((struct wl_proxy *) wl_seat); |
| 1613 } |
| 1614 |
| 1615 static inline struct wl_pointer * |
| 1616 wl_seat_get_pointer(struct wl_seat *wl_seat) |
| 1617 { |
| 1618 struct wl_proxy *id; |
| 1619 |
| 1620 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat, |
| 1621 WL_SEAT_GET_POINTER, &wl_pointer_interface, NULL); |
| 1622 |
| 1623 return (struct wl_pointer *) id; |
| 1624 } |
| 1625 |
| 1626 static inline struct wl_keyboard * |
| 1627 wl_seat_get_keyboard(struct wl_seat *wl_seat) |
| 1628 { |
| 1629 struct wl_proxy *id; |
| 1630 |
| 1631 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat, |
| 1632 WL_SEAT_GET_KEYBOARD, &wl_keyboard_interface, NULL); |
| 1633 |
| 1634 return (struct wl_keyboard *) id; |
| 1635 } |
| 1636 |
| 1637 static inline struct wl_touch * |
| 1638 wl_seat_get_touch(struct wl_seat *wl_seat) |
| 1639 { |
| 1640 struct wl_proxy *id; |
| 1641 |
| 1642 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat, |
| 1643 WL_SEAT_GET_TOUCH, &wl_touch_interface, NULL); |
| 1644 |
| 1645 return (struct wl_touch *) id; |
| 1646 } |
| 1647 |
| 1648 #ifndef WL_POINTER_ERROR_ENUM |
| 1649 #define WL_POINTER_ERROR_ENUM |
| 1650 enum wl_pointer_error { |
| 1651 WL_POINTER_ERROR_ROLE = 0, |
| 1652 }; |
| 1653 #endif /* WL_POINTER_ERROR_ENUM */ |
| 1654 |
| 1655 #ifndef WL_POINTER_BUTTON_STATE_ENUM |
| 1656 #define WL_POINTER_BUTTON_STATE_ENUM |
| 1657 /** |
| 1658 * wl_pointer_button_state - physical button state |
| 1659 * @WL_POINTER_BUTTON_STATE_RELEASED: The button is not pressed |
| 1660 * @WL_POINTER_BUTTON_STATE_PRESSED: The button is pressed |
| 1661 * |
| 1662 * Describes the physical state of a button which provoked the button |
| 1663 * event. |
| 1664 */ |
| 1665 enum wl_pointer_button_state { |
| 1666 WL_POINTER_BUTTON_STATE_RELEASED = 0, |
| 1667 WL_POINTER_BUTTON_STATE_PRESSED = 1, |
| 1668 }; |
| 1669 #endif /* WL_POINTER_BUTTON_STATE_ENUM */ |
| 1670 |
| 1671 #ifndef WL_POINTER_AXIS_ENUM |
| 1672 #define WL_POINTER_AXIS_ENUM |
| 1673 /** |
| 1674 * wl_pointer_axis - axis types |
| 1675 * @WL_POINTER_AXIS_VERTICAL_SCROLL: (none) |
| 1676 * @WL_POINTER_AXIS_HORIZONTAL_SCROLL: (none) |
| 1677 * |
| 1678 * Describes the axis types of scroll events. |
| 1679 */ |
| 1680 enum wl_pointer_axis { |
| 1681 WL_POINTER_AXIS_VERTICAL_SCROLL = 0, |
| 1682 WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1, |
| 1683 }; |
| 1684 #endif /* WL_POINTER_AXIS_ENUM */ |
| 1685 |
| 1686 /** |
| 1687 * wl_pointer - pointer input device |
| 1688 * @enter: enter event |
| 1689 * @leave: leave event |
| 1690 * @motion: pointer motion event |
| 1691 * @button: pointer button event |
| 1692 * @axis: axis event |
| 1693 * |
| 1694 * The wl_pointer interface represents one or more input devices, such as |
| 1695 * mice, which control the pointer location and pointer_focus of a seat. |
| 1696 * |
| 1697 * The wl_pointer interface generates motion, enter and leave events for |
| 1698 * the surfaces that the pointer is located over, and button and axis |
| 1699 * events for button presses, button releases and scrolling. |
| 1700 */ |
| 1701 struct wl_pointer_listener { |
| 1702 /** |
| 1703 * enter - enter event |
| 1704 * @serial: (none) |
| 1705 * @surface: (none) |
| 1706 * @surface_x: x coordinate in surface-relative coordinates |
| 1707 * @surface_y: y coordinate in surface-relative coordinates |
| 1708 * |
| 1709 * Notification that this seat's pointer is focused on a certain |
| 1710 * surface. |
| 1711 * |
| 1712 * When an seat's focus enters a surface, the pointer image is |
| 1713 * undefined and a client should respond to this event by setting |
| 1714 * an appropriate pointer image with the set_cursor request. |
| 1715 */ |
| 1716 void (*enter)(void *data, |
| 1717 struct wl_pointer *wl_pointer, |
| 1718 uint32_t serial, |
| 1719 struct wl_surface *surface, |
| 1720 wl_fixed_t surface_x, |
| 1721 wl_fixed_t surface_y); |
| 1722 /** |
| 1723 * leave - leave event |
| 1724 * @serial: (none) |
| 1725 * @surface: (none) |
| 1726 * |
| 1727 * Notification that this seat's pointer is no longer focused on |
| 1728 * a certain surface. |
| 1729 * |
| 1730 * The leave notification is sent before the enter notification for |
| 1731 * the new focus. |
| 1732 */ |
| 1733 void (*leave)(void *data, |
| 1734 struct wl_pointer *wl_pointer, |
| 1735 uint32_t serial, |
| 1736 struct wl_surface *surface); |
| 1737 /** |
| 1738 * motion - pointer motion event |
| 1739 * @time: timestamp with millisecond granularity |
| 1740 * @surface_x: x coordinate in surface-relative coordinates |
| 1741 * @surface_y: y coordinate in surface-relative coordinates |
| 1742 * |
| 1743 * Notification of pointer location change. The arguments |
| 1744 * surface_x and surface_y are the location relative to the focused |
| 1745 * surface. |
| 1746 */ |
| 1747 void (*motion)(void *data, |
| 1748 struct wl_pointer *wl_pointer, |
| 1749 uint32_t time, |
| 1750 wl_fixed_t surface_x, |
| 1751 wl_fixed_t surface_y); |
| 1752 /** |
| 1753 * button - pointer button event |
| 1754 * @serial: (none) |
| 1755 * @time: timestamp with millisecond granularity |
| 1756 * @button: (none) |
| 1757 * @state: (none) |
| 1758 * |
| 1759 * Mouse button click and release notifications. |
| 1760 * |
| 1761 * The location of the click is given by the last motion or enter |
| 1762 * event. The time argument is a timestamp with millisecond |
| 1763 * granularity, with an undefined base. |
| 1764 */ |
| 1765 void (*button)(void *data, |
| 1766 struct wl_pointer *wl_pointer, |
| 1767 uint32_t serial, |
| 1768 uint32_t time, |
| 1769 uint32_t button, |
| 1770 uint32_t state); |
| 1771 /** |
| 1772 * axis - axis event |
| 1773 * @time: timestamp with millisecond granularity |
| 1774 * @axis: (none) |
| 1775 * @value: (none) |
| 1776 * |
| 1777 * Scroll and other axis notifications. |
| 1778 * |
| 1779 * For scroll events (vertical and horizontal scroll axes), the |
| 1780 * value parameter is the length of a vector along the specified |
| 1781 * axis in a coordinate space identical to those of motion events, |
| 1782 * representing a relative movement along the specified axis. |
| 1783 * |
| 1784 * For devices that support movements non-parallel to axes multiple |
| 1785 * axis events will be emitted. |
| 1786 * |
| 1787 * When applicable, for example for touch pads, the server can |
| 1788 * choose to emit scroll events where the motion vector is |
| 1789 * equivalent to a motion event vector. |
| 1790 * |
| 1791 * When applicable, clients can transform its view relative to the |
| 1792 * scroll distance. |
| 1793 */ |
| 1794 void (*axis)(void *data, |
| 1795 struct wl_pointer *wl_pointer, |
| 1796 uint32_t time, |
| 1797 uint32_t axis, |
| 1798 wl_fixed_t value); |
| 1799 }; |
| 1800 |
| 1801 static inline int |
| 1802 wl_pointer_add_listener(struct wl_pointer *wl_pointer, |
| 1803 const struct wl_pointer_listener *listener, void *data) |
| 1804 { |
| 1805 return wl_proxy_add_listener((struct wl_proxy *) wl_pointer, |
| 1806 (void (**)(void)) listener, data); |
| 1807 } |
| 1808 |
| 1809 #define WL_POINTER_SET_CURSOR 0 |
| 1810 #define WL_POINTER_RELEASE 1 |
| 1811 |
| 1812 static inline void |
| 1813 wl_pointer_set_user_data(struct wl_pointer *wl_pointer, void *user_data) |
| 1814 { |
| 1815 wl_proxy_set_user_data((struct wl_proxy *) wl_pointer, user_data); |
| 1816 } |
| 1817 |
| 1818 static inline void * |
| 1819 wl_pointer_get_user_data(struct wl_pointer *wl_pointer) |
| 1820 { |
| 1821 return wl_proxy_get_user_data((struct wl_proxy *) wl_pointer); |
| 1822 } |
| 1823 |
| 1824 static inline void |
| 1825 wl_pointer_destroy(struct wl_pointer *wl_pointer) |
| 1826 { |
| 1827 wl_proxy_destroy((struct wl_proxy *) wl_pointer); |
| 1828 } |
| 1829 |
| 1830 static inline void |
| 1831 wl_pointer_set_cursor(struct wl_pointer *wl_pointer, uint32_t serial, struct wl_
surface *surface, int32_t hotspot_x, int32_t hotspot_y) |
| 1832 { |
| 1833 wl_proxy_marshal((struct wl_proxy *) wl_pointer, |
| 1834 WL_POINTER_SET_CURSOR, serial, surface, hotspot_x, hots
pot_y); |
| 1835 } |
| 1836 |
| 1837 static inline void |
| 1838 wl_pointer_release(struct wl_pointer *wl_pointer) |
| 1839 { |
| 1840 wl_proxy_marshal((struct wl_proxy *) wl_pointer, |
| 1841 WL_POINTER_RELEASE); |
| 1842 |
| 1843 wl_proxy_destroy((struct wl_proxy *) wl_pointer); |
| 1844 } |
| 1845 |
| 1846 #ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM |
| 1847 #define WL_KEYBOARD_KEYMAP_FORMAT_ENUM |
| 1848 /** |
| 1849 * wl_keyboard_keymap_format - keyboard mapping format |
| 1850 * @WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP: no keymap; client must |
| 1851 * understand how to interpret the raw keycode |
| 1852 * @WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1: libxkbcommon compatible; to |
| 1853 * determine the xkb keycode, clients must add 8 to the key event keycode |
| 1854 * |
| 1855 * This specifies the format of the keymap provided to the client with |
| 1856 * the wl_keyboard.keymap event. |
| 1857 */ |
| 1858 enum wl_keyboard_keymap_format { |
| 1859 WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0, |
| 1860 WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1, |
| 1861 }; |
| 1862 #endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */ |
| 1863 |
| 1864 #ifndef WL_KEYBOARD_KEY_STATE_ENUM |
| 1865 #define WL_KEYBOARD_KEY_STATE_ENUM |
| 1866 /** |
| 1867 * wl_keyboard_key_state - physical key state |
| 1868 * @WL_KEYBOARD_KEY_STATE_RELEASED: key is not pressed |
| 1869 * @WL_KEYBOARD_KEY_STATE_PRESSED: key is pressed |
| 1870 * |
| 1871 * Describes the physical state of a key which provoked the key event. |
| 1872 */ |
| 1873 enum wl_keyboard_key_state { |
| 1874 WL_KEYBOARD_KEY_STATE_RELEASED = 0, |
| 1875 WL_KEYBOARD_KEY_STATE_PRESSED = 1, |
| 1876 }; |
| 1877 #endif /* WL_KEYBOARD_KEY_STATE_ENUM */ |
| 1878 |
| 1879 /** |
| 1880 * wl_keyboard - keyboard input device |
| 1881 * @keymap: keyboard mapping |
| 1882 * @enter: enter event |
| 1883 * @leave: leave event |
| 1884 * @key: key event |
| 1885 * @modifiers: modifier and group state |
| 1886 * @repeat_info: repeat rate and delay |
| 1887 * |
| 1888 * The wl_keyboard interface represents one or more keyboards associated |
| 1889 * with a seat. |
| 1890 */ |
| 1891 struct wl_keyboard_listener { |
| 1892 /** |
| 1893 * keymap - keyboard mapping |
| 1894 * @format: (none) |
| 1895 * @fd: (none) |
| 1896 * @size: (none) |
| 1897 * |
| 1898 * This event provides a file descriptor to the client which can |
| 1899 * be memory-mapped to provide a keyboard mapping description. |
| 1900 */ |
| 1901 void (*keymap)(void *data, |
| 1902 struct wl_keyboard *wl_keyboard, |
| 1903 uint32_t format, |
| 1904 int32_t fd, |
| 1905 uint32_t size); |
| 1906 /** |
| 1907 * enter - enter event |
| 1908 * @serial: (none) |
| 1909 * @surface: (none) |
| 1910 * @keys: the currently pressed keys |
| 1911 * |
| 1912 * Notification that this seat's keyboard focus is on a certain |
| 1913 * surface. |
| 1914 */ |
| 1915 void (*enter)(void *data, |
| 1916 struct wl_keyboard *wl_keyboard, |
| 1917 uint32_t serial, |
| 1918 struct wl_surface *surface, |
| 1919 struct wl_array *keys); |
| 1920 /** |
| 1921 * leave - leave event |
| 1922 * @serial: (none) |
| 1923 * @surface: (none) |
| 1924 * |
| 1925 * Notification that this seat's keyboard focus is no longer on a |
| 1926 * certain surface. |
| 1927 * |
| 1928 * The leave notification is sent before the enter notification for |
| 1929 * the new focus. |
| 1930 */ |
| 1931 void (*leave)(void *data, |
| 1932 struct wl_keyboard *wl_keyboard, |
| 1933 uint32_t serial, |
| 1934 struct wl_surface *surface); |
| 1935 /** |
| 1936 * key - key event |
| 1937 * @serial: (none) |
| 1938 * @time: timestamp with millisecond granularity |
| 1939 * @key: (none) |
| 1940 * @state: (none) |
| 1941 * |
| 1942 * A key was pressed or released. The time argument is a |
| 1943 * timestamp with millisecond granularity, with an undefined base. |
| 1944 */ |
| 1945 void (*key)(void *data, |
| 1946 struct wl_keyboard *wl_keyboard, |
| 1947 uint32_t serial, |
| 1948 uint32_t time, |
| 1949 uint32_t key, |
| 1950 uint32_t state); |
| 1951 /** |
| 1952 * modifiers - modifier and group state |
| 1953 * @serial: (none) |
| 1954 * @mods_depressed: (none) |
| 1955 * @mods_latched: (none) |
| 1956 * @mods_locked: (none) |
| 1957 * @group: (none) |
| 1958 * |
| 1959 * Notifies clients that the modifier and/or group state has |
| 1960 * changed, and it should update its local state. |
| 1961 */ |
| 1962 void (*modifiers)(void *data, |
| 1963 struct wl_keyboard *wl_keyboard, |
| 1964 uint32_t serial, |
| 1965 uint32_t mods_depressed, |
| 1966 uint32_t mods_latched, |
| 1967 uint32_t mods_locked, |
| 1968 uint32_t group); |
| 1969 /** |
| 1970 * repeat_info - repeat rate and delay |
| 1971 * @rate: the rate of repeating keys in characters per second |
| 1972 * @delay: delay in milliseconds since key down until repeating |
| 1973 * starts |
| 1974 * |
| 1975 * Informs the client about the keyboard's repeat rate and delay. |
| 1976 * |
| 1977 * This event is sent as soon as the wl_keyboard object has been |
| 1978 * created, and is guaranteed to be received by the client before |
| 1979 * any key press event. |
| 1980 * |
| 1981 * Negative values for either rate or delay are illegal. A rate of |
| 1982 * zero will disable any repeating (regardless of the value of |
| 1983 * delay). |
| 1984 * |
| 1985 * This event can be sent later on as well with a new value if |
| 1986 * necessary, so clients should continue listening for the event |
| 1987 * past the creation of wl_keyboard. |
| 1988 * @since: 4 |
| 1989 */ |
| 1990 void (*repeat_info)(void *data, |
| 1991 struct wl_keyboard *wl_keyboard, |
| 1992 int32_t rate, |
| 1993 int32_t delay); |
| 1994 }; |
| 1995 |
| 1996 static inline int |
| 1997 wl_keyboard_add_listener(struct wl_keyboard *wl_keyboard, |
| 1998 const struct wl_keyboard_listener *listener, void *data
) |
| 1999 { |
| 2000 return wl_proxy_add_listener((struct wl_proxy *) wl_keyboard, |
| 2001 (void (**)(void)) listener, data); |
| 2002 } |
| 2003 |
| 2004 #define WL_KEYBOARD_RELEASE 0 |
| 2005 |
| 2006 static inline void |
| 2007 wl_keyboard_set_user_data(struct wl_keyboard *wl_keyboard, void *user_data) |
| 2008 { |
| 2009 wl_proxy_set_user_data((struct wl_proxy *) wl_keyboard, user_data); |
| 2010 } |
| 2011 |
| 2012 static inline void * |
| 2013 wl_keyboard_get_user_data(struct wl_keyboard *wl_keyboard) |
| 2014 { |
| 2015 return wl_proxy_get_user_data((struct wl_proxy *) wl_keyboard); |
| 2016 } |
| 2017 |
| 2018 static inline void |
| 2019 wl_keyboard_destroy(struct wl_keyboard *wl_keyboard) |
| 2020 { |
| 2021 wl_proxy_destroy((struct wl_proxy *) wl_keyboard); |
| 2022 } |
| 2023 |
| 2024 static inline void |
| 2025 wl_keyboard_release(struct wl_keyboard *wl_keyboard) |
| 2026 { |
| 2027 wl_proxy_marshal((struct wl_proxy *) wl_keyboard, |
| 2028 WL_KEYBOARD_RELEASE); |
| 2029 |
| 2030 wl_proxy_destroy((struct wl_proxy *) wl_keyboard); |
| 2031 } |
| 2032 |
| 2033 /** |
| 2034 * wl_touch - touchscreen input device |
| 2035 * @down: touch down event and beginning of a touch sequence |
| 2036 * @up: end of a touch event sequence |
| 2037 * @motion: update of touch point coordinates |
| 2038 * @frame: end of touch frame event |
| 2039 * @cancel: touch session cancelled |
| 2040 * |
| 2041 * The wl_touch interface represents a touchscreen associated with a |
| 2042 * seat. |
| 2043 * |
| 2044 * Touch interactions can consist of one or more contacts. For each |
| 2045 * contact, a series of events is generated, starting with a down event, |
| 2046 * followed by zero or more motion events, and ending with an up event. |
| 2047 * Events relating to the same contact point can be identified by the ID of |
| 2048 * the sequence. |
| 2049 */ |
| 2050 struct wl_touch_listener { |
| 2051 /** |
| 2052 * down - touch down event and beginning of a touch sequence |
| 2053 * @serial: (none) |
| 2054 * @time: timestamp with millisecond granularity |
| 2055 * @surface: (none) |
| 2056 * @id: the unique ID of this touch point |
| 2057 * @x: x coordinate in surface-relative coordinates |
| 2058 * @y: y coordinate in surface-relative coordinates |
| 2059 * |
| 2060 * A new touch point has appeared on the surface. This touch |
| 2061 * point is assigned a unique @id. Future events from this |
| 2062 * touchpoint reference this ID. The ID ceases to be valid after a |
| 2063 * touch up event and may be re-used in the future. |
| 2064 */ |
| 2065 void (*down)(void *data, |
| 2066 struct wl_touch *wl_touch, |
| 2067 uint32_t serial, |
| 2068 uint32_t time, |
| 2069 struct wl_surface *surface, |
| 2070 int32_t id, |
| 2071 wl_fixed_t x, |
| 2072 wl_fixed_t y); |
| 2073 /** |
| 2074 * up - end of a touch event sequence |
| 2075 * @serial: (none) |
| 2076 * @time: timestamp with millisecond granularity |
| 2077 * @id: the unique ID of this touch point |
| 2078 * |
| 2079 * The touch point has disappeared. No further events will be |
| 2080 * sent for this touchpoint and the touch point's ID is released |
| 2081 * and may be re-used in a future touch down event. |
| 2082 */ |
| 2083 void (*up)(void *data, |
| 2084 struct wl_touch *wl_touch, |
| 2085 uint32_t serial, |
| 2086 uint32_t time, |
| 2087 int32_t id); |
| 2088 /** |
| 2089 * motion - update of touch point coordinates |
| 2090 * @time: timestamp with millisecond granularity |
| 2091 * @id: the unique ID of this touch point |
| 2092 * @x: x coordinate in surface-relative coordinates |
| 2093 * @y: y coordinate in surface-relative coordinates |
| 2094 * |
| 2095 * A touchpoint has changed coordinates. |
| 2096 */ |
| 2097 void (*motion)(void *data, |
| 2098 struct wl_touch *wl_touch, |
| 2099 uint32_t time, |
| 2100 int32_t id, |
| 2101 wl_fixed_t x, |
| 2102 wl_fixed_t y); |
| 2103 /** |
| 2104 * frame - end of touch frame event |
| 2105 * |
| 2106 * Indicates the end of a contact point list. |
| 2107 */ |
| 2108 void (*frame)(void *data, |
| 2109 struct wl_touch *wl_touch); |
| 2110 /** |
| 2111 * cancel - touch session cancelled |
| 2112 * |
| 2113 * Sent if the compositor decides the touch stream is a global |
| 2114 * gesture. No further events are sent to the clients from that |
| 2115 * particular gesture. Touch cancellation applies to all touch |
| 2116 * points currently active on this client's surface. The client is |
| 2117 * responsible for finalizing the touch points, future touch points |
| 2118 * on this surface may re-use the touch point ID. |
| 2119 */ |
| 2120 void (*cancel)(void *data, |
| 2121 struct wl_touch *wl_touch); |
| 2122 }; |
| 2123 |
| 2124 static inline int |
| 2125 wl_touch_add_listener(struct wl_touch *wl_touch, |
| 2126 const struct wl_touch_listener *listener, void *data) |
| 2127 { |
| 2128 return wl_proxy_add_listener((struct wl_proxy *) wl_touch, |
| 2129 (void (**)(void)) listener, data); |
| 2130 } |
| 2131 |
| 2132 #define WL_TOUCH_RELEASE 0 |
| 2133 |
| 2134 static inline void |
| 2135 wl_touch_set_user_data(struct wl_touch *wl_touch, void *user_data) |
| 2136 { |
| 2137 wl_proxy_set_user_data((struct wl_proxy *) wl_touch, user_data); |
| 2138 } |
| 2139 |
| 2140 static inline void * |
| 2141 wl_touch_get_user_data(struct wl_touch *wl_touch) |
| 2142 { |
| 2143 return wl_proxy_get_user_data((struct wl_proxy *) wl_touch); |
| 2144 } |
| 2145 |
| 2146 static inline void |
| 2147 wl_touch_destroy(struct wl_touch *wl_touch) |
| 2148 { |
| 2149 wl_proxy_destroy((struct wl_proxy *) wl_touch); |
| 2150 } |
| 2151 |
| 2152 static inline void |
| 2153 wl_touch_release(struct wl_touch *wl_touch) |
| 2154 { |
| 2155 wl_proxy_marshal((struct wl_proxy *) wl_touch, |
| 2156 WL_TOUCH_RELEASE); |
| 2157 |
| 2158 wl_proxy_destroy((struct wl_proxy *) wl_touch); |
| 2159 } |
| 2160 |
| 2161 #ifndef WL_OUTPUT_SUBPIXEL_ENUM |
| 2162 #define WL_OUTPUT_SUBPIXEL_ENUM |
| 2163 /** |
| 2164 * wl_output_subpixel - subpixel geometry information |
| 2165 * @WL_OUTPUT_SUBPIXEL_UNKNOWN: (none) |
| 2166 * @WL_OUTPUT_SUBPIXEL_NONE: (none) |
| 2167 * @WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: (none) |
| 2168 * @WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: (none) |
| 2169 * @WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: (none) |
| 2170 * @WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: (none) |
| 2171 * |
| 2172 * This enumeration describes how the physical pixels on an output are |
| 2173 * laid out. |
| 2174 */ |
| 2175 enum wl_output_subpixel { |
| 2176 WL_OUTPUT_SUBPIXEL_UNKNOWN = 0, |
| 2177 WL_OUTPUT_SUBPIXEL_NONE = 1, |
| 2178 WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2, |
| 2179 WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3, |
| 2180 WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4, |
| 2181 WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5, |
| 2182 }; |
| 2183 #endif /* WL_OUTPUT_SUBPIXEL_ENUM */ |
| 2184 |
| 2185 #ifndef WL_OUTPUT_TRANSFORM_ENUM |
| 2186 #define WL_OUTPUT_TRANSFORM_ENUM |
| 2187 /** |
| 2188 * wl_output_transform - transform from framebuffer to output |
| 2189 * @WL_OUTPUT_TRANSFORM_NORMAL: (none) |
| 2190 * @WL_OUTPUT_TRANSFORM_90: (none) |
| 2191 * @WL_OUTPUT_TRANSFORM_180: (none) |
| 2192 * @WL_OUTPUT_TRANSFORM_270: (none) |
| 2193 * @WL_OUTPUT_TRANSFORM_FLIPPED: (none) |
| 2194 * @WL_OUTPUT_TRANSFORM_FLIPPED_90: (none) |
| 2195 * @WL_OUTPUT_TRANSFORM_FLIPPED_180: (none) |
| 2196 * @WL_OUTPUT_TRANSFORM_FLIPPED_270: (none) |
| 2197 * |
| 2198 * This describes the transform that a compositor will apply to a surface |
| 2199 * to compensate for the rotation or mirroring of an output device. |
| 2200 * |
| 2201 * The flipped values correspond to an initial flip around a vertical axis |
| 2202 * followed by rotation. |
| 2203 * |
| 2204 * The purpose is mainly to allow clients render accordingly and tell the |
| 2205 * compositor, so that for fullscreen surfaces, the compositor will still |
| 2206 * be able to scan out directly from client surfaces. |
| 2207 */ |
| 2208 enum wl_output_transform { |
| 2209 WL_OUTPUT_TRANSFORM_NORMAL = 0, |
| 2210 WL_OUTPUT_TRANSFORM_90 = 1, |
| 2211 WL_OUTPUT_TRANSFORM_180 = 2, |
| 2212 WL_OUTPUT_TRANSFORM_270 = 3, |
| 2213 WL_OUTPUT_TRANSFORM_FLIPPED = 4, |
| 2214 WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5, |
| 2215 WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6, |
| 2216 WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7, |
| 2217 }; |
| 2218 #endif /* WL_OUTPUT_TRANSFORM_ENUM */ |
| 2219 |
| 2220 #ifndef WL_OUTPUT_MODE_ENUM |
| 2221 #define WL_OUTPUT_MODE_ENUM |
| 2222 /** |
| 2223 * wl_output_mode - mode information |
| 2224 * @WL_OUTPUT_MODE_CURRENT: indicates this is the current mode |
| 2225 * @WL_OUTPUT_MODE_PREFERRED: indicates this is the preferred mode |
| 2226 * |
| 2227 * These flags describe properties of an output mode. They are used in |
| 2228 * the flags bitfield of the mode event. |
| 2229 */ |
| 2230 enum wl_output_mode { |
| 2231 WL_OUTPUT_MODE_CURRENT = 0x1, |
| 2232 WL_OUTPUT_MODE_PREFERRED = 0x2, |
| 2233 }; |
| 2234 #endif /* WL_OUTPUT_MODE_ENUM */ |
| 2235 |
| 2236 /** |
| 2237 * wl_output - compositor output region |
| 2238 * @geometry: properties of the output |
| 2239 * @mode: advertise available modes for the output |
| 2240 * @done: sent all information about output |
| 2241 * @scale: output scaling properties |
| 2242 * |
| 2243 * An output describes part of the compositor geometry. The compositor |
| 2244 * works in the 'compositor coordinate system' and an output corresponds to |
| 2245 * rectangular area in that space that is actually visible. This typically |
| 2246 * corresponds to a monitor that displays part of the compositor space. |
| 2247 * This object is published as global during start up, or when a monitor is |
| 2248 * hotplugged. |
| 2249 */ |
| 2250 struct wl_output_listener { |
| 2251 /** |
| 2252 * geometry - properties of the output |
| 2253 * @x: x position within the global compositor space |
| 2254 * @y: y position within the global compositor space |
| 2255 * @physical_width: width in millimeters of the output |
| 2256 * @physical_height: height in millimeters of the output |
| 2257 * @subpixel: subpixel orientation of the output |
| 2258 * @make: textual description of the manufacturer |
| 2259 * @model: textual description of the model |
| 2260 * @transform: transform that maps framebuffer to output |
| 2261 * |
| 2262 * The geometry event describes geometric properties of the |
| 2263 * output. The event is sent when binding to the output object and |
| 2264 * whenever any of the properties change. |
| 2265 */ |
| 2266 void (*geometry)(void *data, |
| 2267 struct wl_output *wl_output, |
| 2268 int32_t x, |
| 2269 int32_t y, |
| 2270 int32_t physical_width, |
| 2271 int32_t physical_height, |
| 2272 int32_t subpixel, |
| 2273 const char *make, |
| 2274 const char *model, |
| 2275 int32_t transform); |
| 2276 /** |
| 2277 * mode - advertise available modes for the output |
| 2278 * @flags: bitfield of mode flags |
| 2279 * @width: width of the mode in hardware units |
| 2280 * @height: height of the mode in hardware units |
| 2281 * @refresh: vertical refresh rate in mHz |
| 2282 * |
| 2283 * The mode event describes an available mode for the output. |
| 2284 * |
| 2285 * The event is sent when binding to the output object and there |
| 2286 * will always be one mode, the current mode. The event is sent |
| 2287 * again if an output changes mode, for the mode that is now |
| 2288 * current. In other words, the current mode is always the last |
| 2289 * mode that was received with the current flag set. |
| 2290 * |
| 2291 * The size of a mode is given in physical hardware units of the |
| 2292 * output device. This is not necessarily the same as the output |
| 2293 * size in the global compositor space. For instance, the output |
| 2294 * may be scaled, as described in wl_output.scale, or transformed , |
| 2295 * as described in wl_output.transform. |
| 2296 */ |
| 2297 void (*mode)(void *data, |
| 2298 struct wl_output *wl_output, |
| 2299 uint32_t flags, |
| 2300 int32_t width, |
| 2301 int32_t height, |
| 2302 int32_t refresh); |
| 2303 /** |
| 2304 * done - sent all information about output |
| 2305 * |
| 2306 * This event is sent after all other properties has been sent |
| 2307 * after binding to the output object and after any other property |
| 2308 * changes done after that. This allows changes to the output |
| 2309 * properties to be seen as atomic, even if they happen via |
| 2310 * multiple events. |
| 2311 * @since: 2 |
| 2312 */ |
| 2313 void (*done)(void *data, |
| 2314 struct wl_output *wl_output); |
| 2315 /** |
| 2316 * scale - output scaling properties |
| 2317 * @factor: scaling factor of output |
| 2318 * |
| 2319 * This event contains scaling geometry information that is not |
| 2320 * in the geometry event. It may be sent after binding the output |
| 2321 * object or if the output scale changes later. If it is not sent, |
| 2322 * the client should assume a scale of 1. |
| 2323 * |
| 2324 * A scale larger than 1 means that the compositor will |
| 2325 * automatically scale surface buffers by this amount when |
| 2326 * rendering. This is used for very high resolution displays where |
| 2327 * applications rendering at the native resolution would be too |
| 2328 * small to be legible. |
| 2329 * |
| 2330 * It is intended that scaling aware clients track the current |
| 2331 * output of a surface, and if it is on a scaled output it should |
| 2332 * use wl_surface.set_buffer_scale with the scale of the output. |
| 2333 * That way the compositor can avoid scaling the surface, and the |
| 2334 * client can supply a higher detail image. |
| 2335 * @since: 2 |
| 2336 */ |
| 2337 void (*scale)(void *data, |
| 2338 struct wl_output *wl_output, |
| 2339 int32_t factor); |
| 2340 }; |
| 2341 |
| 2342 static inline int |
| 2343 wl_output_add_listener(struct wl_output *wl_output, |
| 2344 const struct wl_output_listener *listener, void *data) |
| 2345 { |
| 2346 return wl_proxy_add_listener((struct wl_proxy *) wl_output, |
| 2347 (void (**)(void)) listener, data); |
| 2348 } |
| 2349 |
| 2350 static inline void |
| 2351 wl_output_set_user_data(struct wl_output *wl_output, void *user_data) |
| 2352 { |
| 2353 wl_proxy_set_user_data((struct wl_proxy *) wl_output, user_data); |
| 2354 } |
| 2355 |
| 2356 static inline void * |
| 2357 wl_output_get_user_data(struct wl_output *wl_output) |
| 2358 { |
| 2359 return wl_proxy_get_user_data((struct wl_proxy *) wl_output); |
| 2360 } |
| 2361 |
| 2362 static inline void |
| 2363 wl_output_destroy(struct wl_output *wl_output) |
| 2364 { |
| 2365 wl_proxy_destroy((struct wl_proxy *) wl_output); |
| 2366 } |
| 2367 |
| 2368 #define WL_REGION_DESTROY 0 |
| 2369 #define WL_REGION_ADD 1 |
| 2370 #define WL_REGION_SUBTRACT 2 |
| 2371 |
| 2372 static inline void |
| 2373 wl_region_set_user_data(struct wl_region *wl_region, void *user_data) |
| 2374 { |
| 2375 wl_proxy_set_user_data((struct wl_proxy *) wl_region, user_data); |
| 2376 } |
| 2377 |
| 2378 static inline void * |
| 2379 wl_region_get_user_data(struct wl_region *wl_region) |
| 2380 { |
| 2381 return wl_proxy_get_user_data((struct wl_proxy *) wl_region); |
| 2382 } |
| 2383 |
| 2384 static inline void |
| 2385 wl_region_destroy(struct wl_region *wl_region) |
| 2386 { |
| 2387 wl_proxy_marshal((struct wl_proxy *) wl_region, |
| 2388 WL_REGION_DESTROY); |
| 2389 |
| 2390 wl_proxy_destroy((struct wl_proxy *) wl_region); |
| 2391 } |
| 2392 |
| 2393 static inline void |
| 2394 wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width,
int32_t height) |
| 2395 { |
| 2396 wl_proxy_marshal((struct wl_proxy *) wl_region, |
| 2397 WL_REGION_ADD, x, y, width, height); |
| 2398 } |
| 2399 |
| 2400 static inline void |
| 2401 wl_region_subtract(struct wl_region *wl_region, int32_t x, int32_t y, int32_t wi
dth, int32_t height) |
| 2402 { |
| 2403 wl_proxy_marshal((struct wl_proxy *) wl_region, |
| 2404 WL_REGION_SUBTRACT, x, y, width, height); |
| 2405 } |
| 2406 |
| 2407 #ifndef WL_SUBCOMPOSITOR_ERROR_ENUM |
| 2408 #define WL_SUBCOMPOSITOR_ERROR_ENUM |
| 2409 enum wl_subcompositor_error { |
| 2410 WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0, |
| 2411 }; |
| 2412 #endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */ |
| 2413 |
| 2414 #define WL_SUBCOMPOSITOR_DESTROY 0 |
| 2415 #define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1 |
| 2416 |
| 2417 static inline void |
| 2418 wl_subcompositor_set_user_data(struct wl_subcompositor *wl_subcompositor, void *
user_data) |
| 2419 { |
| 2420 wl_proxy_set_user_data((struct wl_proxy *) wl_subcompositor, user_data); |
| 2421 } |
| 2422 |
| 2423 static inline void * |
| 2424 wl_subcompositor_get_user_data(struct wl_subcompositor *wl_subcompositor) |
| 2425 { |
| 2426 return wl_proxy_get_user_data((struct wl_proxy *) wl_subcompositor); |
| 2427 } |
| 2428 |
| 2429 static inline void |
| 2430 wl_subcompositor_destroy(struct wl_subcompositor *wl_subcompositor) |
| 2431 { |
| 2432 wl_proxy_marshal((struct wl_proxy *) wl_subcompositor, |
| 2433 WL_SUBCOMPOSITOR_DESTROY); |
| 2434 |
| 2435 wl_proxy_destroy((struct wl_proxy *) wl_subcompositor); |
| 2436 } |
| 2437 |
| 2438 static inline struct wl_subsurface * |
| 2439 wl_subcompositor_get_subsurface(struct wl_subcompositor *wl_subcompositor, struc
t wl_surface *surface, struct wl_surface *parent) |
| 2440 { |
| 2441 struct wl_proxy *id; |
| 2442 |
| 2443 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_subcompositor, |
| 2444 WL_SUBCOMPOSITOR_GET_SUBSURFACE, &wl_subsurface_interfa
ce, NULL, surface, parent); |
| 2445 |
| 2446 return (struct wl_subsurface *) id; |
| 2447 } |
| 2448 |
| 2449 #ifndef WL_SUBSURFACE_ERROR_ENUM |
| 2450 #define WL_SUBSURFACE_ERROR_ENUM |
| 2451 enum wl_subsurface_error { |
| 2452 WL_SUBSURFACE_ERROR_BAD_SURFACE = 0, |
| 2453 }; |
| 2454 #endif /* WL_SUBSURFACE_ERROR_ENUM */ |
| 2455 |
| 2456 #define WL_SUBSURFACE_DESTROY 0 |
| 2457 #define WL_SUBSURFACE_SET_POSITION 1 |
| 2458 #define WL_SUBSURFACE_PLACE_ABOVE 2 |
| 2459 #define WL_SUBSURFACE_PLACE_BELOW 3 |
| 2460 #define WL_SUBSURFACE_SET_SYNC 4 |
| 2461 #define WL_SUBSURFACE_SET_DESYNC 5 |
| 2462 |
| 2463 static inline void |
| 2464 wl_subsurface_set_user_data(struct wl_subsurface *wl_subsurface, void *user_data
) |
| 2465 { |
| 2466 wl_proxy_set_user_data((struct wl_proxy *) wl_subsurface, user_data); |
| 2467 } |
| 2468 |
| 2469 static inline void * |
| 2470 wl_subsurface_get_user_data(struct wl_subsurface *wl_subsurface) |
| 2471 { |
| 2472 return wl_proxy_get_user_data((struct wl_proxy *) wl_subsurface); |
| 2473 } |
| 2474 |
| 2475 static inline void |
| 2476 wl_subsurface_destroy(struct wl_subsurface *wl_subsurface) |
| 2477 { |
| 2478 wl_proxy_marshal((struct wl_proxy *) wl_subsurface, |
| 2479 WL_SUBSURFACE_DESTROY); |
| 2480 |
| 2481 wl_proxy_destroy((struct wl_proxy *) wl_subsurface); |
| 2482 } |
| 2483 |
| 2484 static inline void |
| 2485 wl_subsurface_set_position(struct wl_subsurface *wl_subsurface, int32_t x, int32
_t y) |
| 2486 { |
| 2487 wl_proxy_marshal((struct wl_proxy *) wl_subsurface, |
| 2488 WL_SUBSURFACE_SET_POSITION, x, y); |
| 2489 } |
| 2490 |
| 2491 static inline void |
| 2492 wl_subsurface_place_above(struct wl_subsurface *wl_subsurface, struct wl_surface
*sibling) |
| 2493 { |
| 2494 wl_proxy_marshal((struct wl_proxy *) wl_subsurface, |
| 2495 WL_SUBSURFACE_PLACE_ABOVE, sibling); |
| 2496 } |
| 2497 |
| 2498 static inline void |
| 2499 wl_subsurface_place_below(struct wl_subsurface *wl_subsurface, struct wl_surface
*sibling) |
| 2500 { |
| 2501 wl_proxy_marshal((struct wl_proxy *) wl_subsurface, |
| 2502 WL_SUBSURFACE_PLACE_BELOW, sibling); |
| 2503 } |
| 2504 |
| 2505 static inline void |
| 2506 wl_subsurface_set_sync(struct wl_subsurface *wl_subsurface) |
| 2507 { |
| 2508 wl_proxy_marshal((struct wl_proxy *) wl_subsurface, |
| 2509 WL_SUBSURFACE_SET_SYNC); |
| 2510 } |
| 2511 |
| 2512 static inline void |
| 2513 wl_subsurface_set_desync(struct wl_subsurface *wl_subsurface) |
| 2514 { |
| 2515 wl_proxy_marshal((struct wl_proxy *) wl_subsurface, |
| 2516 WL_SUBSURFACE_SET_DESYNC); |
| 2517 } |
| 2518 |
| 2519 #ifdef __cplusplus |
| 2520 } |
| 2521 #endif |
| 2522 |
| 2523 #endif |
OLD | NEW |