AtlatestRepositorysigil-ui
1
/* Generated by wayland-scanner 1.24.0 */3
#ifndef XDG_SHELL_CLIENT_PROTOCOL_H4
#define XDG_SHELL_CLIENT_PROTOCOL_H6
#include <stdint.h>7
#include <stddef.h>8
#include "wayland-client.h"10
#ifdef __cplusplus11
extern "C" {12
#endif14
/**15
* @page page_xdg_shell The xdg_shell protocol16
* @section page_ifaces_xdg_shell Interfaces17
* - @subpage page_iface_xdg_wm_base - create desktop-style surfaces18
* - @subpage page_iface_xdg_positioner - child surface positioner19
* - @subpage page_iface_xdg_surface - desktop user interface surface base interface20
* - @subpage page_iface_xdg_toplevel - toplevel surface21
* - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus22
* @section page_copyright_xdg_shell Copyright23
* <pre>24
*25
* Copyright © 2008-2013 Kristian Høgsberg26
* Copyright © 2013 Rafael Antognolli27
* Copyright © 2013 Jasper St. Pierre28
* Copyright © 2010-2013 Intel Corporation29
* Copyright © 2015-2017 Samsung Electronics Co., Ltd30
* Copyright © 2015-2017 Red Hat Inc.31
*32
* Permission is hereby granted, free of charge, to any person obtaining a33
* copy of this software and associated documentation files (the "Software"),34
* to deal in the Software without restriction, including without limitation35
* the rights to use, copy, modify, merge, publish, distribute, sublicense,36
* and/or sell copies of the Software, and to permit persons to whom the37
* Software is furnished to do so, subject to the following conditions:38
*39
* The above copyright notice and this permission notice (including the next40
* paragraph) shall be included in all copies or substantial portions of the41
* Software.42
*43
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR44
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,45
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL46
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER47
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING48
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER49
* 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;61
#ifndef XDG_WM_BASE_INTERFACE62
#define XDG_WM_BASE_INTERFACE63
/**64
* @page page_iface_xdg_wm_base xdg_wm_base65
* @section page_iface_xdg_wm_base_desc Description66
*67
* The xdg_wm_base interface is exposed as a global object enabling clients68
* to turn their wl_surfaces into windows in a desktop environment. It69
* defines the basic functionality needed for clients and the compositor to70
* create windows that can be dragged, resized, maximized, etc, as well as71
* creating transient windows such as popup menus.72
* @section page_iface_xdg_wm_base_api API73
* See @ref iface_xdg_wm_base.74
*/75
/**76
* @defgroup iface_xdg_wm_base The xdg_wm_base interface77
*78
* The xdg_wm_base interface is exposed as a global object enabling clients79
* to turn their wl_surfaces into windows in a desktop environment. It80
* defines the basic functionality needed for clients and the compositor to81
* create windows that can be dragged, resized, maximized, etc, as well as82
* creating transient windows such as popup menus.83
*/84
extern const struct wl_interface xdg_wm_base_interface;85
#endif86
#ifndef XDG_POSITIONER_INTERFACE87
#define XDG_POSITIONER_INTERFACE88
/**89
* @page page_iface_xdg_positioner xdg_positioner90
* @section page_iface_xdg_positioner_desc Description91
*92
* The xdg_positioner provides a collection of rules for the placement of a93
* child surface relative to a parent surface. Rules can be defined to ensure94
* the child surface remains within the visible area's borders, and to95
* specify how the child surface changes its position, such as sliding along96
* an axis, or flipping around a rectangle. These positioner-created rules are97
* constrained by the requirement that a child surface must intersect with or98
* 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 rules103
* specified by the xdg_positioner. Thus, after the request is complete the104
* xdg_positioner object can be destroyed or reused; further changes to the105
* object will have no effect on previous usages.106
*107
* For an xdg_positioner object to be considered complete, it must have a108
* non-zero size set by set_size, and a non-zero anchor rectangle set by109
* set_anchor_rect. Passing an incomplete xdg_positioner object when110
* positioning a surface raises an invalid_positioner error.111
* @section page_iface_xdg_positioner_api API112
* See @ref iface_xdg_positioner.113
*/114
/**115
* @defgroup iface_xdg_positioner The xdg_positioner interface116
*117
* The xdg_positioner provides a collection of rules for the placement of a118
* child surface relative to a parent surface. Rules can be defined to ensure119
* the child surface remains within the visible area's borders, and to120
* specify how the child surface changes its position, such as sliding along121
* an axis, or flipping around a rectangle. These positioner-created rules are122
* constrained by the requirement that a child surface must intersect with or123
* 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 rules128
* specified by the xdg_positioner. Thus, after the request is complete the129
* xdg_positioner object can be destroyed or reused; further changes to the130
* object will have no effect on previous usages.131
*132
* For an xdg_positioner object to be considered complete, it must have a133
* non-zero size set by set_size, and a non-zero anchor rectangle set by134
* set_anchor_rect. Passing an incomplete xdg_positioner object when135
* positioning a surface raises an invalid_positioner error.136
*/137
extern const struct wl_interface xdg_positioner_interface;138
#endif139
#ifndef XDG_SURFACE_INTERFACE140
#define XDG_SURFACE_INTERFACE141
/**142
* @page page_iface_xdg_surface xdg_surface143
* @section page_iface_xdg_surface_desc Description144
*145
* An interface that may be implemented by a wl_surface, for146
* implementations that provide a desktop-style user interface.147
*148
* It provides a base set of functionality required to construct user149
* interface elements requiring management by the compositor, such as150
* toplevel windows, menus, etc. The types of functionality are split into151
* xdg_surface roles.152
*153
* Creating an xdg_surface does not set the role for a wl_surface. In order154
* to map an xdg_surface, the client must create a role-specific object155
* using, e.g., get_toplevel, get_popup. The wl_surface for any given156
* xdg_surface can have at most one role, and may not be assigned any role157
* not based on xdg_surface.158
*159
* A role must be assigned before any other requests are made to the160
* xdg_surface object.161
*162
* The client must call wl_surface.commit on the corresponding wl_surface163
* for the xdg_surface state to take effect.164
*165
* Creating an xdg_surface from a wl_surface which has a buffer attached or166
* committed is a client error, and any attempts by a client to attach or167
* manipulate a buffer prior to the first xdg_surface.configure call must168
* also be treated as errors.169
*170
* After creating a role-specific object and setting it up (e.g. by sending171
* the title, app ID, size constraints, parent, etc), the client must172
* perform an initial commit without any buffer attached. The compositor173
* will reply with initial wl_surface state such as174
* wl_surface.preferred_buffer_scale followed by an xdg_surface.configure175
* event. The client must acknowledge it and is then allowed to attach a176
* buffer to map the surface.177
*178
* Mapping an xdg_surface-based role surface is defined as making it179
* possible for the surface to be shown by the compositor. Note that180
* 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 following183
* conditions must be met:184
* (1) the client has assigned an xdg_surface-based role to the surface185
* (2) the client has set and committed the xdg_surface state and the186
* role-dependent state to the surface187
* (3) the client has committed a buffer to the surface188
*189
* A newly-unmapped surface is considered to have met condition (1) out190
* of the 3 required conditions for mapping a surface if its role surface191
* has not been destroyed, i.e. the client must perform the initial commit192
* again before attaching a buffer.193
* @section page_iface_xdg_surface_api API194
* See @ref iface_xdg_surface.195
*/196
/**197
* @defgroup iface_xdg_surface The xdg_surface interface198
*199
* An interface that may be implemented by a wl_surface, for200
* implementations that provide a desktop-style user interface.201
*202
* It provides a base set of functionality required to construct user203
* interface elements requiring management by the compositor, such as204
* toplevel windows, menus, etc. The types of functionality are split into205
* xdg_surface roles.206
*207
* Creating an xdg_surface does not set the role for a wl_surface. In order208
* to map an xdg_surface, the client must create a role-specific object209
* using, e.g., get_toplevel, get_popup. The wl_surface for any given210
* xdg_surface can have at most one role, and may not be assigned any role211
* not based on xdg_surface.212
*213
* A role must be assigned before any other requests are made to the214
* xdg_surface object.215
*216
* The client must call wl_surface.commit on the corresponding wl_surface217
* for the xdg_surface state to take effect.218
*219
* Creating an xdg_surface from a wl_surface which has a buffer attached or220
* committed is a client error, and any attempts by a client to attach or221
* manipulate a buffer prior to the first xdg_surface.configure call must222
* also be treated as errors.223
*224
* After creating a role-specific object and setting it up (e.g. by sending225
* the title, app ID, size constraints, parent, etc), the client must226
* perform an initial commit without any buffer attached. The compositor227
* will reply with initial wl_surface state such as228
* wl_surface.preferred_buffer_scale followed by an xdg_surface.configure229
* event. The client must acknowledge it and is then allowed to attach a230
* buffer to map the surface.231
*232
* Mapping an xdg_surface-based role surface is defined as making it233
* possible for the surface to be shown by the compositor. Note that234
* 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 following237
* conditions must be met:238
* (1) the client has assigned an xdg_surface-based role to the surface239
* (2) the client has set and committed the xdg_surface state and the240
* role-dependent state to the surface241
* (3) the client has committed a buffer to the surface242
*243
* A newly-unmapped surface is considered to have met condition (1) out244
* of the 3 required conditions for mapping a surface if its role surface245
* has not been destroyed, i.e. the client must perform the initial commit246
* again before attaching a buffer.247
*/248
extern const struct wl_interface xdg_surface_interface;249
#endif250
#ifndef XDG_TOPLEVEL_INTERFACE251
#define XDG_TOPLEVEL_INTERFACE252
/**253
* @page page_iface_xdg_toplevel xdg_toplevel254
* @section page_iface_xdg_toplevel_desc Description255
*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 and259
* id, and well as trigger user interactive operations such as interactive260
* resize and move.261
*262
* A xdg_toplevel by default is responsible for providing the full intended263
* visual representation of the toplevel, which depending on the window264
* 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 shown267
* by the compositor until it is explicitly mapped again.268
* All active operations (e.g., move, resize) are canceled and all269
* attributes (e.g. title, state, stacking, ...) are discarded for270
* an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to271
* the state it had right after xdg_surface.get_toplevel. The client272
* can re-map the toplevel by performing a commit without any buffer273
* attached, waiting for a configure event and handling it as usual (see274
* xdg_surface description).275
*276
* Attaching a null buffer to a toplevel unmaps the surface.277
* @section page_iface_xdg_toplevel_api API278
* See @ref iface_xdg_toplevel.279
*/280
/**281
* @defgroup iface_xdg_toplevel The xdg_toplevel interface282
*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 and286
* id, and well as trigger user interactive operations such as interactive287
* resize and move.288
*289
* A xdg_toplevel by default is responsible for providing the full intended290
* visual representation of the toplevel, which depending on the window291
* 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 shown294
* by the compositor until it is explicitly mapped again.295
* All active operations (e.g., move, resize) are canceled and all296
* attributes (e.g. title, state, stacking, ...) are discarded for297
* an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to298
* the state it had right after xdg_surface.get_toplevel. The client299
* can re-map the toplevel by performing a commit without any buffer300
* attached, waiting for a configure event and handling it as usual (see301
* 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
#endif307
#ifndef XDG_POPUP_INTERFACE308
#define XDG_POPUP_INTERFACE309
/**310
* @page page_iface_xdg_popup xdg_popup311
* @section page_iface_xdg_popup_desc Description312
*313
* A popup surface is a short-lived, temporary surface. It can be used to314
* implement for example menus, popovers, tooltips and other similar user315
* interface concepts.316
*317
* A popup can be made to take an explicit grab. See xdg_popup.grab for318
* details.319
*320
* When the popup is dismissed, a popup_done event will be sent out, and at321
* the same time the surface will be unmapped. See the xdg_popup.popup_done322
* event for details.323
*324
* Explicitly destroying the xdg_popup object will also dismiss the popup and325
* unmap the surface. Clients that want to dismiss the popup when another326
* surface of their own is clicked should dismiss the popup using the destroy327
* request.328
*329
* A newly created xdg_popup will be stacked on top of all previously created330
* xdg_popup surfaces associated with the same xdg_toplevel.331
*332
* The parent of an xdg_popup must be mapped (see the xdg_surface333
* description) before the xdg_popup itself.334
*335
* The client must call wl_surface.commit on the corresponding wl_surface336
* for the xdg_popup state to take effect.337
* @section page_iface_xdg_popup_api API338
* See @ref iface_xdg_popup.339
*/340
/**341
* @defgroup iface_xdg_popup The xdg_popup interface342
*343
* A popup surface is a short-lived, temporary surface. It can be used to344
* implement for example menus, popovers, tooltips and other similar user345
* interface concepts.346
*347
* A popup can be made to take an explicit grab. See xdg_popup.grab for348
* details.349
*350
* When the popup is dismissed, a popup_done event will be sent out, and at351
* the same time the surface will be unmapped. See the xdg_popup.popup_done352
* event for details.353
*354
* Explicitly destroying the xdg_popup object will also dismiss the popup and355
* unmap the surface. Clients that want to dismiss the popup when another356
* surface of their own is clicked should dismiss the popup using the destroy357
* request.358
*359
* A newly created xdg_popup will be stacked on top of all previously created360
* xdg_popup surfaces associated with the same xdg_toplevel.361
*362
* The parent of an xdg_popup must be mapped (see the xdg_surface363
* description) before the xdg_popup itself.364
*365
* The client must call wl_surface.commit on the corresponding wl_surface366
* for the xdg_popup state to take effect.367
*/368
extern const struct wl_interface xdg_popup_interface;369
#endif371
#ifndef XDG_WM_BASE_ERROR_ENUM372
#define XDG_WM_BASE_ERROR_ENUM373
enum xdg_wm_base_error {374
/**375
* given wl_surface has another role376
*/377
XDG_WM_BASE_ERROR_ROLE = 0,378
/**379
* xdg_wm_base was destroyed before children380
*/381
XDG_WM_BASE_ERROR_DEFUNCT_SURFACES = 1,382
/**383
* the client tried to map or destroy a non-topmost popup384
*/385
XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP = 2,386
/**387
* the client specified an invalid popup parent surface388
*/389
XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT = 3,390
/**391
* the client provided an invalid surface state392
*/393
XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE = 4,394
/**395
* the client provided an invalid positioner396
*/397
XDG_WM_BASE_ERROR_INVALID_POSITIONER = 5,398
/**399
* the client didn’t respond to a ping event in time400
*/401
XDG_WM_BASE_ERROR_UNRESPONSIVE = 6,402
};403
#endif /* XDG_WM_BASE_ERROR_ENUM */405
/**406
* @ingroup iface_xdg_wm_base407
* @struct xdg_wm_base_listener408
*/409
struct xdg_wm_base_listener {410
/**411
* check if the client is alive412
*413
* The ping event asks the client if it's still alive. Pass the414
* serial specified in the event back to the compositor by sending415
* a "pong" request back with the specified serial. See416
* xdg_wm_base.pong.417
*418
* Compositors can use this to determine if the client is still419
* alive. It's unspecified what will happen if the client doesn't420
* respond to the ping request, or in what timeframe. Clients421
* should try to respond in a reasonable amount of time. The422
* “unresponsive” error is provided for compositors that wish423
* to disconnect unresponsive clients.424
*425
* A compositor is free to ping in any way it wants, but a client426
* must always respond to any xdg_wm_base object it created.427
* @param serial pass this to the pong request428
*/429
void (*ping)(void *data,430
struct xdg_wm_base *xdg_wm_base,431
uint32_t serial);432
};434
/**435
* @ingroup iface_xdg_wm_base436
*/437
static inline int438
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
}445
#define XDG_WM_BASE_DESTROY 0446
#define XDG_WM_BASE_CREATE_POSITIONER 1447
#define XDG_WM_BASE_GET_XDG_SURFACE 2448
#define XDG_WM_BASE_PONG 3450
/**451
* @ingroup iface_xdg_wm_base452
*/453
#define XDG_WM_BASE_PING_SINCE_VERSION 1455
/**456
* @ingroup iface_xdg_wm_base457
*/458
#define XDG_WM_BASE_DESTROY_SINCE_VERSION 1459
/**460
* @ingroup iface_xdg_wm_base461
*/462
#define XDG_WM_BASE_CREATE_POSITIONER_SINCE_VERSION 1463
/**464
* @ingroup iface_xdg_wm_base465
*/466
#define XDG_WM_BASE_GET_XDG_SURFACE_SINCE_VERSION 1467
/**468
* @ingroup iface_xdg_wm_base469
*/470
#define XDG_WM_BASE_PONG_SINCE_VERSION 1472
/** @ingroup iface_xdg_wm_base */473
static inline void474
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
}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
}486
static inline uint32_t487
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
}492
/**493
* @ingroup iface_xdg_wm_base494
*495
* Destroy this xdg_wm_base object.496
*497
* Destroying a bound xdg_wm_base object while there are surfaces498
* still alive created by this xdg_wm_base object instance is illegal499
* and will result in a defunct_surfaces error.500
*/501
static inline void502
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
}508
/**509
* @ingroup iface_xdg_wm_base510
*511
* Create a positioner object. A positioner object is used to position512
* surfaces relative to some parent surface. See the interface description513
* 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;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);523
return (struct xdg_positioner *) id;524
}526
/**527
* @ingroup iface_xdg_wm_base528
*529
* This creates an xdg_surface for the given surface. While xdg_surface530
* itself is not a role, the corresponding surface may only be assigned531
* a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is532
* illegal to create an xdg_surface for a wl_surface which already has an533
* assigned role and this will result in a role error.534
*535
* This creates an xdg_surface for the given surface. An xdg_surface is536
* used as basis to define a role to a given surface, such as xdg_toplevel537
* or xdg_popup. It also manages functionality shared between xdg_surface538
* based surface roles.539
*540
* See the documentation of xdg_surface for more details about what an541
* 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;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);551
return (struct xdg_surface *) id;552
}554
/**555
* @ingroup iface_xdg_wm_base556
*557
* A client must respond to a ping event with a pong request or558
* the client may be deemed unresponsive. See xdg_wm_base.ping559
* and xdg_wm_base.error.unresponsive.560
*/561
static inline void562
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
}568
#ifndef XDG_POSITIONER_ERROR_ENUM569
#define XDG_POSITIONER_ERROR_ENUM570
enum xdg_positioner_error {571
/**572
* invalid input provided573
*/574
XDG_POSITIONER_ERROR_INVALID_INPUT = 0,575
};576
#endif /* XDG_POSITIONER_ERROR_ENUM */578
#ifndef XDG_POSITIONER_ANCHOR_ENUM579
#define XDG_POSITIONER_ANCHOR_ENUM580
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 */593
#ifndef XDG_POSITIONER_GRAVITY_ENUM594
#define XDG_POSITIONER_GRAVITY_ENUM595
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 */608
#ifndef XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM609
#define XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM610
/**611
* @ingroup iface_xdg_positioner612
* constraint adjustments613
*614
* The constraint adjustment value define ways the compositor will adjust615
* the position of the surface, if the unadjusted position would result616
* in the surface being partly constrained.617
*618
* Whether a surface is considered 'constrained' is left to the compositor619
* to determine. For example, the surface may be partly outside the620
* compositor's defined 'work area', thus necessitating the child surface's621
* 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 constrained629
*630
* Don't alter the surface position even if it is constrained on631
* 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 unconstrained636
*637
* Slide the surface along the x axis until it is no longer638
* constrained.639
*640
* First try to slide towards the direction of the gravity on the x641
* axis until either the edge in the opposite direction of the642
* gravity is unconstrained or the edge in the direction of the643
* gravity is constrained.644
*645
* Then try to slide towards the opposite direction of the gravity646
* on the x axis until either the edge in the direction of the647
* gravity is unconstrained or the edge in the opposite direction648
* of the gravity is constrained.649
*/650
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1,651
/**652
* move along the y axis until unconstrained653
*654
* Slide the surface along the y axis until it is no longer655
* constrained.656
*657
* First try to slide towards the direction of the gravity on the y658
* axis until either the edge in the opposite direction of the659
* gravity is unconstrained or the edge in the direction of the660
* gravity is constrained.661
*662
* Then try to slide towards the opposite direction of the gravity663
* on the y axis until either the edge in the direction of the664
* gravity is unconstrained or the edge in the opposite direction665
* of the gravity is constrained.666
*/667
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2,668
/**669
* invert the anchor and gravity on the x axis670
*671
* Invert the anchor and gravity on the x axis if the surface is672
* constrained on the x axis. For example, if the left edge of the673
* surface is constrained, the gravity is 'left' and the anchor is674
* 'left', change the gravity to 'right' and the anchor to 'right'.675
*676
* If the adjusted position also ends up being constrained, the677
* resulting position of the flip_x adjustment will be the one678
* before the adjustment.679
*/680
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X = 4,681
/**682
* invert the anchor and gravity on the y axis683
*684
* Invert the anchor and gravity on the y axis if the surface is685
* constrained on the y axis. For example, if the bottom edge of686
* the surface is constrained, the gravity is 'bottom' and the687
* anchor is 'bottom', change the gravity to 'top' and the anchor688
* to 'top'.689
*690
* The adjusted position is calculated given the original anchor691
* rectangle and offset, but with the new flipped anchor and692
* gravity values.693
*694
* If the adjusted position also ends up being constrained, the695
* resulting position of the flip_y adjustment will be the one696
* before the adjustment.697
*/698
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8,699
/**700
* horizontally resize the surface701
*702
* Resize the surface horizontally so that it is completely703
* unconstrained.704
*/705
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16,706
/**707
* vertically resize the surface708
*709
* Resize the surface vertically so that it is completely710
* unconstrained.711
*/712
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32,713
};714
#endif /* XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM */716
#define XDG_POSITIONER_DESTROY 0717
#define XDG_POSITIONER_SET_SIZE 1718
#define XDG_POSITIONER_SET_ANCHOR_RECT 2719
#define XDG_POSITIONER_SET_ANCHOR 3720
#define XDG_POSITIONER_SET_GRAVITY 4721
#define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT 5722
#define XDG_POSITIONER_SET_OFFSET 6723
#define XDG_POSITIONER_SET_REACTIVE 7724
#define XDG_POSITIONER_SET_PARENT_SIZE 8725
#define XDG_POSITIONER_SET_PARENT_CONFIGURE 9728
/**729
* @ingroup iface_xdg_positioner730
*/731
#define XDG_POSITIONER_DESTROY_SINCE_VERSION 1732
/**733
* @ingroup iface_xdg_positioner734
*/735
#define XDG_POSITIONER_SET_SIZE_SINCE_VERSION 1736
/**737
* @ingroup iface_xdg_positioner738
*/739
#define XDG_POSITIONER_SET_ANCHOR_RECT_SINCE_VERSION 1740
/**741
* @ingroup iface_xdg_positioner742
*/743
#define XDG_POSITIONER_SET_ANCHOR_SINCE_VERSION 1744
/**745
* @ingroup iface_xdg_positioner746
*/747
#define XDG_POSITIONER_SET_GRAVITY_SINCE_VERSION 1748
/**749
* @ingroup iface_xdg_positioner750
*/751
#define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION 1752
/**753
* @ingroup iface_xdg_positioner754
*/755
#define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1756
/**757
* @ingroup iface_xdg_positioner758
*/759
#define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3760
/**761
* @ingroup iface_xdg_positioner762
*/763
#define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3764
/**765
* @ingroup iface_xdg_positioner766
*/767
#define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3769
/** @ingroup iface_xdg_positioner */770
static inline void771
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
}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
}783
static inline uint32_t784
xdg_positioner_get_version(struct xdg_positioner *xdg_positioner)785
{786
return wl_proxy_get_version((struct wl_proxy *) xdg_positioner);787
}789
/**790
* @ingroup iface_xdg_positioner791
*792
* Notify the compositor that the xdg_positioner will no longer be used.793
*/794
static inline void795
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
}801
/**802
* @ingroup iface_xdg_positioner803
*804
* Set the size of the surface that is to be positioned with the positioner805
* object. The size is in surface-local coordinates and corresponds to the806
* 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 void811
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
}817
/**818
* @ingroup iface_xdg_positioner819
*820
* Specify the anchor rectangle within the parent surface that the child821
* surface will be placed relative to. The rectangle is relative to the822
* window geometry as defined by xdg_surface.set_window_geometry of the823
* parent surface.824
*825
* When the xdg_positioner object is used to position a child surface, the826
* anchor rectangle may not extend outside the window geometry of the827
* positioned child's parent surface.828
*829
* If a negative size is set the invalid_input error is raised.830
*/831
static inline void832
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
}838
/**839
* @ingroup iface_xdg_positioner840
*841
* Defines the anchor point for the anchor rectangle. The specified anchor842
* is used derive an anchor point that the child surface will be843
* positioned relative to. If a corner anchor is set (e.g. 'top_left' or844
* 'bottom_right'), the anchor point will be at the specified corner;845
* otherwise, the derived anchor point will be centered on the specified846
* edge, or in the center of the anchor rectangle if no edge is specified.847
*/848
static inline void849
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
}855
/**856
* @ingroup iface_xdg_positioner857
*858
* Defines in what direction a surface should be positioned, relative to859
* the anchor point of the parent surface. If a corner gravity is860
* specified (e.g. 'bottom_right' or 'top_left'), then the child surface861
* will be placed towards the specified gravity; otherwise, the child862
* surface will be centered over the anchor point on any axis that had no863
* gravity specified. If the gravity is not in the ‘gravity’ enum, an864
* invalid_input error is raised.865
*/866
static inline void867
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
}873
/**874
* @ingroup iface_xdg_positioner875
*876
* Specify how the window should be positioned if the originally intended877
* position caused the surface to be constrained, meaning at least878
* partially outside positioning boundaries set by the compositor. The879
* adjustment is set by constructing a bitmask describing the adjustment to880
* 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 child883
* 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 adjustments886
* are applied is specified in the corresponding adjustment descriptions.887
*888
* The default adjustment is none.889
*/890
static inline void891
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
}897
/**898
* @ingroup iface_xdg_positioner899
*900
* Specify the surface position offset relative to the position of the901
* anchor on the anchor rectangle and the anchor on the surface. For902
* example if the anchor of the anchor rectangle is at (x, y), the surface903
* has the gravity bottom|right, and the offset is (ox, oy), the calculated904
* surface position will be (x + ox, y + oy). The offset position of the905
* surface is the one used for constraint testing. See906
* set_constraint_adjustment.907
*908
* An example use case is placing a popup menu on top of a user interface909
* element, while aligning the user interface element of the parent surface910
* with some user interface element placed somewhere in the popup surface.911
*/912
static inline void913
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
}919
/**920
* @ingroup iface_xdg_positioner921
*922
* When set reactive, the surface is reconstrained if the conditions used923
* for constraining changed, e.g. the parent window moved.924
*925
* If the conditions changed and the popup was reconstrained, an926
* xdg_popup.configure event is sent with updated geometry, followed by an927
* xdg_surface.configure event.928
*/929
static inline void930
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
}936
/**937
* @ingroup iface_xdg_positioner938
*939
* Set the parent window geometry the compositor should use when940
* positioning the popup. The compositor may use this information to941
* determine the future state the popup should be constrained using. If942
* this doesn't match the dimension of the parent the popup is eventually943
* positioned against, the behavior is undefined.944
*945
* The arguments are given in the surface-local coordinate space.946
*/947
static inline void948
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
}954
/**955
* @ingroup iface_xdg_positioner956
*957
* Set the serial of an xdg_surface.configure event this positioner will be958
* used in response to. The compositor may use this information together959
* with set_parent_size to determine what future state the popup should be960
* constrained using.961
*/962
static inline void963
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
}969
#ifndef XDG_SURFACE_ERROR_ENUM970
#define XDG_SURFACE_ERROR_ENUM971
enum xdg_surface_error {972
/**973
* Surface was not fully constructed974
*/975
XDG_SURFACE_ERROR_NOT_CONSTRUCTED = 1,976
/**977
* Surface was already constructed978
*/979
XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED = 2,980
/**981
* Attaching a buffer to an unconfigured surface982
*/983
XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER = 3,984
/**985
* Invalid serial number when acking a configure event986
*/987
XDG_SURFACE_ERROR_INVALID_SERIAL = 4,988
/**989
* Width or height was zero or negative990
*/991
XDG_SURFACE_ERROR_INVALID_SIZE = 5,992
/**993
* Surface was destroyed before its role object994
*/995
XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT = 6,996
};997
#endif /* XDG_SURFACE_ERROR_ENUM */999
/**1000
* @ingroup iface_xdg_surface1001
* @struct xdg_surface_listener1002
*/1003
struct xdg_surface_listener {1004
/**1005
* suggest a surface change1006
*1007
* The configure event marks the end of a configure sequence. A1008
* configure sequence is a set of one or more events configuring1009
* the state of the xdg_surface, including the final1010
* xdg_surface.configure event.1011
*1012
* Where applicable, xdg_surface surface roles will during a1013
* configure sequence extend this event as a latched state sent as1014
* events before the xdg_surface.configure event. Such events1015
* should be considered to make up a set of atomically applied1016
* configuration states, where the xdg_surface.configure commits1017
* the accumulated state.1018
*1019
* Clients should arrange their surface for the new states, and1020
* then send an ack_configure request with the serial sent in this1021
* configure event at some point before committing the new surface.1022
*1023
* If the client receives multiple configure events before it can1024
* respond to one, it is free to discard all but the last event it1025
* received.1026
* @param serial serial of the configure event1027
*/1028
void (*configure)(void *data,1029
struct xdg_surface *xdg_surface,1030
uint32_t serial);1031
};1033
/**1034
* @ingroup iface_xdg_surface1035
*/1036
static inline int1037
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
}1044
#define XDG_SURFACE_DESTROY 01045
#define XDG_SURFACE_GET_TOPLEVEL 11046
#define XDG_SURFACE_GET_POPUP 21047
#define XDG_SURFACE_SET_WINDOW_GEOMETRY 31048
#define XDG_SURFACE_ACK_CONFIGURE 41050
/**1051
* @ingroup iface_xdg_surface1052
*/1053
#define XDG_SURFACE_CONFIGURE_SINCE_VERSION 11055
/**1056
* @ingroup iface_xdg_surface1057
*/1058
#define XDG_SURFACE_DESTROY_SINCE_VERSION 11059
/**1060
* @ingroup iface_xdg_surface1061
*/1062
#define XDG_SURFACE_GET_TOPLEVEL_SINCE_VERSION 11063
/**1064
* @ingroup iface_xdg_surface1065
*/1066
#define XDG_SURFACE_GET_POPUP_SINCE_VERSION 11067
/**1068
* @ingroup iface_xdg_surface1069
*/1070
#define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 11071
/**1072
* @ingroup iface_xdg_surface1073
*/1074
#define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 11076
/** @ingroup iface_xdg_surface */1077
static inline void1078
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
}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
}1090
static inline uint32_t1091
xdg_surface_get_version(struct xdg_surface *xdg_surface)1092
{1093
return wl_proxy_get_version((struct wl_proxy *) xdg_surface);1094
}1096
/**1097
* @ingroup iface_xdg_surface1098
*1099
* Destroy the xdg_surface object. An xdg_surface must only be destroyed1100
* after its role object has been destroyed, otherwise1101
* a defunct_role_object error is raised.1102
*/1103
static inline void1104
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
}1110
/**1111
* @ingroup iface_xdg_surface1112
*1113
* This creates an xdg_toplevel object for the given xdg_surface and gives1114
* the associated wl_surface the xdg_toplevel role.1115
*1116
* See the documentation of xdg_toplevel for more details about what an1117
* 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;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);1127
return (struct xdg_toplevel *) id;1128
}1130
/**1131
* @ingroup iface_xdg_surface1132
*1133
* This creates an xdg_popup object for the given xdg_surface and gives1134
* the associated wl_surface the xdg_popup role.1135
*1136
* If null is passed as a parent, a parent surface must be specified using1137
* some other protocol, before committing the initial state.1138
*1139
* See the documentation of xdg_popup for more details about what an1140
* 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;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);1150
return (struct xdg_popup *) id;1151
}1153
/**1154
* @ingroup iface_xdg_surface1155
*1156
* The window geometry of a surface is its "visible bounds" from the1157
* user's perspective. Client-side decorations often have invisible1158
* portions like drop-shadows which should be ignored for the1159
* purposes of aligning, placing and constraining windows.1160
*1161
* The window geometry is double-buffered state, see wl_surface.commit.1162
*1163
* When maintaining a position, the compositor should treat the (x, y)1164
* coordinate of the window geometry as the top left corner of the window.1165
* A client changing the (x, y) window geometry coordinate should in1166
* general not alter the position of the window.1167
*1168
* Once the window geometry of the surface is set, it is not possible to1169
* unset it, and it will remain the same until set_window_geometry is1170
* called again, even if a new subsurface or buffer is attached.1171
*1172
* If never set, the value is the full bounds of the surface,1173
* including any subsurfaces. This updates dynamically on every1174
* commit. This unset is meant for extremely simple clients.1175
*1176
* The arguments are given in the surface-local coordinate space of1177
* the wl_surface associated with this xdg_surface, and may extend outside1178
* of the wl_surface itself to mark parts of the subsurface tree as part of1179
* the window geometry.1180
*1181
* When applied, the effective window geometry will be the set window1182
* geometry clamped to the bounding rectangle of the combined1183
* geometry of the surface of the xdg_surface and the associated1184
* subsurfaces.1185
*1186
* The effective geometry will not be recalculated unless a new call to1187
* set_window_geometry is done and the new pending surface state is1188
* subsequently applied.1189
*1190
* The width and height of the effective window geometry must be1191
* greater than zero. Setting an invalid size will raise an1192
* invalid_size error.1193
*/1194
static inline void1195
xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)1196
{1197
wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,1198
XDG_SURFACE_SET_WINDOW_GEOMETRY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, x, y, width, height);1199
}1201
/**1202
* @ingroup iface_xdg_surface1203
*1204
* When a configure event is received, if a client commits the1205
* surface in response to the configure event, then the client1206
* must make an ack_configure request sometime before the commit1207
* request, passing along the serial of the configure event.1208
*1209
* For instance, for toplevel surfaces the compositor might use this1210
* information to move a surface to the top left only when the client has1211
* drawn itself for the maximized or fullscreen state.1212
*1213
* If the client receives multiple configure events before it1214
* can respond to one, it only has to ack the last configure event.1215
* Acking a configure event that was never sent raises an invalid_serial1216
* error.1217
*1218
* A client is not required to commit immediately after sending1219
* an ack_configure request - it may even ack_configure several times1220
* before its next surface commit.1221
*1222
* A client may send multiple ack_configure requests before committing, but1223
* only the last request sent before a commit indicates which configure1224
* event the client really is responding to.1225
*1226
* Sending an ack_configure request consumes the serial number sent with1227
* the request, as well as serial numbers sent by all configure events1228
* sent on this xdg_surface prior to the configure event referenced by1229
* the committed serial.1230
*1231
* It is an error to issue multiple ack_configure requests referencing a1232
* serial from the same configure event, or to issue an ack_configure1233
* request referencing a serial from a configure event issued before the1234
* event identified by the last ack_configure request for the same1235
* xdg_surface. Doing so will raise an invalid_serial error.1236
*/1237
static inline void1238
xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)1239
{1240
wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,1241
XDG_SURFACE_ACK_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, serial);1242
}1244
#ifndef XDG_TOPLEVEL_ERROR_ENUM1245
#define XDG_TOPLEVEL_ERROR_ENUM1246
enum xdg_toplevel_error {1247
/**1248
* provided value is not a valid variant of the resize_edge enum1249
*/1250
XDG_TOPLEVEL_ERROR_INVALID_RESIZE_EDGE = 0,1251
/**1252
* invalid parent toplevel1253
*/1254
XDG_TOPLEVEL_ERROR_INVALID_PARENT = 1,1255
/**1256
* client provided an invalid min or max size1257
*/1258
XDG_TOPLEVEL_ERROR_INVALID_SIZE = 2,1259
};1260
#endif /* XDG_TOPLEVEL_ERROR_ENUM */1262
#ifndef XDG_TOPLEVEL_RESIZE_EDGE_ENUM1263
#define XDG_TOPLEVEL_RESIZE_EDGE_ENUM1264
/**1265
* @ingroup iface_xdg_toplevel1266
* edge values for resizing1267
*1268
* These values are used to indicate which edge of a surface1269
* is being dragged in a resize operation.1270
*/1271
enum xdg_toplevel_resize_edge {1272
XDG_TOPLEVEL_RESIZE_EDGE_NONE = 0,1273
XDG_TOPLEVEL_RESIZE_EDGE_TOP = 1,1274
XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM = 2,1275
XDG_TOPLEVEL_RESIZE_EDGE_LEFT = 4,1276
XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT = 5,1277
XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT = 6,1278
XDG_TOPLEVEL_RESIZE_EDGE_RIGHT = 8,1279
XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT = 9,1280
XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT = 10,1281
};1282
#endif /* XDG_TOPLEVEL_RESIZE_EDGE_ENUM */1284
#ifndef XDG_TOPLEVEL_STATE_ENUM1285
#define XDG_TOPLEVEL_STATE_ENUM1286
/**1287
* @ingroup iface_xdg_toplevel1288
* types of state on the surface1289
*1290
* The different state values used on the surface. This is designed for1291
* state values like maximized, fullscreen. It is paired with the1292
* configure event to ensure that both the client and the compositor1293
* setting the state can be synchronized.1294
*1295
* States set in this way are double-buffered, see wl_surface.commit.1296
*/1297
enum xdg_toplevel_state {1298
/**1299
* the surface is maximized1300
* the surface is maximized1301
*1302
* The surface is maximized. The window geometry specified in the1303
* configure event must be obeyed by the client, or the1304
* xdg_wm_base.invalid_surface_state error is raised.1305
*1306
* The client should draw without shadow or other decoration1307
* outside of the window geometry.1308
*/1309
XDG_TOPLEVEL_STATE_MAXIMIZED = 1,1310
/**1311
* the surface is fullscreen1312
* the surface is fullscreen1313
*1314
* The surface is fullscreen. The window geometry specified in1315
* the configure event is a maximum; the client cannot resize1316
* beyond it. For a surface to cover the whole fullscreened area,1317
* the geometry dimensions must be obeyed by the client. For more1318
* details, see xdg_toplevel.set_fullscreen.1319
*/1320
XDG_TOPLEVEL_STATE_FULLSCREEN = 2,1321
/**1322
* the surface is being resized1323
* the surface is being resized1324
*1325
* The surface is being resized. The window geometry specified in1326
* the configure event is a maximum; the client cannot resize1327
* beyond it. Clients that have aspect ratio or cell sizing1328
* configuration can use a smaller size, however.1329
*/1330
XDG_TOPLEVEL_STATE_RESIZING = 3,1331
/**1332
* the surface is now activated1333
* the surface is now activated1334
*1335
* Client window decorations should be painted as if the window1336
* is active. Do not assume this means that the window actually has1337
* keyboard or pointer focus.1338
*/1339
XDG_TOPLEVEL_STATE_ACTIVATED = 4,1340
/**1341
* the surface’s left edge is tiled1342
*1343
* The window is currently in a tiled layout and the left edge is1344
* considered to be adjacent to another part of the tiling grid.1345
*1346
* The client should draw without shadow or other decoration1347
* outside of the window geometry on the left edge.1348
* @since 21349
*/1350
XDG_TOPLEVEL_STATE_TILED_LEFT = 5,1351
/**1352
* the surface’s right edge is tiled1353
*1354
* The window is currently in a tiled layout and the right edge1355
* is considered to be adjacent to another part of the tiling grid.1356
*1357
* The client should draw without shadow or other decoration1358
* outside of the window geometry on the right edge.1359
* @since 21360
*/1361
XDG_TOPLEVEL_STATE_TILED_RIGHT = 6,1362
/**1363
* the surface’s top edge is tiled1364
*1365
* The window is currently in a tiled layout and the top edge is1366
* considered to be adjacent to another part of the tiling grid.1367
*1368
* The client should draw without shadow or other decoration1369
* outside of the window geometry on the top edge.1370
* @since 21371
*/1372
XDG_TOPLEVEL_STATE_TILED_TOP = 7,1373
/**1374
* the surface’s bottom edge is tiled1375
*1376
* The window is currently in a tiled layout and the bottom edge1377
* is considered to be adjacent to another part of the tiling grid.1378
*1379
* The client should draw without shadow or other decoration1380
* outside of the window geometry on the bottom edge.1381
* @since 21382
*/1383
XDG_TOPLEVEL_STATE_TILED_BOTTOM = 8,1384
/**1385
* surface repaint is suspended1386
*1387
* The surface is currently not ordinarily being repainted; for1388
* example because its content is occluded by another window, or1389
* its outputs are switched off due to screen locking.1390
* @since 61391
*/1392
XDG_TOPLEVEL_STATE_SUSPENDED = 9,1393
/**1394
* the surface’s left edge is constrained1395
*1396
* The left edge of the window is currently constrained, meaning1397
* it shouldn't attempt to resize from that edge. It can for1398
* example mean it's tiled next to a monitor edge on the1399
* constrained side of the window.1400
* @since 71401
*/1402
XDG_TOPLEVEL_STATE_CONSTRAINED_LEFT = 10,1403
/**1404
* the surface’s right edge is constrained1405
*1406
* The right edge of the window is currently constrained, meaning1407
* it shouldn't attempt to resize from that edge. It can for1408
* example mean it's tiled next to a monitor edge on the1409
* constrained side of the window.1410
* @since 71411
*/1412
XDG_TOPLEVEL_STATE_CONSTRAINED_RIGHT = 11,1413
/**1414
* the surface’s top edge is constrained1415
*1416
* The top edge of the window is currently constrained, meaning1417
* it shouldn't attempt to resize from that edge. It can for1418
* example mean it's tiled next to a monitor edge on the1419
* constrained side of the window.1420
* @since 71421
*/1422
XDG_TOPLEVEL_STATE_CONSTRAINED_TOP = 12,1423
/**1424
* the surface’s bottom edge is tiled1425
*1426
* The bottom edge of the window is currently constrained,1427
* meaning it shouldn't attempt to resize from that edge. It can1428
* for example mean it's tiled next to a monitor edge on the1429
* constrained side of the window.1430
* @since 71431
*/1432
XDG_TOPLEVEL_STATE_CONSTRAINED_BOTTOM = 13,1433
};1434
/**1435
* @ingroup iface_xdg_toplevel1436
*/1437
#define XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION 21438
/**1439
* @ingroup iface_xdg_toplevel1440
*/1441
#define XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION 21442
/**1443
* @ingroup iface_xdg_toplevel1444
*/1445
#define XDG_TOPLEVEL_STATE_TILED_TOP_SINCE_VERSION 21446
/**1447
* @ingroup iface_xdg_toplevel1448
*/1449
#define XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION 21450
/**1451
* @ingroup iface_xdg_toplevel1452
*/1453
#define XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION 61454
/**1455
* @ingroup iface_xdg_toplevel1456
*/1457
#define XDG_TOPLEVEL_STATE_CONSTRAINED_LEFT_SINCE_VERSION 71458
/**1459
* @ingroup iface_xdg_toplevel1460
*/1461
#define XDG_TOPLEVEL_STATE_CONSTRAINED_RIGHT_SINCE_VERSION 71462
/**1463
* @ingroup iface_xdg_toplevel1464
*/1465
#define XDG_TOPLEVEL_STATE_CONSTRAINED_TOP_SINCE_VERSION 71466
/**1467
* @ingroup iface_xdg_toplevel1468
*/1469
#define XDG_TOPLEVEL_STATE_CONSTRAINED_BOTTOM_SINCE_VERSION 71470
#endif /* XDG_TOPLEVEL_STATE_ENUM */1472
#ifndef XDG_TOPLEVEL_WM_CAPABILITIES_ENUM1473
#define XDG_TOPLEVEL_WM_CAPABILITIES_ENUM1474
enum xdg_toplevel_wm_capabilities {1475
/**1476
* show_window_menu is available1477
*/1478
XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU = 1,1479
/**1480
* set_maximized and unset_maximized are available1481
*/1482
XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE = 2,1483
/**1484
* set_fullscreen and unset_fullscreen are available1485
*/1486
XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 3,1487
/**1488
* set_minimized is available1489
*/1490
XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE = 4,1491
};1492
#endif /* XDG_TOPLEVEL_WM_CAPABILITIES_ENUM */1494
/**1495
* @ingroup iface_xdg_toplevel1496
* @struct xdg_toplevel_listener1497
*/1498
struct xdg_toplevel_listener {1499
/**1500
* suggest a surface change1501
*1502
* This configure event asks the client to resize its toplevel1503
* surface or to change its state. The configured state should not1504
* be applied immediately. See xdg_surface.configure for details.1505
*1506
* The width and height arguments specify a hint to the window1507
* about how its surface should be resized in window geometry1508
* coordinates. See set_window_geometry.1509
*1510
* If the width or height arguments are zero, it means the client1511
* should decide its own window dimension. This may happen when the1512
* compositor needs to configure the state of the surface but1513
* doesn't have any information about any previous or expected1514
* dimension.1515
*1516
* The states listed in the event specify how the width/height1517
* arguments should be interpreted, and possibly how it should be1518
* drawn.1519
*1520
* Clients must send an ack_configure in response to this event.1521
* See xdg_surface.configure and xdg_surface.ack_configure for1522
* details.1523
*/1524
void (*configure)(void *data,1525
struct xdg_toplevel *xdg_toplevel,1526
int32_t width,1527
int32_t height,1528
struct wl_array *states);1529
/**1530
* surface wants to be closed1531
*1532
* The close event is sent by the compositor when the user wants1533
* the surface to be closed. This should be equivalent to the user1534
* clicking the close button in client-side decorations, if your1535
* application has any.1536
*1537
* This is only a request that the user intends to close the1538
* window. The client may choose to ignore this request, or show a1539
* dialog to ask the user to save their data, etc.1540
*/1541
void (*close)(void *data,1542
struct xdg_toplevel *xdg_toplevel);1543
/**1544
* recommended window geometry bounds1545
*1546
* The configure_bounds event may be sent prior to a1547
* xdg_toplevel.configure event to communicate the bounds a window1548
* geometry size is recommended to constrain to.1549
*1550
* The passed width and height are in surface coordinate space. If1551
* width and height are 0, it means bounds is unknown and1552
* equivalent to as if no configure_bounds event was ever sent for1553
* this surface.1554
*1555
* The bounds can for example correspond to the size of a monitor1556
* excluding any panels or other shell components, so that a1557
* surface isn't created in a way that it cannot fit.1558
*1559
* The bounds may change at any point, and in such a case, a new1560
* xdg_toplevel.configure_bounds will be sent, followed by1561
* xdg_toplevel.configure and xdg_surface.configure.1562
* @since 41563
*/1564
void (*configure_bounds)(void *data,1565
struct xdg_toplevel *xdg_toplevel,1566
int32_t width,1567
int32_t height);1568
/**1569
* compositor capabilities1570
*1571
* This event advertises the capabilities supported by the1572
* compositor. If a capability isn't supported, clients should hide1573
* or disable the UI elements that expose this functionality. For1574
* instance, if the compositor doesn't advertise support for1575
* minimized toplevels, a button triggering the set_minimized1576
* request should not be displayed.1577
*1578
* The compositor will ignore requests it doesn't support. For1579
* instance, a compositor which doesn't advertise support for1580
* minimized will ignore set_minimized requests.1581
*1582
* Compositors must send this event once before the first1583
* xdg_surface.configure event. When the capabilities change,1584
* compositors must send this event again and then send an1585
* xdg_surface.configure event.1586
*1587
* The configured state should not be applied immediately. See1588
* xdg_surface.configure for details.1589
*1590
* The capabilities are sent as an array of 32-bit unsigned1591
* integers in native endianness.1592
* @param capabilities array of 32-bit capabilities1593
* @since 51594
*/1595
void (*wm_capabilities)(void *data,1596
struct xdg_toplevel *xdg_toplevel,1597
struct wl_array *capabilities);1598
};1600
/**1601
* @ingroup iface_xdg_toplevel1602
*/1603
static inline int1604
xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel,1605
const struct xdg_toplevel_listener *listener, void *data)1606
{1607
return wl_proxy_add_listener((struct wl_proxy *) xdg_toplevel,1608
(void (**)(void)) listener, data);1609
}1611
#define XDG_TOPLEVEL_DESTROY 01612
#define XDG_TOPLEVEL_SET_PARENT 11613
#define XDG_TOPLEVEL_SET_TITLE 21614
#define XDG_TOPLEVEL_SET_APP_ID 31615
#define XDG_TOPLEVEL_SHOW_WINDOW_MENU 41616
#define XDG_TOPLEVEL_MOVE 51617
#define XDG_TOPLEVEL_RESIZE 61618
#define XDG_TOPLEVEL_SET_MAX_SIZE 71619
#define XDG_TOPLEVEL_SET_MIN_SIZE 81620
#define XDG_TOPLEVEL_SET_MAXIMIZED 91621
#define XDG_TOPLEVEL_UNSET_MAXIMIZED 101622
#define XDG_TOPLEVEL_SET_FULLSCREEN 111623
#define XDG_TOPLEVEL_UNSET_FULLSCREEN 121624
#define XDG_TOPLEVEL_SET_MINIMIZED 131626
/**1627
* @ingroup iface_xdg_toplevel1628
*/1629
#define XDG_TOPLEVEL_CONFIGURE_SINCE_VERSION 11630
/**1631
* @ingroup iface_xdg_toplevel1632
*/1633
#define XDG_TOPLEVEL_CLOSE_SINCE_VERSION 11634
/**1635
* @ingroup iface_xdg_toplevel1636
*/1637
#define XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION 41638
/**1639
* @ingroup iface_xdg_toplevel1640
*/1641
#define XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION 51643
/**1644
* @ingroup iface_xdg_toplevel1645
*/1646
#define XDG_TOPLEVEL_DESTROY_SINCE_VERSION 11647
/**1648
* @ingroup iface_xdg_toplevel1649
*/1650
#define XDG_TOPLEVEL_SET_PARENT_SINCE_VERSION 11651
/**1652
* @ingroup iface_xdg_toplevel1653
*/1654
#define XDG_TOPLEVEL_SET_TITLE_SINCE_VERSION 11655
/**1656
* @ingroup iface_xdg_toplevel1657
*/1658
#define XDG_TOPLEVEL_SET_APP_ID_SINCE_VERSION 11659
/**1660
* @ingroup iface_xdg_toplevel1661
*/1662
#define XDG_TOPLEVEL_SHOW_WINDOW_MENU_SINCE_VERSION 11663
/**1664
* @ingroup iface_xdg_toplevel1665
*/1666
#define XDG_TOPLEVEL_MOVE_SINCE_VERSION 11667
/**1668
* @ingroup iface_xdg_toplevel1669
*/1670
#define XDG_TOPLEVEL_RESIZE_SINCE_VERSION 11671
/**1672
* @ingroup iface_xdg_toplevel1673
*/1674
#define XDG_TOPLEVEL_SET_MAX_SIZE_SINCE_VERSION 11675
/**1676
* @ingroup iface_xdg_toplevel1677
*/1678
#define XDG_TOPLEVEL_SET_MIN_SIZE_SINCE_VERSION 11679
/**1680
* @ingroup iface_xdg_toplevel1681
*/1682
#define XDG_TOPLEVEL_SET_MAXIMIZED_SINCE_VERSION 11683
/**1684
* @ingroup iface_xdg_toplevel1685
*/1686
#define XDG_TOPLEVEL_UNSET_MAXIMIZED_SINCE_VERSION 11687
/**1688
* @ingroup iface_xdg_toplevel1689
*/1690
#define XDG_TOPLEVEL_SET_FULLSCREEN_SINCE_VERSION 11691
/**1692
* @ingroup iface_xdg_toplevel1693
*/1694
#define XDG_TOPLEVEL_UNSET_FULLSCREEN_SINCE_VERSION 11695
/**1696
* @ingroup iface_xdg_toplevel1697
*/1698
#define XDG_TOPLEVEL_SET_MINIMIZED_SINCE_VERSION 11700
/** @ingroup iface_xdg_toplevel */1701
static inline void1702
xdg_toplevel_set_user_data(struct xdg_toplevel *xdg_toplevel, void *user_data)1703
{1704
wl_proxy_set_user_data((struct wl_proxy *) xdg_toplevel, user_data);1705
}1707
/** @ingroup iface_xdg_toplevel */1708
static inline void *1709
xdg_toplevel_get_user_data(struct xdg_toplevel *xdg_toplevel)1710
{1711
return wl_proxy_get_user_data((struct wl_proxy *) xdg_toplevel);1712
}1714
static inline uint32_t1715
xdg_toplevel_get_version(struct xdg_toplevel *xdg_toplevel)1716
{1717
return wl_proxy_get_version((struct wl_proxy *) xdg_toplevel);1718
}1720
/**1721
* @ingroup iface_xdg_toplevel1722
*1723
* This request destroys the role surface and unmaps the surface;1724
* see "Unmapping" behavior in interface section for details.1725
*/1726
static inline void1727
xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)1728
{1729
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1730
XDG_TOPLEVEL_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), WL_MARSHAL_FLAG_DESTROY);1731
}1733
/**1734
* @ingroup iface_xdg_toplevel1735
*1736
* Set the "parent" of this surface. This surface should be stacked1737
* above the parent surface and all other ancestor surfaces.1738
*1739
* Parent surfaces should be set on dialogs, toolboxes, or other1740
* "auxiliary" surfaces, so that the parent is raised when the dialog1741
* is raised.1742
*1743
* Setting a null parent for a child surface unsets its parent. Setting1744
* a null parent for a surface which currently has no parent is a no-op.1745
*1746
* Only mapped surfaces can have child surfaces. Setting a parent which1747
* is not mapped is equivalent to setting a null parent. If a surface1748
* becomes unmapped, its children's parent is set to the parent of1749
* the now-unmapped surface. If the now-unmapped surface has no parent,1750
* its children's parent is unset. If the now-unmapped surface becomes1751
* mapped again, its parent-child relationship is not restored.1752
*1753
* The parent toplevel must not be one of the child toplevel's1754
* descendants, and the parent must be different from the child toplevel,1755
* otherwise the invalid_parent protocol error is raised.1756
*/1757
static inline void1758
xdg_toplevel_set_parent(struct xdg_toplevel *xdg_toplevel, struct xdg_toplevel *parent)1759
{1760
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1761
XDG_TOPLEVEL_SET_PARENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, parent);1762
}1764
/**1765
* @ingroup iface_xdg_toplevel1766
*1767
* Set a short title for the surface.1768
*1769
* This string may be used to identify the surface in a task bar,1770
* window list, or other user interface elements provided by the1771
* compositor.1772
*1773
* The string must be encoded in UTF-8.1774
*/1775
static inline void1776
xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)1777
{1778
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1779
XDG_TOPLEVEL_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, title);1780
}1782
/**1783
* @ingroup iface_xdg_toplevel1784
*1785
* Set an application identifier for the surface.1786
*1787
* The app ID identifies the general class of applications to which1788
* the surface belongs. The compositor can use this to group multiple1789
* surfaces together, or to determine how to launch a new application.1790
*1791
* For D-Bus activatable applications, the app ID is used as the D-Bus1792
* service name.1793
*1794
* The compositor shell will try to group application surfaces together1795
* by their app ID. As a best practice, it is suggested to select app1796
* ID's that match the basename of the application's .desktop file.1797
* For example, "org.freedesktop.FooViewer" where the .desktop file is1798
* "org.freedesktop.FooViewer.desktop".1799
*1800
* Like other properties, a set_app_id request can be sent after the1801
* xdg_toplevel has been mapped to update the property.1802
*1803
* See the desktop-entry specification [0] for more details on1804
* application identifiers and how they relate to well-known D-Bus1805
* names and .desktop files.1806
*1807
* [0] https://standards.freedesktop.org/desktop-entry-spec/1808
*/1809
static inline void1810
xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)1811
{1812
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1813
XDG_TOPLEVEL_SET_APP_ID, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, app_id);1814
}1816
/**1817
* @ingroup iface_xdg_toplevel1818
*1819
* Clients implementing client-side decorations might want to show1820
* a context menu when right-clicking on the decorations, giving the1821
* user a menu that they can use to maximize or minimize the window.1822
*1823
* This request asks the compositor to pop up such a window menu at1824
* the given position, relative to the local surface coordinates of1825
* the parent surface. There are no guarantees as to what menu items1826
* the window menu contains, or even if a window menu will be drawn1827
* at all.1828
*1829
* This request must be used in response to some sort of user action1830
* like a button press, key press, or touch down event.1831
*/1832
static inline void1833
xdg_toplevel_show_window_menu(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)1834
{1835
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1836
XDG_TOPLEVEL_SHOW_WINDOW_MENU, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, x, y);1837
}1839
/**1840
* @ingroup iface_xdg_toplevel1841
*1842
* Start an interactive, user-driven move of the surface.1843
*1844
* This request must be used in response to some sort of user action1845
* like a button press, key press, or touch down event. The passed1846
* serial is used to determine the type of interactive move (touch,1847
* pointer, etc).1848
*1849
* The server may ignore move requests depending on the state of1850
* the surface (e.g. fullscreen or maximized), or if the passed serial1851
* is no longer valid.1852
*1853
* If triggered, the surface will lose the focus of the device1854
* (wl_pointer, wl_touch, etc) used for the move. It is up to the1855
* compositor to visually indicate that the move is taking place, such as1856
* updating a pointer cursor, during the move. There is no guarantee1857
* that the device focus will return when the move is completed.1858
*/1859
static inline void1860
xdg_toplevel_move(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial)1861
{1862
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1863
XDG_TOPLEVEL_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial);1864
}1866
/**1867
* @ingroup iface_xdg_toplevel1868
*1869
* Start a user-driven, interactive resize of the surface.1870
*1871
* This request must be used in response to some sort of user action1872
* like a button press, key press, or touch down event. The passed1873
* serial is used to determine the type of interactive resize (touch,1874
* pointer, etc).1875
*1876
* The server may ignore resize requests depending on the state of1877
* the surface (e.g. fullscreen or maximized).1878
*1879
* If triggered, the client will receive configure events with the1880
* "resize" state enum value and the expected sizes. See the "resize"1881
* enum value for more details about what is required. The client1882
* must also acknowledge configure events using "ack_configure". After1883
* the resize is completed, the client will receive another "configure"1884
* event without the resize state.1885
*1886
* If triggered, the surface also will lose the focus of the device1887
* (wl_pointer, wl_touch, etc) used for the resize. It is up to the1888
* compositor to visually indicate that the resize is taking place,1889
* such as updating a pointer cursor, during the resize. There is no1890
* guarantee that the device focus will return when the resize is1891
* completed.1892
*1893
* The edges parameter specifies how the surface should be resized, and1894
* is one of the values of the resize_edge enum. Values not matching1895
* a variant of the enum will cause the invalid_resize_edge protocol error.1896
* The compositor may use this information to update the surface position1897
* for example when dragging the top left corner. The compositor may also1898
* use this information to adapt its behavior, e.g. choose an appropriate1899
* cursor image.1900
*/1901
static inline void1902
xdg_toplevel_resize(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, uint32_t edges)1903
{1904
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1905
XDG_TOPLEVEL_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, edges);1906
}1908
/**1909
* @ingroup iface_xdg_toplevel1910
*1911
* Set a maximum size for the window.1912
*1913
* The client can specify a maximum size so that the compositor does1914
* not try to configure the window beyond this size.1915
*1916
* The width and height arguments are in window geometry coordinates.1917
* See xdg_surface.set_window_geometry.1918
*1919
* Values set in this way are double-buffered, see wl_surface.commit.1920
*1921
* The compositor can use this information to allow or disallow1922
* different states like maximize or fullscreen and draw accurate1923
* animations.1924
*1925
* Similarly, a tiling window manager may use this information to1926
* place and resize client windows in a more effective way.1927
*1928
* The client should not rely on the compositor to obey the maximum1929
* size. The compositor may decide to ignore the values set by the1930
* client and request a larger size.1931
*1932
* If never set, or a value of zero in the request, means that the1933
* client has no expected maximum size in the given dimension.1934
* As a result, a client wishing to reset the maximum size1935
* to an unspecified state can use zero for width and height in the1936
* request.1937
*1938
* Requesting a maximum size to be smaller than the minimum size of1939
* a surface is illegal and will result in an invalid_size error.1940
*1941
* The width and height must be greater than or equal to zero. Using1942
* strictly negative values for width or height will result in a1943
* invalid_size error.1944
*/1945
static inline void1946
xdg_toplevel_set_max_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)1947
{1948
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1949
XDG_TOPLEVEL_SET_MAX_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height);1950
}1952
/**1953
* @ingroup iface_xdg_toplevel1954
*1955
* Set a minimum size for the window.1956
*1957
* The client can specify a minimum size so that the compositor does1958
* not try to configure the window below this size.1959
*1960
* The width and height arguments are in window geometry coordinates.1961
* See xdg_surface.set_window_geometry.1962
*1963
* Values set in this way are double-buffered, see wl_surface.commit.1964
*1965
* The compositor can use this information to allow or disallow1966
* different states like maximize or fullscreen and draw accurate1967
* animations.1968
*1969
* Similarly, a tiling window manager may use this information to1970
* place and resize client windows in a more effective way.1971
*1972
* The client should not rely on the compositor to obey the minimum1973
* size. The compositor may decide to ignore the values set by the1974
* client and request a smaller size.1975
*1976
* If never set, or a value of zero in the request, means that the1977
* client has no expected minimum size in the given dimension.1978
* As a result, a client wishing to reset the minimum size1979
* to an unspecified state can use zero for width and height in the1980
* request.1981
*1982
* Requesting a minimum size to be larger than the maximum size of1983
* a surface is illegal and will result in an invalid_size error.1984
*1985
* The width and height must be greater than or equal to zero. Using1986
* strictly negative values for width and height will result in a1987
* invalid_size error.1988
*/1989
static inline void1990
xdg_toplevel_set_min_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)1991
{1992
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,1993
XDG_TOPLEVEL_SET_MIN_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height);1994
}1996
/**1997
* @ingroup iface_xdg_toplevel1998
*1999
* Maximize the surface.2000
*2001
* After requesting that the surface should be maximized, the compositor2002
* will respond by emitting a configure event. Whether this configure2003
* actually sets the window maximized is subject to compositor policies.2004
* The client must then update its content, drawing in the configured2005
* state. The client must also acknowledge the configure when committing2006
* the new content (see ack_configure).2007
*2008
* It is up to the compositor to decide how and where to maximize the2009
* surface, for example which output and what region of the screen should2010
* be used.2011
*2012
* If the surface was already maximized, the compositor will still emit2013
* a configure event with the "maximized" state.2014
*2015
* If the surface is in a fullscreen state, this request has no direct2016
* effect. It may alter the state the surface is returned to when2017
* unmaximized unless overridden by the compositor.2018
*/2019
static inline void2020
xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)2021
{2022
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,2023
XDG_TOPLEVEL_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);2024
}2026
/**2027
* @ingroup iface_xdg_toplevel2028
*2029
* Unmaximize the surface.2030
*2031
* After requesting that the surface should be unmaximized, the compositor2032
* will respond by emitting a configure event. Whether this actually2033
* un-maximizes the window is subject to compositor policies.2034
* If available and applicable, the compositor will include the window2035
* geometry dimensions the window had prior to being maximized in the2036
* configure event. The client must then update its content, drawing it in2037
* the configured state. The client must also acknowledge the configure2038
* when committing the new content (see ack_configure).2039
*2040
* It is up to the compositor to position the surface after it was2041
* unmaximized; usually the position the surface had before maximizing, if2042
* applicable.2043
*2044
* If the surface was already not maximized, the compositor will still2045
* emit a configure event without the "maximized" state.2046
*2047
* If the surface is in a fullscreen state, this request has no direct2048
* effect. It may alter the state the surface is returned to when2049
* unmaximized unless overridden by the compositor.2050
*/2051
static inline void2052
xdg_toplevel_unset_maximized(struct xdg_toplevel *xdg_toplevel)2053
{2054
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,2055
XDG_TOPLEVEL_UNSET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);2056
}2058
/**2059
* @ingroup iface_xdg_toplevel2060
*2061
* Make the surface fullscreen.2062
*2063
* After requesting that the surface should be fullscreened, the2064
* compositor will respond by emitting a configure event. Whether the2065
* client is actually put into a fullscreen state is subject to compositor2066
* policies. The client must also acknowledge the configure when2067
* committing the new content (see ack_configure).2068
*2069
* The output passed by the request indicates the client's preference as2070
* to which display it should be set fullscreen on. If this value is NULL,2071
* it's up to the compositor to choose which display will be used to map2072
* this surface.2073
*2074
* If the surface doesn't cover the whole output, the compositor will2075
* position the surface in the center of the output and compensate with2076
* with border fill covering the rest of the output. The content of the2077
* border fill is undefined, but should be assumed to be in some way that2078
* attempts to blend into the surrounding area (e.g. solid black).2079
*2080
* If the fullscreened surface is not opaque, the compositor must make2081
* sure that other screen content not part of the same surface tree (made2082
* up of subsurfaces, popups or similarly coupled surfaces) are not2083
* visible below the fullscreened surface.2084
*/2085
static inline void2086
xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)2087
{2088
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,2089
XDG_TOPLEVEL_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, output);2090
}2092
/**2093
* @ingroup iface_xdg_toplevel2094
*2095
* Make the surface no longer fullscreen.2096
*2097
* After requesting that the surface should be unfullscreened, the2098
* compositor will respond by emitting a configure event.2099
* Whether this actually removes the fullscreen state of the client is2100
* subject to compositor policies.2101
*2102
* Making a surface unfullscreen sets states for the surface based on the following:2103
* * the state(s) it may have had before becoming fullscreen2104
* * any state(s) decided by the compositor2105
* * any state(s) requested by the client while the surface was fullscreen2106
*2107
* The compositor may include the previous window geometry dimensions in2108
* the configure event, if applicable.2109
*2110
* The client must also acknowledge the configure when committing the new2111
* content (see ack_configure).2112
*/2113
static inline void2114
xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)2115
{2116
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,2117
XDG_TOPLEVEL_UNSET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);2118
}2120
/**2121
* @ingroup iface_xdg_toplevel2122
*2123
* Request that the compositor minimize your surface. There is no2124
* way to know if the surface is currently minimized, nor is there2125
* any way to unset minimization on this surface.2126
*2127
* If you are looking to throttle redrawing when minimized, please2128
* instead use the wl_surface.frame event for this, as this will2129
* also work with live previews on windows in Alt-Tab, Expose or2130
* similar compositor features.2131
*/2132
static inline void2133
xdg_toplevel_set_minimized(struct xdg_toplevel *xdg_toplevel)2134
{2135
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,2136
XDG_TOPLEVEL_SET_MINIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);2137
}2139
#ifndef XDG_POPUP_ERROR_ENUM2140
#define XDG_POPUP_ERROR_ENUM2141
enum xdg_popup_error {2142
/**2143
* tried to grab after being mapped2144
*/2145
XDG_POPUP_ERROR_INVALID_GRAB = 0,2146
};2147
#endif /* XDG_POPUP_ERROR_ENUM */2149
/**2150
* @ingroup iface_xdg_popup2151
* @struct xdg_popup_listener2152
*/2153
struct xdg_popup_listener {2154
/**2155
* configure the popup surface2156
*2157
* This event asks the popup surface to configure itself given2158
* the configuration. The configured state should not be applied2159
* immediately. See xdg_surface.configure for details.2160
*2161
* The x and y arguments represent the position the popup was2162
* placed at given the xdg_positioner rule, relative to the upper2163
* left corner of the window geometry of the parent surface.2164
*2165
* For version 2 or older, the configure event for an xdg_popup is2166
* only ever sent once for the initial configuration. Starting with2167
* version 3, it may be sent again if the popup is setup with an2168
* xdg_positioner with set_reactive requested, or in response to2169
* xdg_popup.reposition requests.2170
* @param x x position relative to parent surface window geometry2171
* @param y y position relative to parent surface window geometry2172
* @param width window geometry width2173
* @param height window geometry height2174
*/2175
void (*configure)(void *data,2176
struct xdg_popup *xdg_popup,2177
int32_t x,2178
int32_t y,2179
int32_t width,2180
int32_t height);2181
/**2182
* popup interaction is done2183
*2184
* The popup_done event is sent out when a popup is dismissed by2185
* the compositor. The client should destroy the xdg_popup object2186
* at this point.2187
*/2188
void (*popup_done)(void *data,2189
struct xdg_popup *xdg_popup);2190
/**2191
* signal the completion of a repositioned request2192
*2193
* The repositioned event is sent as part of a popup2194
* configuration sequence, together with xdg_popup.configure and2195
* lastly xdg_surface.configure to notify the completion of a2196
* reposition request.2197
*2198
* The repositioned event is to notify about the completion of a2199
* xdg_popup.reposition request. The token argument is the token2200
* passed in the xdg_popup.reposition request.2201
*2202
* Immediately after this event is emitted, xdg_popup.configure and2203
* xdg_surface.configure will be sent with the updated size and2204
* position, as well as a new configure serial.2205
*2206
* The client should optionally update the content of the popup,2207
* but must acknowledge the new popup configuration for the new2208
* position to take effect. See xdg_surface.ack_configure for2209
* details.2210
* @param token reposition request token2211
* @since 32212
*/2213
void (*repositioned)(void *data,2214
struct xdg_popup *xdg_popup,2215
uint32_t token);2216
};2218
/**2219
* @ingroup iface_xdg_popup2220
*/2221
static inline int2222
xdg_popup_add_listener(struct xdg_popup *xdg_popup,2223
const struct xdg_popup_listener *listener, void *data)2224
{2225
return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,2226
(void (**)(void)) listener, data);2227
}2229
#define XDG_POPUP_DESTROY 02230
#define XDG_POPUP_GRAB 12231
#define XDG_POPUP_REPOSITION 22233
/**2234
* @ingroup iface_xdg_popup2235
*/2236
#define XDG_POPUP_CONFIGURE_SINCE_VERSION 12237
/**2238
* @ingroup iface_xdg_popup2239
*/2240
#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 12241
/**2242
* @ingroup iface_xdg_popup2243
*/2244
#define XDG_POPUP_REPOSITIONED_SINCE_VERSION 32246
/**2247
* @ingroup iface_xdg_popup2248
*/2249
#define XDG_POPUP_DESTROY_SINCE_VERSION 12250
/**2251
* @ingroup iface_xdg_popup2252
*/2253
#define XDG_POPUP_GRAB_SINCE_VERSION 12254
/**2255
* @ingroup iface_xdg_popup2256
*/2257
#define XDG_POPUP_REPOSITION_SINCE_VERSION 32259
/** @ingroup iface_xdg_popup */2260
static inline void2261
xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data)2262
{2263
wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);2264
}2266
/** @ingroup iface_xdg_popup */2267
static inline void *2268
xdg_popup_get_user_data(struct xdg_popup *xdg_popup)2269
{2270
return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);2271
}2273
static inline uint32_t2274
xdg_popup_get_version(struct xdg_popup *xdg_popup)2275
{2276
return wl_proxy_get_version((struct wl_proxy *) xdg_popup);2277
}2279
/**2280
* @ingroup iface_xdg_popup2281
*2282
* This destroys the popup. Explicitly destroying the xdg_popup2283
* object will also dismiss the popup, and unmap the surface.2284
*2285
* If this xdg_popup is not the "topmost" popup, the2286
* xdg_wm_base.not_the_topmost_popup protocol error will be sent.2287
*/2288
static inline void2289
xdg_popup_destroy(struct xdg_popup *xdg_popup)2290
{2291
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,2292
XDG_POPUP_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), WL_MARSHAL_FLAG_DESTROY);2293
}2295
/**2296
* @ingroup iface_xdg_popup2297
*2298
* This request makes the created popup take an explicit grab. An explicit2299
* grab will be dismissed when the user dismisses the popup, or when the2300
* client destroys the xdg_popup. This can be done by the user clicking2301
* outside the surface, using the keyboard, or even locking the screen2302
* through closing the lid or a timeout.2303
*2304
* If the compositor denies the grab, the popup will be immediately2305
* dismissed.2306
*2307
* This request must be used in response to some sort of user action like a2308
* button press, key press, or touch down event. The serial number of the2309
* event should be passed as 'serial'.2310
*2311
* The parent of a grabbing popup must either be an xdg_toplevel surface or2312
* another xdg_popup with an explicit grab. If the parent is another2313
* xdg_popup it means that the popups are nested, with this popup now being2314
* the topmost popup.2315
*2316
* Nested popups must be destroyed in the reverse order they were created2317
* in, e.g. the only popup you are allowed to destroy at all times is the2318
* topmost one.2319
*2320
* When compositors choose to dismiss a popup, they may dismiss every2321
* nested grabbing popup as well. When a compositor dismisses popups, it2322
* will follow the same dismissing order as required from the client.2323
*2324
* If the topmost grabbing popup is destroyed, the grab will be returned to2325
* the parent of the popup, if that parent previously had an explicit grab.2326
*2327
* If the parent is a grabbing popup which has already been dismissed, this2328
* popup will be immediately dismissed. If the parent is a popup that did2329
* not take an explicit grab, an error will be raised.2330
*2331
* During a popup grab, the client owning the grab will receive pointer2332
* and touch events for all their surfaces as normal (similar to an2333
* "owner-events" grab in X11 parlance), while the top most grabbing popup2334
* will always have keyboard focus.2335
*/2336
static inline void2337
xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t serial)2338
{2339
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,2340
XDG_POPUP_GRAB, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, seat, serial);2341
}2343
/**2344
* @ingroup iface_xdg_popup2345
*2346
* Reposition an already-mapped popup. The popup will be placed given the2347
* details in the passed xdg_positioner object, and a2348
* xdg_popup.repositioned followed by xdg_popup.configure and2349
* xdg_surface.configure will be emitted in response. Any parameters set2350
* by the previous positioner will be discarded.2351
*2352
* The passed token will be sent in the corresponding2353
* xdg_popup.repositioned event. The new popup position will not take2354
* effect until the corresponding configure event is acknowledged by the2355
* client. See xdg_popup.repositioned for details. The token itself is2356
* opaque, and has no other special meaning.2357
*2358
* If multiple reposition requests are sent, the compositor may skip all2359
* but the last one.2360
*2361
* If the popup is repositioned in response to a configure event for its2362
* parent, the client should send an xdg_positioner.set_parent_configure2363
* and possibly an xdg_positioner.set_parent_size request to allow the2364
* compositor to properly constrain the popup.2365
*2366
* If the popup is repositioned together with a parent that is being2367
* resized, but not in response to a configure event, the client should2368
* send an xdg_positioner.set_parent_size request.2369
*/2370
static inline void2371
xdg_popup_reposition(struct xdg_popup *xdg_popup, struct xdg_positioner *positioner, uint32_t token)2372
{2373
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,2374
XDG_POPUP_REPOSITION, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, positioner, token);2375
}2377
#ifdef __cplusplus2378
}2379
#endif2381
#endif