| 1 | /* Generated by wayland-scanner 1.24.0 */ |
| 2 | |
| 3 | #ifndef XDG_SHELL_CLIENT_PROTOCOL_H |
| 4 | #define XDG_SHELL_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_shell The xdg_shell protocol |
| 16 | * @section page_ifaces_xdg_shell Interfaces |
| 17 | * - @subpage page_iface_xdg_wm_base - create desktop-style surfaces |
| 18 | * - @subpage page_iface_xdg_positioner - child surface positioner |
| 19 | * - @subpage page_iface_xdg_surface - desktop user interface surface base interface |
| 20 | * - @subpage page_iface_xdg_toplevel - toplevel surface |
| 21 | * - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus |
| 22 | * @section page_copyright_xdg_shell Copyright |
| 23 | * <pre> |
| 24 | * |
| 25 | * Copyright © 2008-2013 Kristian Høgsberg |
| 26 | * Copyright © 2013 Rafael Antognolli |
| 27 | * Copyright © 2013 Jasper St. Pierre |
| 28 | * Copyright © 2010-2013 Intel Corporation |
| 29 | * Copyright © 2015-2017 Samsung Electronics Co., Ltd |
| 30 | * Copyright © 2015-2017 Red Hat Inc. |
| 31 | * |
| 32 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 33 | * copy of this software and associated documentation files (the "Software"), |
| 34 | * to deal in the Software without restriction, including without limitation |
| 35 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 36 | * and/or sell copies of the Software, and to permit persons to whom the |
| 37 | * Software is furnished to do so, subject to the following conditions: |
| 38 | * |
| 39 | * The above copyright notice and this permission notice (including the next |
| 40 | * paragraph) shall be included in all copies or substantial portions of the |
| 41 | * Software. |
| 42 | * |
| 43 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 44 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 45 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 46 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 47 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 48 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 49 | * DEALINGS IN THE SOFTWARE. |
| 50 | * </pre> |
| 51 | */ |
| 52 | struct wl_output; |
| 53 | struct wl_seat; |
| 54 | struct wl_surface; |
| 55 | struct xdg_popup; |
| 56 | struct xdg_positioner; |
| 57 | struct xdg_surface; |
| 58 | struct xdg_toplevel; |
| 59 | struct xdg_wm_base; |
| 60 | |
| 61 | #ifndef XDG_WM_BASE_INTERFACE |
| 62 | #define XDG_WM_BASE_INTERFACE |
| 63 | /** |
| 64 | * @page page_iface_xdg_wm_base xdg_wm_base |
| 65 | * @section page_iface_xdg_wm_base_desc Description |
| 66 | * |
| 67 | * The xdg_wm_base interface is exposed as a global object enabling clients |
| 68 | * to turn their wl_surfaces into windows in a desktop environment. It |
| 69 | * defines the basic functionality needed for clients and the compositor to |
| 70 | * create windows that can be dragged, resized, maximized, etc, as well as |
| 71 | * creating transient windows such as popup menus. |
| 72 | * @section page_iface_xdg_wm_base_api API |
| 73 | * See @ref iface_xdg_wm_base. |
| 74 | */ |
| 75 | /** |
| 76 | * @defgroup iface_xdg_wm_base The xdg_wm_base interface |
| 77 | * |
| 78 | * The xdg_wm_base interface is exposed as a global object enabling clients |
| 79 | * to turn their wl_surfaces into windows in a desktop environment. It |
| 80 | * defines the basic functionality needed for clients and the compositor to |
| 81 | * create windows that can be dragged, resized, maximized, etc, as well as |
| 82 | * creating transient windows such as popup menus. |
| 83 | */ |
| 84 | extern const struct wl_interface xdg_wm_base_interface; |
| 85 | #endif |
| 86 | #ifndef XDG_POSITIONER_INTERFACE |
| 87 | #define XDG_POSITIONER_INTERFACE |
| 88 | /** |
| 89 | * @page page_iface_xdg_positioner xdg_positioner |
| 90 | * @section page_iface_xdg_positioner_desc Description |
| 91 | * |
| 92 | * The xdg_positioner provides a collection of rules for the placement of a |
| 93 | * child surface relative to a parent surface. Rules can be defined to ensure |
| 94 | * the child surface remains within the visible area's borders, and to |
| 95 | * specify how the child surface changes its position, such as sliding along |
| 96 | * an axis, or flipping around a rectangle. These positioner-created rules are |
| 97 | * constrained by the requirement that a child surface must intersect with or |
| 98 | * be at least partially adjacent to its parent surface. |
| 99 | * |
| 100 | * See the various requests for details about possible rules. |
| 101 | * |
| 102 | * At the time of the request, the compositor makes a copy of the rules |
| 103 | * specified by the xdg_positioner. Thus, after the request is complete the |
| 104 | * xdg_positioner object can be destroyed or reused; further changes to the |
| 105 | * object will have no effect on previous usages. |
| 106 | * |
| 107 | * For an xdg_positioner object to be considered complete, it must have a |
| 108 | * non-zero size set by set_size, and a non-zero anchor rectangle set by |
| 109 | * set_anchor_rect. Passing an incomplete xdg_positioner object when |
| 110 | * positioning a surface raises an invalid_positioner error. |
| 111 | * @section page_iface_xdg_positioner_api API |
| 112 | * See @ref iface_xdg_positioner. |
| 113 | */ |
| 114 | /** |
| 115 | * @defgroup iface_xdg_positioner The xdg_positioner interface |
| 116 | * |
| 117 | * The xdg_positioner provides a collection of rules for the placement of a |
| 118 | * child surface relative to a parent surface. Rules can be defined to ensure |
| 119 | * the child surface remains within the visible area's borders, and to |
| 120 | * specify how the child surface changes its position, such as sliding along |
| 121 | * an axis, or flipping around a rectangle. These positioner-created rules are |
| 122 | * constrained by the requirement that a child surface must intersect with or |
| 123 | * be at least partially adjacent to its parent surface. |
| 124 | * |
| 125 | * See the various requests for details about possible rules. |
| 126 | * |
| 127 | * At the time of the request, the compositor makes a copy of the rules |
| 128 | * specified by the xdg_positioner. Thus, after the request is complete the |
| 129 | * xdg_positioner object can be destroyed or reused; further changes to the |
| 130 | * object will have no effect on previous usages. |
| 131 | * |
| 132 | * For an xdg_positioner object to be considered complete, it must have a |
| 133 | * non-zero size set by set_size, and a non-zero anchor rectangle set by |
| 134 | * set_anchor_rect. Passing an incomplete xdg_positioner object when |
| 135 | * positioning a surface raises an invalid_positioner error. |
| 136 | */ |
| 137 | extern const struct wl_interface xdg_positioner_interface; |
| 138 | #endif |
| 139 | #ifndef XDG_SURFACE_INTERFACE |
| 140 | #define XDG_SURFACE_INTERFACE |
| 141 | /** |
| 142 | * @page page_iface_xdg_surface xdg_surface |
| 143 | * @section page_iface_xdg_surface_desc Description |
| 144 | * |
| 145 | * An interface that may be implemented by a wl_surface, for |
| 146 | * implementations that provide a desktop-style user interface. |
| 147 | * |
| 148 | * It provides a base set of functionality required to construct user |
| 149 | * interface elements requiring management by the compositor, such as |
| 150 | * toplevel windows, menus, etc. The types of functionality are split into |
| 151 | * xdg_surface roles. |
| 152 | * |
| 153 | * Creating an xdg_surface does not set the role for a wl_surface. In order |
| 154 | * to map an xdg_surface, the client must create a role-specific object |
| 155 | * using, e.g., get_toplevel, get_popup. The wl_surface for any given |
| 156 | * xdg_surface can have at most one role, and may not be assigned any role |
| 157 | * not based on xdg_surface. |
| 158 | * |
| 159 | * A role must be assigned before any other requests are made to the |
| 160 | * xdg_surface object. |
| 161 | * |
| 162 | * The client must call wl_surface.commit on the corresponding wl_surface |
| 163 | * for the xdg_surface state to take effect. |
| 164 | * |
| 165 | * Creating an xdg_surface from a wl_surface which has a buffer attached or |
| 166 | * committed is a client error, and any attempts by a client to attach or |
| 167 | * manipulate a buffer prior to the first xdg_surface.configure call must |
| 168 | * also be treated as errors. |
| 169 | * |
| 170 | * After creating a role-specific object and setting it up (e.g. by sending |
| 171 | * the title, app ID, size constraints, parent, etc), the client must |
| 172 | * perform an initial commit without any buffer attached. The compositor |
| 173 | * will reply with initial wl_surface state such as |
| 174 | * wl_surface.preferred_buffer_scale followed by an xdg_surface.configure |
| 175 | * event. The client must acknowledge it and is then allowed to attach a |
| 176 | * buffer to map the surface. |
| 177 | * |
| 178 | * Mapping an xdg_surface-based role surface is defined as making it |
| 179 | * possible for the surface to be shown by the compositor. Note that |
| 180 | * a mapped surface is not guaranteed to be visible once it is mapped. |
| 181 | * |
| 182 | * For an xdg_surface to be mapped by the compositor, the following |
| 183 | * conditions must be met: |
| 184 | * (1) the client has assigned an xdg_surface-based role to the surface |
| 185 | * (2) the client has set and committed the xdg_surface state and the |
| 186 | * role-dependent state to the surface |
| 187 | * (3) the client has committed a buffer to the surface |
| 188 | * |
| 189 | * A newly-unmapped surface is considered to have met condition (1) out |
| 190 | * of the 3 required conditions for mapping a surface if its role surface |
| 191 | * has not been destroyed, i.e. the client must perform the initial commit |
| 192 | * again before attaching a buffer. |
| 193 | * @section page_iface_xdg_surface_api API |
| 194 | * See @ref iface_xdg_surface. |
| 195 | */ |
| 196 | /** |
| 197 | * @defgroup iface_xdg_surface The xdg_surface interface |
| 198 | * |
| 199 | * An interface that may be implemented by a wl_surface, for |
| 200 | * implementations that provide a desktop-style user interface. |
| 201 | * |
| 202 | * It provides a base set of functionality required to construct user |
| 203 | * interface elements requiring management by the compositor, such as |
| 204 | * toplevel windows, menus, etc. The types of functionality are split into |
| 205 | * xdg_surface roles. |
| 206 | * |
| 207 | * Creating an xdg_surface does not set the role for a wl_surface. In order |
| 208 | * to map an xdg_surface, the client must create a role-specific object |
| 209 | * using, e.g., get_toplevel, get_popup. The wl_surface for any given |
| 210 | * xdg_surface can have at most one role, and may not be assigned any role |
| 211 | * not based on xdg_surface. |
| 212 | * |
| 213 | * A role must be assigned before any other requests are made to the |
| 214 | * xdg_surface object. |
| 215 | * |
| 216 | * The client must call wl_surface.commit on the corresponding wl_surface |
| 217 | * for the xdg_surface state to take effect. |
| 218 | * |
| 219 | * Creating an xdg_surface from a wl_surface which has a buffer attached or |
| 220 | * committed is a client error, and any attempts by a client to attach or |
| 221 | * manipulate a buffer prior to the first xdg_surface.configure call must |
| 222 | * also be treated as errors. |
| 223 | * |
| 224 | * After creating a role-specific object and setting it up (e.g. by sending |
| 225 | * the title, app ID, size constraints, parent, etc), the client must |
| 226 | * perform an initial commit without any buffer attached. The compositor |
| 227 | * will reply with initial wl_surface state such as |
| 228 | * wl_surface.preferred_buffer_scale followed by an xdg_surface.configure |
| 229 | * event. The client must acknowledge it and is then allowed to attach a |
| 230 | * buffer to map the surface. |
| 231 | * |
| 232 | * Mapping an xdg_surface-based role surface is defined as making it |
| 233 | * possible for the surface to be shown by the compositor. Note that |
| 234 | * a mapped surface is not guaranteed to be visible once it is mapped. |
| 235 | * |
| 236 | * For an xdg_surface to be mapped by the compositor, the following |
| 237 | * conditions must be met: |
| 238 | * (1) the client has assigned an xdg_surface-based role to the surface |
| 239 | * (2) the client has set and committed the xdg_surface state and the |
| 240 | * role-dependent state to the surface |
| 241 | * (3) the client has committed a buffer to the surface |
| 242 | * |
| 243 | * A newly-unmapped surface is considered to have met condition (1) out |
| 244 | * of the 3 required conditions for mapping a surface if its role surface |
| 245 | * has not been destroyed, i.e. the client must perform the initial commit |
| 246 | * again before attaching a buffer. |
| 247 | */ |
| 248 | extern const struct wl_interface xdg_surface_interface; |
| 249 | #endif |
| 250 | #ifndef XDG_TOPLEVEL_INTERFACE |
| 251 | #define XDG_TOPLEVEL_INTERFACE |
| 252 | /** |
| 253 | * @page page_iface_xdg_toplevel xdg_toplevel |
| 254 | * @section page_iface_xdg_toplevel_desc Description |
| 255 | * |
| 256 | * This interface defines an xdg_surface role which allows a surface to, |
| 257 | * among other things, set window-like properties such as maximize, |
| 258 | * fullscreen, and minimize, set application-specific metadata like title and |
| 259 | * id, and well as trigger user interactive operations such as interactive |
| 260 | * resize and move. |
| 261 | * |
| 262 | * A xdg_toplevel by default is responsible for providing the full intended |
| 263 | * visual representation of the toplevel, which depending on the window |
| 264 | * state, may mean things like a title bar, window controls and drop shadow. |
| 265 | * |
| 266 | * Unmapping an xdg_toplevel means that the surface cannot be shown |
| 267 | * by the compositor until it is explicitly mapped again. |
| 268 | * All active operations (e.g., move, resize) are canceled and all |
| 269 | * attributes (e.g. title, state, stacking, ...) are discarded for |
| 270 | * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to |
| 271 | * the state it had right after xdg_surface.get_toplevel. The client |
| 272 | * can re-map the toplevel by performing a commit without any buffer |
| 273 | * attached, waiting for a configure event and handling it as usual (see |
| 274 | * xdg_surface description). |
| 275 | * |
| 276 | * Attaching a null buffer to a toplevel unmaps the surface. |
| 277 | * @section page_iface_xdg_toplevel_api API |
| 278 | * See @ref iface_xdg_toplevel. |
| 279 | */ |
| 280 | /** |
| 281 | * @defgroup iface_xdg_toplevel The xdg_toplevel interface |
| 282 | * |
| 283 | * This interface defines an xdg_surface role which allows a surface to, |
| 284 | * among other things, set window-like properties such as maximize, |
| 285 | * fullscreen, and minimize, set application-specific metadata like title and |
| 286 | * id, and well as trigger user interactive operations such as interactive |
| 287 | * resize and move. |
| 288 | * |
| 289 | * A xdg_toplevel by default is responsible for providing the full intended |
| 290 | * visual representation of the toplevel, which depending on the window |
| 291 | * state, may mean things like a title bar, window controls and drop shadow. |
| 292 | * |
| 293 | * Unmapping an xdg_toplevel means that the surface cannot be shown |
| 294 | * by the compositor until it is explicitly mapped again. |
| 295 | * All active operations (e.g., move, resize) are canceled and all |
| 296 | * attributes (e.g. title, state, stacking, ...) are discarded for |
| 297 | * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to |
| 298 | * the state it had right after xdg_surface.get_toplevel. The client |
| 299 | * can re-map the toplevel by performing a commit without any buffer |
| 300 | * attached, waiting for a configure event and handling it as usual (see |
| 301 | * xdg_surface description). |
| 302 | * |
| 303 | * Attaching a null buffer to a toplevel unmaps the surface. |
| 304 | */ |
| 305 | extern const struct wl_interface xdg_toplevel_interface; |
| 306 | #endif |
| 307 | #ifndef XDG_POPUP_INTERFACE |
| 308 | #define XDG_POPUP_INTERFACE |
| 309 | /** |
| 310 | * @page page_iface_xdg_popup xdg_popup |
| 311 | * @section page_iface_xdg_popup_desc Description |
| 312 | * |
| 313 | * A popup surface is a short-lived, temporary surface. It can be used to |
| 314 | * implement for example menus, popovers, tooltips and other similar user |
| 315 | * interface concepts. |
| 316 | * |
| 317 | * A popup can be made to take an explicit grab. See xdg_popup.grab for |
| 318 | * details. |
| 319 | * |
| 320 | * When the popup is dismissed, a popup_done event will be sent out, and at |
| 321 | * the same time the surface will be unmapped. See the xdg_popup.popup_done |
| 322 | * event for details. |
| 323 | * |
| 324 | * Explicitly destroying the xdg_popup object will also dismiss the popup and |
| 325 | * unmap the surface. Clients that want to dismiss the popup when another |
| 326 | * surface of their own is clicked should dismiss the popup using the destroy |
| 327 | * request. |
| 328 | * |
| 329 | * A newly created xdg_popup will be stacked on top of all previously created |
| 330 | * xdg_popup surfaces associated with the same xdg_toplevel. |
| 331 | * |
| 332 | * The parent of an xdg_popup must be mapped (see the xdg_surface |
| 333 | * description) before the xdg_popup itself. |
| 334 | * |
| 335 | * The client must call wl_surface.commit on the corresponding wl_surface |
| 336 | * for the xdg_popup state to take effect. |
| 337 | * @section page_iface_xdg_popup_api API |
| 338 | * See @ref iface_xdg_popup. |
| 339 | */ |
| 340 | /** |
| 341 | * @defgroup iface_xdg_popup The xdg_popup interface |
| 342 | * |
| 343 | * A popup surface is a short-lived, temporary surface. It can be used to |
| 344 | * implement for example menus, popovers, tooltips and other similar user |
| 345 | * interface concepts. |
| 346 | * |
| 347 | * A popup can be made to take an explicit grab. See xdg_popup.grab for |
| 348 | * details. |
| 349 | * |
| 350 | * When the popup is dismissed, a popup_done event will be sent out, and at |
| 351 | * the same time the surface will be unmapped. See the xdg_popup.popup_done |
| 352 | * event for details. |
| 353 | * |
| 354 | * Explicitly destroying the xdg_popup object will also dismiss the popup and |
| 355 | * unmap the surface. Clients that want to dismiss the popup when another |
| 356 | * surface of their own is clicked should dismiss the popup using the destroy |
| 357 | * request. |
| 358 | * |
| 359 | * A newly created xdg_popup will be stacked on top of all previously created |
| 360 | * xdg_popup surfaces associated with the same xdg_toplevel. |
| 361 | * |
| 362 | * The parent of an xdg_popup must be mapped (see the xdg_surface |
| 363 | * description) before the xdg_popup itself. |
| 364 | * |
| 365 | * The client must call wl_surface.commit on the corresponding wl_surface |
| 366 | * for the xdg_popup state to take effect. |
| 367 | */ |
| 368 | extern const struct wl_interface xdg_popup_interface; |
| 369 | #endif |
| 370 | |
| 371 | #ifndef XDG_WM_BASE_ERROR_ENUM |
| 372 | #define XDG_WM_BASE_ERROR_ENUM |
| 373 | enum xdg_wm_base_error { |
| 374 | /** |
| 375 | * given wl_surface has another role |
| 376 | */ |
| 377 | XDG_WM_BASE_ERROR_ROLE = 0, |
| 378 | /** |
| 379 | * xdg_wm_base was destroyed before children |
| 380 | */ |
| 381 | XDG_WM_BASE_ERROR_DEFUNCT_SURFACES = 1, |
| 382 | /** |
| 383 | * the client tried to map or destroy a non-topmost popup |
| 384 | */ |
| 385 | XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP = 2, |
| 386 | /** |
| 387 | * the client specified an invalid popup parent surface |
| 388 | */ |
| 389 | XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT = 3, |
| 390 | /** |
| 391 | * the client provided an invalid surface state |
| 392 | */ |
| 393 | XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE = 4, |
| 394 | /** |
| 395 | * the client provided an invalid positioner |
| 396 | */ |
| 397 | XDG_WM_BASE_ERROR_INVALID_POSITIONER = 5, |
| 398 | /** |
| 399 | * the client didn’t respond to a ping event in time |
| 400 | */ |
| 401 | XDG_WM_BASE_ERROR_UNRESPONSIVE = 6, |
| 402 | }; |
| 403 | #endif /* XDG_WM_BASE_ERROR_ENUM */ |
| 404 | |
| 405 | /** |
| 406 | * @ingroup iface_xdg_wm_base |
| 407 | * @struct xdg_wm_base_listener |
| 408 | */ |
| 409 | struct xdg_wm_base_listener { |
| 410 | /** |
| 411 | * check if the client is alive |
| 412 | * |
| 413 | * The ping event asks the client if it's still alive. Pass the |
| 414 | * serial specified in the event back to the compositor by sending |
| 415 | * a "pong" request back with the specified serial. See |
| 416 | * xdg_wm_base.pong. |
| 417 | * |
| 418 | * Compositors can use this to determine if the client is still |
| 419 | * alive. It's unspecified what will happen if the client doesn't |
| 420 | * respond to the ping request, or in what timeframe. Clients |
| 421 | * should try to respond in a reasonable amount of time. The |
| 422 | * “unresponsive” error is provided for compositors that wish |
| 423 | * to disconnect unresponsive clients. |
| 424 | * |
| 425 | * A compositor is free to ping in any way it wants, but a client |
| 426 | * must always respond to any xdg_wm_base object it created. |
| 427 | * @param serial pass this to the pong request |
| 428 | */ |
| 429 | void (*ping)(void *data, |
| 430 | struct xdg_wm_base *xdg_wm_base, |
| 431 | uint32_t serial); |
| 432 | }; |
| 433 | |
| 434 | /** |
| 435 | * @ingroup iface_xdg_wm_base |
| 436 | */ |
| 437 | static inline int |
| 438 | xdg_wm_base_add_listener(struct xdg_wm_base *xdg_wm_base, |
| 439 | const struct xdg_wm_base_listener *listener, void *data) |
| 440 | { |
| 441 | return wl_proxy_add_listener((struct wl_proxy *) xdg_wm_base, |
| 442 | (void (**)(void)) listener, data); |
| 443 | } |
| 444 | |
| 445 | #define XDG_WM_BASE_DESTROY 0 |
| 446 | #define XDG_WM_BASE_CREATE_POSITIONER 1 |
| 447 | #define XDG_WM_BASE_GET_XDG_SURFACE 2 |
| 448 | #define XDG_WM_BASE_PONG 3 |
| 449 | |
| 450 | /** |
| 451 | * @ingroup iface_xdg_wm_base |
| 452 | */ |
| 453 | #define XDG_WM_BASE_PING_SINCE_VERSION 1 |
| 454 | |
| 455 | /** |
| 456 | * @ingroup iface_xdg_wm_base |
| 457 | */ |
| 458 | #define XDG_WM_BASE_DESTROY_SINCE_VERSION 1 |
| 459 | /** |
| 460 | * @ingroup iface_xdg_wm_base |
| 461 | */ |
| 462 | #define XDG_WM_BASE_CREATE_POSITIONER_SINCE_VERSION 1 |
| 463 | /** |
| 464 | * @ingroup iface_xdg_wm_base |
| 465 | */ |
| 466 | #define XDG_WM_BASE_GET_XDG_SURFACE_SINCE_VERSION 1 |
| 467 | /** |
| 468 | * @ingroup iface_xdg_wm_base |
| 469 | */ |
| 470 | #define XDG_WM_BASE_PONG_SINCE_VERSION 1 |
| 471 | |
| 472 | /** @ingroup iface_xdg_wm_base */ |
| 473 | static inline void |
| 474 | xdg_wm_base_set_user_data(struct xdg_wm_base *xdg_wm_base, void *user_data) |
| 475 | { |
| 476 | wl_proxy_set_user_data((struct wl_proxy *) xdg_wm_base, user_data); |
| 477 | } |
| 478 | |
| 479 | /** @ingroup iface_xdg_wm_base */ |
| 480 | static inline void * |
| 481 | xdg_wm_base_get_user_data(struct xdg_wm_base *xdg_wm_base) |
| 482 | { |
| 483 | return wl_proxy_get_user_data((struct wl_proxy *) xdg_wm_base); |
| 484 | } |
| 485 | |
| 486 | static inline uint32_t |
| 487 | xdg_wm_base_get_version(struct xdg_wm_base *xdg_wm_base) |
| 488 | { |
| 489 | return wl_proxy_get_version((struct wl_proxy *) xdg_wm_base); |
| 490 | } |
| 491 | |
| 492 | /** |
| 493 | * @ingroup iface_xdg_wm_base |
| 494 | * |
| 495 | * Destroy this xdg_wm_base object. |
| 496 | * |
| 497 | * Destroying a bound xdg_wm_base object while there are surfaces |
| 498 | * still alive created by this xdg_wm_base object instance is illegal |
| 499 | * and will result in a defunct_surfaces error. |
| 500 | */ |
| 501 | static inline void |
| 502 | xdg_wm_base_destroy(struct xdg_wm_base *xdg_wm_base) |
| 503 | { |
| 504 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base, |
| 505 | XDG_WM_BASE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), WL_MARSHAL_FLAG_DESTROY); |
| 506 | } |
| 507 | |
| 508 | /** |
| 509 | * @ingroup iface_xdg_wm_base |
| 510 | * |
| 511 | * Create a positioner object. A positioner object is used to position |
| 512 | * surfaces relative to some parent surface. See the interface description |
| 513 | * and xdg_surface.get_popup for details. |
| 514 | */ |
| 515 | static inline struct xdg_positioner * |
| 516 | xdg_wm_base_create_positioner(struct xdg_wm_base *xdg_wm_base) |
| 517 | { |
| 518 | struct wl_proxy *id; |
| 519 | |
| 520 | id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base, |
| 521 | XDG_WM_BASE_CREATE_POSITIONER, &xdg_positioner_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL); |
| 522 | |
| 523 | return (struct xdg_positioner *) id; |
| 524 | } |
| 525 | |
| 526 | /** |
| 527 | * @ingroup iface_xdg_wm_base |
| 528 | * |
| 529 | * This creates an xdg_surface for the given surface. While xdg_surface |
| 530 | * itself is not a role, the corresponding surface may only be assigned |
| 531 | * a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is |
| 532 | * illegal to create an xdg_surface for a wl_surface which already has an |
| 533 | * assigned role and this will result in a role error. |
| 534 | * |
| 535 | * This creates an xdg_surface for the given surface. An xdg_surface is |
| 536 | * used as basis to define a role to a given surface, such as xdg_toplevel |
| 537 | * or xdg_popup. It also manages functionality shared between xdg_surface |
| 538 | * based surface roles. |
| 539 | * |
| 540 | * See the documentation of xdg_surface for more details about what an |
| 541 | * xdg_surface is and how it is used. |
| 542 | */ |
| 543 | static inline struct xdg_surface * |
| 544 | xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *surface) |
| 545 | { |
| 546 | struct wl_proxy *id; |
| 547 | |
| 548 | id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base, |
| 549 | XDG_WM_BASE_GET_XDG_SURFACE, &xdg_surface_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL, surface); |
| 550 | |
| 551 | return (struct xdg_surface *) id; |
| 552 | } |
| 553 | |
| 554 | /** |
| 555 | * @ingroup iface_xdg_wm_base |
| 556 | * |
| 557 | * A client must respond to a ping event with a pong request or |
| 558 | * the client may be deemed unresponsive. See xdg_wm_base.ping |
| 559 | * and xdg_wm_base.error.unresponsive. |
| 560 | */ |
| 561 | static inline void |
| 562 | xdg_wm_base_pong(struct xdg_wm_base *xdg_wm_base, uint32_t serial) |
| 563 | { |
| 564 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base, |
| 565 | XDG_WM_BASE_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, serial); |
| 566 | } |
| 567 | |
| 568 | #ifndef XDG_POSITIONER_ERROR_ENUM |
| 569 | #define XDG_POSITIONER_ERROR_ENUM |
| 570 | enum xdg_positioner_error { |
| 571 | /** |
| 572 | * invalid input provided |
| 573 | */ |
| 574 | XDG_POSITIONER_ERROR_INVALID_INPUT = 0, |
| 575 | }; |
| 576 | #endif /* XDG_POSITIONER_ERROR_ENUM */ |
| 577 | |
| 578 | #ifndef XDG_POSITIONER_ANCHOR_ENUM |
| 579 | #define XDG_POSITIONER_ANCHOR_ENUM |
| 580 | enum xdg_positioner_anchor { |
| 581 | XDG_POSITIONER_ANCHOR_NONE = 0, |
| 582 | XDG_POSITIONER_ANCHOR_TOP = 1, |
| 583 | XDG_POSITIONER_ANCHOR_BOTTOM = 2, |
| 584 | XDG_POSITIONER_ANCHOR_LEFT = 3, |
| 585 | XDG_POSITIONER_ANCHOR_RIGHT = 4, |
| 586 | XDG_POSITIONER_ANCHOR_TOP_LEFT = 5, |
| 587 | XDG_POSITIONER_ANCHOR_BOTTOM_LEFT = 6, |
| 588 | XDG_POSITIONER_ANCHOR_TOP_RIGHT = 7, |
| 589 | XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT = 8, |
| 590 | }; |
| 591 | #endif /* XDG_POSITIONER_ANCHOR_ENUM */ |
| 592 | |
| 593 | #ifndef XDG_POSITIONER_GRAVITY_ENUM |
| 594 | #define XDG_POSITIONER_GRAVITY_ENUM |
| 595 | enum xdg_positioner_gravity { |
| 596 | XDG_POSITIONER_GRAVITY_NONE = 0, |
| 597 | XDG_POSITIONER_GRAVITY_TOP = 1, |
| 598 | XDG_POSITIONER_GRAVITY_BOTTOM = 2, |
| 599 | XDG_POSITIONER_GRAVITY_LEFT = 3, |
| 600 | XDG_POSITIONER_GRAVITY_RIGHT = 4, |
| 601 | XDG_POSITIONER_GRAVITY_TOP_LEFT = 5, |
| 602 | XDG_POSITIONER_GRAVITY_BOTTOM_LEFT = 6, |
| 603 | XDG_POSITIONER_GRAVITY_TOP_RIGHT = 7, |
| 604 | XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT = 8, |
| 605 | }; |
| 606 | #endif /* XDG_POSITIONER_GRAVITY_ENUM */ |
| 607 | |
| 608 | #ifndef XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM |
| 609 | #define XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM |
| 610 | /** |
| 611 | * @ingroup iface_xdg_positioner |
| 612 | * constraint adjustments |
| 613 | * |
| 614 | * The constraint adjustment value define ways the compositor will adjust |
| 615 | * the position of the surface, if the unadjusted position would result |
| 616 | * in the surface being partly constrained. |
| 617 | * |
| 618 | * Whether a surface is considered 'constrained' is left to the compositor |
| 619 | * to determine. For example, the surface may be partly outside the |
| 620 | * compositor's defined 'work area', thus necessitating the child surface's |
| 621 | * position be adjusted until it is entirely inside the work area. |
| 622 | * |
| 623 | * The adjustments can be combined, according to a defined precedence: 1) |
| 624 | * Flip, 2) Slide, 3) Resize. |
| 625 | */ |
| 626 | enum xdg_positioner_constraint_adjustment { |
| 627 | /** |
| 628 | * don't move the child surface when constrained |
| 629 | * |
| 630 | * Don't alter the surface position even if it is constrained on |
| 631 | * some axis, for example partially outside the edge of an output. |
| 632 | */ |
| 633 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE = 0, |
| 634 | /** |
| 635 | * move along the x axis until unconstrained |
| 636 | * |
| 637 | * Slide the surface along the x axis until it is no longer |
| 638 | * constrained. |
| 639 | * |
| 640 | * First try to slide towards the direction of the gravity on the x |
| 641 | * axis until either the edge in the opposite direction of the |
| 642 | * gravity is unconstrained or the edge in the direction of the |
| 643 | * gravity is constrained. |
| 644 | * |
| 645 | * Then try to slide towards the opposite direction of the gravity |
| 646 | * on the x axis until either the edge in the direction of the |
| 647 | * gravity is unconstrained or the edge in the opposite direction |
| 648 | * of the gravity is constrained. |
| 649 | */ |
| 650 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1, |
| 651 | /** |
| 652 | * move along the y axis until unconstrained |
| 653 | * |
| 654 | * Slide the surface along the y axis until it is no longer |
| 655 | * constrained. |
| 656 | * |
| 657 | * First try to slide towards the direction of the gravity on the y |
| 658 | * axis until either the edge in the opposite direction of the |
| 659 | * gravity is unconstrained or the edge in the direction of the |
| 660 | * gravity is constrained. |
| 661 | * |
| 662 | * Then try to slide towards the opposite direction of the gravity |
| 663 | * on the y axis until either the edge in the direction of the |
| 664 | * gravity is unconstrained or the edge in the opposite direction |
| 665 | * of the gravity is constrained. |
| 666 | */ |
| 667 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2, |
| 668 | /** |
| 669 | * invert the anchor and gravity on the x axis |
| 670 | * |
| 671 | * Invert the anchor and gravity on the x axis if the surface is |
| 672 | * constrained on the x axis. For example, if the left edge of the |
| 673 | * surface is constrained, the gravity is 'left' and the anchor is |
| 674 | * 'left', change the gravity to 'right' and the anchor to 'right'. |
| 675 | * |
| 676 | * If the adjusted position also ends up being constrained, the |
| 677 | * resulting position of the flip_x adjustment will be the one |
| 678 | * before the adjustment. |
| 679 | */ |
| 680 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X = 4, |
| 681 | /** |
| 682 | * invert the anchor and gravity on the y axis |
| 683 | * |
| 684 | * Invert the anchor and gravity on the y axis if the surface is |
| 685 | * constrained on the y axis. For example, if the bottom edge of |
| 686 | * the surface is constrained, the gravity is 'bottom' and the |
| 687 | * anchor is 'bottom', change the gravity to 'top' and the anchor |
| 688 | * to 'top'. |
| 689 | * |
| 690 | * The adjusted position is calculated given the original anchor |
| 691 | * rectangle and offset, but with the new flipped anchor and |
| 692 | * gravity values. |
| 693 | * |
| 694 | * If the adjusted position also ends up being constrained, the |
| 695 | * resulting position of the flip_y adjustment will be the one |
| 696 | * before the adjustment. |
| 697 | */ |
| 698 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8, |
| 699 | /** |
| 700 | * horizontally resize the surface |
| 701 | * |
| 702 | * Resize the surface horizontally so that it is completely |
| 703 | * unconstrained. |
| 704 | */ |
| 705 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16, |
| 706 | /** |
| 707 | * vertically resize the surface |
| 708 | * |
| 709 | * Resize the surface vertically so that it is completely |
| 710 | * unconstrained. |
| 711 | */ |
| 712 | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32, |
| 713 | }; |
| 714 | #endif /* XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM */ |
| 715 | |
| 716 | #define XDG_POSITIONER_DESTROY 0 |
| 717 | #define XDG_POSITIONER_SET_SIZE 1 |
| 718 | #define XDG_POSITIONER_SET_ANCHOR_RECT 2 |
| 719 | #define XDG_POSITIONER_SET_ANCHOR 3 |
| 720 | #define XDG_POSITIONER_SET_GRAVITY 4 |
| 721 | #define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT 5 |
| 722 | #define XDG_POSITIONER_SET_OFFSET 6 |
| 723 | #define XDG_POSITIONER_SET_REACTIVE 7 |
| 724 | #define XDG_POSITIONER_SET_PARENT_SIZE 8 |
| 725 | #define XDG_POSITIONER_SET_PARENT_CONFIGURE 9 |
| 726 | |
| 727 | |
| 728 | /** |
| 729 | * @ingroup iface_xdg_positioner |
| 730 | */ |
| 731 | #define XDG_POSITIONER_DESTROY_SINCE_VERSION 1 |
| 732 | /** |
| 733 | * @ingroup iface_xdg_positioner |
| 734 | */ |
| 735 | #define XDG_POSITIONER_SET_SIZE_SINCE_VERSION 1 |
| 736 | /** |
| 737 | * @ingroup iface_xdg_positioner |
| 738 | */ |
| 739 | #define XDG_POSITIONER_SET_ANCHOR_RECT_SINCE_VERSION 1 |
| 740 | /** |
| 741 | * @ingroup iface_xdg_positioner |
| 742 | */ |
| 743 | #define XDG_POSITIONER_SET_ANCHOR_SINCE_VERSION 1 |
| 744 | /** |
| 745 | * @ingroup iface_xdg_positioner |
| 746 | */ |
| 747 | #define XDG_POSITIONER_SET_GRAVITY_SINCE_VERSION 1 |
| 748 | /** |
| 749 | * @ingroup iface_xdg_positioner |
| 750 | */ |
| 751 | #define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION 1 |
| 752 | /** |
| 753 | * @ingroup iface_xdg_positioner |
| 754 | */ |
| 755 | #define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1 |
| 756 | /** |
| 757 | * @ingroup iface_xdg_positioner |
| 758 | */ |
| 759 | #define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3 |
| 760 | /** |
| 761 | * @ingroup iface_xdg_positioner |
| 762 | */ |
| 763 | #define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3 |
| 764 | /** |
| 765 | * @ingroup iface_xdg_positioner |
| 766 | */ |
| 767 | #define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3 |
| 768 | |
| 769 | /** @ingroup iface_xdg_positioner */ |
| 770 | static inline void |
| 771 | xdg_positioner_set_user_data(struct xdg_positioner *xdg_positioner, void *user_data) |
| 772 | { |
| 773 | wl_proxy_set_user_data((struct wl_proxy *) xdg_positioner, user_data); |
| 774 | } |
| 775 | |
| 776 | /** @ingroup iface_xdg_positioner */ |
| 777 | static inline void * |
| 778 | xdg_positioner_get_user_data(struct xdg_positioner *xdg_positioner) |
| 779 | { |
| 780 | return wl_proxy_get_user_data((struct wl_proxy *) xdg_positioner); |
| 781 | } |
| 782 | |
| 783 | static inline uint32_t |
| 784 | xdg_positioner_get_version(struct xdg_positioner *xdg_positioner) |
| 785 | { |
| 786 | return wl_proxy_get_version((struct wl_proxy *) xdg_positioner); |
| 787 | } |
| 788 | |
| 789 | /** |
| 790 | * @ingroup iface_xdg_positioner |
| 791 | * |
| 792 | * Notify the compositor that the xdg_positioner will no longer be used. |
| 793 | */ |
| 794 | static inline void |
| 795 | xdg_positioner_destroy(struct xdg_positioner *xdg_positioner) |
| 796 | { |
| 797 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 798 | XDG_POSITIONER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), WL_MARSHAL_FLAG_DESTROY); |
| 799 | } |
| 800 | |
| 801 | /** |
| 802 | * @ingroup iface_xdg_positioner |
| 803 | * |
| 804 | * Set the size of the surface that is to be positioned with the positioner |
| 805 | * object. The size is in surface-local coordinates and corresponds to the |
| 806 | * window geometry. See xdg_surface.set_window_geometry. |
| 807 | * |
| 808 | * If a zero or negative size is set the invalid_input error is raised. |
| 809 | */ |
| 810 | static inline void |
| 811 | xdg_positioner_set_size(struct xdg_positioner *xdg_positioner, int32_t width, int32_t height) |
| 812 | { |
| 813 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 814 | XDG_POSITIONER_SET_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, width, height); |
| 815 | } |
| 816 | |
| 817 | /** |
| 818 | * @ingroup iface_xdg_positioner |
| 819 | * |
| 820 | * Specify the anchor rectangle within the parent surface that the child |
| 821 | * surface will be placed relative to. The rectangle is relative to the |
| 822 | * window geometry as defined by xdg_surface.set_window_geometry of the |
| 823 | * parent surface. |
| 824 | * |
| 825 | * When the xdg_positioner object is used to position a child surface, the |
| 826 | * anchor rectangle may not extend outside the window geometry of the |
| 827 | * positioned child's parent surface. |
| 828 | * |
| 829 | * If a negative size is set the invalid_input error is raised. |
| 830 | */ |
| 831 | static inline void |
| 832 | xdg_positioner_set_anchor_rect(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y, int32_t width, int32_t height) |
| 833 | { |
| 834 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 835 | XDG_POSITIONER_SET_ANCHOR_RECT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y, width, height); |
| 836 | } |
| 837 | |
| 838 | /** |
| 839 | * @ingroup iface_xdg_positioner |
| 840 | * |
| 841 | * Defines the anchor point for the anchor rectangle. The specified anchor |
| 842 | * is used derive an anchor point that the child surface will be |
| 843 | * positioned relative to. If a corner anchor is set (e.g. 'top_left' or |
| 844 | * 'bottom_right'), the anchor point will be at the specified corner; |
| 845 | * otherwise, the derived anchor point will be centered on the specified |
| 846 | * edge, or in the center of the anchor rectangle if no edge is specified. |
| 847 | */ |
| 848 | static inline void |
| 849 | xdg_positioner_set_anchor(struct xdg_positioner *xdg_positioner, uint32_t anchor) |
| 850 | { |
| 851 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 852 | XDG_POSITIONER_SET_ANCHOR, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, anchor); |
| 853 | } |
| 854 | |
| 855 | /** |
| 856 | * @ingroup iface_xdg_positioner |
| 857 | * |
| 858 | * Defines in what direction a surface should be positioned, relative to |
| 859 | * the anchor point of the parent surface. If a corner gravity is |
| 860 | * specified (e.g. 'bottom_right' or 'top_left'), then the child surface |
| 861 | * will be placed towards the specified gravity; otherwise, the child |
| 862 | * surface will be centered over the anchor point on any axis that had no |
| 863 | * gravity specified. If the gravity is not in the ‘gravity’ enum, an |
| 864 | * invalid_input error is raised. |
| 865 | */ |
| 866 | static inline void |
| 867 | xdg_positioner_set_gravity(struct xdg_positioner *xdg_positioner, uint32_t gravity) |
| 868 | { |
| 869 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 870 | XDG_POSITIONER_SET_GRAVITY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, gravity); |
| 871 | } |
| 872 | |
| 873 | /** |
| 874 | * @ingroup iface_xdg_positioner |
| 875 | * |
| 876 | * Specify how the window should be positioned if the originally intended |
| 877 | * position caused the surface to be constrained, meaning at least |
| 878 | * partially outside positioning boundaries set by the compositor. The |
| 879 | * adjustment is set by constructing a bitmask describing the adjustment to |
| 880 | * be made when the surface is constrained on that axis. |
| 881 | * |
| 882 | * If no bit for one axis is set, the compositor will assume that the child |
| 883 | * surface should not change its position on that axis when constrained. |
| 884 | * |
| 885 | * If more than one bit for one axis is set, the order of how adjustments |
| 886 | * are applied is specified in the corresponding adjustment descriptions. |
| 887 | * |
| 888 | * The default adjustment is none. |
| 889 | */ |
| 890 | static inline void |
| 891 | xdg_positioner_set_constraint_adjustment(struct xdg_positioner *xdg_positioner, uint32_t constraint_adjustment) |
| 892 | { |
| 893 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 894 | XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, constraint_adjustment); |
| 895 | } |
| 896 | |
| 897 | /** |
| 898 | * @ingroup iface_xdg_positioner |
| 899 | * |
| 900 | * Specify the surface position offset relative to the position of the |
| 901 | * anchor on the anchor rectangle and the anchor on the surface. For |
| 902 | * example if the anchor of the anchor rectangle is at (x, y), the surface |
| 903 | * has the gravity bottom|right, and the offset is (ox, oy), the calculated |
| 904 | * surface position will be (x + ox, y + oy). The offset position of the |
| 905 | * surface is the one used for constraint testing. See |
| 906 | * set_constraint_adjustment. |
| 907 | * |
| 908 | * An example use case is placing a popup menu on top of a user interface |
| 909 | * element, while aligning the user interface element of the parent surface |
| 910 | * with some user interface element placed somewhere in the popup surface. |
| 911 | */ |
| 912 | static inline void |
| 913 | xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y) |
| 914 | { |
| 915 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 916 | XDG_POSITIONER_SET_OFFSET, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y); |
| 917 | } |
| 918 | |
| 919 | /** |
| 920 | * @ingroup iface_xdg_positioner |
| 921 | * |
| 922 | * When set reactive, the surface is reconstrained if the conditions used |
| 923 | * for constraining changed, e.g. the parent window moved. |
| 924 | * |
| 925 | * If the conditions changed and the popup was reconstrained, an |
| 926 | * xdg_popup.configure event is sent with updated geometry, followed by an |
| 927 | * xdg_surface.configure event. |
| 928 | */ |
| 929 | static inline void |
| 930 | xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner) |
| 931 | { |
| 932 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 933 | XDG_POSITIONER_SET_REACTIVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0); |
| 934 | } |
| 935 | |
| 936 | /** |
| 937 | * @ingroup iface_xdg_positioner |
| 938 | * |
| 939 | * Set the parent window geometry the compositor should use when |
| 940 | * positioning the popup. The compositor may use this information to |
| 941 | * determine the future state the popup should be constrained using. If |
| 942 | * this doesn't match the dimension of the parent the popup is eventually |
| 943 | * positioned against, the behavior is undefined. |
| 944 | * |
| 945 | * The arguments are given in the surface-local coordinate space. |
| 946 | */ |
| 947 | static inline void |
| 948 | xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t parent_width, int32_t parent_height) |
| 949 | { |
| 950 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 951 | XDG_POSITIONER_SET_PARENT_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, parent_width, parent_height); |
| 952 | } |
| 953 | |
| 954 | /** |
| 955 | * @ingroup iface_xdg_positioner |
| 956 | * |
| 957 | * Set the serial of an xdg_surface.configure event this positioner will be |
| 958 | * used in response to. The compositor may use this information together |
| 959 | * with set_parent_size to determine what future state the popup should be |
| 960 | * constrained using. |
| 961 | */ |
| 962 | static inline void |
| 963 | xdg_positioner_set_parent_configure(struct xdg_positioner *xdg_positioner, uint32_t serial) |
| 964 | { |
| 965 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner, |
| 966 | XDG_POSITIONER_SET_PARENT_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, serial); |
| 967 | } |
| 968 | |
| 969 | #ifndef XDG_SURFACE_ERROR_ENUM |
| 970 | #define XDG_SURFACE_ERROR_ENUM |
| 971 | enum xdg_surface_error { |
| 972 | /** |
| 973 | * Surface was not fully constructed |
| 974 | */ |
| 975 | XDG_SURFACE_ERROR_NOT_CONSTRUCTED = 1, |
| 976 | /** |
| 977 | * Surface was already constructed |
| 978 | */ |
| 979 | XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED = 2, |
| 980 | /** |
| 981 | * Attaching a buffer to an unconfigured surface |
| 982 | */ |
| 983 | XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER = 3, |
| 984 | /** |
| 985 | * Invalid serial number when acking a configure event |
| 986 | */ |
| 987 | XDG_SURFACE_ERROR_INVALID_SERIAL = 4, |
| 988 | /** |
| 989 | * Width or height was zero or negative |
| 990 | */ |
| 991 | XDG_SURFACE_ERROR_INVALID_SIZE = 5, |
| 992 | /** |
| 993 | * Surface was destroyed before its role object |
| 994 | */ |
| 995 | XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT = 6, |
| 996 | }; |
| 997 | #endif /* XDG_SURFACE_ERROR_ENUM */ |
| 998 | |
| 999 | /** |
| 1000 | * @ingroup iface_xdg_surface |
| 1001 | * @struct xdg_surface_listener |
| 1002 | */ |
| 1003 | struct xdg_surface_listener { |
| 1004 | /** |
| 1005 | * suggest a surface change |
| 1006 | * |
| 1007 | * The configure event marks the end of a configure sequence. A |
| 1008 | * configure sequence is a set of one or more events configuring |
| 1009 | * the state of the xdg_surface, including the final |
| 1010 | * xdg_surface.configure event. |
| 1011 | * |
| 1012 | * Where applicable, xdg_surface surface roles will during a |
| 1013 | * configure sequence extend this event as a latched state sent as |
| 1014 | * events before the xdg_surface.configure event. Such events |
| 1015 | * should be considered to make up a set of atomically applied |
| 1016 | * configuration states, where the xdg_surface.configure commits |
| 1017 | * the accumulated state. |
| 1018 | * |
| 1019 | * Clients should arrange their surface for the new states, and |
| 1020 | * then send an ack_configure request with the serial sent in this |
| 1021 | * configure event at some point before committing the new surface. |
| 1022 | * |
| 1023 | * If the client receives multiple configure events before it can |
| 1024 | * respond to one, it is free to discard all but the last event it |
| 1025 | * received. |
| 1026 | * @param serial serial of the configure event |
| 1027 | */ |
| 1028 | void (*configure)(void *data, |
| 1029 | struct xdg_surface *xdg_surface, |
| 1030 | uint32_t serial); |
| 1031 | }; |
| 1032 | |
| 1033 | /** |
| 1034 | * @ingroup iface_xdg_surface |
| 1035 | */ |
| 1036 | static inline int |
| 1037 | xdg_surface_add_listener(struct xdg_surface *xdg_surface, |
| 1038 | const struct xdg_surface_listener *listener, void *data) |
| 1039 | { |
| 1040 | return wl_proxy_add_listener((struct wl_proxy *) xdg_surface, |
| 1041 | (void (**)(void)) listener, data); |
| 1042 | } |
| 1043 | |
| 1044 | #define XDG_SURFACE_DESTROY 0 |
| 1045 | #define XDG_SURFACE_GET_TOPLEVEL 1 |
| 1046 | #define XDG_SURFACE_GET_POPUP 2 |
| 1047 | #define XDG_SURFACE_SET_WINDOW_GEOMETRY 3 |
| 1048 | #define XDG_SURFACE_ACK_CONFIGURE 4 |
| 1049 | |
| 1050 | /** |
| 1051 | * @ingroup iface_xdg_surface |
| 1052 | */ |
| 1053 | #define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1 |
| 1054 | |
| 1055 | /** |
| 1056 | * @ingroup iface_xdg_surface |
| 1057 | */ |
| 1058 | #define XDG_SURFACE_DESTROY_SINCE_VERSION 1 |
| 1059 | /** |
| 1060 | * @ingroup iface_xdg_surface |
| 1061 | */ |
| 1062 | #define XDG_SURFACE_GET_TOPLEVEL_SINCE_VERSION 1 |
| 1063 | /** |
| 1064 | * @ingroup iface_xdg_surface |
| 1065 | */ |
| 1066 | #define XDG_SURFACE_GET_POPUP_SINCE_VERSION 1 |
| 1067 | /** |
| 1068 | * @ingroup iface_xdg_surface |
| 1069 | */ |
| 1070 | #define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1 |
| 1071 | /** |
| 1072 | * @ingroup iface_xdg_surface |
| 1073 | */ |
| 1074 | #define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1 |
| 1075 | |
| 1076 | /** @ingroup iface_xdg_surface */ |
| 1077 | static inline void |
| 1078 | xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data) |
| 1079 | { |
| 1080 | wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data); |
| 1081 | } |
| 1082 | |
| 1083 | /** @ingroup iface_xdg_surface */ |
| 1084 | static inline void * |
| 1085 | xdg_surface_get_user_data(struct xdg_surface *xdg_surface) |
| 1086 | { |
| 1087 | return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface); |
| 1088 | } |
| 1089 | |
| 1090 | static inline uint32_t |
| 1091 | xdg_surface_get_version(struct xdg_surface *xdg_surface) |
| 1092 | { |
| 1093 | return wl_proxy_get_version((struct wl_proxy *) xdg_surface); |
| 1094 | } |
| 1095 | |
| 1096 | /** |
| 1097 | * @ingroup iface_xdg_surface |
| 1098 | * |
| 1099 | * Destroy the xdg_surface object. An xdg_surface must only be destroyed |
| 1100 | * after its role object has been destroyed, otherwise |
| 1101 | * a defunct_role_object error is raised. |
| 1102 | */ |
| 1103 | static inline void |
| 1104 | xdg_surface_destroy(struct xdg_surface *xdg_surface) |
| 1105 | { |
| 1106 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface, |
| 1107 | XDG_SURFACE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), WL_MARSHAL_FLAG_DESTROY); |
| 1108 | } |
| 1109 | |
| 1110 | /** |
| 1111 | * @ingroup iface_xdg_surface |
| 1112 | * |
| 1113 | * This creates an xdg_toplevel object for the given xdg_surface and gives |
| 1114 | * the associated wl_surface the xdg_toplevel role. |
| 1115 | * |
| 1116 | * See the documentation of xdg_toplevel for more details about what an |
| 1117 | * xdg_toplevel is and how it is used. |
| 1118 | */ |
| 1119 | static inline struct xdg_toplevel * |
| 1120 | xdg_surface_get_toplevel(struct xdg_surface *xdg_surface) |
| 1121 | { |
| 1122 | struct wl_proxy *id; |
| 1123 | |
| 1124 | id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface, |
| 1125 | XDG_SURFACE_GET_TOPLEVEL, &xdg_toplevel_interface, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, NULL); |
| 1126 | |
| 1127 | return (struct xdg_toplevel *) id; |
| 1128 | } |
| 1129 | |
| 1130 | /** |
| 1131 | * @ingroup iface_xdg_surface |
| 1132 | * |
| 1133 | * This creates an xdg_popup object for the given xdg_surface and gives |
| 1134 | * the associated wl_surface the xdg_popup role. |
| 1135 | * |
| 1136 | * If null is passed as a parent, a parent surface must be specified using |
| 1137 | * some other protocol, before committing the initial state. |
| 1138 | * |
| 1139 | * See the documentation of xdg_popup for more details about what an |
| 1140 | * xdg_popup is and how it is used. |
| 1141 | */ |
| 1142 | static inline struct xdg_popup * |
| 1143 | xdg_surface_get_popup(struct xdg_surface *xdg_surface, struct xdg_surface *parent, struct xdg_positioner *positioner) |
| 1144 | { |
| 1145 | struct wl_proxy *id; |
| 1146 | |
| 1147 | id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface, |
| 1148 | XDG_SURFACE_GET_POPUP, &xdg_popup_interface, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, NULL, parent, positioner); |
| 1149 | |
| 1150 | return (struct xdg_popup *) id; |
| 1151 | } |
| 1152 | |
| 1153 | /** |
| 1154 | * @ingroup iface_xdg_surface |
| 1155 | * |
| 1156 | * The window geometry of a surface is its "visible bounds" from the |
| 1157 | * user's perspective. Client-side decorations often have invisible |
| 1158 | * portions like drop-shadows which should be ignored for the |
| 1159 | * purposes of aligning, placing and constraining windows. Note that |
| 1160 | * in some situations, compositors may clip rendering to the window |
| 1161 | * geometry, so the client should avoid putting functional elements |
| 1162 | * outside of it. |
| 1163 | * |
| 1164 | * The window geometry is double-buffered state, see wl_surface.commit. |
| 1165 | * |
| 1166 | * When maintaining a position, the compositor should treat the (x, y) |
| 1167 | * coordinate of the window geometry as the top left corner of the window. |
| 1168 | * A client changing the (x, y) window geometry coordinate should in |
| 1169 | * general not alter the position of the window. |
| 1170 | * |
| 1171 | * Once the window geometry of the surface is set, it is not possible to |
| 1172 | * unset it, and it will remain the same until set_window_geometry is |
| 1173 | * called again, even if a new subsurface or buffer is attached. |
| 1174 | * |
| 1175 | * If never set, the value is the full bounds of the surface, |
| 1176 | * including any subsurfaces. This updates dynamically on every |
| 1177 | * commit. This unset is meant for extremely simple clients. |
| 1178 | * |
| 1179 | * The arguments are given in the surface-local coordinate space of |
| 1180 | * the wl_surface associated with this xdg_surface, and may extend outside |
| 1181 | * of the wl_surface itself to mark parts of the subsurface tree as part of |
| 1182 | * the window geometry. |
| 1183 | * |
| 1184 | * When applied, the effective window geometry will be the set window |
| 1185 | * geometry clamped to the bounding rectangle of the combined |
| 1186 | * geometry of the surface of the xdg_surface and the associated |
| 1187 | * subsurfaces. |
| 1188 | * |
| 1189 | * The effective geometry will not be recalculated unless a new call to |
| 1190 | * set_window_geometry is done and the new pending surface state is |
| 1191 | * subsequently applied. |
| 1192 | * |
| 1193 | * The width and height of the effective window geometry must be |
| 1194 | * greater than zero. Setting an invalid size will raise an |
| 1195 | * invalid_size error. |
| 1196 | */ |
| 1197 | static inline void |
| 1198 | xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height) |
| 1199 | { |
| 1200 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface, |
| 1201 | XDG_SURFACE_SET_WINDOW_GEOMETRY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, x, y, width, height); |
| 1202 | } |
| 1203 | |
| 1204 | /** |
| 1205 | * @ingroup iface_xdg_surface |
| 1206 | * |
| 1207 | * When a configure event is received, if a client commits the |
| 1208 | * surface in response to the configure event, then the client |
| 1209 | * must make an ack_configure request sometime before the commit |
| 1210 | * request, passing along the serial of the configure event. |
| 1211 | * |
| 1212 | * For instance, for toplevel surfaces the compositor might use this |
| 1213 | * information to move a surface to the top left only when the client has |
| 1214 | * drawn itself for the maximized or fullscreen state. |
| 1215 | * |
| 1216 | * If the client receives multiple configure events before it |
| 1217 | * can respond to one, it only has to ack the last configure event. |
| 1218 | * Acking a configure event that was never sent raises an invalid_serial |
| 1219 | * error. |
| 1220 | * |
| 1221 | * A client is not required to commit immediately after sending |
| 1222 | * an ack_configure request - it may even ack_configure several times |
| 1223 | * before its next surface commit. |
| 1224 | * |
| 1225 | * A client may send multiple ack_configure requests before committing, but |
| 1226 | * only the last request sent before a commit indicates which configure |
| 1227 | * event the client really is responding to. |
| 1228 | * |
| 1229 | * Sending an ack_configure request consumes the serial number sent with |
| 1230 | * the request, as well as serial numbers sent by all configure events |
| 1231 | * sent on this xdg_surface prior to the configure event referenced by |
| 1232 | * the committed serial. |
| 1233 | * |
| 1234 | * It is an error to issue multiple ack_configure requests referencing a |
| 1235 | * serial from the same configure event, or to issue an ack_configure |
| 1236 | * request referencing a serial from a configure event issued before the |
| 1237 | * event identified by the last ack_configure request for the same |
| 1238 | * xdg_surface. Doing so will raise an invalid_serial error. |
| 1239 | */ |
| 1240 | static inline void |
| 1241 | xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial) |
| 1242 | { |
| 1243 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface, |
| 1244 | XDG_SURFACE_ACK_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, serial); |
| 1245 | } |
| 1246 | |
| 1247 | #ifndef XDG_TOPLEVEL_ERROR_ENUM |
| 1248 | #define XDG_TOPLEVEL_ERROR_ENUM |
| 1249 | enum xdg_toplevel_error { |
| 1250 | /** |
| 1251 | * provided value is not a valid variant of the resize_edge enum |
| 1252 | */ |
| 1253 | XDG_TOPLEVEL_ERROR_INVALID_RESIZE_EDGE = 0, |
| 1254 | /** |
| 1255 | * invalid parent toplevel |
| 1256 | */ |
| 1257 | XDG_TOPLEVEL_ERROR_INVALID_PARENT = 1, |
| 1258 | /** |
| 1259 | * client provided an invalid min or max size |
| 1260 | */ |
| 1261 | XDG_TOPLEVEL_ERROR_INVALID_SIZE = 2, |
| 1262 | }; |
| 1263 | #endif /* XDG_TOPLEVEL_ERROR_ENUM */ |
| 1264 | |
| 1265 | #ifndef XDG_TOPLEVEL_RESIZE_EDGE_ENUM |
| 1266 | #define XDG_TOPLEVEL_RESIZE_EDGE_ENUM |
| 1267 | /** |
| 1268 | * @ingroup iface_xdg_toplevel |
| 1269 | * edge values for resizing |
| 1270 | * |
| 1271 | * These values are used to indicate which edge of a surface |
| 1272 | * is being dragged in a resize operation. |
| 1273 | */ |
| 1274 | enum xdg_toplevel_resize_edge { |
| 1275 | XDG_TOPLEVEL_RESIZE_EDGE_NONE = 0, |
| 1276 | XDG_TOPLEVEL_RESIZE_EDGE_TOP = 1, |
| 1277 | XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM = 2, |
| 1278 | XDG_TOPLEVEL_RESIZE_EDGE_LEFT = 4, |
| 1279 | XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT = 5, |
| 1280 | XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT = 6, |
| 1281 | XDG_TOPLEVEL_RESIZE_EDGE_RIGHT = 8, |
| 1282 | XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT = 9, |
| 1283 | XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT = 10, |
| 1284 | }; |
| 1285 | #endif /* XDG_TOPLEVEL_RESIZE_EDGE_ENUM */ |
| 1286 | |
| 1287 | #ifndef XDG_TOPLEVEL_STATE_ENUM |
| 1288 | #define XDG_TOPLEVEL_STATE_ENUM |
| 1289 | /** |
| 1290 | * @ingroup iface_xdg_toplevel |
| 1291 | * types of state on the surface |
| 1292 | * |
| 1293 | * The different state values used on the surface. This is designed for |
| 1294 | * state values like maximized, fullscreen. It is paired with the |
| 1295 | * configure event to ensure that both the client and the compositor |
| 1296 | * setting the state can be synchronized. |
| 1297 | * |
| 1298 | * States set in this way are double-buffered, see wl_surface.commit. |
| 1299 | */ |
| 1300 | enum xdg_toplevel_state { |
| 1301 | /** |
| 1302 | * the surface is maximized |
| 1303 | * the surface is maximized |
| 1304 | * |
| 1305 | * The surface is maximized. The window geometry specified in the |
| 1306 | * configure event must be obeyed by the client, or the |
| 1307 | * xdg_wm_base.invalid_surface_state error is raised. |
| 1308 | * |
| 1309 | * The client should draw without shadow or other decoration |
| 1310 | * outside of the window geometry. |
| 1311 | */ |
| 1312 | XDG_TOPLEVEL_STATE_MAXIMIZED = 1, |
| 1313 | /** |
| 1314 | * the surface is fullscreen |
| 1315 | * the surface is fullscreen |
| 1316 | * |
| 1317 | * The surface is fullscreen. The window geometry specified in |
| 1318 | * the configure event is a maximum; the client cannot resize |
| 1319 | * beyond it. For a surface to cover the whole fullscreened area, |
| 1320 | * the geometry dimensions must be obeyed by the client. For more |
| 1321 | * details, see xdg_toplevel.set_fullscreen. |
| 1322 | */ |
| 1323 | XDG_TOPLEVEL_STATE_FULLSCREEN = 2, |
| 1324 | /** |
| 1325 | * the surface is being resized |
| 1326 | * the surface is being resized |
| 1327 | * |
| 1328 | * The surface is being resized. The window geometry specified in |
| 1329 | * the configure event is a maximum; the client cannot resize |
| 1330 | * beyond it. Clients that have aspect ratio or cell sizing |
| 1331 | * configuration can use a smaller size, however. |
| 1332 | */ |
| 1333 | XDG_TOPLEVEL_STATE_RESIZING = 3, |
| 1334 | /** |
| 1335 | * the surface is now activated |
| 1336 | * the surface is now activated |
| 1337 | * |
| 1338 | * Client window decorations should be painted as if the window |
| 1339 | * is active. Do not assume this means that the window actually has |
| 1340 | * keyboard or pointer focus. |
| 1341 | */ |
| 1342 | XDG_TOPLEVEL_STATE_ACTIVATED = 4, |
| 1343 | /** |
| 1344 | * the surface’s left edge is tiled |
| 1345 | * |
| 1346 | * The window is currently in a tiled layout and the left edge is |
| 1347 | * considered to be adjacent to another part of the tiling grid. |
| 1348 | * |
| 1349 | * The client should draw without shadow or other decoration |
| 1350 | * outside of the window geometry on the left edge. |
| 1351 | * @since 2 |
| 1352 | */ |
| 1353 | XDG_TOPLEVEL_STATE_TILED_LEFT = 5, |
| 1354 | /** |
| 1355 | * the surface’s right edge is tiled |
| 1356 | * |
| 1357 | * The window is currently in a tiled layout and the right edge |
| 1358 | * is considered to be adjacent to another part of the tiling grid. |
| 1359 | * |
| 1360 | * The client should draw without shadow or other decoration |
| 1361 | * outside of the window geometry on the right edge. |
| 1362 | * @since 2 |
| 1363 | */ |
| 1364 | XDG_TOPLEVEL_STATE_TILED_RIGHT = 6, |
| 1365 | /** |
| 1366 | * the surface’s top edge is tiled |
| 1367 | * |
| 1368 | * The window is currently in a tiled layout and the top edge is |
| 1369 | * considered to be adjacent to another part of the tiling grid. |
| 1370 | * |
| 1371 | * The client should draw without shadow or other decoration |
| 1372 | * outside of the window geometry on the top edge. |
| 1373 | * @since 2 |
| 1374 | */ |
| 1375 | XDG_TOPLEVEL_STATE_TILED_TOP = 7, |
| 1376 | /** |
| 1377 | * the surface’s bottom edge is tiled |
| 1378 | * |
| 1379 | * The window is currently in a tiled layout and the bottom edge |
| 1380 | * is considered to be adjacent to another part of the tiling grid. |
| 1381 | * |
| 1382 | * The client should draw without shadow or other decoration |
| 1383 | * outside of the window geometry on the bottom edge. |
| 1384 | * @since 2 |
| 1385 | */ |
| 1386 | XDG_TOPLEVEL_STATE_TILED_BOTTOM = 8, |
| 1387 | /** |
| 1388 | * surface repaint is suspended |
| 1389 | * |
| 1390 | * The surface is currently not ordinarily being repainted; for |
| 1391 | * example because its content is occluded by another window, or |
| 1392 | * its outputs are switched off due to screen locking. |
| 1393 | * @since 6 |
| 1394 | */ |
| 1395 | XDG_TOPLEVEL_STATE_SUSPENDED = 9, |
| 1396 | /** |
| 1397 | * the surface’s left edge is constrained |
| 1398 | * |
| 1399 | * The left edge of the window is currently constrained, meaning |
| 1400 | * it shouldn't attempt to resize from that edge. It can for |
| 1401 | * example mean it's tiled next to a monitor edge on the |
| 1402 | * constrained side of the window. |
| 1403 | * @since 7 |
| 1404 | */ |
| 1405 | XDG_TOPLEVEL_STATE_CONSTRAINED_LEFT = 10, |
| 1406 | /** |
| 1407 | * the surface’s right edge is constrained |
| 1408 | * |
| 1409 | * The right edge of the window is currently constrained, meaning |
| 1410 | * it shouldn't attempt to resize from that edge. It can for |
| 1411 | * example mean it's tiled next to a monitor edge on the |
| 1412 | * constrained side of the window. |
| 1413 | * @since 7 |
| 1414 | */ |
| 1415 | XDG_TOPLEVEL_STATE_CONSTRAINED_RIGHT = 11, |
| 1416 | /** |
| 1417 | * the surface’s top edge is constrained |
| 1418 | * |
| 1419 | * The top edge of the window is currently constrained, meaning |
| 1420 | * it shouldn't attempt to resize from that edge. It can for |
| 1421 | * example mean it's tiled next to a monitor edge on the |
| 1422 | * constrained side of the window. |
| 1423 | * @since 7 |
| 1424 | */ |
| 1425 | XDG_TOPLEVEL_STATE_CONSTRAINED_TOP = 12, |
| 1426 | /** |
| 1427 | * the surface’s bottom edge is constrained |
| 1428 | * |
| 1429 | * The bottom edge of the window is currently constrained, |
| 1430 | * meaning it shouldn't attempt to resize from that edge. It can |
| 1431 | * for example mean it's tiled next to a monitor edge on the |
| 1432 | * constrained side of the window. |
| 1433 | * @since 7 |
| 1434 | */ |
| 1435 | XDG_TOPLEVEL_STATE_CONSTRAINED_BOTTOM = 13, |
| 1436 | }; |
| 1437 | /** |
| 1438 | * @ingroup iface_xdg_toplevel |
| 1439 | */ |
| 1440 | #define XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION 2 |
| 1441 | /** |
| 1442 | * @ingroup iface_xdg_toplevel |
| 1443 | */ |
| 1444 | #define XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION 2 |
| 1445 | /** |
| 1446 | * @ingroup iface_xdg_toplevel |
| 1447 | */ |
| 1448 | #define XDG_TOPLEVEL_STATE_TILED_TOP_SINCE_VERSION 2 |
| 1449 | /** |
| 1450 | * @ingroup iface_xdg_toplevel |
| 1451 | */ |
| 1452 | #define XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION 2 |
| 1453 | /** |
| 1454 | * @ingroup iface_xdg_toplevel |
| 1455 | */ |
| 1456 | #define XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION 6 |
| 1457 | /** |
| 1458 | * @ingroup iface_xdg_toplevel |
| 1459 | */ |
| 1460 | #define XDG_TOPLEVEL_STATE_CONSTRAINED_LEFT_SINCE_VERSION 7 |
| 1461 | /** |
| 1462 | * @ingroup iface_xdg_toplevel |
| 1463 | */ |
| 1464 | #define XDG_TOPLEVEL_STATE_CONSTRAINED_RIGHT_SINCE_VERSION 7 |
| 1465 | /** |
| 1466 | * @ingroup iface_xdg_toplevel |
| 1467 | */ |
| 1468 | #define XDG_TOPLEVEL_STATE_CONSTRAINED_TOP_SINCE_VERSION 7 |
| 1469 | /** |
| 1470 | * @ingroup iface_xdg_toplevel |
| 1471 | */ |
| 1472 | #define XDG_TOPLEVEL_STATE_CONSTRAINED_BOTTOM_SINCE_VERSION 7 |
| 1473 | #endif /* XDG_TOPLEVEL_STATE_ENUM */ |
| 1474 | |
| 1475 | #ifndef XDG_TOPLEVEL_WM_CAPABILITIES_ENUM |
| 1476 | #define XDG_TOPLEVEL_WM_CAPABILITIES_ENUM |
| 1477 | enum xdg_toplevel_wm_capabilities { |
| 1478 | /** |
| 1479 | * show_window_menu is available |
| 1480 | */ |
| 1481 | XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU = 1, |
| 1482 | /** |
| 1483 | * set_maximized and unset_maximized are available |
| 1484 | */ |
| 1485 | XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE = 2, |
| 1486 | /** |
| 1487 | * set_fullscreen and unset_fullscreen are available |
| 1488 | */ |
| 1489 | XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 3, |
| 1490 | /** |
| 1491 | * set_minimized is available |
| 1492 | */ |
| 1493 | XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE = 4, |
| 1494 | }; |
| 1495 | #endif /* XDG_TOPLEVEL_WM_CAPABILITIES_ENUM */ |
| 1496 | |
| 1497 | /** |
| 1498 | * @ingroup iface_xdg_toplevel |
| 1499 | * @struct xdg_toplevel_listener |
| 1500 | */ |
| 1501 | struct xdg_toplevel_listener { |
| 1502 | /** |
| 1503 | * suggest a surface change |
| 1504 | * |
| 1505 | * This configure event asks the client to resize its toplevel |
| 1506 | * surface or to change its state. The configured state should not |
| 1507 | * be applied immediately. See xdg_surface.configure for details. |
| 1508 | * |
| 1509 | * The width and height arguments specify a hint to the window |
| 1510 | * about how its surface should be resized in window geometry |
| 1511 | * coordinates. See set_window_geometry. |
| 1512 | * |
| 1513 | * If the width or height arguments are zero, it means the client |
| 1514 | * should decide its own window dimension. This may happen when the |
| 1515 | * compositor needs to configure the state of the surface but |
| 1516 | * doesn't have any information about any previous or expected |
| 1517 | * dimension. |
| 1518 | * |
| 1519 | * The states listed in the event specify how the width/height |
| 1520 | * arguments should be interpreted, and possibly how it should be |
| 1521 | * drawn. |
| 1522 | * |
| 1523 | * Clients must send an ack_configure in response to this event. |
| 1524 | * See xdg_surface.configure and xdg_surface.ack_configure for |
| 1525 | * details. |
| 1526 | */ |
| 1527 | void (*configure)(void *data, |
| 1528 | struct xdg_toplevel *xdg_toplevel, |
| 1529 | int32_t width, |
| 1530 | int32_t height, |
| 1531 | struct wl_array *states); |
| 1532 | /** |
| 1533 | * surface wants to be closed |
| 1534 | * |
| 1535 | * The close event is sent by the compositor when the user wants |
| 1536 | * the surface to be closed. This should be equivalent to the user |
| 1537 | * clicking the close button in client-side decorations, if your |
| 1538 | * application has any. |
| 1539 | * |
| 1540 | * This is only a request that the user intends to close the |
| 1541 | * window. The client may choose to ignore this request, or show a |
| 1542 | * dialog to ask the user to save their data, etc. |
| 1543 | */ |
| 1544 | void (*close)(void *data, |
| 1545 | struct xdg_toplevel *xdg_toplevel); |
| 1546 | /** |
| 1547 | * recommended window geometry bounds |
| 1548 | * |
| 1549 | * The configure_bounds event may be sent prior to a |
| 1550 | * xdg_toplevel.configure event to communicate the bounds a window |
| 1551 | * geometry size is recommended to constrain to. |
| 1552 | * |
| 1553 | * The passed width and height are in surface coordinate space. If |
| 1554 | * width and height are 0, it means bounds is unknown and |
| 1555 | * equivalent to as if no configure_bounds event was ever sent for |
| 1556 | * this surface. |
| 1557 | * |
| 1558 | * The bounds can for example correspond to the size of a monitor |
| 1559 | * excluding any panels or other shell components, so that a |
| 1560 | * surface isn't created in a way that it cannot fit. |
| 1561 | * |
| 1562 | * The bounds may change at any point, and in such a case, a new |
| 1563 | * xdg_toplevel.configure_bounds will be sent, followed by |
| 1564 | * xdg_toplevel.configure and xdg_surface.configure. |
| 1565 | * @since 4 |
| 1566 | */ |
| 1567 | void (*configure_bounds)(void *data, |
| 1568 | struct xdg_toplevel *xdg_toplevel, |
| 1569 | int32_t width, |
| 1570 | int32_t height); |
| 1571 | /** |
| 1572 | * compositor capabilities |
| 1573 | * |
| 1574 | * This event advertises the capabilities supported by the |
| 1575 | * compositor. If a capability isn't supported, clients should hide |
| 1576 | * or disable the UI elements that expose this functionality. For |
| 1577 | * instance, if the compositor doesn't advertise support for |
| 1578 | * minimized toplevels, a button triggering the set_minimized |
| 1579 | * request should not be displayed. |
| 1580 | * |
| 1581 | * The compositor will ignore requests it doesn't support. For |
| 1582 | * instance, a compositor which doesn't advertise support for |
| 1583 | * minimized will ignore set_minimized requests. |
| 1584 | * |
| 1585 | * Compositors must send this event once before the first |
| 1586 | * xdg_surface.configure event. When the capabilities change, |
| 1587 | * compositors must send this event again and then send an |
| 1588 | * xdg_surface.configure event. |
| 1589 | * |
| 1590 | * The configured state should not be applied immediately. See |
| 1591 | * xdg_surface.configure for details. |
| 1592 | * |
| 1593 | * The capabilities are sent as an array of 32-bit unsigned |
| 1594 | * integers in native endianness. |
| 1595 | * @param capabilities array of 32-bit capabilities |
| 1596 | * @since 5 |
| 1597 | */ |
| 1598 | void (*wm_capabilities)(void *data, |
| 1599 | struct xdg_toplevel *xdg_toplevel, |
| 1600 | struct wl_array *capabilities); |
| 1601 | }; |
| 1602 | |
| 1603 | /** |
| 1604 | * @ingroup iface_xdg_toplevel |
| 1605 | */ |
| 1606 | static inline int |
| 1607 | xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel, |
| 1608 | const struct xdg_toplevel_listener *listener, void *data) |
| 1609 | { |
| 1610 | return wl_proxy_add_listener((struct wl_proxy *) xdg_toplevel, |
| 1611 | (void (**)(void)) listener, data); |
| 1612 | } |
| 1613 | |
| 1614 | #define XDG_TOPLEVEL_DESTROY 0 |
| 1615 | #define XDG_TOPLEVEL_SET_PARENT 1 |
| 1616 | #define XDG_TOPLEVEL_SET_TITLE 2 |
| 1617 | #define XDG_TOPLEVEL_SET_APP_ID 3 |
| 1618 | #define XDG_TOPLEVEL_SHOW_WINDOW_MENU 4 |
| 1619 | #define XDG_TOPLEVEL_MOVE 5 |
| 1620 | #define XDG_TOPLEVEL_RESIZE 6 |
| 1621 | #define XDG_TOPLEVEL_SET_MAX_SIZE 7 |
| 1622 | #define XDG_TOPLEVEL_SET_MIN_SIZE 8 |
| 1623 | #define XDG_TOPLEVEL_SET_MAXIMIZED 9 |
| 1624 | #define XDG_TOPLEVEL_UNSET_MAXIMIZED 10 |
| 1625 | #define XDG_TOPLEVEL_SET_FULLSCREEN 11 |
| 1626 | #define XDG_TOPLEVEL_UNSET_FULLSCREEN 12 |
| 1627 | #define XDG_TOPLEVEL_SET_MINIMIZED 13 |
| 1628 | |
| 1629 | /** |
| 1630 | * @ingroup iface_xdg_toplevel |
| 1631 | */ |
| 1632 | #define XDG_TOPLEVEL_CONFIGURE_SINCE_VERSION 1 |
| 1633 | /** |
| 1634 | * @ingroup iface_xdg_toplevel |
| 1635 | */ |
| 1636 | #define XDG_TOPLEVEL_CLOSE_SINCE_VERSION 1 |
| 1637 | /** |
| 1638 | * @ingroup iface_xdg_toplevel |
| 1639 | */ |
| 1640 | #define XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION 4 |
| 1641 | /** |
| 1642 | * @ingroup iface_xdg_toplevel |
| 1643 | */ |
| 1644 | #define XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION 5 |
| 1645 | |
| 1646 | /** |
| 1647 | * @ingroup iface_xdg_toplevel |
| 1648 | */ |
| 1649 | #define XDG_TOPLEVEL_DESTROY_SINCE_VERSION 1 |
| 1650 | /** |
| 1651 | * @ingroup iface_xdg_toplevel |
| 1652 | */ |
| 1653 | #define XDG_TOPLEVEL_SET_PARENT_SINCE_VERSION 1 |
| 1654 | /** |
| 1655 | * @ingroup iface_xdg_toplevel |
| 1656 | */ |
| 1657 | #define XDG_TOPLEVEL_SET_TITLE_SINCE_VERSION 1 |
| 1658 | /** |
| 1659 | * @ingroup iface_xdg_toplevel |
| 1660 | */ |
| 1661 | #define XDG_TOPLEVEL_SET_APP_ID_SINCE_VERSION 1 |
| 1662 | /** |
| 1663 | * @ingroup iface_xdg_toplevel |
| 1664 | */ |
| 1665 | #define XDG_TOPLEVEL_SHOW_WINDOW_MENU_SINCE_VERSION 1 |
| 1666 | /** |
| 1667 | * @ingroup iface_xdg_toplevel |
| 1668 | */ |
| 1669 | #define XDG_TOPLEVEL_MOVE_SINCE_VERSION 1 |
| 1670 | /** |
| 1671 | * @ingroup iface_xdg_toplevel |
| 1672 | */ |
| 1673 | #define XDG_TOPLEVEL_RESIZE_SINCE_VERSION 1 |
| 1674 | /** |
| 1675 | * @ingroup iface_xdg_toplevel |
| 1676 | */ |
| 1677 | #define XDG_TOPLEVEL_SET_MAX_SIZE_SINCE_VERSION 1 |
| 1678 | /** |
| 1679 | * @ingroup iface_xdg_toplevel |
| 1680 | */ |
| 1681 | #define XDG_TOPLEVEL_SET_MIN_SIZE_SINCE_VERSION 1 |
| 1682 | /** |
| 1683 | * @ingroup iface_xdg_toplevel |
| 1684 | */ |
| 1685 | #define XDG_TOPLEVEL_SET_MAXIMIZED_SINCE_VERSION 1 |
| 1686 | /** |
| 1687 | * @ingroup iface_xdg_toplevel |
| 1688 | */ |
| 1689 | #define XDG_TOPLEVEL_UNSET_MAXIMIZED_SINCE_VERSION 1 |
| 1690 | /** |
| 1691 | * @ingroup iface_xdg_toplevel |
| 1692 | */ |
| 1693 | #define XDG_TOPLEVEL_SET_FULLSCREEN_SINCE_VERSION 1 |
| 1694 | /** |
| 1695 | * @ingroup iface_xdg_toplevel |
| 1696 | */ |
| 1697 | #define XDG_TOPLEVEL_UNSET_FULLSCREEN_SINCE_VERSION 1 |
| 1698 | /** |
| 1699 | * @ingroup iface_xdg_toplevel |
| 1700 | */ |
| 1701 | #define XDG_TOPLEVEL_SET_MINIMIZED_SINCE_VERSION 1 |
| 1702 | |
| 1703 | /** @ingroup iface_xdg_toplevel */ |
| 1704 | static inline void |
| 1705 | xdg_toplevel_set_user_data(struct xdg_toplevel *xdg_toplevel, void *user_data) |
| 1706 | { |
| 1707 | wl_proxy_set_user_data((struct wl_proxy *) xdg_toplevel, user_data); |
| 1708 | } |
| 1709 | |
| 1710 | /** @ingroup iface_xdg_toplevel */ |
| 1711 | static inline void * |
| 1712 | xdg_toplevel_get_user_data(struct xdg_toplevel *xdg_toplevel) |
| 1713 | { |
| 1714 | return wl_proxy_get_user_data((struct wl_proxy *) xdg_toplevel); |
| 1715 | } |
| 1716 | |
| 1717 | static inline uint32_t |
| 1718 | xdg_toplevel_get_version(struct xdg_toplevel *xdg_toplevel) |
| 1719 | { |
| 1720 | return wl_proxy_get_version((struct wl_proxy *) xdg_toplevel); |
| 1721 | } |
| 1722 | |
| 1723 | /** |
| 1724 | * @ingroup iface_xdg_toplevel |
| 1725 | * |
| 1726 | * This request destroys the role surface and unmaps the surface; |
| 1727 | * see "Unmapping" behavior in interface section for details. |
| 1728 | */ |
| 1729 | static inline void |
| 1730 | xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel) |
| 1731 | { |
| 1732 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1733 | XDG_TOPLEVEL_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), WL_MARSHAL_FLAG_DESTROY); |
| 1734 | } |
| 1735 | |
| 1736 | /** |
| 1737 | * @ingroup iface_xdg_toplevel |
| 1738 | * |
| 1739 | * Set the "parent" of this surface. This surface should be stacked |
| 1740 | * above the parent surface and all other ancestor surfaces. |
| 1741 | * |
| 1742 | * Parent surfaces should be set on dialogs, toolboxes, or other |
| 1743 | * "auxiliary" surfaces, so that the parent is raised when the dialog |
| 1744 | * is raised. |
| 1745 | * |
| 1746 | * Setting a null parent for a child surface unsets its parent. Setting |
| 1747 | * a null parent for a surface which currently has no parent is a no-op. |
| 1748 | * |
| 1749 | * Only mapped surfaces can have child surfaces. Setting a parent which |
| 1750 | * is not mapped is equivalent to setting a null parent. If a surface |
| 1751 | * becomes unmapped, its children's parent is set to the parent of |
| 1752 | * the now-unmapped surface. If the now-unmapped surface has no parent, |
| 1753 | * its children's parent is unset. If the now-unmapped surface becomes |
| 1754 | * mapped again, its parent-child relationship is not restored. |
| 1755 | * |
| 1756 | * The parent toplevel must not be one of the child toplevel's |
| 1757 | * descendants, and the parent must be different from the child toplevel, |
| 1758 | * otherwise the invalid_parent protocol error is raised. |
| 1759 | */ |
| 1760 | static inline void |
| 1761 | xdg_toplevel_set_parent(struct xdg_toplevel *xdg_toplevel, struct xdg_toplevel *parent) |
| 1762 | { |
| 1763 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1764 | XDG_TOPLEVEL_SET_PARENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, parent); |
| 1765 | } |
| 1766 | |
| 1767 | /** |
| 1768 | * @ingroup iface_xdg_toplevel |
| 1769 | * |
| 1770 | * Set a short title for the surface. |
| 1771 | * |
| 1772 | * This string may be used to identify the surface in a task bar, |
| 1773 | * window list, or other user interface elements provided by the |
| 1774 | * compositor. |
| 1775 | * |
| 1776 | * The string must be encoded in UTF-8. |
| 1777 | */ |
| 1778 | static inline void |
| 1779 | xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title) |
| 1780 | { |
| 1781 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1782 | XDG_TOPLEVEL_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, title); |
| 1783 | } |
| 1784 | |
| 1785 | /** |
| 1786 | * @ingroup iface_xdg_toplevel |
| 1787 | * |
| 1788 | * Set an application identifier for the surface. |
| 1789 | * |
| 1790 | * The app ID identifies the general class of applications to which |
| 1791 | * the surface belongs. The compositor can use this to group multiple |
| 1792 | * surfaces together, or to determine how to launch a new application. |
| 1793 | * |
| 1794 | * For D-Bus activatable applications, the app ID is used as the D-Bus |
| 1795 | * service name. |
| 1796 | * |
| 1797 | * The compositor shell will try to group application surfaces together |
| 1798 | * by their app ID. As a best practice, it is suggested to select app |
| 1799 | * ID's that match the basename of the application's .desktop file. |
| 1800 | * For example, "org.freedesktop.FooViewer" where the .desktop file is |
| 1801 | * "org.freedesktop.FooViewer.desktop". |
| 1802 | * |
| 1803 | * Like other properties, a set_app_id request can be sent after the |
| 1804 | * xdg_toplevel has been mapped to update the property. |
| 1805 | * |
| 1806 | * See the desktop-entry specification [0] for more details on |
| 1807 | * application identifiers and how they relate to well-known D-Bus |
| 1808 | * names and .desktop files. |
| 1809 | * |
| 1810 | * [0] https://standards.freedesktop.org/desktop-entry-spec/ |
| 1811 | */ |
| 1812 | static inline void |
| 1813 | xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id) |
| 1814 | { |
| 1815 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1816 | XDG_TOPLEVEL_SET_APP_ID, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, app_id); |
| 1817 | } |
| 1818 | |
| 1819 | /** |
| 1820 | * @ingroup iface_xdg_toplevel |
| 1821 | * |
| 1822 | * Clients implementing client-side decorations might want to show |
| 1823 | * a context menu when right-clicking on the decorations, giving the |
| 1824 | * user a menu that they can use to maximize or minimize the window. |
| 1825 | * |
| 1826 | * This request asks the compositor to pop up such a window menu at |
| 1827 | * the given position, relative to the local surface coordinates of |
| 1828 | * the parent surface. There are no guarantees as to what menu items |
| 1829 | * the window menu contains, or even if a window menu will be drawn |
| 1830 | * at all. |
| 1831 | * |
| 1832 | * This request must be used in response to some sort of user action |
| 1833 | * like a button press, key press, or touch down event. |
| 1834 | */ |
| 1835 | static inline void |
| 1836 | xdg_toplevel_show_window_menu(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y) |
| 1837 | { |
| 1838 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1839 | XDG_TOPLEVEL_SHOW_WINDOW_MENU, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, x, y); |
| 1840 | } |
| 1841 | |
| 1842 | /** |
| 1843 | * @ingroup iface_xdg_toplevel |
| 1844 | * |
| 1845 | * Start an interactive, user-driven move of the surface. |
| 1846 | * |
| 1847 | * This request must be used in response to some sort of user action |
| 1848 | * like a button press, key press, or touch down event. The passed |
| 1849 | * serial is used to determine the type of interactive move (touch, |
| 1850 | * pointer, etc). |
| 1851 | * |
| 1852 | * The server may ignore move requests depending on the state of |
| 1853 | * the surface (e.g. fullscreen or maximized), or if the passed serial |
| 1854 | * is no longer valid. |
| 1855 | * |
| 1856 | * If triggered, the surface will lose the focus of the device |
| 1857 | * (wl_pointer, wl_touch, etc) used for the move. It is up to the |
| 1858 | * compositor to visually indicate that the move is taking place, such as |
| 1859 | * updating a pointer cursor, during the move. There is no guarantee |
| 1860 | * that the device focus will return when the move is completed. |
| 1861 | */ |
| 1862 | static inline void |
| 1863 | xdg_toplevel_move(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial) |
| 1864 | { |
| 1865 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1866 | XDG_TOPLEVEL_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial); |
| 1867 | } |
| 1868 | |
| 1869 | /** |
| 1870 | * @ingroup iface_xdg_toplevel |
| 1871 | * |
| 1872 | * Start a user-driven, interactive resize of the surface. |
| 1873 | * |
| 1874 | * This request must be used in response to some sort of user action |
| 1875 | * like a button press, key press, or touch down event. The passed |
| 1876 | * serial is used to determine the type of interactive resize (touch, |
| 1877 | * pointer, etc). |
| 1878 | * |
| 1879 | * The server may ignore resize requests depending on the state of |
| 1880 | * the surface (e.g. fullscreen or maximized). |
| 1881 | * |
| 1882 | * If triggered, the client will receive configure events with the |
| 1883 | * "resize" state enum value and the expected sizes. See the "resize" |
| 1884 | * enum value for more details about what is required. The client |
| 1885 | * must also acknowledge configure events using "ack_configure". After |
| 1886 | * the resize is completed, the client will receive another "configure" |
| 1887 | * event without the resize state. |
| 1888 | * |
| 1889 | * If triggered, the surface also will lose the focus of the device |
| 1890 | * (wl_pointer, wl_touch, etc) used for the resize. It is up to the |
| 1891 | * compositor to visually indicate that the resize is taking place, |
| 1892 | * such as updating a pointer cursor, during the resize. There is no |
| 1893 | * guarantee that the device focus will return when the resize is |
| 1894 | * completed. |
| 1895 | * |
| 1896 | * The edges parameter specifies how the surface should be resized, and |
| 1897 | * is one of the values of the resize_edge enum. Values not matching |
| 1898 | * a variant of the enum will cause the invalid_resize_edge protocol error. |
| 1899 | * The compositor may use this information to update the surface position |
| 1900 | * for example when dragging the top left corner. The compositor may also |
| 1901 | * use this information to adapt its behavior, e.g. choose an appropriate |
| 1902 | * cursor image. |
| 1903 | */ |
| 1904 | static inline void |
| 1905 | xdg_toplevel_resize(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, uint32_t edges) |
| 1906 | { |
| 1907 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1908 | XDG_TOPLEVEL_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, edges); |
| 1909 | } |
| 1910 | |
| 1911 | /** |
| 1912 | * @ingroup iface_xdg_toplevel |
| 1913 | * |
| 1914 | * Set a maximum size for the window. |
| 1915 | * |
| 1916 | * The client can specify a maximum size so that the compositor does |
| 1917 | * not try to configure the window beyond this size. |
| 1918 | * |
| 1919 | * The width and height arguments are in window geometry coordinates. |
| 1920 | * See xdg_surface.set_window_geometry. |
| 1921 | * |
| 1922 | * Values set in this way are double-buffered, see wl_surface.commit. |
| 1923 | * |
| 1924 | * The compositor can use this information to allow or disallow |
| 1925 | * different states like maximize or fullscreen and draw accurate |
| 1926 | * animations. |
| 1927 | * |
| 1928 | * Similarly, a tiling window manager may use this information to |
| 1929 | * place and resize client windows in a more effective way. |
| 1930 | * |
| 1931 | * The client should not rely on the compositor to obey the maximum |
| 1932 | * size. The compositor may decide to ignore the values set by the |
| 1933 | * client and request a larger size. |
| 1934 | * |
| 1935 | * If never set, or a value of zero in the request, means that the |
| 1936 | * client has no expected maximum size in the given dimension. |
| 1937 | * As a result, a client wishing to reset the maximum size |
| 1938 | * to an unspecified state can use zero for width and height in the |
| 1939 | * request. |
| 1940 | * |
| 1941 | * Requesting a maximum size to be smaller than the minimum size of |
| 1942 | * a surface is illegal and will result in an invalid_size error. |
| 1943 | * |
| 1944 | * The width and height must be greater than or equal to zero. Using |
| 1945 | * strictly negative values for width or height will result in a |
| 1946 | * invalid_size error. |
| 1947 | */ |
| 1948 | static inline void |
| 1949 | xdg_toplevel_set_max_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height) |
| 1950 | { |
| 1951 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1952 | XDG_TOPLEVEL_SET_MAX_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height); |
| 1953 | } |
| 1954 | |
| 1955 | /** |
| 1956 | * @ingroup iface_xdg_toplevel |
| 1957 | * |
| 1958 | * Set a minimum size for the window. |
| 1959 | * |
| 1960 | * The client can specify a minimum size so that the compositor does |
| 1961 | * not try to configure the window below this size. |
| 1962 | * |
| 1963 | * The width and height arguments are in window geometry coordinates. |
| 1964 | * See xdg_surface.set_window_geometry. |
| 1965 | * |
| 1966 | * Values set in this way are double-buffered, see wl_surface.commit. |
| 1967 | * |
| 1968 | * The compositor can use this information to allow or disallow |
| 1969 | * different states like maximize or fullscreen and draw accurate |
| 1970 | * animations. |
| 1971 | * |
| 1972 | * Similarly, a tiling window manager may use this information to |
| 1973 | * place and resize client windows in a more effective way. |
| 1974 | * |
| 1975 | * The client should not rely on the compositor to obey the minimum |
| 1976 | * size. The compositor may decide to ignore the values set by the |
| 1977 | * client and request a smaller size. |
| 1978 | * |
| 1979 | * If never set, or a value of zero in the request, means that the |
| 1980 | * client has no expected minimum size in the given dimension. |
| 1981 | * As a result, a client wishing to reset the minimum size |
| 1982 | * to an unspecified state can use zero for width and height in the |
| 1983 | * request. |
| 1984 | * |
| 1985 | * Requesting a minimum size to be larger than the maximum size of |
| 1986 | * a surface is illegal and will result in an invalid_size error. |
| 1987 | * |
| 1988 | * The width and height must be greater than or equal to zero. Using |
| 1989 | * strictly negative values for width and height will result in a |
| 1990 | * invalid_size error. |
| 1991 | */ |
| 1992 | static inline void |
| 1993 | xdg_toplevel_set_min_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height) |
| 1994 | { |
| 1995 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 1996 | XDG_TOPLEVEL_SET_MIN_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height); |
| 1997 | } |
| 1998 | |
| 1999 | /** |
| 2000 | * @ingroup iface_xdg_toplevel |
| 2001 | * |
| 2002 | * Maximize the surface. |
| 2003 | * |
| 2004 | * After requesting that the surface should be maximized, the compositor |
| 2005 | * will respond by emitting a configure event. Whether this configure |
| 2006 | * actually sets the window maximized is subject to compositor policies. |
| 2007 | * The client must then update its content, drawing in the configured |
| 2008 | * state. The client must also acknowledge the configure when committing |
| 2009 | * the new content (see ack_configure). |
| 2010 | * |
| 2011 | * It is up to the compositor to decide how and where to maximize the |
| 2012 | * surface, for example which output and what region of the screen should |
| 2013 | * be used. |
| 2014 | * |
| 2015 | * If the surface was already maximized, the compositor will still emit |
| 2016 | * a configure event with the "maximized" state. |
| 2017 | * |
| 2018 | * If the surface is in a fullscreen state, this request has no direct |
| 2019 | * effect. It may alter the state the surface is returned to when |
| 2020 | * unmaximized unless overridden by the compositor. |
| 2021 | */ |
| 2022 | static inline void |
| 2023 | xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel) |
| 2024 | { |
| 2025 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 2026 | XDG_TOPLEVEL_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0); |
| 2027 | } |
| 2028 | |
| 2029 | /** |
| 2030 | * @ingroup iface_xdg_toplevel |
| 2031 | * |
| 2032 | * Unmaximize the surface. |
| 2033 | * |
| 2034 | * After requesting that the surface should be unmaximized, the compositor |
| 2035 | * will respond by emitting a configure event. Whether this actually |
| 2036 | * un-maximizes the window is subject to compositor policies. |
| 2037 | * If available and applicable, the compositor will include the window |
| 2038 | * geometry dimensions the window had prior to being maximized in the |
| 2039 | * configure event. The client must then update its content, drawing it in |
| 2040 | * the configured state. The client must also acknowledge the configure |
| 2041 | * when committing the new content (see ack_configure). |
| 2042 | * |
| 2043 | * It is up to the compositor to position the surface after it was |
| 2044 | * unmaximized; usually the position the surface had before maximizing, if |
| 2045 | * applicable. |
| 2046 | * |
| 2047 | * If the surface was already not maximized, the compositor will still |
| 2048 | * emit a configure event without the "maximized" state. |
| 2049 | * |
| 2050 | * If the surface is in a fullscreen state, this request has no direct |
| 2051 | * effect. It may alter the state the surface is returned to when |
| 2052 | * unmaximized unless overridden by the compositor. |
| 2053 | */ |
| 2054 | static inline void |
| 2055 | xdg_toplevel_unset_maximized(struct xdg_toplevel *xdg_toplevel) |
| 2056 | { |
| 2057 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 2058 | XDG_TOPLEVEL_UNSET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0); |
| 2059 | } |
| 2060 | |
| 2061 | /** |
| 2062 | * @ingroup iface_xdg_toplevel |
| 2063 | * |
| 2064 | * Make the surface fullscreen. |
| 2065 | * |
| 2066 | * After requesting that the surface should be fullscreened, the |
| 2067 | * compositor will respond by emitting a configure event. Whether the |
| 2068 | * client is actually put into a fullscreen state is subject to compositor |
| 2069 | * policies. The client must also acknowledge the configure when |
| 2070 | * committing the new content (see ack_configure). |
| 2071 | * |
| 2072 | * The output passed by the request indicates the client's preference as |
| 2073 | * to which display it should be set fullscreen on. If this value is NULL, |
| 2074 | * it's up to the compositor to choose which display will be used to map |
| 2075 | * this surface. |
| 2076 | * |
| 2077 | * If the surface doesn't cover the whole output, the compositor will |
| 2078 | * position the surface in the center of the output and compensate with |
| 2079 | * with border fill covering the rest of the output. The content of the |
| 2080 | * border fill is undefined, but should be assumed to be in some way that |
| 2081 | * attempts to blend into the surrounding area (e.g. solid black). |
| 2082 | * |
| 2083 | * If the fullscreened surface is not opaque, the compositor must make |
| 2084 | * sure that other screen content not part of the same surface tree (made |
| 2085 | * up of subsurfaces, popups or similarly coupled surfaces) are not |
| 2086 | * visible below the fullscreened surface. |
| 2087 | */ |
| 2088 | static inline void |
| 2089 | xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output) |
| 2090 | { |
| 2091 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 2092 | XDG_TOPLEVEL_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, output); |
| 2093 | } |
| 2094 | |
| 2095 | /** |
| 2096 | * @ingroup iface_xdg_toplevel |
| 2097 | * |
| 2098 | * Make the surface no longer fullscreen. |
| 2099 | * |
| 2100 | * After requesting that the surface should be unfullscreened, the |
| 2101 | * compositor will respond by emitting a configure event. |
| 2102 | * Whether this actually removes the fullscreen state of the client is |
| 2103 | * subject to compositor policies. |
| 2104 | * |
| 2105 | * Making a surface unfullscreen sets states for the surface based on the following: |
| 2106 | * * the state(s) it may have had before becoming fullscreen |
| 2107 | * * any state(s) decided by the compositor |
| 2108 | * * any state(s) requested by the client while the surface was fullscreen |
| 2109 | * |
| 2110 | * The compositor may include the previous window geometry dimensions in |
| 2111 | * the configure event, if applicable. |
| 2112 | * |
| 2113 | * The client must also acknowledge the configure when committing the new |
| 2114 | * content (see ack_configure). |
| 2115 | */ |
| 2116 | static inline void |
| 2117 | xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel) |
| 2118 | { |
| 2119 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 2120 | XDG_TOPLEVEL_UNSET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0); |
| 2121 | } |
| 2122 | |
| 2123 | /** |
| 2124 | * @ingroup iface_xdg_toplevel |
| 2125 | * |
| 2126 | * Request that the compositor minimize your surface. There is no |
| 2127 | * way to know if the surface is currently minimized, nor is there |
| 2128 | * any way to unset minimization on this surface. |
| 2129 | * |
| 2130 | * If you are looking to throttle redrawing when minimized, please |
| 2131 | * instead use the wl_surface.frame event for this, as this will |
| 2132 | * also work with live previews on windows in Alt-Tab, Expose or |
| 2133 | * similar compositor features. |
| 2134 | */ |
| 2135 | static inline void |
| 2136 | xdg_toplevel_set_minimized(struct xdg_toplevel *xdg_toplevel) |
| 2137 | { |
| 2138 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel, |
| 2139 | XDG_TOPLEVEL_SET_MINIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0); |
| 2140 | } |
| 2141 | |
| 2142 | #ifndef XDG_POPUP_ERROR_ENUM |
| 2143 | #define XDG_POPUP_ERROR_ENUM |
| 2144 | enum xdg_popup_error { |
| 2145 | /** |
| 2146 | * tried to grab after being mapped |
| 2147 | */ |
| 2148 | XDG_POPUP_ERROR_INVALID_GRAB = 0, |
| 2149 | }; |
| 2150 | #endif /* XDG_POPUP_ERROR_ENUM */ |
| 2151 | |
| 2152 | /** |
| 2153 | * @ingroup iface_xdg_popup |
| 2154 | * @struct xdg_popup_listener |
| 2155 | */ |
| 2156 | struct xdg_popup_listener { |
| 2157 | /** |
| 2158 | * configure the popup surface |
| 2159 | * |
| 2160 | * This event asks the popup surface to configure itself given |
| 2161 | * the configuration. The configured state should not be applied |
| 2162 | * immediately. See xdg_surface.configure for details. |
| 2163 | * |
| 2164 | * The x and y arguments represent the position the popup was |
| 2165 | * placed at given the xdg_positioner rule, relative to the upper |
| 2166 | * left corner of the window geometry of the parent surface. |
| 2167 | * |
| 2168 | * For version 2 or older, the configure event for an xdg_popup is |
| 2169 | * only ever sent once for the initial configuration. Starting with |
| 2170 | * version 3, it may be sent again if the popup is setup with an |
| 2171 | * xdg_positioner with set_reactive requested, or in response to |
| 2172 | * xdg_popup.reposition requests. |
| 2173 | * @param x x position relative to parent surface window geometry |
| 2174 | * @param y y position relative to parent surface window geometry |
| 2175 | * @param width window geometry width |
| 2176 | * @param height window geometry height |
| 2177 | */ |
| 2178 | void (*configure)(void *data, |
| 2179 | struct xdg_popup *xdg_popup, |
| 2180 | int32_t x, |
| 2181 | int32_t y, |
| 2182 | int32_t width, |
| 2183 | int32_t height); |
| 2184 | /** |
| 2185 | * popup interaction is done |
| 2186 | * |
| 2187 | * The popup_done event is sent out when a popup is dismissed by |
| 2188 | * the compositor. The client should destroy the xdg_popup object |
| 2189 | * at this point. |
| 2190 | */ |
| 2191 | void (*popup_done)(void *data, |
| 2192 | struct xdg_popup *xdg_popup); |
| 2193 | /** |
| 2194 | * signal the completion of a repositioned request |
| 2195 | * |
| 2196 | * The repositioned event is sent as part of a popup |
| 2197 | * configuration sequence, together with xdg_popup.configure and |
| 2198 | * lastly xdg_surface.configure to notify the completion of a |
| 2199 | * reposition request. |
| 2200 | * |
| 2201 | * The repositioned event is to notify about the completion of a |
| 2202 | * xdg_popup.reposition request. The token argument is the token |
| 2203 | * passed in the xdg_popup.reposition request. |
| 2204 | * |
| 2205 | * Immediately after this event is emitted, xdg_popup.configure and |
| 2206 | * xdg_surface.configure will be sent with the updated size and |
| 2207 | * position, as well as a new configure serial. |
| 2208 | * |
| 2209 | * The client should optionally update the content of the popup, |
| 2210 | * but must acknowledge the new popup configuration for the new |
| 2211 | * position to take effect. See xdg_surface.ack_configure for |
| 2212 | * details. |
| 2213 | * @param token reposition request token |
| 2214 | * @since 3 |
| 2215 | */ |
| 2216 | void (*repositioned)(void *data, |
| 2217 | struct xdg_popup *xdg_popup, |
| 2218 | uint32_t token); |
| 2219 | }; |
| 2220 | |
| 2221 | /** |
| 2222 | * @ingroup iface_xdg_popup |
| 2223 | */ |
| 2224 | static inline int |
| 2225 | xdg_popup_add_listener(struct xdg_popup *xdg_popup, |
| 2226 | const struct xdg_popup_listener *listener, void *data) |
| 2227 | { |
| 2228 | return wl_proxy_add_listener((struct wl_proxy *) xdg_popup, |
| 2229 | (void (**)(void)) listener, data); |
| 2230 | } |
| 2231 | |
| 2232 | #define XDG_POPUP_DESTROY 0 |
| 2233 | #define XDG_POPUP_GRAB 1 |
| 2234 | #define XDG_POPUP_REPOSITION 2 |
| 2235 | |
| 2236 | /** |
| 2237 | * @ingroup iface_xdg_popup |
| 2238 | */ |
| 2239 | #define XDG_POPUP_CONFIGURE_SINCE_VERSION 1 |
| 2240 | /** |
| 2241 | * @ingroup iface_xdg_popup |
| 2242 | */ |
| 2243 | #define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1 |
| 2244 | /** |
| 2245 | * @ingroup iface_xdg_popup |
| 2246 | */ |
| 2247 | #define XDG_POPUP_REPOSITIONED_SINCE_VERSION 3 |
| 2248 | |
| 2249 | /** |
| 2250 | * @ingroup iface_xdg_popup |
| 2251 | */ |
| 2252 | #define XDG_POPUP_DESTROY_SINCE_VERSION 1 |
| 2253 | /** |
| 2254 | * @ingroup iface_xdg_popup |
| 2255 | */ |
| 2256 | #define XDG_POPUP_GRAB_SINCE_VERSION 1 |
| 2257 | /** |
| 2258 | * @ingroup iface_xdg_popup |
| 2259 | */ |
| 2260 | #define XDG_POPUP_REPOSITION_SINCE_VERSION 3 |
| 2261 | |
| 2262 | /** @ingroup iface_xdg_popup */ |
| 2263 | static inline void |
| 2264 | xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data) |
| 2265 | { |
| 2266 | wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data); |
| 2267 | } |
| 2268 | |
| 2269 | /** @ingroup iface_xdg_popup */ |
| 2270 | static inline void * |
| 2271 | xdg_popup_get_user_data(struct xdg_popup *xdg_popup) |
| 2272 | { |
| 2273 | return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup); |
| 2274 | } |
| 2275 | |
| 2276 | static inline uint32_t |
| 2277 | xdg_popup_get_version(struct xdg_popup *xdg_popup) |
| 2278 | { |
| 2279 | return wl_proxy_get_version((struct wl_proxy *) xdg_popup); |
| 2280 | } |
| 2281 | |
| 2282 | /** |
| 2283 | * @ingroup iface_xdg_popup |
| 2284 | * |
| 2285 | * This destroys the popup. Explicitly destroying the xdg_popup |
| 2286 | * object will also dismiss the popup, and unmap the surface. |
| 2287 | * |
| 2288 | * If this xdg_popup is not the "topmost" popup, the |
| 2289 | * xdg_wm_base.not_the_topmost_popup protocol error will be sent. |
| 2290 | */ |
| 2291 | static inline void |
| 2292 | xdg_popup_destroy(struct xdg_popup *xdg_popup) |
| 2293 | { |
| 2294 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup, |
| 2295 | XDG_POPUP_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), WL_MARSHAL_FLAG_DESTROY); |
| 2296 | } |
| 2297 | |
| 2298 | /** |
| 2299 | * @ingroup iface_xdg_popup |
| 2300 | * |
| 2301 | * This request makes the created popup take an explicit grab. An explicit |
| 2302 | * grab will be dismissed when the user dismisses the popup, or when the |
| 2303 | * client destroys the xdg_popup. This can be done by the user clicking |
| 2304 | * outside the surface, using the keyboard, or even locking the screen |
| 2305 | * through closing the lid or a timeout. |
| 2306 | * |
| 2307 | * If the compositor denies the grab, the popup will be immediately |
| 2308 | * dismissed. |
| 2309 | * |
| 2310 | * This request must be used in response to some sort of user action like a |
| 2311 | * button press, key press, or touch down event. The serial number of the |
| 2312 | * event should be passed as 'serial'. |
| 2313 | * |
| 2314 | * The parent of a grabbing popup must either be an xdg_toplevel surface or |
| 2315 | * another xdg_popup with an explicit grab. If the parent is another |
| 2316 | * xdg_popup it means that the popups are nested, with this popup now being |
| 2317 | * the topmost popup. |
| 2318 | * |
| 2319 | * Nested popups must be destroyed in the reverse order they were created |
| 2320 | * in, e.g. the only popup you are allowed to destroy at all times is the |
| 2321 | * topmost one. |
| 2322 | * |
| 2323 | * When compositors choose to dismiss a popup, they may dismiss every |
| 2324 | * nested grabbing popup as well. When a compositor dismisses popups, it |
| 2325 | * will follow the same dismissing order as required from the client. |
| 2326 | * |
| 2327 | * If the topmost grabbing popup is destroyed, the grab will be returned to |
| 2328 | * the parent of the popup, if that parent previously had an explicit grab. |
| 2329 | * |
| 2330 | * If the parent is a grabbing popup which has already been dismissed, this |
| 2331 | * popup will be immediately dismissed. If the parent is a popup that did |
| 2332 | * not take an explicit grab, an error will be raised. |
| 2333 | * |
| 2334 | * During a popup grab, the client owning the grab will receive pointer |
| 2335 | * and touch events for all their surfaces as normal (similar to an |
| 2336 | * "owner-events" grab in X11 parlance), while the top most grabbing popup |
| 2337 | * will always have keyboard focus. |
| 2338 | */ |
| 2339 | static inline void |
| 2340 | xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t serial) |
| 2341 | { |
| 2342 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup, |
| 2343 | XDG_POPUP_GRAB, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, seat, serial); |
| 2344 | } |
| 2345 | |
| 2346 | /** |
| 2347 | * @ingroup iface_xdg_popup |
| 2348 | * |
| 2349 | * Reposition an already-mapped popup. The popup will be placed given the |
| 2350 | * details in the passed xdg_positioner object, and a |
| 2351 | * xdg_popup.repositioned followed by xdg_popup.configure and |
| 2352 | * xdg_surface.configure will be emitted in response. Any parameters set |
| 2353 | * by the previous positioner will be discarded. |
| 2354 | * |
| 2355 | * The passed token will be sent in the corresponding |
| 2356 | * xdg_popup.repositioned event. The new popup position will not take |
| 2357 | * effect until the corresponding configure event is acknowledged by the |
| 2358 | * client. See xdg_popup.repositioned for details. The token itself is |
| 2359 | * opaque, and has no other special meaning. |
| 2360 | * |
| 2361 | * If multiple reposition requests are sent, the compositor may skip all |
| 2362 | * but the last one. |
| 2363 | * |
| 2364 | * If the popup is repositioned in response to a configure event for its |
| 2365 | * parent, the client should send an xdg_positioner.set_parent_configure |
| 2366 | * and possibly an xdg_positioner.set_parent_size request to allow the |
| 2367 | * compositor to properly constrain the popup. |
| 2368 | * |
| 2369 | * If the popup is repositioned together with a parent that is being |
| 2370 | * resized, but not in response to a configure event, the client should |
| 2371 | * send an xdg_positioner.set_parent_size request. |
| 2372 | */ |
| 2373 | static inline void |
| 2374 | xdg_popup_reposition(struct xdg_popup *xdg_popup, struct xdg_positioner *positioner, uint32_t token) |
| 2375 | { |
| 2376 | wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup, |
| 2377 | XDG_POPUP_REPOSITION, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, positioner, token); |
| 2378 | } |
| 2379 | |
| 2380 | #ifdef __cplusplus |
| 2381 | } |
| 2382 | #endif |
| 2383 | |
| 2384 | #endif |
| 2385 | |