| 1 | /* Generated by wayland-scanner 1.24.0 */ |
| 2 | |
| 3 | #ifndef VIEWPORTER_CLIENT_PROTOCOL_H |
| 4 | #define VIEWPORTER_CLIENT_PROTOCOL_H |
| 5 | |
| 6 | #include <stdint.h> |
| 7 | #include <stddef.h> |
| 8 | #include "wayland-client.h" |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | |
| 14 | /** |
| 15 | * @page page_viewporter The viewporter protocol |
| 16 | * @section page_ifaces_viewporter Interfaces |
| 17 | * - @subpage page_iface_wp_viewporter - surface cropping and scaling |
| 18 | * - @subpage page_iface_wp_viewport - crop and scale interface to a wl_surface |
| 19 | * @section page_copyright_viewporter Copyright |
| 20 | * <pre> |
| 21 | * |
| 22 | * Copyright © 2013-2016 Collabora, Ltd. |
| 23 | * |
| 24 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 25 | * copy of this software and associated documentation files (the "Software"), |
| 26 | * to deal in the Software without restriction, including without limitation |
| 27 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 28 | * and/or sell copies of the Software, and to permit persons to whom the |
| 29 | * Software is furnished to do so, subject to the following conditions: |
| 30 | * |
| 31 | * The above copyright notice and this permission notice (including the next |
| 32 | * paragraph) shall be included in all copies or substantial portions of the |
| 33 | * Software. |
| 34 | * |
| 35 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 36 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 37 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 38 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 39 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 40 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 41 | * DEALINGS IN THE SOFTWARE. |
| 42 | * </pre> |
| 43 | */ |
| 44 | struct wl_surface; |
| 45 | struct wp_viewport; |
| 46 | struct wp_viewporter; |
| 47 | |
| 48 | #ifndef WP_VIEWPORTER_INTERFACE |
| 49 | #define WP_VIEWPORTER_INTERFACE |
| 50 | /** |
| 51 | * @page page_iface_wp_viewporter wp_viewporter |
| 52 | * @section page_iface_wp_viewporter_desc Description |
| 53 | * |
| 54 | * The global interface exposing surface cropping and scaling |
| 55 | * capabilities is used to instantiate an interface extension for a |
| 56 | * wl_surface object. This extended interface will then allow |
| 57 | * cropping and scaling the surface contents, effectively |
| 58 | * disconnecting the direct relationship between the buffer and the |
| 59 | * surface size. |
| 60 | * @section page_iface_wp_viewporter_api API |
| 61 | * See @ref iface_wp_viewporter. |
| 62 | */ |
| 63 | /** |
| 64 | * @defgroup iface_wp_viewporter The wp_viewporter interface |
| 65 | * |
| 66 | * The global interface exposing surface cropping and scaling |
| 67 | * capabilities is used to instantiate an interface extension for a |
| 68 | * wl_surface object. This extended interface will then allow |
| 69 | * cropping and scaling the surface contents, effectively |
| 70 | * disconnecting the direct relationship between the buffer and the |
| 71 | * surface size. |
| 72 | */ |
| 73 | extern const struct wl_interface wp_viewporter_interface; |
| 74 | #endif |
| 75 | #ifndef WP_VIEWPORT_INTERFACE |
| 76 | #define WP_VIEWPORT_INTERFACE |
| 77 | /** |
| 78 | * @page page_iface_wp_viewport wp_viewport |
| 79 | * @section page_iface_wp_viewport_desc Description |
| 80 | * |
| 81 | * An additional interface to a wl_surface object, which allows the |
| 82 | * client to specify the cropping and scaling of the surface |
| 83 | * contents. |
| 84 | * |
| 85 | * This interface works with two concepts: the source rectangle (src_x, |
| 86 | * src_y, src_width, src_height), and the destination size (dst_width, |
| 87 | * dst_height). The contents of the source rectangle are scaled to the |
| 88 | * destination size, and content outside the source rectangle is ignored. |
| 89 | * This state is double-buffered, see wl_surface.commit. |
| 90 | * |
| 91 | * The two parts of crop and scale state are independent: the source |
| 92 | * rectangle, and the destination size. Initially both are unset, that |
| 93 | * is, no scaling is applied. The whole of the current wl_buffer is |
| 94 | * used as the source, and the surface size is as defined in |
| 95 | * wl_surface.attach. |
| 96 | * |
| 97 | * If the destination size is set, it causes the surface size to become |
| 98 | * dst_width, dst_height. The source (rectangle) is scaled to exactly |
| 99 | * this size. This overrides whatever the attached wl_buffer size is, |
| 100 | * unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface |
| 101 | * has no content and therefore no size. Otherwise, the size is always |
| 102 | * at least 1x1 in surface local coordinates. |
| 103 | * |
| 104 | * If the source rectangle is set, it defines what area of the wl_buffer is |
| 105 | * taken as the source. If the source rectangle is set and the destination |
| 106 | * size is not set, then src_width and src_height must be integers, and the |
| 107 | * surface size becomes the source rectangle size. This results in cropping |
| 108 | * without scaling. If src_width or src_height are not integers and |
| 109 | * destination size is not set, the bad_size protocol error is raised when |
| 110 | * the surface state is applied. |
| 111 | * |
| 112 | * The coordinate transformations from buffer pixel coordinates up to |
| 113 | * the surface-local coordinates happen in the following order: |
| 114 | * 1. buffer_transform (wl_surface.set_buffer_transform) |
| 115 | * 2. buffer_scale (wl_surface.set_buffer_scale) |
| 116 | * 3. crop and scale (wp_viewport.set*) |
| 117 | * This means, that the source rectangle coordinates of crop and scale |
| 118 | * are given in the coordinates after the buffer transform and scale, |
| 119 | * i.e. in the coordinates that would be the surface-local coordinates |
| 120 | * if the crop and scale was not applied. |
| 121 | * |
| 122 | * If src_x or src_y are negative, the bad_value protocol error is raised. |
| 123 | * Otherwise, if the source rectangle is partially or completely outside of |
| 124 | * the non-NULL wl_buffer, then the out_of_buffer protocol error is raised |
| 125 | * when the surface state is applied. A NULL wl_buffer does not raise the |
| 126 | * out_of_buffer error. |
| 127 | * |
| 128 | * If the wl_surface associated with the wp_viewport is destroyed, |
| 129 | * all wp_viewport requests except 'destroy' raise the protocol error |
| 130 | * no_surface. |
| 131 | * |
| 132 | * If the wp_viewport object is destroyed, the crop and scale |
| 133 | * state is removed from the wl_surface. The change will be applied |
| 134 | * on the next wl_surface.commit. |
| 135 | * @section page_iface_wp_viewport_api API |
| 136 | * See @ref iface_wp_viewport. |
| 137 | */ |
| 138 | /** |
| 139 | * @defgroup iface_wp_viewport The wp_viewport interface |
| 140 | * |
| 141 | * An additional interface to a wl_surface object, which allows the |
| 142 | * client to specify the cropping and scaling of the surface |
| 143 | * contents. |
| 144 | * |
| 145 | * This interface works with two concepts: the source rectangle (src_x, |
| 146 | * src_y, src_width, src_height), and the destination size (dst_width, |
| 147 | * dst_height). The contents of the source rectangle are scaled to the |
| 148 | * destination size, and content outside the source rectangle is ignored. |
| 149 | * This state is double-buffered, see wl_surface.commit. |
| 150 | * |
| 151 | * The two parts of crop and scale state are independent: the source |
| 152 | * rectangle, and the destination size. Initially both are unset, that |
| 153 | * is, no scaling is applied. The whole of the current wl_buffer is |
| 154 | * used as the source, and the surface size is as defined in |
| 155 | * wl_surface.attach. |
| 156 | * |
| 157 | * If the destination size is set, it causes the surface size to become |
| 158 | * dst_width, dst_height. The source (rectangle) is scaled to exactly |
| 159 | * this size. This overrides whatever the attached wl_buffer size is, |
| 160 | * unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface |
| 161 | * has no content and therefore no size. Otherwise, the size is always |
| 162 | * at least 1x1 in surface local coordinates. |
| 163 | * |
| 164 | * If the source rectangle is set, it defines what area of the wl_buffer is |
| 165 | * taken as the source. If the source rectangle is set and the destination |
| 166 | * size is not set, then src_width and src_height must be integers, and the |
| 167 | * surface size becomes the source rectangle size. This results in cropping |
| 168 | * without scaling. If src_width or src_height are not integers and |
| 169 | * destination size is not set, the bad_size protocol error is raised when |
| 170 | * the surface state is applied. |
| 171 | * |
| 172 | * The coordinate transformations from buffer pixel coordinates up to |
| 173 | * the surface-local coordinates happen in the following order: |
| 174 | * 1. buffer_transform (wl_surface.set_buffer_transform) |
| 175 | * 2. buffer_scale (wl_surface.set_buffer_scale) |
| 176 | * 3. crop and scale (wp_viewport.set*) |
| 177 | * This means, that the source rectangle coordinates of crop and scale |
| 178 | * are given in the coordinates after the buffer transform and scale, |
| 179 | * i.e. in the coordinates that would be the surface-local coordinates |
| 180 | * if the crop and scale was not applied. |
| 181 | * |
| 182 | * If src_x or src_y are negative, the bad_value protocol error is raised. |
| 183 | * Otherwise, if the source rectangle is partially or completely outside of |
| 184 | * the non-NULL wl_buffer, then the out_of_buffer protocol error is raised |
| 185 | * when the surface state is applied. A NULL wl_buffer does not raise the |
| 186 | * out_of_buffer error. |
| 187 | * |
| 188 | * If the wl_surface associated with the wp_viewport is destroyed, |
| 189 | * all wp_viewport requests except 'destroy' raise the protocol error |
| 190 | * no_surface. |
| 191 | * |
| 192 | * If the wp_viewport object is destroyed, the crop and scale |
| 193 | * state is removed from the wl_surface. The change will be applied |
| 194 | * on the next wl_surface.commit. |
| 195 | */ |
| 196 | extern const struct wl_interface wp_viewport_interface; |
| 197 | #endif |
| 198 | |
| 199 | #ifndef WP_VIEWPORTER_ERROR_ENUM |
| 200 | #define WP_VIEWPORTER_ERROR_ENUM |
| 201 | enum wp_viewporter_error { |
| 202 | /** |
| 203 | * the surface already has a viewport object associated |
| 204 | */ |
| 205 | WP_VIEWPORTER_ERROR_VIEWPORT_EXISTS = 0, |
| 206 | }; |
| 207 | #endif /* WP_VIEWPORTER_ERROR_ENUM */ |
| 208 | |
| 209 | #define WP_VIEWPORTER_DESTROY 0 |
| 210 | #define WP_VIEWPORTER_GET_VIEWPORT 1 |
| 211 | |
| 212 | |
| 213 | /** |
| 214 | * @ingroup iface_wp_viewporter |
| 215 | */ |
| 216 | #define WP_VIEWPORTER_DESTROY_SINCE_VERSION 1 |
| 217 | /** |
| 218 | * @ingroup iface_wp_viewporter |
| 219 | */ |
| 220 | #define WP_VIEWPORTER_GET_VIEWPORT_SINCE_VERSION 1 |
| 221 | |
| 222 | /** @ingroup iface_wp_viewporter */ |
| 223 | static inline void |
| 224 | wp_viewporter_set_user_data(struct wp_viewporter *wp_viewporter, void *user_data) |
| 225 | { |
| 226 | wl_proxy_set_user_data((struct wl_proxy *) wp_viewporter, user_data); |
| 227 | } |
| 228 | |
| 229 | /** @ingroup iface_wp_viewporter */ |
| 230 | static inline void * |
| 231 | wp_viewporter_get_user_data(struct wp_viewporter *wp_viewporter) |
| 232 | { |
| 233 | return wl_proxy_get_user_data((struct wl_proxy *) wp_viewporter); |
| 234 | } |
| 235 | |
| 236 | static inline uint32_t |
| 237 | wp_viewporter_get_version(struct wp_viewporter *wp_viewporter) |
| 238 | { |
| 239 | return wl_proxy_get_version((struct wl_proxy *) wp_viewporter); |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * @ingroup iface_wp_viewporter |
| 244 | * |
| 245 | * Informs the server that the client will not be using this |
| 246 | * protocol object anymore. This does not affect any other objects, |
| 247 | * wp_viewport objects included. |
| 248 | */ |
| 249 | static inline void |
| 250 | wp_viewporter_destroy(struct wp_viewporter *wp_viewporter) |
| 251 | { |
| 252 | wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter, |
| 253 | WP_VIEWPORTER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), WL_MARSHAL_FLAG_DESTROY); |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * @ingroup iface_wp_viewporter |
| 258 | * |
| 259 | * Instantiate an interface extension for the given wl_surface to |
| 260 | * crop and scale its content. If the given wl_surface already has |
| 261 | * a wp_viewport object associated, the viewport_exists |
| 262 | * protocol error is raised. |
| 263 | */ |
| 264 | static inline struct wp_viewport * |
| 265 | wp_viewporter_get_viewport(struct wp_viewporter *wp_viewporter, struct wl_surface *surface) |
| 266 | { |
| 267 | struct wl_proxy *id; |
| 268 | |
| 269 | id = wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter, |
| 270 | WP_VIEWPORTER_GET_VIEWPORT, &wp_viewport_interface, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), 0, NULL, surface); |
| 271 | |
| 272 | return (struct wp_viewport *) id; |
| 273 | } |
| 274 | |
| 275 | #ifndef WP_VIEWPORT_ERROR_ENUM |
| 276 | #define WP_VIEWPORT_ERROR_ENUM |
| 277 | enum wp_viewport_error { |
| 278 | /** |
| 279 | * negative or zero values in width or height |
| 280 | */ |
| 281 | WP_VIEWPORT_ERROR_BAD_VALUE = 0, |
| 282 | /** |
| 283 | * destination size is not integer |
| 284 | */ |
| 285 | WP_VIEWPORT_ERROR_BAD_SIZE = 1, |
| 286 | /** |
| 287 | * source rectangle extends outside of the content area |
| 288 | */ |
| 289 | WP_VIEWPORT_ERROR_OUT_OF_BUFFER = 2, |
| 290 | /** |
| 291 | * the wl_surface was destroyed |
| 292 | */ |
| 293 | WP_VIEWPORT_ERROR_NO_SURFACE = 3, |
| 294 | }; |
| 295 | #endif /* WP_VIEWPORT_ERROR_ENUM */ |
| 296 | |
| 297 | #define WP_VIEWPORT_DESTROY 0 |
| 298 | #define WP_VIEWPORT_SET_SOURCE 1 |
| 299 | #define WP_VIEWPORT_SET_DESTINATION 2 |
| 300 | |
| 301 | |
| 302 | /** |
| 303 | * @ingroup iface_wp_viewport |
| 304 | */ |
| 305 | #define WP_VIEWPORT_DESTROY_SINCE_VERSION 1 |
| 306 | /** |
| 307 | * @ingroup iface_wp_viewport |
| 308 | */ |
| 309 | #define WP_VIEWPORT_SET_SOURCE_SINCE_VERSION 1 |
| 310 | /** |
| 311 | * @ingroup iface_wp_viewport |
| 312 | */ |
| 313 | #define WP_VIEWPORT_SET_DESTINATION_SINCE_VERSION 1 |
| 314 | |
| 315 | /** @ingroup iface_wp_viewport */ |
| 316 | static inline void |
| 317 | wp_viewport_set_user_data(struct wp_viewport *wp_viewport, void *user_data) |
| 318 | { |
| 319 | wl_proxy_set_user_data((struct wl_proxy *) wp_viewport, user_data); |
| 320 | } |
| 321 | |
| 322 | /** @ingroup iface_wp_viewport */ |
| 323 | static inline void * |
| 324 | wp_viewport_get_user_data(struct wp_viewport *wp_viewport) |
| 325 | { |
| 326 | return wl_proxy_get_user_data((struct wl_proxy *) wp_viewport); |
| 327 | } |
| 328 | |
| 329 | static inline uint32_t |
| 330 | wp_viewport_get_version(struct wp_viewport *wp_viewport) |
| 331 | { |
| 332 | return wl_proxy_get_version((struct wl_proxy *) wp_viewport); |
| 333 | } |
| 334 | |
| 335 | /** |
| 336 | * @ingroup iface_wp_viewport |
| 337 | * |
| 338 | * The associated wl_surface's crop and scale state is removed. |
| 339 | * The change is applied on the next wl_surface.commit. |
| 340 | */ |
| 341 | static inline void |
| 342 | wp_viewport_destroy(struct wp_viewport *wp_viewport) |
| 343 | { |
| 344 | wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport, |
| 345 | WP_VIEWPORT_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), WL_MARSHAL_FLAG_DESTROY); |
| 346 | } |
| 347 | |
| 348 | /** |
| 349 | * @ingroup iface_wp_viewport |
| 350 | * |
| 351 | * Set the source rectangle of the associated wl_surface. See |
| 352 | * wp_viewport for the description, and relation to the wl_buffer |
| 353 | * size. |
| 354 | * |
| 355 | * If all of x, y, width and height are -1.0, the source rectangle is |
| 356 | * unset instead. Any other set of values where width or height are zero |
| 357 | * or negative, or x or y are negative, raise the bad_value protocol |
| 358 | * error. |
| 359 | * |
| 360 | * The crop and scale state is double-buffered, see wl_surface.commit. |
| 361 | */ |
| 362 | static inline void |
| 363 | wp_viewport_set_source(struct wp_viewport *wp_viewport, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) |
| 364 | { |
| 365 | wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport, |
| 366 | WP_VIEWPORT_SET_SOURCE, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, x, y, width, height); |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * @ingroup iface_wp_viewport |
| 371 | * |
| 372 | * Set the destination size of the associated wl_surface. See |
| 373 | * wp_viewport for the description, and relation to the wl_buffer |
| 374 | * size. |
| 375 | * |
| 376 | * If width is -1 and height is -1, the destination size is unset |
| 377 | * instead. Any other pair of values for width and height that |
| 378 | * contains zero or negative values raises the bad_value protocol |
| 379 | * error. |
| 380 | * |
| 381 | * The crop and scale state is double-buffered, see wl_surface.commit. |
| 382 | */ |
| 383 | static inline void |
| 384 | wp_viewport_set_destination(struct wp_viewport *wp_viewport, int32_t width, int32_t height) |
| 385 | { |
| 386 | wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport, |
| 387 | WP_VIEWPORT_SET_DESTINATION, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, width, height); |
| 388 | } |
| 389 | |
| 390 | #ifdef __cplusplus |
| 391 | } |
| 392 | #endif |
| 393 | |
| 394 | #endif |
| 395 | |