| 1 | /* Generated by wayland-scanner 1.24.0 */ |
| 2 | |
| 3 | #ifndef XDG_TOPLEVEL_ICON_V1_CLIENT_PROTOCOL_H |
| 4 | #define XDG_TOPLEVEL_ICON_V1_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_xdg_toplevel_icon_v1 The xdg_toplevel_icon_v1 protocol |
| 16 | * protocol to assign icons to toplevels |
| 17 | * |
| 18 | * @section page_desc_xdg_toplevel_icon_v1 Description |
| 19 | * |
| 20 | * This protocol allows clients to set icons for their toplevel surfaces |
| 21 | * either via the XDG icon stock (using an icon name), or from pixel data. |
| 22 | * |
| 23 | * A toplevel icon represents the individual toplevel (unlike the application |
| 24 | * or launcher icon, which represents the application as a whole), and may be |
| 25 | * shown in window switchers, window overviews and taskbars that list |
| 26 | * individual windows. |
| 27 | * |
| 28 | * This document adheres to RFC 2119 when using words like "must", |
| 29 | * "should", "may", etc. |
| 30 | * |
| 31 | * Warning! The protocol described in this file is currently in the testing |
| 32 | * phase. Backward compatible changes may be added together with the |
| 33 | * corresponding interface version bump. Backward incompatible changes can |
| 34 | * only be done by creating a new major version of the extension. |
| 35 | * |
| 36 | * @section page_ifaces_xdg_toplevel_icon_v1 Interfaces |
| 37 | * - @subpage page_iface_xdg_toplevel_icon_manager_v1 - interface to manage toplevel icons |
| 38 | * - @subpage page_iface_xdg_toplevel_icon_v1 - a toplevel window icon |
| 39 | * @section page_copyright_xdg_toplevel_icon_v1 Copyright |
| 40 | * <pre> |
| 41 | * |
| 42 | * Copyright © 2023-2024 Matthias Klumpp |
| 43 | * Copyright © 2024 David Edmundson |
| 44 | * |
| 45 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 46 | * copy of this software and associated documentation files (the "Software"), |
| 47 | * to deal in the Software without restriction, including without limitation |
| 48 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 49 | * and/or sell copies of the Software, and to permit persons to whom the |
| 50 | * Software is furnished to do so, subject to the following conditions: |
| 51 | * |
| 52 | * The above copyright notice and this permission notice (including the next |
| 53 | * paragraph) shall be included in all copies or substantial portions of the |
| 54 | * Software. |
| 55 | * |
| 56 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 57 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 58 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 59 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 60 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 61 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 62 | * DEALINGS IN THE SOFTWARE. |
| 63 | * </pre> |
| 64 | */ |
| 65 | struct wl_buffer; |
| 66 | struct xdg_toplevel; |
| 67 | struct xdg_toplevel_icon_manager_v1; |
| 68 | struct xdg_toplevel_icon_v1; |
| 69 | |
| 70 | #ifndef XDG_TOPLEVEL_ICON_MANAGER_V1_INTERFACE |
| 71 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_INTERFACE |
| 72 | /** |
| 73 | * @page page_iface_xdg_toplevel_icon_manager_v1 xdg_toplevel_icon_manager_v1 |
| 74 | * @section page_iface_xdg_toplevel_icon_manager_v1_desc Description |
| 75 | * |
| 76 | * This interface allows clients to create toplevel window icons and set |
| 77 | * them on toplevel windows to be displayed to the user. |
| 78 | * @section page_iface_xdg_toplevel_icon_manager_v1_api API |
| 79 | * See @ref iface_xdg_toplevel_icon_manager_v1. |
| 80 | */ |
| 81 | /** |
| 82 | * @defgroup iface_xdg_toplevel_icon_manager_v1 The xdg_toplevel_icon_manager_v1 interface |
| 83 | * |
| 84 | * This interface allows clients to create toplevel window icons and set |
| 85 | * them on toplevel windows to be displayed to the user. |
| 86 | */ |
| 87 | extern const struct wl_interface xdg_toplevel_icon_manager_v1_interface; |
| 88 | #endif |
| 89 | #ifndef XDG_TOPLEVEL_ICON_V1_INTERFACE |
| 90 | #define XDG_TOPLEVEL_ICON_V1_INTERFACE |
| 91 | /** |
| 92 | * @page page_iface_xdg_toplevel_icon_v1 xdg_toplevel_icon_v1 |
| 93 | * @section page_iface_xdg_toplevel_icon_v1_desc Description |
| 94 | * |
| 95 | * This interface defines a toplevel icon. |
| 96 | * An icon can have a name, and multiple buffers. |
| 97 | * In order to be applied, the icon must have either a name, or at least |
| 98 | * one buffer assigned. Applying an empty icon (with no buffer or name) to |
| 99 | * a toplevel should reset its icon to the default icon. |
| 100 | * |
| 101 | * It is up to compositor policy whether to prefer using a buffer or loading |
| 102 | * an icon via its name. See 'set_name' and 'add_buffer' for details. |
| 103 | * @section page_iface_xdg_toplevel_icon_v1_api API |
| 104 | * See @ref iface_xdg_toplevel_icon_v1. |
| 105 | */ |
| 106 | /** |
| 107 | * @defgroup iface_xdg_toplevel_icon_v1 The xdg_toplevel_icon_v1 interface |
| 108 | * |
| 109 | * This interface defines a toplevel icon. |
| 110 | * An icon can have a name, and multiple buffers. |
| 111 | * In order to be applied, the icon must have either a name, or at least |
| 112 | * one buffer assigned. Applying an empty icon (with no buffer or name) to |
| 113 | * a toplevel should reset its icon to the default icon. |
| 114 | * |
| 115 | * It is up to compositor policy whether to prefer using a buffer or loading |
| 116 | * an icon via its name. See 'set_name' and 'add_buffer' for details. |
| 117 | */ |
| 118 | extern const struct wl_interface xdg_toplevel_icon_v1_interface; |
| 119 | #endif |
| 120 | |
| 121 | /** |
| 122 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 123 | * @struct xdg_toplevel_icon_manager_v1_listener |
| 124 | */ |
| 125 | struct xdg_toplevel_icon_manager_v1_listener { |
| 126 | /** |
| 127 | * describes a supported & preferred icon size |
| 128 | * |
| 129 | * This event indicates an icon size the compositor prefers to be |
| 130 | * available if the client has scalable icons and can render to any |
| 131 | * size. |
| 132 | * |
| 133 | * When the 'xdg_toplevel_icon_manager_v1' object is created, the |
| 134 | * compositor may send one or more 'icon_size' events to describe |
| 135 | * the list of preferred icon sizes. If the compositor has no size |
| 136 | * preference, it may not send any 'icon_size' event, and it is up |
| 137 | * to the client to decide a suitable icon size. |
| 138 | * |
| 139 | * A sequence of 'icon_size' events must be finished with a 'done' |
| 140 | * event. If the compositor has no size preferences, it must still |
| 141 | * send the 'done' event, without any preceding 'icon_size' events. |
| 142 | * @param size the edge size of the square icon in surface-local coordinates, e.g. 64 |
| 143 | */ |
| 144 | void (*icon_size)(void *data, |
| 145 | struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1, |
| 146 | int32_t size); |
| 147 | /** |
| 148 | * all information has been sent |
| 149 | * |
| 150 | * This event is sent after all 'icon_size' events have been |
| 151 | * sent. |
| 152 | */ |
| 153 | void (*done)(void *data, |
| 154 | struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1); |
| 155 | }; |
| 156 | |
| 157 | /** |
| 158 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 159 | */ |
| 160 | static inline int |
| 161 | xdg_toplevel_icon_manager_v1_add_listener(struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1, |
| 162 | const struct xdg_toplevel_icon_manager_v1_listener *listener, void *data) |
| 163 | { |
| 164 | return wl_proxy_add_listener((struct wl_proxy *) xdg_toplevel_icon_manager_v1, |
| 165 | (void (**)(void)) listener, data); |
| 166 | } |
| 167 | |
| 168 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_DESTROY 0 |
| 169 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_CREATE_ICON 1 |
| 170 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_SET_ICON 2 |
| 171 | |
| 172 | /** |
| 173 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 174 | */ |
| 175 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_ICON_SIZE_SINCE_VERSION 1 |
| 176 | /** |
| 177 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 178 | */ |
| 179 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_DONE_SINCE_VERSION 1 |
| 180 | |
| 181 | /** |
| 182 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 183 | */ |
| 184 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_DESTROY_SINCE_VERSION 1 |
| 185 | /** |
| 186 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 187 | */ |
| 188 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_CREATE_ICON_SINCE_VERSION 1 |
| 189 | /** |
| 190 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 191 | */ |
| 192 | #define XDG_TOPLEVEL_ICON_MANAGER_V1_SET_ICON_SINCE_VERSION 1 |
| 193 | |
| 194 | /** @ingroup iface_xdg_toplevel_icon_manager_v1 */ |
| 195 | static inline void |
| 196 | xdg_toplevel_icon_manager_v1_set_user_data(struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1, void *user_data) |
| 197 | { |
| 198 | wl_proxy_set_user_data((struct wl_proxy *) xdg_toplevel_icon_manager_v1, user_data); |
| 199 | } |
| 200 | |
| 201 | /** @ingroup iface_xdg_toplevel_icon_manager_v1 */ |
| 202 | static inline void * |
| 203 | xdg_toplevel_icon_manager_v1_get_user_data(struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1) |
| 204 | { |
| 205 | return wl_proxy_get_user_data((struct wl_proxy *) xdg_toplevel_icon_manager_v1); |
| 206 | } |
| 207 | |
| 208 | static inline uint32_t |
| 209 | xdg_toplevel_icon_manager_v1_get_version(struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1) |
| 210 | { |
| 211 | return wl_proxy_get_version((struct wl_proxy *) xdg_toplevel_icon_manager_v1); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 216 | * |
| 217 | * Destroy the toplevel icon manager. |
| 218 | * This does not destroy objects created with the manager. |
| 219 | */ |
| 220 | static inline void |
| 221 | xdg_toplevel_icon_manager_v1_destroy(struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1) |
| 222 | { |
| 223 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel_icon_manager_v1, |
| 224 | XDG_TOPLEVEL_ICON_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel_icon_manager_v1), WL_MARSHAL_FLAG_DESTROY); |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 229 | * |
| 230 | * Creates a new icon object. This icon can then be attached to a |
| 231 | * xdg_toplevel via the 'set_icon' request. |
| 232 | */ |
| 233 | static inline struct xdg_toplevel_icon_v1 * |
| 234 | xdg_toplevel_icon_manager_v1_create_icon(struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1) |
| 235 | { |
| 236 | struct wl_proxy *id; |
| 237 | |
| 238 | id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel_icon_manager_v1, |
| 239 | XDG_TOPLEVEL_ICON_MANAGER_V1_CREATE_ICON, &xdg_toplevel_icon_v1_interface, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel_icon_manager_v1), 0, NULL); |
| 240 | |
| 241 | return (struct xdg_toplevel_icon_v1 *) id; |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * @ingroup iface_xdg_toplevel_icon_manager_v1 |
| 246 | * |
| 247 | * This request assigns the icon 'icon' to 'toplevel', or clears the |
| 248 | * toplevel icon if 'icon' was null. |
| 249 | * This state is double-buffered and is applied on the next |
| 250 | * wl_surface.commit of the toplevel. |
| 251 | * |
| 252 | * After making this call, the xdg_toplevel_icon_v1 provided as 'icon' |
| 253 | * can be destroyed by the client without 'toplevel' losing its icon. |
| 254 | * The xdg_toplevel_icon_v1 is immutable from this point, and any |
| 255 | * future attempts to change it must raise the |
| 256 | * 'xdg_toplevel_icon_v1.immutable' protocol error. |
| 257 | * |
| 258 | * The compositor must set the toplevel icon from either the pixel data |
| 259 | * the icon provides, or by loading a stock icon using the icon name. |
| 260 | * See the description of 'xdg_toplevel_icon_v1' for details. |
| 261 | * |
| 262 | * If 'icon' is set to null, the icon of the respective toplevel is reset |
| 263 | * to its default icon (usually the icon of the application, derived from |
| 264 | * its desktop-entry file, or a placeholder icon). |
| 265 | * If this request is passed an icon with no pixel buffers or icon name |
| 266 | * assigned, the icon must be reset just like if 'icon' was null. |
| 267 | */ |
| 268 | static inline void |
| 269 | xdg_toplevel_icon_manager_v1_set_icon(struct xdg_toplevel_icon_manager_v1 *xdg_toplevel_icon_manager_v1, struct xdg_toplevel *toplevel, struct xdg_toplevel_icon_v1 *icon) |
| 270 | { |
| 271 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel_icon_manager_v1, |
| 272 | XDG_TOPLEVEL_ICON_MANAGER_V1_SET_ICON, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel_icon_manager_v1), 0, toplevel, icon); |
| 273 | } |
| 274 | |
| 275 | #ifndef XDG_TOPLEVEL_ICON_V1_ERROR_ENUM |
| 276 | #define XDG_TOPLEVEL_ICON_V1_ERROR_ENUM |
| 277 | enum xdg_toplevel_icon_v1_error { |
| 278 | /** |
| 279 | * the provided buffer does not satisfy requirements |
| 280 | */ |
| 281 | XDG_TOPLEVEL_ICON_V1_ERROR_INVALID_BUFFER = 1, |
| 282 | /** |
| 283 | * the icon has already been assigned to a toplevel and must not be changed |
| 284 | */ |
| 285 | XDG_TOPLEVEL_ICON_V1_ERROR_IMMUTABLE = 2, |
| 286 | /** |
| 287 | * the provided buffer has been destroyed before the toplevel icon |
| 288 | */ |
| 289 | XDG_TOPLEVEL_ICON_V1_ERROR_NO_BUFFER = 3, |
| 290 | }; |
| 291 | #endif /* XDG_TOPLEVEL_ICON_V1_ERROR_ENUM */ |
| 292 | |
| 293 | #define XDG_TOPLEVEL_ICON_V1_DESTROY 0 |
| 294 | #define XDG_TOPLEVEL_ICON_V1_SET_NAME 1 |
| 295 | #define XDG_TOPLEVEL_ICON_V1_ADD_BUFFER 2 |
| 296 | |
| 297 | |
| 298 | /** |
| 299 | * @ingroup iface_xdg_toplevel_icon_v1 |
| 300 | */ |
| 301 | #define XDG_TOPLEVEL_ICON_V1_DESTROY_SINCE_VERSION 1 |
| 302 | /** |
| 303 | * @ingroup iface_xdg_toplevel_icon_v1 |
| 304 | */ |
| 305 | #define XDG_TOPLEVEL_ICON_V1_SET_NAME_SINCE_VERSION 1 |
| 306 | /** |
| 307 | * @ingroup iface_xdg_toplevel_icon_v1 |
| 308 | */ |
| 309 | #define XDG_TOPLEVEL_ICON_V1_ADD_BUFFER_SINCE_VERSION 1 |
| 310 | |
| 311 | /** @ingroup iface_xdg_toplevel_icon_v1 */ |
| 312 | static inline void |
| 313 | xdg_toplevel_icon_v1_set_user_data(struct xdg_toplevel_icon_v1 *xdg_toplevel_icon_v1, void *user_data) |
| 314 | { |
| 315 | wl_proxy_set_user_data((struct wl_proxy *) xdg_toplevel_icon_v1, user_data); |
| 316 | } |
| 317 | |
| 318 | /** @ingroup iface_xdg_toplevel_icon_v1 */ |
| 319 | static inline void * |
| 320 | xdg_toplevel_icon_v1_get_user_data(struct xdg_toplevel_icon_v1 *xdg_toplevel_icon_v1) |
| 321 | { |
| 322 | return wl_proxy_get_user_data((struct wl_proxy *) xdg_toplevel_icon_v1); |
| 323 | } |
| 324 | |
| 325 | static inline uint32_t |
| 326 | xdg_toplevel_icon_v1_get_version(struct xdg_toplevel_icon_v1 *xdg_toplevel_icon_v1) |
| 327 | { |
| 328 | return wl_proxy_get_version((struct wl_proxy *) xdg_toplevel_icon_v1); |
| 329 | } |
| 330 | |
| 331 | /** |
| 332 | * @ingroup iface_xdg_toplevel_icon_v1 |
| 333 | * |
| 334 | * Destroys the 'xdg_toplevel_icon_v1' object. |
| 335 | * The icon must still remain set on every toplevel it was assigned to, |
| 336 | * until the toplevel icon is reset explicitly. |
| 337 | */ |
| 338 | static inline void |
| 339 | xdg_toplevel_icon_v1_destroy(struct xdg_toplevel_icon_v1 *xdg_toplevel_icon_v1) |
| 340 | { |
| 341 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel_icon_v1, |
| 342 | XDG_TOPLEVEL_ICON_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel_icon_v1), WL_MARSHAL_FLAG_DESTROY); |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * @ingroup iface_xdg_toplevel_icon_v1 |
| 347 | * |
| 348 | * This request assigns an icon name to this icon. |
| 349 | * Any previously set name is overridden. |
| 350 | * |
| 351 | * The compositor must resolve 'icon_name' according to the lookup rules |
| 352 | * described in the XDG icon theme specification[1] using the |
| 353 | * environment's current icon theme. |
| 354 | * |
| 355 | * If the compositor does not support icon names or cannot resolve |
| 356 | * 'icon_name' according to the XDG icon theme specification it must |
| 357 | * fall back to using pixel buffer data instead. |
| 358 | * |
| 359 | * If this request is made after the icon has been assigned to a toplevel |
| 360 | * via 'set_icon', a 'immutable' error must be raised. |
| 361 | * |
| 362 | * [1]: https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html |
| 363 | */ |
| 364 | static inline void |
| 365 | xdg_toplevel_icon_v1_set_name(struct xdg_toplevel_icon_v1 *xdg_toplevel_icon_v1, const char *icon_name) |
| 366 | { |
| 367 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel_icon_v1, |
| 368 | XDG_TOPLEVEL_ICON_V1_SET_NAME, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel_icon_v1), 0, icon_name); |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * @ingroup iface_xdg_toplevel_icon_v1 |
| 373 | * |
| 374 | * This request adds pixel data supplied as wl_buffer to the icon. |
| 375 | * |
| 376 | * The client should add pixel data for all icon sizes and scales that |
| 377 | * it can provide, or which are explicitly requested by the compositor |
| 378 | * via 'icon_size' events on xdg_toplevel_icon_manager_v1. |
| 379 | * |
| 380 | * The wl_buffer supplying pixel data as 'buffer' must be backed by wl_shm |
| 381 | * and must be a square (width and height being equal). |
| 382 | * If any of these buffer requirements are not fulfilled, a 'invalid_buffer' |
| 383 | * error must be raised. |
| 384 | * |
| 385 | * If this icon instance already has a buffer of the same size and scale |
| 386 | * from a previous 'add_buffer' request, data from the last request |
| 387 | * overrides the preexisting pixel data. |
| 388 | * |
| 389 | * The wl_buffer must be kept alive for as long as the xdg_toplevel_icon |
| 390 | * it is associated with is not destroyed, otherwise a 'no_buffer' error |
| 391 | * is raised. The buffer contents must not be modified after it was |
| 392 | * assigned to the icon. As a result, the region of the wl_shm_pool's |
| 393 | * backing storage used for the wl_buffer must not be modified after this |
| 394 | * request is sent. The wl_buffer.release event is unused. |
| 395 | * |
| 396 | * If this request is made after the icon has been assigned to a toplevel |
| 397 | * via 'set_icon', a 'immutable' error must be raised. |
| 398 | */ |
| 399 | static inline void |
| 400 | xdg_toplevel_icon_v1_add_buffer(struct xdg_toplevel_icon_v1 *xdg_toplevel_icon_v1, struct wl_buffer *buffer, int32_t scale) |
| 401 | { |
| 402 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel_icon_v1, |
| 403 | XDG_TOPLEVEL_ICON_V1_ADD_BUFFER, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel_icon_v1), 0, buffer, scale); |
| 404 | } |
| 405 | |
| 406 | #ifdef __cplusplus |
| 407 | } |
| 408 | #endif |
| 409 | |
| 410 | #endif |
| 411 | |