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_SERVER_PROTOCOL_H |
| 29 #define WAYLAND_SERVER_PROTOCOL_H |
| 30 |
| 31 #ifdef __cplusplus |
| 32 extern "C" { |
| 33 #endif |
| 34 |
| 35 #include <stdint.h> |
| 36 #include <stddef.h> |
| 37 #include "wayland-server.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 * @sync: asynchronous roundtrip |
| 110 * @get_registry: get global registry object |
| 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_interface { |
| 116 /** |
| 117 * sync - asynchronous roundtrip |
| 118 * @callback: (none) |
| 119 * |
| 120 * The sync request asks the server to emit the 'done' event on |
| 121 * the returned wl_callback object. Since requests are handled |
| 122 * in-order and events are delivered in-order, this can be used as |
| 123 * a barrier to ensure all previous requests and the resulting |
| 124 * events have been handled. |
| 125 * |
| 126 * The object returned by this request will be destroyed by the |
| 127 * compositor after the callback is fired and as such the client |
| 128 * must not attempt to use it after that point. |
| 129 * |
| 130 * The callback_data passed in the callback is the event serial. |
| 131 */ |
| 132 void (*sync)(struct wl_client *client, |
| 133 struct wl_resource *resource, |
| 134 uint32_t callback); |
| 135 /** |
| 136 * get_registry - get global registry object |
| 137 * @registry: (none) |
| 138 * |
| 139 * This request creates a registry object that allows the client |
| 140 * to list and bind the global objects available from the |
| 141 * compositor. |
| 142 */ |
| 143 void (*get_registry)(struct wl_client *client, |
| 144 struct wl_resource *resource, |
| 145 uint32_t registry); |
| 146 }; |
| 147 |
| 148 #define WL_DISPLAY_ERROR 0 |
| 149 #define WL_DISPLAY_DELETE_ID 1 |
| 150 |
| 151 #define WL_DISPLAY_ERROR_SINCE_VERSION 1 |
| 152 #define WL_DISPLAY_DELETE_ID_SINCE_VERSION 1 |
| 153 |
| 154 /** |
| 155 * wl_registry - global registry object |
| 156 * @bind: bind an object to the display |
| 157 * |
| 158 * The global registry object. The server has a number of global objects |
| 159 * that are available to all clients. These objects typically represent an |
| 160 * actual object in the server (for example, an input device) or they are |
| 161 * singleton objects that provide extension functionality. |
| 162 * |
| 163 * When a client creates a registry object, the registry object will emit a |
| 164 * global event for each global currently in the registry. Globals come and |
| 165 * go as a result of device or monitor hotplugs, reconfiguration or other |
| 166 * events, and the registry will send out global and global_remove events |
| 167 * to keep the client up to date with the changes. To mark the end of the |
| 168 * initial burst of events, the client can use the wl_display.sync request |
| 169 * immediately after calling wl_display.get_registry. |
| 170 * |
| 171 * A client can bind to a global object by using the bind request. This |
| 172 * creates a client-side handle that lets the object emit events to the |
| 173 * client and lets the client invoke requests on the object. |
| 174 */ |
| 175 struct wl_registry_interface { |
| 176 /** |
| 177 * bind - bind an object to the display |
| 178 * @name: unique name for the object |
| 179 * @interface: name of the objects interface |
| 180 * @version: version of the objects interface |
| 181 * @id: (none) |
| 182 * |
| 183 * Binds a new, client-created object to the server using the |
| 184 * specified name as the identifier. |
| 185 */ |
| 186 void (*bind)(struct wl_client *client, |
| 187 struct wl_resource *resource, |
| 188 uint32_t name, |
| 189 const char *interface, uint32_t version, uint32_t id); |
| 190 }; |
| 191 |
| 192 #define WL_REGISTRY_GLOBAL 0 |
| 193 #define WL_REGISTRY_GLOBAL_REMOVE 1 |
| 194 |
| 195 #define WL_REGISTRY_GLOBAL_SINCE_VERSION 1 |
| 196 #define WL_REGISTRY_GLOBAL_REMOVE_SINCE_VERSION 1 |
| 197 |
| 198 static inline void |
| 199 wl_registry_send_global(struct wl_resource *resource_, uint32_t name, const char
*interface, uint32_t version) |
| 200 { |
| 201 wl_resource_post_event(resource_, WL_REGISTRY_GLOBAL, name, interface, v
ersion); |
| 202 } |
| 203 |
| 204 static inline void |
| 205 wl_registry_send_global_remove(struct wl_resource *resource_, uint32_t name) |
| 206 { |
| 207 wl_resource_post_event(resource_, WL_REGISTRY_GLOBAL_REMOVE, name); |
| 208 } |
| 209 |
| 210 #define WL_CALLBACK_DONE 0 |
| 211 |
| 212 #define WL_CALLBACK_DONE_SINCE_VERSION 1 |
| 213 |
| 214 static inline void |
| 215 wl_callback_send_done(struct wl_resource *resource_, uint32_t callback_data) |
| 216 { |
| 217 wl_resource_post_event(resource_, WL_CALLBACK_DONE, callback_data); |
| 218 } |
| 219 |
| 220 /** |
| 221 * wl_compositor - the compositor singleton |
| 222 * @create_surface: create new surface |
| 223 * @create_region: create new region |
| 224 * |
| 225 * A compositor. This object is a singleton global. The compositor is in |
| 226 * charge of combining the contents of multiple surfaces into one |
| 227 * displayable output. |
| 228 */ |
| 229 struct wl_compositor_interface { |
| 230 /** |
| 231 * create_surface - create new surface |
| 232 * @id: (none) |
| 233 * |
| 234 * Ask the compositor to create a new surface. |
| 235 */ |
| 236 void (*create_surface)(struct wl_client *client, |
| 237 struct wl_resource *resource, |
| 238 uint32_t id); |
| 239 /** |
| 240 * create_region - create new region |
| 241 * @id: (none) |
| 242 * |
| 243 * Ask the compositor to create a new region. |
| 244 */ |
| 245 void (*create_region)(struct wl_client *client, |
| 246 struct wl_resource *resource, |
| 247 uint32_t id); |
| 248 }; |
| 249 |
| 250 |
| 251 /** |
| 252 * wl_shm_pool - a shared memory pool |
| 253 * @create_buffer: create a buffer from the pool |
| 254 * @destroy: destroy the pool |
| 255 * @resize: change the size of the pool mapping |
| 256 * |
| 257 * The wl_shm_pool object encapsulates a piece of memory shared between |
| 258 * the compositor and client. Through the wl_shm_pool object, the client |
| 259 * can allocate shared memory wl_buffer objects. All objects created |
| 260 * through the same pool share the same underlying mapped memory. Reusing |
| 261 * the mapped memory avoids the setup/teardown overhead and is useful when |
| 262 * interactively resizing a surface or for many small buffers. |
| 263 */ |
| 264 struct wl_shm_pool_interface { |
| 265 /** |
| 266 * create_buffer - create a buffer from the pool |
| 267 * @id: (none) |
| 268 * @offset: (none) |
| 269 * @width: (none) |
| 270 * @height: (none) |
| 271 * @stride: (none) |
| 272 * @format: (none) |
| 273 * |
| 274 * Create a wl_buffer object from the pool. |
| 275 * |
| 276 * The buffer is created offset bytes into the pool and has width |
| 277 * and height as specified. The stride arguments specifies the |
| 278 * number of bytes from beginning of one row to the beginning of |
| 279 * the next. The format is the pixel format of the buffer and must |
| 280 * be one of those advertised through the wl_shm.format event. |
| 281 * |
| 282 * A buffer will keep a reference to the pool it was created from |
| 283 * so it is valid to destroy the pool immediately after creating a |
| 284 * buffer from it. |
| 285 */ |
| 286 void (*create_buffer)(struct wl_client *client, |
| 287 struct wl_resource *resource, |
| 288 uint32_t id, |
| 289 int32_t offset, |
| 290 int32_t width, |
| 291 int32_t height, |
| 292 int32_t stride, |
| 293 uint32_t format); |
| 294 /** |
| 295 * destroy - destroy the pool |
| 296 * |
| 297 * Destroy the shared memory pool. |
| 298 * |
| 299 * The mmapped memory will be released when all buffers that have |
| 300 * been created from this pool are gone. |
| 301 */ |
| 302 void (*destroy)(struct wl_client *client, |
| 303 struct wl_resource *resource); |
| 304 /** |
| 305 * resize - change the size of the pool mapping |
| 306 * @size: (none) |
| 307 * |
| 308 * This request will cause the server to remap the backing memory |
| 309 * for the pool from the file descriptor passed when the pool was |
| 310 * created, but using the new size. This request can only be used |
| 311 * to make the pool bigger. |
| 312 */ |
| 313 void (*resize)(struct wl_client *client, |
| 314 struct wl_resource *resource, |
| 315 int32_t size); |
| 316 }; |
| 317 |
| 318 |
| 319 #ifndef WL_SHM_ERROR_ENUM |
| 320 #define WL_SHM_ERROR_ENUM |
| 321 /** |
| 322 * wl_shm_error - wl_shm error values |
| 323 * @WL_SHM_ERROR_INVALID_FORMAT: buffer format is not known |
| 324 * @WL_SHM_ERROR_INVALID_STRIDE: invalid size or stride during pool or |
| 325 * buffer creation |
| 326 * @WL_SHM_ERROR_INVALID_FD: mmapping the file descriptor failed |
| 327 * |
| 328 * These errors can be emitted in response to wl_shm requests. |
| 329 */ |
| 330 enum wl_shm_error { |
| 331 WL_SHM_ERROR_INVALID_FORMAT = 0, |
| 332 WL_SHM_ERROR_INVALID_STRIDE = 1, |
| 333 WL_SHM_ERROR_INVALID_FD = 2, |
| 334 }; |
| 335 #endif /* WL_SHM_ERROR_ENUM */ |
| 336 |
| 337 #ifndef WL_SHM_FORMAT_ENUM |
| 338 #define WL_SHM_FORMAT_ENUM |
| 339 /** |
| 340 * wl_shm_format - pixel formats |
| 341 * @WL_SHM_FORMAT_ARGB8888: 32-bit ARGB format |
| 342 * @WL_SHM_FORMAT_XRGB8888: 32-bit RGB format |
| 343 * @WL_SHM_FORMAT_C8: (none) |
| 344 * @WL_SHM_FORMAT_RGB332: (none) |
| 345 * @WL_SHM_FORMAT_BGR233: (none) |
| 346 * @WL_SHM_FORMAT_XRGB4444: (none) |
| 347 * @WL_SHM_FORMAT_XBGR4444: (none) |
| 348 * @WL_SHM_FORMAT_RGBX4444: (none) |
| 349 * @WL_SHM_FORMAT_BGRX4444: (none) |
| 350 * @WL_SHM_FORMAT_ARGB4444: (none) |
| 351 * @WL_SHM_FORMAT_ABGR4444: (none) |
| 352 * @WL_SHM_FORMAT_RGBA4444: (none) |
| 353 * @WL_SHM_FORMAT_BGRA4444: (none) |
| 354 * @WL_SHM_FORMAT_XRGB1555: (none) |
| 355 * @WL_SHM_FORMAT_XBGR1555: (none) |
| 356 * @WL_SHM_FORMAT_RGBX5551: (none) |
| 357 * @WL_SHM_FORMAT_BGRX5551: (none) |
| 358 * @WL_SHM_FORMAT_ARGB1555: (none) |
| 359 * @WL_SHM_FORMAT_ABGR1555: (none) |
| 360 * @WL_SHM_FORMAT_RGBA5551: (none) |
| 361 * @WL_SHM_FORMAT_BGRA5551: (none) |
| 362 * @WL_SHM_FORMAT_RGB565: (none) |
| 363 * @WL_SHM_FORMAT_BGR565: (none) |
| 364 * @WL_SHM_FORMAT_RGB888: (none) |
| 365 * @WL_SHM_FORMAT_BGR888: (none) |
| 366 * @WL_SHM_FORMAT_XBGR8888: (none) |
| 367 * @WL_SHM_FORMAT_RGBX8888: (none) |
| 368 * @WL_SHM_FORMAT_BGRX8888: (none) |
| 369 * @WL_SHM_FORMAT_ABGR8888: (none) |
| 370 * @WL_SHM_FORMAT_RGBA8888: (none) |
| 371 * @WL_SHM_FORMAT_BGRA8888: (none) |
| 372 * @WL_SHM_FORMAT_XRGB2101010: (none) |
| 373 * @WL_SHM_FORMAT_XBGR2101010: (none) |
| 374 * @WL_SHM_FORMAT_RGBX1010102: (none) |
| 375 * @WL_SHM_FORMAT_BGRX1010102: (none) |
| 376 * @WL_SHM_FORMAT_ARGB2101010: (none) |
| 377 * @WL_SHM_FORMAT_ABGR2101010: (none) |
| 378 * @WL_SHM_FORMAT_RGBA1010102: (none) |
| 379 * @WL_SHM_FORMAT_BGRA1010102: (none) |
| 380 * @WL_SHM_FORMAT_YUYV: (none) |
| 381 * @WL_SHM_FORMAT_YVYU: (none) |
| 382 * @WL_SHM_FORMAT_UYVY: (none) |
| 383 * @WL_SHM_FORMAT_VYUY: (none) |
| 384 * @WL_SHM_FORMAT_AYUV: (none) |
| 385 * @WL_SHM_FORMAT_NV12: (none) |
| 386 * @WL_SHM_FORMAT_NV21: (none) |
| 387 * @WL_SHM_FORMAT_NV16: (none) |
| 388 * @WL_SHM_FORMAT_NV61: (none) |
| 389 * @WL_SHM_FORMAT_YUV410: (none) |
| 390 * @WL_SHM_FORMAT_YVU410: (none) |
| 391 * @WL_SHM_FORMAT_YUV411: (none) |
| 392 * @WL_SHM_FORMAT_YVU411: (none) |
| 393 * @WL_SHM_FORMAT_YUV420: (none) |
| 394 * @WL_SHM_FORMAT_YVU420: (none) |
| 395 * @WL_SHM_FORMAT_YUV422: (none) |
| 396 * @WL_SHM_FORMAT_YVU422: (none) |
| 397 * @WL_SHM_FORMAT_YUV444: (none) |
| 398 * @WL_SHM_FORMAT_YVU444: (none) |
| 399 * |
| 400 * This describes the memory layout of an individual pixel. |
| 401 * |
| 402 * All renderers should support argb8888 and xrgb8888 but any other formats |
| 403 * are optional and may not be supported by the particular renderer in use. |
| 404 */ |
| 405 enum wl_shm_format { |
| 406 WL_SHM_FORMAT_ARGB8888 = 0, |
| 407 WL_SHM_FORMAT_XRGB8888 = 1, |
| 408 WL_SHM_FORMAT_C8 = 0x20203843, |
| 409 WL_SHM_FORMAT_RGB332 = 0x38424752, |
| 410 WL_SHM_FORMAT_BGR233 = 0x38524742, |
| 411 WL_SHM_FORMAT_XRGB4444 = 0x32315258, |
| 412 WL_SHM_FORMAT_XBGR4444 = 0x32314258, |
| 413 WL_SHM_FORMAT_RGBX4444 = 0x32315852, |
| 414 WL_SHM_FORMAT_BGRX4444 = 0x32315842, |
| 415 WL_SHM_FORMAT_ARGB4444 = 0x32315241, |
| 416 WL_SHM_FORMAT_ABGR4444 = 0x32314241, |
| 417 WL_SHM_FORMAT_RGBA4444 = 0x32314152, |
| 418 WL_SHM_FORMAT_BGRA4444 = 0x32314142, |
| 419 WL_SHM_FORMAT_XRGB1555 = 0x35315258, |
| 420 WL_SHM_FORMAT_XBGR1555 = 0x35314258, |
| 421 WL_SHM_FORMAT_RGBX5551 = 0x35315852, |
| 422 WL_SHM_FORMAT_BGRX5551 = 0x35315842, |
| 423 WL_SHM_FORMAT_ARGB1555 = 0x35315241, |
| 424 WL_SHM_FORMAT_ABGR1555 = 0x35314241, |
| 425 WL_SHM_FORMAT_RGBA5551 = 0x35314152, |
| 426 WL_SHM_FORMAT_BGRA5551 = 0x35314142, |
| 427 WL_SHM_FORMAT_RGB565 = 0x36314752, |
| 428 WL_SHM_FORMAT_BGR565 = 0x36314742, |
| 429 WL_SHM_FORMAT_RGB888 = 0x34324752, |
| 430 WL_SHM_FORMAT_BGR888 = 0x34324742, |
| 431 WL_SHM_FORMAT_XBGR8888 = 0x34324258, |
| 432 WL_SHM_FORMAT_RGBX8888 = 0x34325852, |
| 433 WL_SHM_FORMAT_BGRX8888 = 0x34325842, |
| 434 WL_SHM_FORMAT_ABGR8888 = 0x34324241, |
| 435 WL_SHM_FORMAT_RGBA8888 = 0x34324152, |
| 436 WL_SHM_FORMAT_BGRA8888 = 0x34324142, |
| 437 WL_SHM_FORMAT_XRGB2101010 = 0x30335258, |
| 438 WL_SHM_FORMAT_XBGR2101010 = 0x30334258, |
| 439 WL_SHM_FORMAT_RGBX1010102 = 0x30335852, |
| 440 WL_SHM_FORMAT_BGRX1010102 = 0x30335842, |
| 441 WL_SHM_FORMAT_ARGB2101010 = 0x30335241, |
| 442 WL_SHM_FORMAT_ABGR2101010 = 0x30334241, |
| 443 WL_SHM_FORMAT_RGBA1010102 = 0x30334152, |
| 444 WL_SHM_FORMAT_BGRA1010102 = 0x30334142, |
| 445 WL_SHM_FORMAT_YUYV = 0x56595559, |
| 446 WL_SHM_FORMAT_YVYU = 0x55595659, |
| 447 WL_SHM_FORMAT_UYVY = 0x59565955, |
| 448 WL_SHM_FORMAT_VYUY = 0x59555956, |
| 449 WL_SHM_FORMAT_AYUV = 0x56555941, |
| 450 WL_SHM_FORMAT_NV12 = 0x3231564e, |
| 451 WL_SHM_FORMAT_NV21 = 0x3132564e, |
| 452 WL_SHM_FORMAT_NV16 = 0x3631564e, |
| 453 WL_SHM_FORMAT_NV61 = 0x3136564e, |
| 454 WL_SHM_FORMAT_YUV410 = 0x39565559, |
| 455 WL_SHM_FORMAT_YVU410 = 0x39555659, |
| 456 WL_SHM_FORMAT_YUV411 = 0x31315559, |
| 457 WL_SHM_FORMAT_YVU411 = 0x31315659, |
| 458 WL_SHM_FORMAT_YUV420 = 0x32315559, |
| 459 WL_SHM_FORMAT_YVU420 = 0x32315659, |
| 460 WL_SHM_FORMAT_YUV422 = 0x36315559, |
| 461 WL_SHM_FORMAT_YVU422 = 0x36315659, |
| 462 WL_SHM_FORMAT_YUV444 = 0x34325559, |
| 463 WL_SHM_FORMAT_YVU444 = 0x34325659, |
| 464 }; |
| 465 #endif /* WL_SHM_FORMAT_ENUM */ |
| 466 |
| 467 /** |
| 468 * wl_shm - shared memory support |
| 469 * @create_pool: create a shm pool |
| 470 * |
| 471 * A global singleton object that provides support for shared memory. |
| 472 * |
| 473 * Clients can create wl_shm_pool objects using the create_pool request. |
| 474 * |
| 475 * At connection setup time, the wl_shm object emits one or more format |
| 476 * events to inform clients about the valid pixel formats that can be used |
| 477 * for buffers. |
| 478 */ |
| 479 struct wl_shm_interface { |
| 480 /** |
| 481 * create_pool - create a shm pool |
| 482 * @id: (none) |
| 483 * @fd: (none) |
| 484 * @size: (none) |
| 485 * |
| 486 * Create a new wl_shm_pool object. |
| 487 * |
| 488 * The pool can be used to create shared memory based buffer |
| 489 * objects. The server will mmap size bytes of the passed file |
| 490 * descriptor, to use as backing memory for the pool. |
| 491 */ |
| 492 void (*create_pool)(struct wl_client *client, |
| 493 struct wl_resource *resource, |
| 494 uint32_t id, |
| 495 int32_t fd, |
| 496 int32_t size); |
| 497 }; |
| 498 |
| 499 #define WL_SHM_FORMAT 0 |
| 500 |
| 501 #define WL_SHM_FORMAT_SINCE_VERSION 1 |
| 502 |
| 503 static inline void |
| 504 wl_shm_send_format(struct wl_resource *resource_, uint32_t format) |
| 505 { |
| 506 wl_resource_post_event(resource_, WL_SHM_FORMAT, format); |
| 507 } |
| 508 |
| 509 /** |
| 510 * wl_buffer - content for a wl_surface |
| 511 * @destroy: destroy a buffer |
| 512 * |
| 513 * A buffer provides the content for a wl_surface. Buffers are created |
| 514 * through factory interfaces such as wl_drm, wl_shm or similar. It has a |
| 515 * width and a height and can be attached to a wl_surface, but the |
| 516 * mechanism by which a client provides and updates the contents is defined |
| 517 * by the buffer factory interface. |
| 518 */ |
| 519 struct wl_buffer_interface { |
| 520 /** |
| 521 * destroy - destroy a buffer |
| 522 * |
| 523 * Destroy a buffer. If and how you need to release the backing |
| 524 * storage is defined by the buffer factory interface. |
| 525 * |
| 526 * For possible side-effects to a surface, see wl_surface.attach. |
| 527 */ |
| 528 void (*destroy)(struct wl_client *client, |
| 529 struct wl_resource *resource); |
| 530 }; |
| 531 |
| 532 #define WL_BUFFER_RELEASE 0 |
| 533 |
| 534 #define WL_BUFFER_RELEASE_SINCE_VERSION 1 |
| 535 |
| 536 static inline void |
| 537 wl_buffer_send_release(struct wl_resource *resource_) |
| 538 { |
| 539 wl_resource_post_event(resource_, WL_BUFFER_RELEASE); |
| 540 } |
| 541 |
| 542 /** |
| 543 * wl_data_offer - offer to transfer data |
| 544 * @accept: accept one of the offered mime types |
| 545 * @receive: request that the data is transferred |
| 546 * @destroy: destroy data offer |
| 547 * |
| 548 * A wl_data_offer represents a piece of data offered for transfer by |
| 549 * another client (the source client). It is used by the copy-and-paste and |
| 550 * drag-and-drop mechanisms. The offer describes the different mime types |
| 551 * that the data can be converted to and provides the mechanism for |
| 552 * transferring the data directly from the source client. |
| 553 */ |
| 554 struct wl_data_offer_interface { |
| 555 /** |
| 556 * accept - accept one of the offered mime types |
| 557 * @serial: (none) |
| 558 * @mime_type: (none) |
| 559 * |
| 560 * Indicate that the client can accept the given mime type, or |
| 561 * NULL for not accepted. |
| 562 * |
| 563 * Used for feedback during drag-and-drop. |
| 564 */ |
| 565 void (*accept)(struct wl_client *client, |
| 566 struct wl_resource *resource, |
| 567 uint32_t serial, |
| 568 const char *mime_type); |
| 569 /** |
| 570 * receive - request that the data is transferred |
| 571 * @mime_type: (none) |
| 572 * @fd: (none) |
| 573 * |
| 574 * To transfer the offered data, the client issues this request |
| 575 * and indicates the mime type it wants to receive. The transfer |
| 576 * happens through the passed file descriptor (typically created |
| 577 * with the pipe system call). The source client writes the data in |
| 578 * the mime type representation requested and then closes the file |
| 579 * descriptor. |
| 580 * |
| 581 * The receiving client reads from the read end of the pipe until |
| 582 * EOF and then closes its end, at which point the transfer is |
| 583 * complete. |
| 584 */ |
| 585 void (*receive)(struct wl_client *client, |
| 586 struct wl_resource *resource, |
| 587 const char *mime_type, |
| 588 int32_t fd); |
| 589 /** |
| 590 * destroy - destroy data offer |
| 591 * |
| 592 * Destroy the data offer. |
| 593 */ |
| 594 void (*destroy)(struct wl_client *client, |
| 595 struct wl_resource *resource); |
| 596 }; |
| 597 |
| 598 #define WL_DATA_OFFER_OFFER 0 |
| 599 |
| 600 #define WL_DATA_OFFER_OFFER_SINCE_VERSION 1 |
| 601 |
| 602 static inline void |
| 603 wl_data_offer_send_offer(struct wl_resource *resource_, const char *mime_type) |
| 604 { |
| 605 wl_resource_post_event(resource_, WL_DATA_OFFER_OFFER, mime_type); |
| 606 } |
| 607 |
| 608 /** |
| 609 * wl_data_source - offer to transfer data |
| 610 * @offer: add an offered mime type |
| 611 * @destroy: destroy the data source |
| 612 * |
| 613 * The wl_data_source object is the source side of a wl_data_offer. It is |
| 614 * created by the source client in a data transfer and provides a way to |
| 615 * describe the offered data and a way to respond to requests to transfer |
| 616 * the data. |
| 617 */ |
| 618 struct wl_data_source_interface { |
| 619 /** |
| 620 * offer - add an offered mime type |
| 621 * @mime_type: (none) |
| 622 * |
| 623 * This request adds a mime type to the set of mime types |
| 624 * advertised to targets. Can be called several times to offer |
| 625 * multiple types. |
| 626 */ |
| 627 void (*offer)(struct wl_client *client, |
| 628 struct wl_resource *resource, |
| 629 const char *mime_type); |
| 630 /** |
| 631 * destroy - destroy the data source |
| 632 * |
| 633 * Destroy the data source. |
| 634 */ |
| 635 void (*destroy)(struct wl_client *client, |
| 636 struct wl_resource *resource); |
| 637 }; |
| 638 |
| 639 #define WL_DATA_SOURCE_TARGET 0 |
| 640 #define WL_DATA_SOURCE_SEND 1 |
| 641 #define WL_DATA_SOURCE_CANCELLED 2 |
| 642 |
| 643 #define WL_DATA_SOURCE_TARGET_SINCE_VERSION 1 |
| 644 #define WL_DATA_SOURCE_SEND_SINCE_VERSION 1 |
| 645 #define WL_DATA_SOURCE_CANCELLED_SINCE_VERSION 1 |
| 646 |
| 647 static inline void |
| 648 wl_data_source_send_target(struct wl_resource *resource_, const char *mime_type) |
| 649 { |
| 650 wl_resource_post_event(resource_, WL_DATA_SOURCE_TARGET, mime_type); |
| 651 } |
| 652 |
| 653 static inline void |
| 654 wl_data_source_send_send(struct wl_resource *resource_, const char *mime_type, i
nt32_t fd) |
| 655 { |
| 656 wl_resource_post_event(resource_, WL_DATA_SOURCE_SEND, mime_type, fd); |
| 657 } |
| 658 |
| 659 static inline void |
| 660 wl_data_source_send_cancelled(struct wl_resource *resource_) |
| 661 { |
| 662 wl_resource_post_event(resource_, WL_DATA_SOURCE_CANCELLED); |
| 663 } |
| 664 |
| 665 #ifndef WL_DATA_DEVICE_ERROR_ENUM |
| 666 #define WL_DATA_DEVICE_ERROR_ENUM |
| 667 enum wl_data_device_error { |
| 668 WL_DATA_DEVICE_ERROR_ROLE = 0, |
| 669 }; |
| 670 #endif /* WL_DATA_DEVICE_ERROR_ENUM */ |
| 671 |
| 672 /** |
| 673 * wl_data_device - data transfer device |
| 674 * @start_drag: start drag-and-drop operation |
| 675 * @set_selection: copy data to the selection |
| 676 * @release: destroy data device |
| 677 * |
| 678 * There is one wl_data_device per seat which can be obtained from the |
| 679 * global wl_data_device_manager singleton. |
| 680 * |
| 681 * A wl_data_device provides access to inter-client data transfer |
| 682 * mechanisms such as copy-and-paste and drag-and-drop. |
| 683 */ |
| 684 struct wl_data_device_interface { |
| 685 /** |
| 686 * start_drag - start drag-and-drop operation |
| 687 * @source: (none) |
| 688 * @origin: (none) |
| 689 * @icon: (none) |
| 690 * @serial: serial of the implicit grab on the origin |
| 691 * |
| 692 * This request asks the compositor to start a drag-and-drop |
| 693 * operation on behalf of the client. |
| 694 * |
| 695 * The source argument is the data source that provides the data |
| 696 * for the eventual data transfer. If source is NULL, enter, leave |
| 697 * and motion events are sent only to the client that initiated the |
| 698 * drag and the client is expected to handle the data passing |
| 699 * internally. |
| 700 * |
| 701 * The origin surface is the surface where the drag originates and |
| 702 * the client must have an active implicit grab that matches the |
| 703 * serial. |
| 704 * |
| 705 * The icon surface is an optional (can be NULL) surface that |
| 706 * provides an icon to be moved around with the cursor. Initially, |
| 707 * the top-left corner of the icon surface is placed at the cursor |
| 708 * hotspot, but subsequent wl_surface.attach request can move the |
| 709 * relative position. Attach requests must be confirmed with |
| 710 * wl_surface.commit as usual. The icon surface is given the role |
| 711 * of a drag-and-drop icon. If the icon surface already has another |
| 712 * role, it raises a protocol error. |
| 713 * |
| 714 * The current and pending input regions of the icon wl_surface are |
| 715 * cleared, and wl_surface.set_input_region is ignored until the |
| 716 * wl_surface is no longer used as the icon surface. When the use |
| 717 * as an icon ends, the current and pending input regions become |
| 718 * undefined, and the wl_surface is unmapped. |
| 719 */ |
| 720 void (*start_drag)(struct wl_client *client, |
| 721 struct wl_resource *resource, |
| 722 struct wl_resource *source, |
| 723 struct wl_resource *origin, |
| 724 struct wl_resource *icon, |
| 725 uint32_t serial); |
| 726 /** |
| 727 * set_selection - copy data to the selection |
| 728 * @source: (none) |
| 729 * @serial: serial of the event that triggered this request |
| 730 * |
| 731 * This request asks the compositor to set the selection to the |
| 732 * data from the source on behalf of the client. |
| 733 * |
| 734 * To unset the selection, set the source to NULL. |
| 735 */ |
| 736 void (*set_selection)(struct wl_client *client, |
| 737 struct wl_resource *resource, |
| 738 struct wl_resource *source, |
| 739 uint32_t serial); |
| 740 /** |
| 741 * release - destroy data device |
| 742 * |
| 743 * This request destroys the data device. |
| 744 * @since: 2 |
| 745 */ |
| 746 void (*release)(struct wl_client *client, |
| 747 struct wl_resource *resource); |
| 748 }; |
| 749 |
| 750 #define WL_DATA_DEVICE_DATA_OFFER 0 |
| 751 #define WL_DATA_DEVICE_ENTER 1 |
| 752 #define WL_DATA_DEVICE_LEAVE 2 |
| 753 #define WL_DATA_DEVICE_MOTION 3 |
| 754 #define WL_DATA_DEVICE_DROP 4 |
| 755 #define WL_DATA_DEVICE_SELECTION 5 |
| 756 |
| 757 #define WL_DATA_DEVICE_DATA_OFFER_SINCE_VERSION 1 |
| 758 #define WL_DATA_DEVICE_ENTER_SINCE_VERSION 1 |
| 759 #define WL_DATA_DEVICE_LEAVE_SINCE_VERSION 1 |
| 760 #define WL_DATA_DEVICE_MOTION_SINCE_VERSION 1 |
| 761 #define WL_DATA_DEVICE_DROP_SINCE_VERSION 1 |
| 762 #define WL_DATA_DEVICE_SELECTION_SINCE_VERSION 1 |
| 763 |
| 764 static inline void |
| 765 wl_data_device_send_data_offer(struct wl_resource *resource_, struct wl_resource
*id) |
| 766 { |
| 767 wl_resource_post_event(resource_, WL_DATA_DEVICE_DATA_OFFER, id); |
| 768 } |
| 769 |
| 770 static inline void |
| 771 wl_data_device_send_enter(struct wl_resource *resource_, uint32_t serial, struct
wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct wl_resource *id) |
| 772 { |
| 773 wl_resource_post_event(resource_, WL_DATA_DEVICE_ENTER, serial, surface,
x, y, id); |
| 774 } |
| 775 |
| 776 static inline void |
| 777 wl_data_device_send_leave(struct wl_resource *resource_) |
| 778 { |
| 779 wl_resource_post_event(resource_, WL_DATA_DEVICE_LEAVE); |
| 780 } |
| 781 |
| 782 static inline void |
| 783 wl_data_device_send_motion(struct wl_resource *resource_, uint32_t time, wl_fixe
d_t x, wl_fixed_t y) |
| 784 { |
| 785 wl_resource_post_event(resource_, WL_DATA_DEVICE_MOTION, time, x, y); |
| 786 } |
| 787 |
| 788 static inline void |
| 789 wl_data_device_send_drop(struct wl_resource *resource_) |
| 790 { |
| 791 wl_resource_post_event(resource_, WL_DATA_DEVICE_DROP); |
| 792 } |
| 793 |
| 794 static inline void |
| 795 wl_data_device_send_selection(struct wl_resource *resource_, struct wl_resource
*id) |
| 796 { |
| 797 wl_resource_post_event(resource_, WL_DATA_DEVICE_SELECTION, id); |
| 798 } |
| 799 |
| 800 /** |
| 801 * wl_data_device_manager - data transfer interface |
| 802 * @create_data_source: create a new data source |
| 803 * @get_data_device: create a new data device |
| 804 * |
| 805 * The wl_data_device_manager is a singleton global object that provides |
| 806 * access to inter-client data transfer mechanisms such as copy-and-paste |
| 807 * and drag-and-drop. These mechanisms are tied to a wl_seat and this |
| 808 * interface lets a client get a wl_data_device corresponding to a wl_seat. |
| 809 */ |
| 810 struct wl_data_device_manager_interface { |
| 811 /** |
| 812 * create_data_source - create a new data source |
| 813 * @id: (none) |
| 814 * |
| 815 * Create a new data source. |
| 816 */ |
| 817 void (*create_data_source)(struct wl_client *client, |
| 818 struct wl_resource *resource, |
| 819 uint32_t id); |
| 820 /** |
| 821 * get_data_device - create a new data device |
| 822 * @id: (none) |
| 823 * @seat: (none) |
| 824 * |
| 825 * Create a new data device for a given seat. |
| 826 */ |
| 827 void (*get_data_device)(struct wl_client *client, |
| 828 struct wl_resource *resource, |
| 829 uint32_t id, |
| 830 struct wl_resource *seat); |
| 831 }; |
| 832 |
| 833 |
| 834 #ifndef WL_SHELL_ERROR_ENUM |
| 835 #define WL_SHELL_ERROR_ENUM |
| 836 enum wl_shell_error { |
| 837 WL_SHELL_ERROR_ROLE = 0, |
| 838 }; |
| 839 #endif /* WL_SHELL_ERROR_ENUM */ |
| 840 |
| 841 /** |
| 842 * wl_shell - create desktop-style surfaces |
| 843 * @get_shell_surface: create a shell surface from a surface |
| 844 * |
| 845 * This interface is implemented by servers that provide desktop-style |
| 846 * user interfaces. |
| 847 * |
| 848 * It allows clients to associate a wl_shell_surface with a basic surface. |
| 849 */ |
| 850 struct wl_shell_interface { |
| 851 /** |
| 852 * get_shell_surface - create a shell surface from a surface |
| 853 * @id: (none) |
| 854 * @surface: (none) |
| 855 * |
| 856 * Create a shell surface for an existing surface. This gives the |
| 857 * wl_surface the role of a shell surface. If the wl_surface |
| 858 * already has another role, it raises a protocol error. |
| 859 * |
| 860 * Only one shell surface can be associated with a given surface. |
| 861 */ |
| 862 void (*get_shell_surface)(struct wl_client *client, |
| 863 struct wl_resource *resource, |
| 864 uint32_t id, |
| 865 struct wl_resource *surface); |
| 866 }; |
| 867 |
| 868 |
| 869 #ifndef WL_SHELL_SURFACE_RESIZE_ENUM |
| 870 #define WL_SHELL_SURFACE_RESIZE_ENUM |
| 871 /** |
| 872 * wl_shell_surface_resize - edge values for resizing |
| 873 * @WL_SHELL_SURFACE_RESIZE_NONE: (none) |
| 874 * @WL_SHELL_SURFACE_RESIZE_TOP: (none) |
| 875 * @WL_SHELL_SURFACE_RESIZE_BOTTOM: (none) |
| 876 * @WL_SHELL_SURFACE_RESIZE_LEFT: (none) |
| 877 * @WL_SHELL_SURFACE_RESIZE_TOP_LEFT: (none) |
| 878 * @WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT: (none) |
| 879 * @WL_SHELL_SURFACE_RESIZE_RIGHT: (none) |
| 880 * @WL_SHELL_SURFACE_RESIZE_TOP_RIGHT: (none) |
| 881 * @WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT: (none) |
| 882 * |
| 883 * These values are used to indicate which edge of a surface is being |
| 884 * dragged in a resize operation. The server may use this information to |
| 885 * adapt its behavior, e.g. choose an appropriate cursor image. |
| 886 */ |
| 887 enum wl_shell_surface_resize { |
| 888 WL_SHELL_SURFACE_RESIZE_NONE = 0, |
| 889 WL_SHELL_SURFACE_RESIZE_TOP = 1, |
| 890 WL_SHELL_SURFACE_RESIZE_BOTTOM = 2, |
| 891 WL_SHELL_SURFACE_RESIZE_LEFT = 4, |
| 892 WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5, |
| 893 WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6, |
| 894 WL_SHELL_SURFACE_RESIZE_RIGHT = 8, |
| 895 WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9, |
| 896 WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10, |
| 897 }; |
| 898 #endif /* WL_SHELL_SURFACE_RESIZE_ENUM */ |
| 899 |
| 900 #ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM |
| 901 #define WL_SHELL_SURFACE_TRANSIENT_ENUM |
| 902 /** |
| 903 * wl_shell_surface_transient - details of transient behaviour |
| 904 * @WL_SHELL_SURFACE_TRANSIENT_INACTIVE: do not set keyboard focus |
| 905 * |
| 906 * These flags specify details of the expected behaviour of transient |
| 907 * surfaces. Used in the set_transient request. |
| 908 */ |
| 909 enum wl_shell_surface_transient { |
| 910 WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1, |
| 911 }; |
| 912 #endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */ |
| 913 |
| 914 #ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM |
| 915 #define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM |
| 916 /** |
| 917 * wl_shell_surface_fullscreen_method - different method to set the |
| 918 * surface fullscreen |
| 919 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT: no preference, apply |
| 920 * default policy |
| 921 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE: scale, preserve the |
| 922 * surface's aspect ratio and center on output |
| 923 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER: switch output mode to the |
| 924 * smallest mode that can fit the surface, add black borders to compensate |
| 925 * size mismatch |
| 926 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL: no upscaling, center on |
| 927 * output and add black borders to compensate size mismatch |
| 928 * |
| 929 * Hints to indicate to the compositor how to deal with a conflict |
| 930 * between the dimensions of the surface and the dimensions of the output. |
| 931 * The compositor is free to ignore this parameter. |
| 932 */ |
| 933 enum wl_shell_surface_fullscreen_method { |
| 934 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0, |
| 935 WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1, |
| 936 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2, |
| 937 WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3, |
| 938 }; |
| 939 #endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */ |
| 940 |
| 941 /** |
| 942 * wl_shell_surface - desktop-style metadata interface |
| 943 * @pong: respond to a ping event |
| 944 * @move: start an interactive move |
| 945 * @resize: start an interactive resize |
| 946 * @set_toplevel: make the surface a toplevel surface |
| 947 * @set_transient: make the surface a transient surface |
| 948 * @set_fullscreen: make the surface a fullscreen surface |
| 949 * @set_popup: make the surface a popup surface |
| 950 * @set_maximized: make the surface a maximized surface |
| 951 * @set_title: set surface title |
| 952 * @set_class: set surface class |
| 953 * |
| 954 * An interface that may be implemented by a wl_surface, for |
| 955 * implementations that provide a desktop-style user interface. |
| 956 * |
| 957 * It provides requests to treat surfaces like toplevel, fullscreen or |
| 958 * popup windows, move, resize or maximize them, associate metadata like |
| 959 * title and class, etc. |
| 960 * |
| 961 * On the server side the object is automatically destroyed when the |
| 962 * related wl_surface is destroyed. On client side, |
| 963 * wl_shell_surface_destroy() must be called before destroying the |
| 964 * wl_surface object. |
| 965 */ |
| 966 struct wl_shell_surface_interface { |
| 967 /** |
| 968 * pong - respond to a ping event |
| 969 * @serial: serial of the ping event |
| 970 * |
| 971 * A client must respond to a ping event with a pong request or |
| 972 * the client may be deemed unresponsive. |
| 973 */ |
| 974 void (*pong)(struct wl_client *client, |
| 975 struct wl_resource *resource, |
| 976 uint32_t serial); |
| 977 /** |
| 978 * move - start an interactive move |
| 979 * @seat: the wl_seat whose pointer is used |
| 980 * @serial: serial of the implicit grab on the pointer |
| 981 * |
| 982 * Start a pointer-driven move of the surface. |
| 983 * |
| 984 * This request must be used in response to a button press event. |
| 985 * The server may ignore move requests depending on the state of |
| 986 * the surface (e.g. fullscreen or maximized). |
| 987 */ |
| 988 void (*move)(struct wl_client *client, |
| 989 struct wl_resource *resource, |
| 990 struct wl_resource *seat, |
| 991 uint32_t serial); |
| 992 /** |
| 993 * resize - start an interactive resize |
| 994 * @seat: the wl_seat whose pointer is used |
| 995 * @serial: serial of the implicit grab on the pointer |
| 996 * @edges: which edge or corner is being dragged |
| 997 * |
| 998 * Start a pointer-driven resizing of the surface. |
| 999 * |
| 1000 * This request must be used in response to a button press event. |
| 1001 * The server may ignore resize requests depending on the state of |
| 1002 * the surface (e.g. fullscreen or maximized). |
| 1003 */ |
| 1004 void (*resize)(struct wl_client *client, |
| 1005 struct wl_resource *resource, |
| 1006 struct wl_resource *seat, |
| 1007 uint32_t serial, |
| 1008 uint32_t edges); |
| 1009 /** |
| 1010 * set_toplevel - make the surface a toplevel surface |
| 1011 * |
| 1012 * Map the surface as a toplevel surface. |
| 1013 * |
| 1014 * A toplevel surface is not fullscreen, maximized or transient. |
| 1015 */ |
| 1016 void (*set_toplevel)(struct wl_client *client, |
| 1017 struct wl_resource *resource); |
| 1018 /** |
| 1019 * set_transient - make the surface a transient surface |
| 1020 * @parent: (none) |
| 1021 * @x: (none) |
| 1022 * @y: (none) |
| 1023 * @flags: (none) |
| 1024 * |
| 1025 * Map the surface relative to an existing surface. |
| 1026 * |
| 1027 * The x and y arguments specify the locations of the upper left |
| 1028 * corner of the surface relative to the upper left corner of the |
| 1029 * parent surface, in surface local coordinates. |
| 1030 * |
| 1031 * The flags argument controls details of the transient behaviour. |
| 1032 */ |
| 1033 void (*set_transient)(struct wl_client *client, |
| 1034 struct wl_resource *resource, |
| 1035 struct wl_resource *parent, |
| 1036 int32_t x, |
| 1037 int32_t y, |
| 1038 uint32_t flags); |
| 1039 /** |
| 1040 * set_fullscreen - make the surface a fullscreen surface |
| 1041 * @method: (none) |
| 1042 * @framerate: (none) |
| 1043 * @output: (none) |
| 1044 * |
| 1045 * Map the surface as a fullscreen surface. |
| 1046 * |
| 1047 * If an output parameter is given then the surface will be made |
| 1048 * fullscreen on that output. If the client does not specify the |
| 1049 * output then the compositor will apply its policy - usually |
| 1050 * choosing the output on which the surface has the biggest surface |
| 1051 * area. |
| 1052 * |
| 1053 * The client may specify a method to resolve a size conflict |
| 1054 * between the output size and the surface size - this is provided |
| 1055 * through the method parameter. |
| 1056 * |
| 1057 * The framerate parameter is used only when the method is set to |
| 1058 * "driver", to indicate the preferred framerate. A value of 0 |
| 1059 * indicates that the app does not care about framerate. The |
| 1060 * framerate is specified in mHz, that is framerate of 60000 is |
| 1061 * 60Hz. |
| 1062 * |
| 1063 * A method of "scale" or "driver" implies a scaling operation of |
| 1064 * the surface, either via a direct scaling operation or a change |
| 1065 * of the output mode. This will override any kind of output |
| 1066 * scaling, so that mapping a surface with a buffer size equal to |
| 1067 * the mode can fill the screen independent of buffer_scale. |
| 1068 * |
| 1069 * A method of "fill" means we don't scale up the buffer, however |
| 1070 * any output scale is applied. This means that you may run into an |
| 1071 * edge case where the application maps a buffer with the same size |
| 1072 * of the output mode but buffer_scale 1 (thus making a surface |
| 1073 * larger than the output). In this case it is allowed to downscale |
| 1074 * the results to fit the screen. |
| 1075 * |
| 1076 * The compositor must reply to this request with a configure event |
| 1077 * with the dimensions for the output on which the surface will be |
| 1078 * made fullscreen. |
| 1079 */ |
| 1080 void (*set_fullscreen)(struct wl_client *client, |
| 1081 struct wl_resource *resource, |
| 1082 uint32_t method, |
| 1083 uint32_t framerate, |
| 1084 struct wl_resource *output); |
| 1085 /** |
| 1086 * set_popup - make the surface a popup surface |
| 1087 * @seat: the wl_seat whose pointer is used |
| 1088 * @serial: serial of the implicit grab on the pointer |
| 1089 * @parent: (none) |
| 1090 * @x: (none) |
| 1091 * @y: (none) |
| 1092 * @flags: (none) |
| 1093 * |
| 1094 * Map the surface as a popup. |
| 1095 * |
| 1096 * A popup surface is a transient surface with an added pointer |
| 1097 * grab. |
| 1098 * |
| 1099 * An existing implicit grab will be changed to owner-events mode, |
| 1100 * and the popup grab will continue after the implicit grab ends |
| 1101 * (i.e. releasing the mouse button does not cause the popup to be |
| 1102 * unmapped). |
| 1103 * |
| 1104 * The popup grab continues until the window is destroyed or a |
| 1105 * mouse button is pressed in any other clients window. A click in |
| 1106 * any of the clients surfaces is reported as normal, however, |
| 1107 * clicks in other clients surfaces will be discarded and trigger |
| 1108 * the callback. |
| 1109 * |
| 1110 * The x and y arguments specify the locations of the upper left |
| 1111 * corner of the surface relative to the upper left corner of the |
| 1112 * parent surface, in surface local coordinates. |
| 1113 */ |
| 1114 void (*set_popup)(struct wl_client *client, |
| 1115 struct wl_resource *resource, |
| 1116 struct wl_resource *seat, |
| 1117 uint32_t serial, |
| 1118 struct wl_resource *parent, |
| 1119 int32_t x, |
| 1120 int32_t y, |
| 1121 uint32_t flags); |
| 1122 /** |
| 1123 * set_maximized - make the surface a maximized surface |
| 1124 * @output: (none) |
| 1125 * |
| 1126 * Map the surface as a maximized surface. |
| 1127 * |
| 1128 * If an output parameter is given then the surface will be |
| 1129 * maximized on that output. If the client does not specify the |
| 1130 * output then the compositor will apply its policy - usually |
| 1131 * choosing the output on which the surface has the biggest surface |
| 1132 * area. |
| 1133 * |
| 1134 * The compositor will reply with a configure event telling the |
| 1135 * expected new surface size. The operation is completed on the |
| 1136 * next buffer attach to this surface. |
| 1137 * |
| 1138 * A maximized surface typically fills the entire output it is |
| 1139 * bound to, except for desktop element such as panels. This is the |
| 1140 * main difference between a maximized shell surface and a |
| 1141 * fullscreen shell surface. |
| 1142 * |
| 1143 * The details depend on the compositor implementation. |
| 1144 */ |
| 1145 void (*set_maximized)(struct wl_client *client, |
| 1146 struct wl_resource *resource, |
| 1147 struct wl_resource *output); |
| 1148 /** |
| 1149 * set_title - set surface title |
| 1150 * @title: (none) |
| 1151 * |
| 1152 * Set a short title for the surface. |
| 1153 * |
| 1154 * This string may be used to identify the surface in a task bar, |
| 1155 * window list, or other user interface elements provided by the |
| 1156 * compositor. |
| 1157 * |
| 1158 * The string must be encoded in UTF-8. |
| 1159 */ |
| 1160 void (*set_title)(struct wl_client *client, |
| 1161 struct wl_resource *resource, |
| 1162 const char *title); |
| 1163 /** |
| 1164 * set_class - set surface class |
| 1165 * @class_: (none) |
| 1166 * |
| 1167 * Set a class for the surface. |
| 1168 * |
| 1169 * The surface class identifies the general class of applications |
| 1170 * to which the surface belongs. A common convention is to use the |
| 1171 * file name (or the full path if it is a non-standard location) of |
| 1172 * the application's .desktop file as the class. |
| 1173 */ |
| 1174 void (*set_class)(struct wl_client *client, |
| 1175 struct wl_resource *resource, |
| 1176 const char *class_); |
| 1177 }; |
| 1178 |
| 1179 #define WL_SHELL_SURFACE_PING 0 |
| 1180 #define WL_SHELL_SURFACE_CONFIGURE 1 |
| 1181 #define WL_SHELL_SURFACE_POPUP_DONE 2 |
| 1182 |
| 1183 #define WL_SHELL_SURFACE_PING_SINCE_VERSION 1 |
| 1184 #define WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION 1 |
| 1185 #define WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION 1 |
| 1186 |
| 1187 static inline void |
| 1188 wl_shell_surface_send_ping(struct wl_resource *resource_, uint32_t serial) |
| 1189 { |
| 1190 wl_resource_post_event(resource_, WL_SHELL_SURFACE_PING, serial); |
| 1191 } |
| 1192 |
| 1193 static inline void |
| 1194 wl_shell_surface_send_configure(struct wl_resource *resource_, uint32_t edges, i
nt32_t width, int32_t height) |
| 1195 { |
| 1196 wl_resource_post_event(resource_, WL_SHELL_SURFACE_CONFIGURE, edges, wid
th, height); |
| 1197 } |
| 1198 |
| 1199 static inline void |
| 1200 wl_shell_surface_send_popup_done(struct wl_resource *resource_) |
| 1201 { |
| 1202 wl_resource_post_event(resource_, WL_SHELL_SURFACE_POPUP_DONE); |
| 1203 } |
| 1204 |
| 1205 #ifndef WL_SURFACE_ERROR_ENUM |
| 1206 #define WL_SURFACE_ERROR_ENUM |
| 1207 /** |
| 1208 * wl_surface_error - wl_surface error values |
| 1209 * @WL_SURFACE_ERROR_INVALID_SCALE: buffer scale value is invalid |
| 1210 * @WL_SURFACE_ERROR_INVALID_TRANSFORM: buffer transform value is invalid |
| 1211 * |
| 1212 * These errors can be emitted in response to wl_surface requests. |
| 1213 */ |
| 1214 enum wl_surface_error { |
| 1215 WL_SURFACE_ERROR_INVALID_SCALE = 0, |
| 1216 WL_SURFACE_ERROR_INVALID_TRANSFORM = 1, |
| 1217 }; |
| 1218 #endif /* WL_SURFACE_ERROR_ENUM */ |
| 1219 |
| 1220 /** |
| 1221 * wl_surface - an onscreen surface |
| 1222 * @destroy: delete surface |
| 1223 * @attach: set the surface contents |
| 1224 * @damage: mark part of the surface damaged |
| 1225 * @frame: request a frame throttling hint |
| 1226 * @set_opaque_region: set opaque region |
| 1227 * @set_input_region: set input region |
| 1228 * @commit: commit pending surface state |
| 1229 * @set_buffer_transform: sets the buffer transformation |
| 1230 * @set_buffer_scale: sets the buffer scaling factor |
| 1231 * |
| 1232 * A surface is a rectangular area that is displayed on the screen. It |
| 1233 * has a location, size and pixel contents. |
| 1234 * |
| 1235 * The size of a surface (and relative positions on it) is described in |
| 1236 * surface local coordinates, which may differ from the buffer local |
| 1237 * coordinates of the pixel content, in case a buffer_transform or a |
| 1238 * buffer_scale is used. |
| 1239 * |
| 1240 * A surface without a "role" is fairly useless, a compositor does not know |
| 1241 * where, when or how to present it. The role is the purpose of a |
| 1242 * wl_surface. Examples of roles are a cursor for a pointer (as set by |
| 1243 * wl_pointer.set_cursor), a drag icon (wl_data_device.start_drag), a |
| 1244 * sub-surface (wl_subcompositor.get_subsurface), and a window as defined |
| 1245 * by a shell protocol (e.g. wl_shell.get_shell_surface). |
| 1246 * |
| 1247 * A surface can have only one role at a time. Initially a wl_surface does |
| 1248 * not have a role. Once a wl_surface is given a role, it is set |
| 1249 * permanently for the whole lifetime of the wl_surface object. Giving the |
| 1250 * current role again is allowed, unless explicitly forbidden by the |
| 1251 * relevant interface specification. |
| 1252 * |
| 1253 * Surface roles are given by requests in other interfaces such as |
| 1254 * wl_pointer.set_cursor. The request should explicitly mention that this |
| 1255 * request gives a role to a wl_surface. Often, this request also creates a |
| 1256 * new protocol object that represents the role and adds additional |
| 1257 * functionality to wl_surface. When a client wants to destroy a |
| 1258 * wl_surface, they must destroy this 'role object' before the wl_surface. |
| 1259 * |
| 1260 * Destroying the role object does not remove the role from the wl_surface, |
| 1261 * but it may stop the wl_surface from "playing the role". For instance, if |
| 1262 * a wl_subsurface object is destroyed, the wl_surface it was created for |
| 1263 * will be unmapped and forget its position and z-order. It is allowed to |
| 1264 * create a wl_subsurface for the same wl_surface again, but it is not |
| 1265 * allowed to use the wl_surface as a cursor (cursor is a different role |
| 1266 * than sub-surface, and role switching is not allowed). |
| 1267 */ |
| 1268 struct wl_surface_interface { |
| 1269 /** |
| 1270 * destroy - delete surface |
| 1271 * |
| 1272 * Deletes the surface and invalidates its object ID. |
| 1273 */ |
| 1274 void (*destroy)(struct wl_client *client, |
| 1275 struct wl_resource *resource); |
| 1276 /** |
| 1277 * attach - set the surface contents |
| 1278 * @buffer: (none) |
| 1279 * @x: (none) |
| 1280 * @y: (none) |
| 1281 * |
| 1282 * Set a buffer as the content of this surface. |
| 1283 * |
| 1284 * The new size of the surface is calculated based on the buffer |
| 1285 * size transformed by the inverse buffer_transform and the inverse |
| 1286 * buffer_scale. This means that the supplied buffer must be an |
| 1287 * integer multiple of the buffer_scale. |
| 1288 * |
| 1289 * The x and y arguments specify the location of the new pending |
| 1290 * buffer's upper left corner, relative to the current buffer's |
| 1291 * upper left corner, in surface local coordinates. In other words, |
| 1292 * the x and y, combined with the new surface size define in which |
| 1293 * directions the surface's size changes. |
| 1294 * |
| 1295 * Surface contents are double-buffered state, see |
| 1296 * wl_surface.commit. |
| 1297 * |
| 1298 * The initial surface contents are void; there is no content. |
| 1299 * wl_surface.attach assigns the given wl_buffer as the pending |
| 1300 * wl_buffer. wl_surface.commit makes the pending wl_buffer the new |
| 1301 * surface contents, and the size of the surface becomes the size |
| 1302 * calculated from the wl_buffer, as described above. After commit, |
| 1303 * there is no pending buffer until the next attach. |
| 1304 * |
| 1305 * Committing a pending wl_buffer allows the compositor to read the |
| 1306 * pixels in the wl_buffer. The compositor may access the pixels at |
| 1307 * any time after the wl_surface.commit request. When the |
| 1308 * compositor will not access the pixels anymore, it will send the |
| 1309 * wl_buffer.release event. Only after receiving wl_buffer.release, |
| 1310 * the client may re-use the wl_buffer. A wl_buffer that has been |
| 1311 * attached and then replaced by another attach instead of |
| 1312 * committed will not receive a release event, and is not used by |
| 1313 * the compositor. |
| 1314 * |
| 1315 * Destroying the wl_buffer after wl_buffer.release does not change |
| 1316 * the surface contents. However, if the client destroys the |
| 1317 * wl_buffer before receiving the wl_buffer.release event, the |
| 1318 * surface contents become undefined immediately. |
| 1319 * |
| 1320 * If wl_surface.attach is sent with a NULL wl_buffer, the |
| 1321 * following wl_surface.commit will remove the surface content. |
| 1322 */ |
| 1323 void (*attach)(struct wl_client *client, |
| 1324 struct wl_resource *resource, |
| 1325 struct wl_resource *buffer, |
| 1326 int32_t x, |
| 1327 int32_t y); |
| 1328 /** |
| 1329 * damage - mark part of the surface damaged |
| 1330 * @x: (none) |
| 1331 * @y: (none) |
| 1332 * @width: (none) |
| 1333 * @height: (none) |
| 1334 * |
| 1335 * This request is used to describe the regions where the pending |
| 1336 * buffer is different from the current surface contents, and where |
| 1337 * the surface therefore needs to be repainted. The pending buffer |
| 1338 * must be set by wl_surface.attach before sending damage. The |
| 1339 * compositor ignores the parts of the damage that fall outside of |
| 1340 * the surface. |
| 1341 * |
| 1342 * Damage is double-buffered state, see wl_surface.commit. |
| 1343 * |
| 1344 * The damage rectangle is specified in surface local coordinates. |
| 1345 * |
| 1346 * The initial value for pending damage is empty: no damage. |
| 1347 * wl_surface.damage adds pending damage: the new pending damage is |
| 1348 * the union of old pending damage and the given rectangle. |
| 1349 * |
| 1350 * wl_surface.commit assigns pending damage as the current damage, |
| 1351 * and clears pending damage. The server will clear the current |
| 1352 * damage as it repaints the surface. |
| 1353 */ |
| 1354 void (*damage)(struct wl_client *client, |
| 1355 struct wl_resource *resource, |
| 1356 int32_t x, |
| 1357 int32_t y, |
| 1358 int32_t width, |
| 1359 int32_t height); |
| 1360 /** |
| 1361 * frame - request a frame throttling hint |
| 1362 * @callback: (none) |
| 1363 * |
| 1364 * Request a notification when it is a good time start drawing a |
| 1365 * new frame, by creating a frame callback. This is useful for |
| 1366 * throttling redrawing operations, and driving animations. |
| 1367 * |
| 1368 * When a client is animating on a wl_surface, it can use the |
| 1369 * 'frame' request to get notified when it is a good time to draw |
| 1370 * and commit the next frame of animation. If the client commits an |
| 1371 * update earlier than that, it is likely that some updates will |
| 1372 * not make it to the display, and the client is wasting resources |
| 1373 * by drawing too often. |
| 1374 * |
| 1375 * The frame request will take effect on the next |
| 1376 * wl_surface.commit. The notification will only be posted for one |
| 1377 * frame unless requested again. For a wl_surface, the |
| 1378 * notifications are posted in the order the frame requests were |
| 1379 * committed. |
| 1380 * |
| 1381 * The server must send the notifications so that a client will not |
| 1382 * send excessive updates, while still allowing the highest |
| 1383 * possible update rate for clients that wait for the reply before |
| 1384 * drawing again. The server should give some time for the client |
| 1385 * to draw and commit after sending the frame callback events to |
| 1386 * let them hit the next output refresh. |
| 1387 * |
| 1388 * A server should avoid signalling the frame callbacks if the |
| 1389 * surface is not visible in any way, e.g. the surface is |
| 1390 * off-screen, or completely obscured by other opaque surfaces. |
| 1391 * |
| 1392 * The object returned by this request will be destroyed by the |
| 1393 * compositor after the callback is fired and as such the client |
| 1394 * must not attempt to use it after that point. |
| 1395 * |
| 1396 * The callback_data passed in the callback is the current time, in |
| 1397 * milliseconds, with an undefined base. |
| 1398 */ |
| 1399 void (*frame)(struct wl_client *client, |
| 1400 struct wl_resource *resource, |
| 1401 uint32_t callback); |
| 1402 /** |
| 1403 * set_opaque_region - set opaque region |
| 1404 * @region: (none) |
| 1405 * |
| 1406 * This request sets the region of the surface that contains |
| 1407 * opaque content. |
| 1408 * |
| 1409 * The opaque region is an optimization hint for the compositor |
| 1410 * that lets it optimize out redrawing of content behind opaque |
| 1411 * regions. Setting an opaque region is not required for correct |
| 1412 * behaviour, but marking transparent content as opaque will result |
| 1413 * in repaint artifacts. |
| 1414 * |
| 1415 * The opaque region is specified in surface local coordinates. |
| 1416 * |
| 1417 * The compositor ignores the parts of the opaque region that fall |
| 1418 * outside of the surface. |
| 1419 * |
| 1420 * Opaque region is double-buffered state, see wl_surface.commit. |
| 1421 * |
| 1422 * wl_surface.set_opaque_region changes the pending opaque region. |
| 1423 * wl_surface.commit copies the pending region to the current |
| 1424 * region. Otherwise, the pending and current regions are never |
| 1425 * changed. |
| 1426 * |
| 1427 * The initial value for opaque region is empty. Setting the |
| 1428 * pending opaque region has copy semantics, and the wl_region |
| 1429 * object can be destroyed immediately. A NULL wl_region causes the |
| 1430 * pending opaque region to be set to empty. |
| 1431 */ |
| 1432 void (*set_opaque_region)(struct wl_client *client, |
| 1433 struct wl_resource *resource, |
| 1434 struct wl_resource *region); |
| 1435 /** |
| 1436 * set_input_region - set input region |
| 1437 * @region: (none) |
| 1438 * |
| 1439 * This request sets the region of the surface that can receive |
| 1440 * pointer and touch events. |
| 1441 * |
| 1442 * Input events happening outside of this region will try the next |
| 1443 * surface in the server surface stack. The compositor ignores the |
| 1444 * parts of the input region that fall outside of the surface. |
| 1445 * |
| 1446 * The input region is specified in surface local coordinates. |
| 1447 * |
| 1448 * Input region is double-buffered state, see wl_surface.commit. |
| 1449 * |
| 1450 * wl_surface.set_input_region changes the pending input region. |
| 1451 * wl_surface.commit copies the pending region to the current |
| 1452 * region. Otherwise the pending and current regions are never |
| 1453 * changed, except cursor and icon surfaces are special cases, see |
| 1454 * wl_pointer.set_cursor and wl_data_device.start_drag. |
| 1455 * |
| 1456 * The initial value for input region is infinite. That means the |
| 1457 * whole surface will accept input. Setting the pending input |
| 1458 * region has copy semantics, and the wl_region object can be |
| 1459 * destroyed immediately. A NULL wl_region causes the input region |
| 1460 * to be set to infinite. |
| 1461 */ |
| 1462 void (*set_input_region)(struct wl_client *client, |
| 1463 struct wl_resource *resource, |
| 1464 struct wl_resource *region); |
| 1465 /** |
| 1466 * commit - commit pending surface state |
| 1467 * |
| 1468 * Surface state (input, opaque, and damage regions, attached |
| 1469 * buffers, etc.) is double-buffered. Protocol requests modify the |
| 1470 * pending state, as opposed to current state in use by the |
| 1471 * compositor. Commit request atomically applies all pending state, |
| 1472 * replacing the current state. After commit, the new pending state |
| 1473 * is as documented for each related request. |
| 1474 * |
| 1475 * On commit, a pending wl_buffer is applied first, all other state |
| 1476 * second. This means that all coordinates in double-buffered state |
| 1477 * are relative to the new wl_buffer coming into use, except for |
| 1478 * wl_surface.attach itself. If there is no pending wl_buffer, the |
| 1479 * coordinates are relative to the current surface contents. |
| 1480 * |
| 1481 * All requests that need a commit to become effective are |
| 1482 * documented to affect double-buffered state. |
| 1483 * |
| 1484 * Other interfaces may add further double-buffered surface state. |
| 1485 */ |
| 1486 void (*commit)(struct wl_client *client, |
| 1487 struct wl_resource *resource); |
| 1488 /** |
| 1489 * set_buffer_transform - sets the buffer transformation |
| 1490 * @transform: (none) |
| 1491 * |
| 1492 * This request sets an optional transformation on how the |
| 1493 * compositor interprets the contents of the buffer attached to the |
| 1494 * surface. The accepted values for the transform parameter are the |
| 1495 * values for wl_output.transform. |
| 1496 * |
| 1497 * Buffer transform is double-buffered state, see |
| 1498 * wl_surface.commit. |
| 1499 * |
| 1500 * A newly created surface has its buffer transformation set to |
| 1501 * normal. |
| 1502 * |
| 1503 * wl_surface.set_buffer_transform changes the pending buffer |
| 1504 * transformation. wl_surface.commit copies the pending buffer |
| 1505 * transformation to the current one. Otherwise, the pending and |
| 1506 * current values are never changed. |
| 1507 * |
| 1508 * The purpose of this request is to allow clients to render |
| 1509 * content according to the output transform, thus permiting the |
| 1510 * compositor to use certain optimizations even if the display is |
| 1511 * rotated. Using hardware overlays and scanning out a client |
| 1512 * buffer for fullscreen surfaces are examples of such |
| 1513 * optimizations. Those optimizations are highly dependent on the |
| 1514 * compositor implementation, so the use of this request should be |
| 1515 * considered on a case-by-case basis. |
| 1516 * |
| 1517 * Note that if the transform value includes 90 or 270 degree |
| 1518 * rotation, the width of the buffer will become the surface height |
| 1519 * and the height of the buffer will become the surface width. |
| 1520 * |
| 1521 * If transform is not one of the values from the |
| 1522 * wl_output.transform enum the invalid_transform protocol error is |
| 1523 * raised. |
| 1524 * @since: 2 |
| 1525 */ |
| 1526 void (*set_buffer_transform)(struct wl_client *client, |
| 1527 struct wl_resource *resource, |
| 1528 int32_t transform); |
| 1529 /** |
| 1530 * set_buffer_scale - sets the buffer scaling factor |
| 1531 * @scale: (none) |
| 1532 * |
| 1533 * This request sets an optional scaling factor on how the |
| 1534 * compositor interprets the contents of the buffer attached to the |
| 1535 * window. |
| 1536 * |
| 1537 * Buffer scale is double-buffered state, see wl_surface.commit. |
| 1538 * |
| 1539 * A newly created surface has its buffer scale set to 1. |
| 1540 * |
| 1541 * wl_surface.set_buffer_scale changes the pending buffer scale. |
| 1542 * wl_surface.commit copies the pending buffer scale to the current |
| 1543 * one. Otherwise, the pending and current values are never |
| 1544 * changed. |
| 1545 * |
| 1546 * The purpose of this request is to allow clients to supply higher |
| 1547 * resolution buffer data for use on high resolution outputs. Its |
| 1548 * intended that you pick the same buffer scale as the scale of the |
| 1549 * output that the surface is displayed on.This means the |
| 1550 * compositor can avoid scaling when rendering the surface on that |
| 1551 * output. |
| 1552 * |
| 1553 * Note that if the scale is larger than 1, then you have to attach |
| 1554 * a buffer that is larger (by a factor of scale in each dimension) |
| 1555 * than the desired surface size. |
| 1556 * |
| 1557 * If scale is not positive the invalid_scale protocol error is |
| 1558 * raised. |
| 1559 * @since: 3 |
| 1560 */ |
| 1561 void (*set_buffer_scale)(struct wl_client *client, |
| 1562 struct wl_resource *resource, |
| 1563 int32_t scale); |
| 1564 }; |
| 1565 |
| 1566 #define WL_SURFACE_ENTER 0 |
| 1567 #define WL_SURFACE_LEAVE 1 |
| 1568 |
| 1569 #define WL_SURFACE_ENTER_SINCE_VERSION 1 |
| 1570 #define WL_SURFACE_LEAVE_SINCE_VERSION 1 |
| 1571 |
| 1572 static inline void |
| 1573 wl_surface_send_enter(struct wl_resource *resource_, struct wl_resource *output) |
| 1574 { |
| 1575 wl_resource_post_event(resource_, WL_SURFACE_ENTER, output); |
| 1576 } |
| 1577 |
| 1578 static inline void |
| 1579 wl_surface_send_leave(struct wl_resource *resource_, struct wl_resource *output) |
| 1580 { |
| 1581 wl_resource_post_event(resource_, WL_SURFACE_LEAVE, output); |
| 1582 } |
| 1583 |
| 1584 #ifndef WL_SEAT_CAPABILITY_ENUM |
| 1585 #define WL_SEAT_CAPABILITY_ENUM |
| 1586 /** |
| 1587 * wl_seat_capability - seat capability bitmask |
| 1588 * @WL_SEAT_CAPABILITY_POINTER: The seat has pointer devices |
| 1589 * @WL_SEAT_CAPABILITY_KEYBOARD: The seat has one or more keyboards |
| 1590 * @WL_SEAT_CAPABILITY_TOUCH: The seat has touch devices |
| 1591 * |
| 1592 * This is a bitmask of capabilities this seat has; if a member is set, |
| 1593 * then it is present on the seat. |
| 1594 */ |
| 1595 enum wl_seat_capability { |
| 1596 WL_SEAT_CAPABILITY_POINTER = 1, |
| 1597 WL_SEAT_CAPABILITY_KEYBOARD = 2, |
| 1598 WL_SEAT_CAPABILITY_TOUCH = 4, |
| 1599 }; |
| 1600 #endif /* WL_SEAT_CAPABILITY_ENUM */ |
| 1601 |
| 1602 /** |
| 1603 * wl_seat - group of input devices |
| 1604 * @get_pointer: return pointer object |
| 1605 * @get_keyboard: return keyboard object |
| 1606 * @get_touch: return touch object |
| 1607 * |
| 1608 * A seat is a group of keyboards, pointer and touch devices. This object |
| 1609 * is published as a global during start up, or when such a device is hot |
| 1610 * plugged. A seat typically has a pointer and maintains a keyboard focus |
| 1611 * and a pointer focus. |
| 1612 */ |
| 1613 struct wl_seat_interface { |
| 1614 /** |
| 1615 * get_pointer - return pointer object |
| 1616 * @id: (none) |
| 1617 * |
| 1618 * The ID provided will be initialized to the wl_pointer |
| 1619 * interface for this seat. |
| 1620 * |
| 1621 * This request only takes effect if the seat has the pointer |
| 1622 * capability. |
| 1623 */ |
| 1624 void (*get_pointer)(struct wl_client *client, |
| 1625 struct wl_resource *resource, |
| 1626 uint32_t id); |
| 1627 /** |
| 1628 * get_keyboard - return keyboard object |
| 1629 * @id: (none) |
| 1630 * |
| 1631 * The ID provided will be initialized to the wl_keyboard |
| 1632 * interface for this seat. |
| 1633 * |
| 1634 * This request only takes effect if the seat has the keyboard |
| 1635 * capability. |
| 1636 */ |
| 1637 void (*get_keyboard)(struct wl_client *client, |
| 1638 struct wl_resource *resource, |
| 1639 uint32_t id); |
| 1640 /** |
| 1641 * get_touch - return touch object |
| 1642 * @id: (none) |
| 1643 * |
| 1644 * The ID provided will be initialized to the wl_touch interface |
| 1645 * for this seat. |
| 1646 * |
| 1647 * This request only takes effect if the seat has the touch |
| 1648 * capability. |
| 1649 */ |
| 1650 void (*get_touch)(struct wl_client *client, |
| 1651 struct wl_resource *resource, |
| 1652 uint32_t id); |
| 1653 }; |
| 1654 |
| 1655 #define WL_SEAT_CAPABILITIES 0 |
| 1656 #define WL_SEAT_NAME 1 |
| 1657 |
| 1658 #define WL_SEAT_CAPABILITIES_SINCE_VERSION 1 |
| 1659 #define WL_SEAT_NAME_SINCE_VERSION 2 |
| 1660 |
| 1661 static inline void |
| 1662 wl_seat_send_capabilities(struct wl_resource *resource_, uint32_t capabilities) |
| 1663 { |
| 1664 wl_resource_post_event(resource_, WL_SEAT_CAPABILITIES, capabilities); |
| 1665 } |
| 1666 |
| 1667 static inline void |
| 1668 wl_seat_send_name(struct wl_resource *resource_, const char *name) |
| 1669 { |
| 1670 wl_resource_post_event(resource_, WL_SEAT_NAME, name); |
| 1671 } |
| 1672 |
| 1673 #ifndef WL_POINTER_ERROR_ENUM |
| 1674 #define WL_POINTER_ERROR_ENUM |
| 1675 enum wl_pointer_error { |
| 1676 WL_POINTER_ERROR_ROLE = 0, |
| 1677 }; |
| 1678 #endif /* WL_POINTER_ERROR_ENUM */ |
| 1679 |
| 1680 #ifndef WL_POINTER_BUTTON_STATE_ENUM |
| 1681 #define WL_POINTER_BUTTON_STATE_ENUM |
| 1682 /** |
| 1683 * wl_pointer_button_state - physical button state |
| 1684 * @WL_POINTER_BUTTON_STATE_RELEASED: The button is not pressed |
| 1685 * @WL_POINTER_BUTTON_STATE_PRESSED: The button is pressed |
| 1686 * |
| 1687 * Describes the physical state of a button which provoked the button |
| 1688 * event. |
| 1689 */ |
| 1690 enum wl_pointer_button_state { |
| 1691 WL_POINTER_BUTTON_STATE_RELEASED = 0, |
| 1692 WL_POINTER_BUTTON_STATE_PRESSED = 1, |
| 1693 }; |
| 1694 #endif /* WL_POINTER_BUTTON_STATE_ENUM */ |
| 1695 |
| 1696 #ifndef WL_POINTER_AXIS_ENUM |
| 1697 #define WL_POINTER_AXIS_ENUM |
| 1698 /** |
| 1699 * wl_pointer_axis - axis types |
| 1700 * @WL_POINTER_AXIS_VERTICAL_SCROLL: (none) |
| 1701 * @WL_POINTER_AXIS_HORIZONTAL_SCROLL: (none) |
| 1702 * |
| 1703 * Describes the axis types of scroll events. |
| 1704 */ |
| 1705 enum wl_pointer_axis { |
| 1706 WL_POINTER_AXIS_VERTICAL_SCROLL = 0, |
| 1707 WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1, |
| 1708 }; |
| 1709 #endif /* WL_POINTER_AXIS_ENUM */ |
| 1710 |
| 1711 /** |
| 1712 * wl_pointer - pointer input device |
| 1713 * @set_cursor: set the pointer surface |
| 1714 * @release: release the pointer object |
| 1715 * |
| 1716 * The wl_pointer interface represents one or more input devices, such as |
| 1717 * mice, which control the pointer location and pointer_focus of a seat. |
| 1718 * |
| 1719 * The wl_pointer interface generates motion, enter and leave events for |
| 1720 * the surfaces that the pointer is located over, and button and axis |
| 1721 * events for button presses, button releases and scrolling. |
| 1722 */ |
| 1723 struct wl_pointer_interface { |
| 1724 /** |
| 1725 * set_cursor - set the pointer surface |
| 1726 * @serial: serial of the enter event |
| 1727 * @surface: (none) |
| 1728 * @hotspot_x: x coordinate in surface-relative coordinates |
| 1729 * @hotspot_y: y coordinate in surface-relative coordinates |
| 1730 * |
| 1731 * Set the pointer surface, i.e., the surface that contains the |
| 1732 * pointer image (cursor). This request gives the surface the role |
| 1733 * of a cursor. If the surface already has another role, it raises |
| 1734 * a protocol error. |
| 1735 * |
| 1736 * The cursor actually changes only if the pointer focus for this |
| 1737 * device is one of the requesting client's surfaces or the surface |
| 1738 * parameter is the current pointer surface. If there was a |
| 1739 * previous surface set with this request it is replaced. If |
| 1740 * surface is NULL, the pointer image is hidden. |
| 1741 * |
| 1742 * The parameters hotspot_x and hotspot_y define the position of |
| 1743 * the pointer surface relative to the pointer location. Its |
| 1744 * top-left corner is always at (x, y) - (hotspot_x, hotspot_y), |
| 1745 * where (x, y) are the coordinates of the pointer location, in |
| 1746 * surface local coordinates. |
| 1747 * |
| 1748 * On surface.attach requests to the pointer surface, hotspot_x and |
| 1749 * hotspot_y are decremented by the x and y parameters passed to |
| 1750 * the request. Attach must be confirmed by wl_surface.commit as |
| 1751 * usual. |
| 1752 * |
| 1753 * The hotspot can also be updated by passing the currently set |
| 1754 * pointer surface to this request with new values for hotspot_x |
| 1755 * and hotspot_y. |
| 1756 * |
| 1757 * The current and pending input regions of the wl_surface are |
| 1758 * cleared, and wl_surface.set_input_region is ignored until the |
| 1759 * wl_surface is no longer used as the cursor. When the use as a |
| 1760 * cursor ends, the current and pending input regions become |
| 1761 * undefined, and the wl_surface is unmapped. |
| 1762 */ |
| 1763 void (*set_cursor)(struct wl_client *client, |
| 1764 struct wl_resource *resource, |
| 1765 uint32_t serial, |
| 1766 struct wl_resource *surface, |
| 1767 int32_t hotspot_x, |
| 1768 int32_t hotspot_y); |
| 1769 /** |
| 1770 * release - release the pointer object |
| 1771 * |
| 1772 * Using this request client can tell the server that it is not |
| 1773 * going to use the pointer object anymore. |
| 1774 * |
| 1775 * This request destroys the pointer proxy object, so user must not |
| 1776 * call wl_pointer_destroy() after using this request. |
| 1777 * @since: 3 |
| 1778 */ |
| 1779 void (*release)(struct wl_client *client, |
| 1780 struct wl_resource *resource); |
| 1781 }; |
| 1782 |
| 1783 #define WL_POINTER_ENTER 0 |
| 1784 #define WL_POINTER_LEAVE 1 |
| 1785 #define WL_POINTER_MOTION 2 |
| 1786 #define WL_POINTER_BUTTON 3 |
| 1787 #define WL_POINTER_AXIS 4 |
| 1788 |
| 1789 #define WL_POINTER_ENTER_SINCE_VERSION 1 |
| 1790 #define WL_POINTER_LEAVE_SINCE_VERSION 1 |
| 1791 #define WL_POINTER_MOTION_SINCE_VERSION 1 |
| 1792 #define WL_POINTER_BUTTON_SINCE_VERSION 1 |
| 1793 #define WL_POINTER_AXIS_SINCE_VERSION 1 |
| 1794 |
| 1795 static inline void |
| 1796 wl_pointer_send_enter(struct wl_resource *resource_, uint32_t serial, struct wl_
resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y) |
| 1797 { |
| 1798 wl_resource_post_event(resource_, WL_POINTER_ENTER, serial, surface, sur
face_x, surface_y); |
| 1799 } |
| 1800 |
| 1801 static inline void |
| 1802 wl_pointer_send_leave(struct wl_resource *resource_, uint32_t serial, struct wl_
resource *surface) |
| 1803 { |
| 1804 wl_resource_post_event(resource_, WL_POINTER_LEAVE, serial, surface); |
| 1805 } |
| 1806 |
| 1807 static inline void |
| 1808 wl_pointer_send_motion(struct wl_resource *resource_, uint32_t time, wl_fixed_t
surface_x, wl_fixed_t surface_y) |
| 1809 { |
| 1810 wl_resource_post_event(resource_, WL_POINTER_MOTION, time, surface_x, su
rface_y); |
| 1811 } |
| 1812 |
| 1813 static inline void |
| 1814 wl_pointer_send_button(struct wl_resource *resource_, uint32_t serial, uint32_t
time, uint32_t button, uint32_t state) |
| 1815 { |
| 1816 wl_resource_post_event(resource_, WL_POINTER_BUTTON, serial, time, butto
n, state); |
| 1817 } |
| 1818 |
| 1819 static inline void |
| 1820 wl_pointer_send_axis(struct wl_resource *resource_, uint32_t time, uint32_t axis
, wl_fixed_t value) |
| 1821 { |
| 1822 wl_resource_post_event(resource_, WL_POINTER_AXIS, time, axis, value); |
| 1823 } |
| 1824 |
| 1825 #ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM |
| 1826 #define WL_KEYBOARD_KEYMAP_FORMAT_ENUM |
| 1827 /** |
| 1828 * wl_keyboard_keymap_format - keyboard mapping format |
| 1829 * @WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP: no keymap; client must |
| 1830 * understand how to interpret the raw keycode |
| 1831 * @WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1: libxkbcommon compatible; to |
| 1832 * determine the xkb keycode, clients must add 8 to the key event keycode |
| 1833 * |
| 1834 * This specifies the format of the keymap provided to the client with |
| 1835 * the wl_keyboard.keymap event. |
| 1836 */ |
| 1837 enum wl_keyboard_keymap_format { |
| 1838 WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0, |
| 1839 WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1, |
| 1840 }; |
| 1841 #endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */ |
| 1842 |
| 1843 #ifndef WL_KEYBOARD_KEY_STATE_ENUM |
| 1844 #define WL_KEYBOARD_KEY_STATE_ENUM |
| 1845 /** |
| 1846 * wl_keyboard_key_state - physical key state |
| 1847 * @WL_KEYBOARD_KEY_STATE_RELEASED: key is not pressed |
| 1848 * @WL_KEYBOARD_KEY_STATE_PRESSED: key is pressed |
| 1849 * |
| 1850 * Describes the physical state of a key which provoked the key event. |
| 1851 */ |
| 1852 enum wl_keyboard_key_state { |
| 1853 WL_KEYBOARD_KEY_STATE_RELEASED = 0, |
| 1854 WL_KEYBOARD_KEY_STATE_PRESSED = 1, |
| 1855 }; |
| 1856 #endif /* WL_KEYBOARD_KEY_STATE_ENUM */ |
| 1857 |
| 1858 /** |
| 1859 * wl_keyboard - keyboard input device |
| 1860 * @release: release the keyboard object |
| 1861 * |
| 1862 * The wl_keyboard interface represents one or more keyboards associated |
| 1863 * with a seat. |
| 1864 */ |
| 1865 struct wl_keyboard_interface { |
| 1866 /** |
| 1867 * release - release the keyboard object |
| 1868 * |
| 1869 * |
| 1870 * @since: 3 |
| 1871 */ |
| 1872 void (*release)(struct wl_client *client, |
| 1873 struct wl_resource *resource); |
| 1874 }; |
| 1875 |
| 1876 #define WL_KEYBOARD_KEYMAP 0 |
| 1877 #define WL_KEYBOARD_ENTER 1 |
| 1878 #define WL_KEYBOARD_LEAVE 2 |
| 1879 #define WL_KEYBOARD_KEY 3 |
| 1880 #define WL_KEYBOARD_MODIFIERS 4 |
| 1881 #define WL_KEYBOARD_REPEAT_INFO 5 |
| 1882 |
| 1883 #define WL_KEYBOARD_KEYMAP_SINCE_VERSION 1 |
| 1884 #define WL_KEYBOARD_ENTER_SINCE_VERSION 1 |
| 1885 #define WL_KEYBOARD_LEAVE_SINCE_VERSION 1 |
| 1886 #define WL_KEYBOARD_KEY_SINCE_VERSION 1 |
| 1887 #define WL_KEYBOARD_MODIFIERS_SINCE_VERSION 1 |
| 1888 #define WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION 4 |
| 1889 |
| 1890 static inline void |
| 1891 wl_keyboard_send_keymap(struct wl_resource *resource_, uint32_t format, int32_t
fd, uint32_t size) |
| 1892 { |
| 1893 wl_resource_post_event(resource_, WL_KEYBOARD_KEYMAP, format, fd, size); |
| 1894 } |
| 1895 |
| 1896 static inline void |
| 1897 wl_keyboard_send_enter(struct wl_resource *resource_, uint32_t serial, struct wl
_resource *surface, struct wl_array *keys) |
| 1898 { |
| 1899 wl_resource_post_event(resource_, WL_KEYBOARD_ENTER, serial, surface, ke
ys); |
| 1900 } |
| 1901 |
| 1902 static inline void |
| 1903 wl_keyboard_send_leave(struct wl_resource *resource_, uint32_t serial, struct wl
_resource *surface) |
| 1904 { |
| 1905 wl_resource_post_event(resource_, WL_KEYBOARD_LEAVE, serial, surface); |
| 1906 } |
| 1907 |
| 1908 static inline void |
| 1909 wl_keyboard_send_key(struct wl_resource *resource_, uint32_t serial, uint32_t ti
me, uint32_t key, uint32_t state) |
| 1910 { |
| 1911 wl_resource_post_event(resource_, WL_KEYBOARD_KEY, serial, time, key, st
ate); |
| 1912 } |
| 1913 |
| 1914 static inline void |
| 1915 wl_keyboard_send_modifiers(struct wl_resource *resource_, uint32_t serial, uint3
2_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) |
| 1916 { |
| 1917 wl_resource_post_event(resource_, WL_KEYBOARD_MODIFIERS, serial, mods_de
pressed, mods_latched, mods_locked, group); |
| 1918 } |
| 1919 |
| 1920 static inline void |
| 1921 wl_keyboard_send_repeat_info(struct wl_resource *resource_, int32_t rate, int32_
t delay) |
| 1922 { |
| 1923 wl_resource_post_event(resource_, WL_KEYBOARD_REPEAT_INFO, rate, delay); |
| 1924 } |
| 1925 |
| 1926 /** |
| 1927 * wl_touch - touchscreen input device |
| 1928 * @release: release the touch object |
| 1929 * |
| 1930 * The wl_touch interface represents a touchscreen associated with a |
| 1931 * seat. |
| 1932 * |
| 1933 * Touch interactions can consist of one or more contacts. For each |
| 1934 * contact, a series of events is generated, starting with a down event, |
| 1935 * followed by zero or more motion events, and ending with an up event. |
| 1936 * Events relating to the same contact point can be identified by the ID of |
| 1937 * the sequence. |
| 1938 */ |
| 1939 struct wl_touch_interface { |
| 1940 /** |
| 1941 * release - release the touch object |
| 1942 * |
| 1943 * |
| 1944 * @since: 3 |
| 1945 */ |
| 1946 void (*release)(struct wl_client *client, |
| 1947 struct wl_resource *resource); |
| 1948 }; |
| 1949 |
| 1950 #define WL_TOUCH_DOWN 0 |
| 1951 #define WL_TOUCH_UP 1 |
| 1952 #define WL_TOUCH_MOTION 2 |
| 1953 #define WL_TOUCH_FRAME 3 |
| 1954 #define WL_TOUCH_CANCEL 4 |
| 1955 |
| 1956 #define WL_TOUCH_DOWN_SINCE_VERSION 1 |
| 1957 #define WL_TOUCH_UP_SINCE_VERSION 1 |
| 1958 #define WL_TOUCH_MOTION_SINCE_VERSION 1 |
| 1959 #define WL_TOUCH_FRAME_SINCE_VERSION 1 |
| 1960 #define WL_TOUCH_CANCEL_SINCE_VERSION 1 |
| 1961 |
| 1962 static inline void |
| 1963 wl_touch_send_down(struct wl_resource *resource_, uint32_t serial, uint32_t time
, struct wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y) |
| 1964 { |
| 1965 wl_resource_post_event(resource_, WL_TOUCH_DOWN, serial, time, surface,
id, x, y); |
| 1966 } |
| 1967 |
| 1968 static inline void |
| 1969 wl_touch_send_up(struct wl_resource *resource_, uint32_t serial, uint32_t time,
int32_t id) |
| 1970 { |
| 1971 wl_resource_post_event(resource_, WL_TOUCH_UP, serial, time, id); |
| 1972 } |
| 1973 |
| 1974 static inline void |
| 1975 wl_touch_send_motion(struct wl_resource *resource_, uint32_t time, int32_t id, w
l_fixed_t x, wl_fixed_t y) |
| 1976 { |
| 1977 wl_resource_post_event(resource_, WL_TOUCH_MOTION, time, id, x, y); |
| 1978 } |
| 1979 |
| 1980 static inline void |
| 1981 wl_touch_send_frame(struct wl_resource *resource_) |
| 1982 { |
| 1983 wl_resource_post_event(resource_, WL_TOUCH_FRAME); |
| 1984 } |
| 1985 |
| 1986 static inline void |
| 1987 wl_touch_send_cancel(struct wl_resource *resource_) |
| 1988 { |
| 1989 wl_resource_post_event(resource_, WL_TOUCH_CANCEL); |
| 1990 } |
| 1991 |
| 1992 #ifndef WL_OUTPUT_SUBPIXEL_ENUM |
| 1993 #define WL_OUTPUT_SUBPIXEL_ENUM |
| 1994 /** |
| 1995 * wl_output_subpixel - subpixel geometry information |
| 1996 * @WL_OUTPUT_SUBPIXEL_UNKNOWN: (none) |
| 1997 * @WL_OUTPUT_SUBPIXEL_NONE: (none) |
| 1998 * @WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: (none) |
| 1999 * @WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: (none) |
| 2000 * @WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: (none) |
| 2001 * @WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: (none) |
| 2002 * |
| 2003 * This enumeration describes how the physical pixels on an output are |
| 2004 * laid out. |
| 2005 */ |
| 2006 enum wl_output_subpixel { |
| 2007 WL_OUTPUT_SUBPIXEL_UNKNOWN = 0, |
| 2008 WL_OUTPUT_SUBPIXEL_NONE = 1, |
| 2009 WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2, |
| 2010 WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3, |
| 2011 WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4, |
| 2012 WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5, |
| 2013 }; |
| 2014 #endif /* WL_OUTPUT_SUBPIXEL_ENUM */ |
| 2015 |
| 2016 #ifndef WL_OUTPUT_TRANSFORM_ENUM |
| 2017 #define WL_OUTPUT_TRANSFORM_ENUM |
| 2018 /** |
| 2019 * wl_output_transform - transform from framebuffer to output |
| 2020 * @WL_OUTPUT_TRANSFORM_NORMAL: (none) |
| 2021 * @WL_OUTPUT_TRANSFORM_90: (none) |
| 2022 * @WL_OUTPUT_TRANSFORM_180: (none) |
| 2023 * @WL_OUTPUT_TRANSFORM_270: (none) |
| 2024 * @WL_OUTPUT_TRANSFORM_FLIPPED: (none) |
| 2025 * @WL_OUTPUT_TRANSFORM_FLIPPED_90: (none) |
| 2026 * @WL_OUTPUT_TRANSFORM_FLIPPED_180: (none) |
| 2027 * @WL_OUTPUT_TRANSFORM_FLIPPED_270: (none) |
| 2028 * |
| 2029 * This describes the transform that a compositor will apply to a surface |
| 2030 * to compensate for the rotation or mirroring of an output device. |
| 2031 * |
| 2032 * The flipped values correspond to an initial flip around a vertical axis |
| 2033 * followed by rotation. |
| 2034 * |
| 2035 * The purpose is mainly to allow clients render accordingly and tell the |
| 2036 * compositor, so that for fullscreen surfaces, the compositor will still |
| 2037 * be able to scan out directly from client surfaces. |
| 2038 */ |
| 2039 enum wl_output_transform { |
| 2040 WL_OUTPUT_TRANSFORM_NORMAL = 0, |
| 2041 WL_OUTPUT_TRANSFORM_90 = 1, |
| 2042 WL_OUTPUT_TRANSFORM_180 = 2, |
| 2043 WL_OUTPUT_TRANSFORM_270 = 3, |
| 2044 WL_OUTPUT_TRANSFORM_FLIPPED = 4, |
| 2045 WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5, |
| 2046 WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6, |
| 2047 WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7, |
| 2048 }; |
| 2049 #endif /* WL_OUTPUT_TRANSFORM_ENUM */ |
| 2050 |
| 2051 #ifndef WL_OUTPUT_MODE_ENUM |
| 2052 #define WL_OUTPUT_MODE_ENUM |
| 2053 /** |
| 2054 * wl_output_mode - mode information |
| 2055 * @WL_OUTPUT_MODE_CURRENT: indicates this is the current mode |
| 2056 * @WL_OUTPUT_MODE_PREFERRED: indicates this is the preferred mode |
| 2057 * |
| 2058 * These flags describe properties of an output mode. They are used in |
| 2059 * the flags bitfield of the mode event. |
| 2060 */ |
| 2061 enum wl_output_mode { |
| 2062 WL_OUTPUT_MODE_CURRENT = 0x1, |
| 2063 WL_OUTPUT_MODE_PREFERRED = 0x2, |
| 2064 }; |
| 2065 #endif /* WL_OUTPUT_MODE_ENUM */ |
| 2066 |
| 2067 #define WL_OUTPUT_GEOMETRY 0 |
| 2068 #define WL_OUTPUT_MODE 1 |
| 2069 #define WL_OUTPUT_DONE 2 |
| 2070 #define WL_OUTPUT_SCALE 3 |
| 2071 |
| 2072 #define WL_OUTPUT_GEOMETRY_SINCE_VERSION 1 |
| 2073 #define WL_OUTPUT_MODE_SINCE_VERSION 1 |
| 2074 #define WL_OUTPUT_DONE_SINCE_VERSION 2 |
| 2075 #define WL_OUTPUT_SCALE_SINCE_VERSION 2 |
| 2076 |
| 2077 static inline void |
| 2078 wl_output_send_geometry(struct wl_resource *resource_, int32_t x, int32_t y, int
32_t physical_width, int32_t physical_height, int32_t subpixel, const char *make
, const char *model, int32_t transform) |
| 2079 { |
| 2080 wl_resource_post_event(resource_, WL_OUTPUT_GEOMETRY, x, y, physical_wid
th, physical_height, subpixel, make, model, transform); |
| 2081 } |
| 2082 |
| 2083 static inline void |
| 2084 wl_output_send_mode(struct wl_resource *resource_, uint32_t flags, int32_t width
, int32_t height, int32_t refresh) |
| 2085 { |
| 2086 wl_resource_post_event(resource_, WL_OUTPUT_MODE, flags, width, height,
refresh); |
| 2087 } |
| 2088 |
| 2089 static inline void |
| 2090 wl_output_send_done(struct wl_resource *resource_) |
| 2091 { |
| 2092 wl_resource_post_event(resource_, WL_OUTPUT_DONE); |
| 2093 } |
| 2094 |
| 2095 static inline void |
| 2096 wl_output_send_scale(struct wl_resource *resource_, int32_t factor) |
| 2097 { |
| 2098 wl_resource_post_event(resource_, WL_OUTPUT_SCALE, factor); |
| 2099 } |
| 2100 |
| 2101 /** |
| 2102 * wl_region - region interface |
| 2103 * @destroy: destroy region |
| 2104 * @add: add rectangle to region |
| 2105 * @subtract: subtract rectangle from region |
| 2106 * |
| 2107 * A region object describes an area. |
| 2108 * |
| 2109 * Region objects are used to describe the opaque and input regions of a |
| 2110 * surface. |
| 2111 */ |
| 2112 struct wl_region_interface { |
| 2113 /** |
| 2114 * destroy - destroy region |
| 2115 * |
| 2116 * Destroy the region. This will invalidate the object ID. |
| 2117 */ |
| 2118 void (*destroy)(struct wl_client *client, |
| 2119 struct wl_resource *resource); |
| 2120 /** |
| 2121 * add - add rectangle to region |
| 2122 * @x: (none) |
| 2123 * @y: (none) |
| 2124 * @width: (none) |
| 2125 * @height: (none) |
| 2126 * |
| 2127 * Add the specified rectangle to the region. |
| 2128 */ |
| 2129 void (*add)(struct wl_client *client, |
| 2130 struct wl_resource *resource, |
| 2131 int32_t x, |
| 2132 int32_t y, |
| 2133 int32_t width, |
| 2134 int32_t height); |
| 2135 /** |
| 2136 * subtract - subtract rectangle from region |
| 2137 * @x: (none) |
| 2138 * @y: (none) |
| 2139 * @width: (none) |
| 2140 * @height: (none) |
| 2141 * |
| 2142 * Subtract the specified rectangle from the region. |
| 2143 */ |
| 2144 void (*subtract)(struct wl_client *client, |
| 2145 struct wl_resource *resource, |
| 2146 int32_t x, |
| 2147 int32_t y, |
| 2148 int32_t width, |
| 2149 int32_t height); |
| 2150 }; |
| 2151 |
| 2152 |
| 2153 #ifndef WL_SUBCOMPOSITOR_ERROR_ENUM |
| 2154 #define WL_SUBCOMPOSITOR_ERROR_ENUM |
| 2155 enum wl_subcompositor_error { |
| 2156 WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0, |
| 2157 }; |
| 2158 #endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */ |
| 2159 |
| 2160 /** |
| 2161 * wl_subcompositor - sub-surface compositing |
| 2162 * @destroy: unbind from the subcompositor interface |
| 2163 * @get_subsurface: give a surface the role sub-surface |
| 2164 * |
| 2165 * The global interface exposing sub-surface compositing capabilities. A |
| 2166 * wl_surface, that has sub-surfaces associated, is called the parent |
| 2167 * surface. Sub-surfaces can be arbitrarily nested and create a tree of |
| 2168 * sub-surfaces. |
| 2169 * |
| 2170 * The root surface in a tree of sub-surfaces is the main surface. The main |
| 2171 * surface cannot be a sub-surface, because sub-surfaces must always have a |
| 2172 * parent. |
| 2173 * |
| 2174 * A main surface with its sub-surfaces forms a (compound) window. For |
| 2175 * window management purposes, this set of wl_surface objects is to be |
| 2176 * considered as a single window, and it should also behave as such. |
| 2177 * |
| 2178 * The aim of sub-surfaces is to offload some of the compositing work |
| 2179 * within a window from clients to the compositor. A prime example is a |
| 2180 * video player with decorations and video in separate wl_surface objects. |
| 2181 * This should allow the compositor to pass YUV video buffer processing to |
| 2182 * dedicated overlay hardware when possible. |
| 2183 */ |
| 2184 struct wl_subcompositor_interface { |
| 2185 /** |
| 2186 * destroy - unbind from the subcompositor interface |
| 2187 * |
| 2188 * Informs the server that the client will not be using this |
| 2189 * protocol object anymore. This does not affect any other objects, |
| 2190 * wl_subsurface objects included. |
| 2191 */ |
| 2192 void (*destroy)(struct wl_client *client, |
| 2193 struct wl_resource *resource); |
| 2194 /** |
| 2195 * get_subsurface - give a surface the role sub-surface |
| 2196 * @id: the new subsurface object id |
| 2197 * @surface: the surface to be turned into a sub-surface |
| 2198 * @parent: the parent surface |
| 2199 * |
| 2200 * Create a sub-surface interface for the given surface, and |
| 2201 * associate it with the given parent surface. This turns a plain |
| 2202 * wl_surface into a sub-surface. |
| 2203 * |
| 2204 * The to-be sub-surface must not already have another role, and it |
| 2205 * must not have an existing wl_subsurface object. Otherwise a |
| 2206 * protocol error is raised. |
| 2207 */ |
| 2208 void (*get_subsurface)(struct wl_client *client, |
| 2209 struct wl_resource *resource, |
| 2210 uint32_t id, |
| 2211 struct wl_resource *surface, |
| 2212 struct wl_resource *parent); |
| 2213 }; |
| 2214 |
| 2215 |
| 2216 #ifndef WL_SUBSURFACE_ERROR_ENUM |
| 2217 #define WL_SUBSURFACE_ERROR_ENUM |
| 2218 enum wl_subsurface_error { |
| 2219 WL_SUBSURFACE_ERROR_BAD_SURFACE = 0, |
| 2220 }; |
| 2221 #endif /* WL_SUBSURFACE_ERROR_ENUM */ |
| 2222 |
| 2223 /** |
| 2224 * wl_subsurface - sub-surface interface to a wl_surface |
| 2225 * @destroy: remove sub-surface interface |
| 2226 * @set_position: reposition the sub-surface |
| 2227 * @place_above: restack the sub-surface |
| 2228 * @place_below: restack the sub-surface |
| 2229 * @set_sync: set sub-surface to synchronized mode |
| 2230 * @set_desync: set sub-surface to desynchronized mode |
| 2231 * |
| 2232 * An additional interface to a wl_surface object, which has been made a |
| 2233 * sub-surface. A sub-surface has one parent surface. A sub-surface's size |
| 2234 * and position are not limited to that of the parent. Particularly, a |
| 2235 * sub-surface is not automatically clipped to its parent's area. |
| 2236 * |
| 2237 * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied and |
| 2238 * the parent surface is mapped. The order of which one happens first is |
| 2239 * irrelevant. A sub-surface is hidden if the parent becomes hidden, or if |
| 2240 * a NULL wl_buffer is applied. These rules apply recursively through the |
| 2241 * tree of surfaces. |
| 2242 * |
| 2243 * The behaviour of wl_surface.commit request on a sub-surface depends on |
| 2244 * the sub-surface's mode. The possible modes are synchronized and |
| 2245 * desynchronized, see methods wl_subsurface.set_sync and |
| 2246 * wl_subsurface.set_desync. Synchronized mode caches the wl_surface state |
| 2247 * to be applied when the parent's state gets applied, and desynchronized |
| 2248 * mode applies the pending wl_surface state directly. A sub-surface is |
| 2249 * initially in the synchronized mode. |
| 2250 * |
| 2251 * Sub-surfaces have also other kind of state, which is managed by |
| 2252 * wl_subsurface requests, as opposed to wl_surface requests. This state |
| 2253 * includes the sub-surface position relative to the parent surface |
| 2254 * (wl_subsurface.set_position), and the stacking order of the parent and |
| 2255 * its sub-surfaces (wl_subsurface.place_above and .place_below). This |
| 2256 * state is applied when the parent surface's wl_surface state is applied, |
| 2257 * regardless of the sub-surface's mode. As the exception, set_sync and |
| 2258 * set_desync are effective immediately. |
| 2259 * |
| 2260 * The main surface can be thought to be always in desynchronized mode, |
| 2261 * since it does not have a parent in the sub-surfaces sense. |
| 2262 * |
| 2263 * Even if a sub-surface is in desynchronized mode, it will behave as in |
| 2264 * synchronized mode, if its parent surface behaves as in synchronized |
| 2265 * mode. This rule is applied recursively throughout the tree of surfaces. |
| 2266 * This means, that one can set a sub-surface into synchronized mode, and |
| 2267 * then assume that all its child and grand-child sub-surfaces are |
| 2268 * synchronized, too, without explicitly setting them. |
| 2269 * |
| 2270 * If the wl_surface associated with the wl_subsurface is destroyed, the |
| 2271 * wl_subsurface object becomes inert. Note, that destroying either object |
| 2272 * takes effect immediately. If you need to synchronize the removal of a |
| 2273 * sub-surface to the parent surface update, unmap the sub-surface first by |
| 2274 * attaching a NULL wl_buffer, update parent, and then destroy the |
| 2275 * sub-surface. |
| 2276 * |
| 2277 * If the parent wl_surface object is destroyed, the sub-surface is |
| 2278 * unmapped. |
| 2279 */ |
| 2280 struct wl_subsurface_interface { |
| 2281 /** |
| 2282 * destroy - remove sub-surface interface |
| 2283 * |
| 2284 * The sub-surface interface is removed from the wl_surface |
| 2285 * object that was turned into a sub-surface with |
| 2286 * wl_subcompositor.get_subsurface request. The wl_surface's |
| 2287 * association to the parent is deleted, and the wl_surface loses |
| 2288 * its role as a sub-surface. The wl_surface is unmapped. |
| 2289 */ |
| 2290 void (*destroy)(struct wl_client *client, |
| 2291 struct wl_resource *resource); |
| 2292 /** |
| 2293 * set_position - reposition the sub-surface |
| 2294 * @x: coordinate in the parent surface |
| 2295 * @y: coordinate in the parent surface |
| 2296 * |
| 2297 * This schedules a sub-surface position change. The sub-surface |
| 2298 * will be moved so, that its origin (top-left corner pixel) will |
| 2299 * be at the location x, y of the parent surface coordinate system. |
| 2300 * The coordinates are not restricted to the parent surface area. |
| 2301 * Negative values are allowed. |
| 2302 * |
| 2303 * The scheduled coordinates will take effect whenever the state of |
| 2304 * the parent surface is applied. When this happens depends on |
| 2305 * whether the parent surface is in synchronized mode or not. See |
| 2306 * wl_subsurface.set_sync and wl_subsurface.set_desync for details. |
| 2307 * |
| 2308 * If more than one set_position request is invoked by the client |
| 2309 * before the commit of the parent surface, the position of a new |
| 2310 * request always replaces the scheduled position from any previous |
| 2311 * request. |
| 2312 * |
| 2313 * The initial position is 0, 0. |
| 2314 */ |
| 2315 void (*set_position)(struct wl_client *client, |
| 2316 struct wl_resource *resource, |
| 2317 int32_t x, |
| 2318 int32_t y); |
| 2319 /** |
| 2320 * place_above - restack the sub-surface |
| 2321 * @sibling: the reference surface |
| 2322 * |
| 2323 * This sub-surface is taken from the stack, and put back just |
| 2324 * above the reference surface, changing the z-order of the |
| 2325 * sub-surfaces. The reference surface must be one of the sibling |
| 2326 * surfaces, or the parent surface. Using any other surface, |
| 2327 * including this sub-surface, will cause a protocol error. |
| 2328 * |
| 2329 * The z-order is double-buffered. Requests are handled in order |
| 2330 * and applied immediately to a pending state. The final pending |
| 2331 * state is copied to the active state the next time the state of |
| 2332 * the parent surface is applied. When this happens depends on |
| 2333 * whether the parent surface is in synchronized mode or not. See |
| 2334 * wl_subsurface.set_sync and wl_subsurface.set_desync for details. |
| 2335 * |
| 2336 * A new sub-surface is initially added as the top-most in the |
| 2337 * stack of its siblings and parent. |
| 2338 */ |
| 2339 void (*place_above)(struct wl_client *client, |
| 2340 struct wl_resource *resource, |
| 2341 struct wl_resource *sibling); |
| 2342 /** |
| 2343 * place_below - restack the sub-surface |
| 2344 * @sibling: the reference surface |
| 2345 * |
| 2346 * The sub-surface is placed just below of the reference surface. |
| 2347 * See wl_subsurface.place_above. |
| 2348 */ |
| 2349 void (*place_below)(struct wl_client *client, |
| 2350 struct wl_resource *resource, |
| 2351 struct wl_resource *sibling); |
| 2352 /** |
| 2353 * set_sync - set sub-surface to synchronized mode |
| 2354 * |
| 2355 * Change the commit behaviour of the sub-surface to synchronized |
| 2356 * mode, also described as the parent dependent mode. |
| 2357 * |
| 2358 * In synchronized mode, wl_surface.commit on a sub-surface will |
| 2359 * accumulate the committed state in a cache, but the state will |
| 2360 * not be applied and hence will not change the compositor output. |
| 2361 * The cached state is applied to the sub-surface immediately after |
| 2362 * the parent surface's state is applied. This ensures atomic |
| 2363 * updates of the parent and all its synchronized sub-surfaces. |
| 2364 * Applying the cached state will invalidate the cache, so further |
| 2365 * parent surface commits do not (re-)apply old state. |
| 2366 * |
| 2367 * See wl_subsurface for the recursive effect of this mode. |
| 2368 */ |
| 2369 void (*set_sync)(struct wl_client *client, |
| 2370 struct wl_resource *resource); |
| 2371 /** |
| 2372 * set_desync - set sub-surface to desynchronized mode |
| 2373 * |
| 2374 * Change the commit behaviour of the sub-surface to |
| 2375 * desynchronized mode, also described as independent or freely |
| 2376 * running mode. |
| 2377 * |
| 2378 * In desynchronized mode, wl_surface.commit on a sub-surface will |
| 2379 * apply the pending state directly, without caching, as happens |
| 2380 * normally with a wl_surface. Calling wl_surface.commit on the |
| 2381 * parent surface has no effect on the sub-surface's wl_surface |
| 2382 * state. This mode allows a sub-surface to be updated on its own. |
| 2383 * |
| 2384 * If cached state exists when wl_surface.commit is called in |
| 2385 * desynchronized mode, the pending state is added to the cached |
| 2386 * state, and applied as whole. This invalidates the cache. |
| 2387 * |
| 2388 * Note: even if a sub-surface is set to desynchronized, a parent |
| 2389 * sub-surface may override it to behave as synchronized. For |
| 2390 * details, see wl_subsurface. |
| 2391 * |
| 2392 * If a surface's parent surface behaves as desynchronized, then |
| 2393 * the cached state is applied on set_desync. |
| 2394 */ |
| 2395 void (*set_desync)(struct wl_client *client, |
| 2396 struct wl_resource *resource); |
| 2397 }; |
| 2398 |
| 2399 |
| 2400 #ifdef __cplusplus |
| 2401 } |
| 2402 #endif |
| 2403 |
| 2404 #endif |
OLD | NEW |