gioui.org@v0.6.1-0.20240506124620-7a9ce51988ce/app/wayland_xdg_decoration.h (about) 1 /* Generated by wayland-scanner 1.19.0 */ 2 3 #ifndef XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H 4 #define XDG_DECORATION_UNSTABLE_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_decoration_unstable_v1 The xdg_decoration_unstable_v1 protocol 16 * @section page_ifaces_xdg_decoration_unstable_v1 Interfaces 17 * - @subpage page_iface_zxdg_decoration_manager_v1 - window decoration manager 18 * - @subpage page_iface_zxdg_toplevel_decoration_v1 - decoration object for a toplevel surface 19 * @section page_copyright_xdg_decoration_unstable_v1 Copyright 20 * <pre> 21 * 22 * Copyright © 2018 Simon Ser 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 xdg_toplevel; 45 struct zxdg_decoration_manager_v1; 46 struct zxdg_toplevel_decoration_v1; 47 48 #ifndef ZXDG_DECORATION_MANAGER_V1_INTERFACE 49 #define ZXDG_DECORATION_MANAGER_V1_INTERFACE 50 /** 51 * @page page_iface_zxdg_decoration_manager_v1 zxdg_decoration_manager_v1 52 * @section page_iface_zxdg_decoration_manager_v1_desc Description 53 * 54 * This interface allows a compositor to announce support for server-side 55 * decorations. 56 * 57 * A window decoration is a set of window controls as deemed appropriate by 58 * the party managing them, such as user interface components used to move, 59 * resize and change a window's state. 60 * 61 * A client can use this protocol to request being decorated by a supporting 62 * compositor. 63 * 64 * If compositor and client do not negotiate the use of a server-side 65 * decoration using this protocol, clients continue to self-decorate as they 66 * see fit. 67 * 68 * Warning! The protocol described in this file is experimental and 69 * backward incompatible changes may be made. Backward compatible changes 70 * may be added together with the corresponding interface version bump. 71 * Backward incompatible changes are done by bumping the version number in 72 * the protocol and interface names and resetting the interface version. 73 * Once the protocol is to be declared stable, the 'z' prefix and the 74 * version number in the protocol and interface names are removed and the 75 * interface version number is reset. 76 * @section page_iface_zxdg_decoration_manager_v1_api API 77 * See @ref iface_zxdg_decoration_manager_v1. 78 */ 79 /** 80 * @defgroup iface_zxdg_decoration_manager_v1 The zxdg_decoration_manager_v1 interface 81 * 82 * This interface allows a compositor to announce support for server-side 83 * decorations. 84 * 85 * A window decoration is a set of window controls as deemed appropriate by 86 * the party managing them, such as user interface components used to move, 87 * resize and change a window's state. 88 * 89 * A client can use this protocol to request being decorated by a supporting 90 * compositor. 91 * 92 * If compositor and client do not negotiate the use of a server-side 93 * decoration using this protocol, clients continue to self-decorate as they 94 * see fit. 95 * 96 * Warning! The protocol described in this file is experimental and 97 * backward incompatible changes may be made. Backward compatible changes 98 * may be added together with the corresponding interface version bump. 99 * Backward incompatible changes are done by bumping the version number in 100 * the protocol and interface names and resetting the interface version. 101 * Once the protocol is to be declared stable, the 'z' prefix and the 102 * version number in the protocol and interface names are removed and the 103 * interface version number is reset. 104 */ 105 extern const struct wl_interface zxdg_decoration_manager_v1_interface; 106 #endif 107 #ifndef ZXDG_TOPLEVEL_DECORATION_V1_INTERFACE 108 #define ZXDG_TOPLEVEL_DECORATION_V1_INTERFACE 109 /** 110 * @page page_iface_zxdg_toplevel_decoration_v1 zxdg_toplevel_decoration_v1 111 * @section page_iface_zxdg_toplevel_decoration_v1_desc Description 112 * 113 * The decoration object allows the compositor to toggle server-side window 114 * decorations for a toplevel surface. The client can request to switch to 115 * another mode. 116 * 117 * The xdg_toplevel_decoration object must be destroyed before its 118 * xdg_toplevel. 119 * @section page_iface_zxdg_toplevel_decoration_v1_api API 120 * See @ref iface_zxdg_toplevel_decoration_v1. 121 */ 122 /** 123 * @defgroup iface_zxdg_toplevel_decoration_v1 The zxdg_toplevel_decoration_v1 interface 124 * 125 * The decoration object allows the compositor to toggle server-side window 126 * decorations for a toplevel surface. The client can request to switch to 127 * another mode. 128 * 129 * The xdg_toplevel_decoration object must be destroyed before its 130 * xdg_toplevel. 131 */ 132 extern const struct wl_interface zxdg_toplevel_decoration_v1_interface; 133 #endif 134 135 #define ZXDG_DECORATION_MANAGER_V1_DESTROY 0 136 #define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION 1 137 138 139 /** 140 * @ingroup iface_zxdg_decoration_manager_v1 141 */ 142 #define ZXDG_DECORATION_MANAGER_V1_DESTROY_SINCE_VERSION 1 143 /** 144 * @ingroup iface_zxdg_decoration_manager_v1 145 */ 146 #define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION_SINCE_VERSION 1 147 148 /** @ingroup iface_zxdg_decoration_manager_v1 */ 149 static inline void 150 zxdg_decoration_manager_v1_set_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, void *user_data) 151 { 152 wl_proxy_set_user_data((struct wl_proxy *) zxdg_decoration_manager_v1, user_data); 153 } 154 155 /** @ingroup iface_zxdg_decoration_manager_v1 */ 156 static inline void * 157 zxdg_decoration_manager_v1_get_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1) 158 { 159 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_decoration_manager_v1); 160 } 161 162 static inline uint32_t 163 zxdg_decoration_manager_v1_get_version(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1) 164 { 165 return wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1); 166 } 167 168 /** 169 * @ingroup iface_zxdg_decoration_manager_v1 170 * 171 * Destroy the decoration manager. This doesn't destroy objects created 172 * with the manager. 173 */ 174 static inline void 175 zxdg_decoration_manager_v1_destroy(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1) 176 { 177 wl_proxy_marshal((struct wl_proxy *) zxdg_decoration_manager_v1, 178 ZXDG_DECORATION_MANAGER_V1_DESTROY); 179 180 wl_proxy_destroy((struct wl_proxy *) zxdg_decoration_manager_v1); 181 } 182 183 /** 184 * @ingroup iface_zxdg_decoration_manager_v1 185 * 186 * Create a new decoration object associated with the given toplevel. 187 * 188 * Creating an xdg_toplevel_decoration from an xdg_toplevel which has a 189 * buffer attached or committed is a client error, and any attempts by a 190 * client to attach or manipulate a buffer prior to the first 191 * xdg_toplevel_decoration.configure event must also be treated as 192 * errors. 193 */ 194 static inline struct zxdg_toplevel_decoration_v1 * 195 zxdg_decoration_manager_v1_get_toplevel_decoration(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, struct xdg_toplevel *toplevel) 196 { 197 struct wl_proxy *id; 198 199 id = wl_proxy_marshal_constructor((struct wl_proxy *) zxdg_decoration_manager_v1, 200 ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION, &zxdg_toplevel_decoration_v1_interface, NULL, toplevel); 201 202 return (struct zxdg_toplevel_decoration_v1 *) id; 203 } 204 205 #ifndef ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM 206 #define ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM 207 enum zxdg_toplevel_decoration_v1_error { 208 /** 209 * xdg_toplevel has a buffer attached before configure 210 */ 211 ZXDG_TOPLEVEL_DECORATION_V1_ERROR_UNCONFIGURED_BUFFER = 0, 212 /** 213 * xdg_toplevel already has a decoration object 214 */ 215 ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ALREADY_CONSTRUCTED = 1, 216 /** 217 * xdg_toplevel destroyed before the decoration object 218 */ 219 ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ORPHANED = 2, 220 }; 221 #endif /* ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM */ 222 223 #ifndef ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM 224 #define ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM 225 /** 226 * @ingroup iface_zxdg_toplevel_decoration_v1 227 * window decoration modes 228 * 229 * These values describe window decoration modes. 230 */ 231 enum zxdg_toplevel_decoration_v1_mode { 232 /** 233 * no server-side window decoration 234 */ 235 ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE = 1, 236 /** 237 * server-side window decoration 238 */ 239 ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE = 2, 240 }; 241 #endif /* ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM */ 242 243 /** 244 * @ingroup iface_zxdg_toplevel_decoration_v1 245 * @struct zxdg_toplevel_decoration_v1_listener 246 */ 247 struct zxdg_toplevel_decoration_v1_listener { 248 /** 249 * suggest a surface change 250 * 251 * The configure event asks the client to change its decoration 252 * mode. The configured state should not be applied immediately. 253 * Clients must send an ack_configure in response to this event. 254 * See xdg_surface.configure and xdg_surface.ack_configure for 255 * details. 256 * 257 * A configure event can be sent at any time. The specified mode 258 * must be obeyed by the client. 259 * @param mode the decoration mode 260 */ 261 void (*configure)(void *data, 262 struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, 263 uint32_t mode); 264 }; 265 266 /** 267 * @ingroup iface_zxdg_toplevel_decoration_v1 268 */ 269 static inline int 270 zxdg_toplevel_decoration_v1_add_listener(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, 271 const struct zxdg_toplevel_decoration_v1_listener *listener, void *data) 272 { 273 return wl_proxy_add_listener((struct wl_proxy *) zxdg_toplevel_decoration_v1, 274 (void (**)(void)) listener, data); 275 } 276 277 #define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY 0 278 #define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE 1 279 #define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE 2 280 281 /** 282 * @ingroup iface_zxdg_toplevel_decoration_v1 283 */ 284 #define ZXDG_TOPLEVEL_DECORATION_V1_CONFIGURE_SINCE_VERSION 1 285 286 /** 287 * @ingroup iface_zxdg_toplevel_decoration_v1 288 */ 289 #define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY_SINCE_VERSION 1 290 /** 291 * @ingroup iface_zxdg_toplevel_decoration_v1 292 */ 293 #define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE_SINCE_VERSION 1 294 /** 295 * @ingroup iface_zxdg_toplevel_decoration_v1 296 */ 297 #define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE_SINCE_VERSION 1 298 299 /** @ingroup iface_zxdg_toplevel_decoration_v1 */ 300 static inline void 301 zxdg_toplevel_decoration_v1_set_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, void *user_data) 302 { 303 wl_proxy_set_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1, user_data); 304 } 305 306 /** @ingroup iface_zxdg_toplevel_decoration_v1 */ 307 static inline void * 308 zxdg_toplevel_decoration_v1_get_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1) 309 { 310 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1); 311 } 312 313 static inline uint32_t 314 zxdg_toplevel_decoration_v1_get_version(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1) 315 { 316 return wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1); 317 } 318 319 /** 320 * @ingroup iface_zxdg_toplevel_decoration_v1 321 * 322 * Switch back to a mode without any server-side decorations at the next 323 * commit. 324 */ 325 static inline void 326 zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1) 327 { 328 wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1, 329 ZXDG_TOPLEVEL_DECORATION_V1_DESTROY); 330 331 wl_proxy_destroy((struct wl_proxy *) zxdg_toplevel_decoration_v1); 332 } 333 334 /** 335 * @ingroup iface_zxdg_toplevel_decoration_v1 336 * 337 * Set the toplevel surface decoration mode. This informs the compositor 338 * that the client prefers the provided decoration mode. 339 * 340 * After requesting a decoration mode, the compositor will respond by 341 * emitting an xdg_surface.configure event. The client should then update 342 * its content, drawing it without decorations if the received mode is 343 * server-side decorations. The client must also acknowledge the configure 344 * when committing the new content (see xdg_surface.ack_configure). 345 * 346 * The compositor can decide not to use the client's mode and enforce a 347 * different mode instead. 348 * 349 * Clients whose decoration mode depend on the xdg_toplevel state may send 350 * a set_mode request in response to an xdg_surface.configure event and wait 351 * for the next xdg_surface.configure event to prevent unwanted state. 352 * Such clients are responsible for preventing configure loops and must 353 * make sure not to send multiple successive set_mode requests with the 354 * same decoration mode. 355 */ 356 static inline void 357 zxdg_toplevel_decoration_v1_set_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode) 358 { 359 wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1, 360 ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE, mode); 361 } 362 363 /** 364 * @ingroup iface_zxdg_toplevel_decoration_v1 365 * 366 * Unset the toplevel surface decoration mode. This informs the compositor 367 * that the client doesn't prefer a particular decoration mode. 368 * 369 * This request has the same semantics as set_mode. 370 */ 371 static inline void 372 zxdg_toplevel_decoration_v1_unset_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1) 373 { 374 wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1, 375 ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE); 376 } 377 378 #ifdef __cplusplus 379 } 380 #endif 381 382 #endif