1 | /* Generated by wayland-scanner 1.13.0 */ |
2 | // Hand-edited to resolve conflicts with xdg-shell stable |
3 | // And make it build with libwayland < 1.10 |
4 | |
5 | #ifndef XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H |
6 | #define XDG_SHELL_UNSTABLE_V5_CLIENT_PROTOCOL_H |
7 | |
8 | #include <stdint.h> |
9 | #include <stddef.h> |
10 | #include "wayland-client-core.h" |
11 | |
12 | #ifdef __cplusplus |
13 | extern "C" { |
14 | #endif |
15 | |
16 | /** |
17 | * @page page_xdg_shell_unstable_v5 The xdg_shell_unstable_v5 protocol |
18 | * @section page_ifaces_xdg_shell_unstable_v5 Interfaces |
19 | * - @subpage page_iface_xdg_shell_v5 - create desktop-style surfaces |
20 | * - @subpage page_iface_xdg_surface_v5 - A desktop window |
21 | * - @subpage page_iface_xdg_popup_v5 - short-lived, popup surfaces for menus |
22 | * @section page_copyright_xdg_shell_unstable_v5 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 | * |
30 | * Permission is hereby granted, free of charge, to any person obtaining a |
31 | * copy of this software and associated documentation files (the "Software"), |
32 | * to deal in the Software without restriction, including without limitation |
33 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
34 | * and/or sell copies of the Software, and to permit persons to whom the |
35 | * Software is furnished to do so, subject to the following conditions: |
36 | * |
37 | * The above copyright notice and this permission notice (including the next |
38 | * paragraph) shall be included in all copies or substantial portions of the |
39 | * Software. |
40 | * |
41 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
42 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
43 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
44 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
45 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
46 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
47 | * DEALINGS IN THE SOFTWARE. |
48 | * </pre> |
49 | */ |
50 | struct wl_output; |
51 | struct wl_seat; |
52 | struct wl_surface; |
53 | struct ; |
54 | struct xdg_shell_v5; |
55 | struct xdg_surface_v5; |
56 | |
57 | /** |
58 | * @page page_iface_xdg_shell_v5 xdg_shell |
59 | * @section page_iface_xdg_shell_desc Description |
60 | * |
61 | * xdg_shell_v5 allows clients to turn a wl_surface into a "real window" |
62 | * which can be dragged, resized, stacked, and moved around by the |
63 | * user. Everything about this interface is suited towards traditional |
64 | * desktop environments. |
65 | * @section page_iface_xdg_shell_api API |
66 | * See @ref iface_xdg_shell. |
67 | */ |
68 | /** |
69 | * @defgroup iface_xdg_shell_v5 The xdg_shell_v5 interface |
70 | * |
71 | * xdg_shell_v5 allows clients to turn a wl_surface into a "real window" |
72 | * which can be dragged, resized, stacked, and moved around by the |
73 | * user. Everything about this interface is suited towards traditional |
74 | * desktop environments. |
75 | */ |
76 | extern const struct wl_interface xdg_shell_v5_interface; |
77 | /** |
78 | * @page page_iface_xdg_surface_v5 xdg_surface |
79 | * @section page_iface_xdg_surface_desc Description |
80 | * |
81 | * An interface that may be implemented by a wl_surface, for |
82 | * implementations that provide a desktop-style user interface. |
83 | * |
84 | * It provides requests to treat surfaces like windows, allowing to set |
85 | * properties like maximized, fullscreen, minimized, and to move and resize |
86 | * them, and associate metadata like title and app id. |
87 | * |
88 | * The client must call wl_surface.commit on the corresponding wl_surface |
89 | * for the xdg_surface_v5 state to take effect. Prior to committing the new |
90 | * state, it can set up initial configuration, such as maximizing or setting |
91 | * a window geometry. |
92 | * |
93 | * Even without attaching a buffer the compositor must respond to initial |
94 | * committed configuration, for instance sending a configure event with |
95 | * expected window geometry if the client maximized its surface during |
96 | * initialization. |
97 | * |
98 | * For a surface to be mapped by the compositor the client must have |
99 | * committed both an xdg_surface_v5 state and a buffer. |
100 | * @section page_iface_xdg_surface_api API |
101 | * See @ref iface_xdg_surface. |
102 | */ |
103 | /** |
104 | * @defgroup iface_xdg_surface_v5 The xdg_surface_v5 interface |
105 | * |
106 | * An interface that may be implemented by a wl_surface, for |
107 | * implementations that provide a desktop-style user interface. |
108 | * |
109 | * It provides requests to treat surfaces like windows, allowing to set |
110 | * properties like maximized, fullscreen, minimized, and to move and resize |
111 | * them, and associate metadata like title and app id. |
112 | * |
113 | * The client must call wl_surface.commit on the corresponding wl_surface |
114 | * for the xdg_surface_v5 state to take effect. Prior to committing the new |
115 | * state, it can set up initial configuration, such as maximizing or setting |
116 | * a window geometry. |
117 | * |
118 | * Even without attaching a buffer the compositor must respond to initial |
119 | * committed configuration, for instance sending a configure event with |
120 | * expected window geometry if the client maximized its surface during |
121 | * initialization. |
122 | * |
123 | * For a surface to be mapped by the compositor the client must have |
124 | * committed both an xdg_surface_v5 state and a buffer. |
125 | */ |
126 | extern const struct wl_interface xdg_surface_v5_interface; |
127 | /** |
128 | * @page page_iface_xdg_popup_v5 xdg_popup |
129 | * @section page_iface_xdg_popup_desc Description |
130 | * |
131 | * A popup surface is a short-lived, temporary surface that can be |
132 | * used to implement menus. It takes an explicit grab on the surface |
133 | * that will be dismissed when the user dismisses the popup. This can |
134 | * be done by the user clicking outside the surface, using the keyboard, |
135 | * or even locking the screen through closing the lid or a timeout. |
136 | * |
137 | * When the popup is dismissed, a popup_done event will be sent out, |
138 | * and at the same time the surface will be unmapped. The xdg_popup |
139 | * object is now inert and cannot be reactivated, so clients should |
140 | * destroy it. Explicitly destroying the xdg_popup_v5 object will also |
141 | * dismiss the popup and unmap the surface. |
142 | * |
143 | * Clients will receive events for all their surfaces during this |
144 | * grab (which is an "owner-events" grab in X11 parlance). This is |
145 | * done so that users can navigate through submenus and other |
146 | * "nested" popup windows without having to dismiss the topmost |
147 | * popup. |
148 | * |
149 | * Clients that want to dismiss the popup when another surface of |
150 | * their own is clicked should dismiss the popup using the destroy |
151 | * request. |
152 | * |
153 | * The parent surface must have either an xdg_surface_v5 or xdg_popup |
154 | * role. |
155 | * |
156 | * Specifying an xdg_popup_v5 for the parent means that the popups are |
157 | * nested, with this popup now being the topmost popup. Nested |
158 | * popups must be destroyed in the reverse order they were created |
159 | * in, e.g. the only popup you are allowed to destroy at all times |
160 | * is the topmost one. |
161 | * |
162 | * If there is an existing popup when creating a new popup, the |
163 | * parent must be the current topmost popup. |
164 | * |
165 | * A parent surface must be mapped before the new popup is mapped. |
166 | * |
167 | * When compositors choose to dismiss a popup, they will likely |
168 | * dismiss every nested popup as well. When a compositor dismisses |
169 | * popups, it will follow the same dismissing order as required |
170 | * from the client. |
171 | * |
172 | * The x and y arguments passed when creating the popup object specify |
173 | * where the top left of the popup should be placed, relative to the |
174 | * local surface coordinates of the parent surface. See |
175 | * xdg_shell.get_xdg_popup. |
176 | * |
177 | * The client must call wl_surface.commit on the corresponding wl_surface |
178 | * for the xdg_popup_v5 state to take effect. |
179 | * |
180 | * For a surface to be mapped by the compositor the client must have |
181 | * committed both the xdg_popup_v5 state and a buffer. |
182 | * @section page_iface_xdg_popup_api API |
183 | * See @ref iface_xdg_popup. |
184 | */ |
185 | /** |
186 | * @defgroup iface_xdg_popup_v5 The xdg_popup_v5 interface |
187 | * |
188 | * A popup surface is a short-lived, temporary surface that can be |
189 | * used to implement menus. It takes an explicit grab on the surface |
190 | * that will be dismissed when the user dismisses the popup. This can |
191 | * be done by the user clicking outside the surface, using the keyboard, |
192 | * or even locking the screen through closing the lid or a timeout. |
193 | * |
194 | * When the popup is dismissed, a popup_done event will be sent out, |
195 | * and at the same time the surface will be unmapped. The xdg_popup |
196 | * object is now inert and cannot be reactivated, so clients should |
197 | * destroy it. Explicitly destroying the xdg_popup_v5 object will also |
198 | * dismiss the popup and unmap the surface. |
199 | * |
200 | * Clients will receive events for all their surfaces during this |
201 | * grab (which is an "owner-events" grab in X11 parlance). This is |
202 | * done so that users can navigate through submenus and other |
203 | * "nested" popup windows without having to dismiss the topmost |
204 | * popup. |
205 | * |
206 | * Clients that want to dismiss the popup when another surface of |
207 | * their own is clicked should dismiss the popup using the destroy |
208 | * request. |
209 | * |
210 | * The parent surface must have either an xdg_surface_v5 or xdg_popup |
211 | * role. |
212 | * |
213 | * Specifying an xdg_popup_v5 for the parent means that the popups are |
214 | * nested, with this popup now being the topmost popup. Nested |
215 | * popups must be destroyed in the reverse order they were created |
216 | * in, e.g. the only popup you are allowed to destroy at all times |
217 | * is the topmost one. |
218 | * |
219 | * If there is an existing popup when creating a new popup, the |
220 | * parent must be the current topmost popup. |
221 | * |
222 | * A parent surface must be mapped before the new popup is mapped. |
223 | * |
224 | * When compositors choose to dismiss a popup, they will likely |
225 | * dismiss every nested popup as well. When a compositor dismisses |
226 | * popups, it will follow the same dismissing order as required |
227 | * from the client. |
228 | * |
229 | * The x and y arguments passed when creating the popup object specify |
230 | * where the top left of the popup should be placed, relative to the |
231 | * local surface coordinates of the parent surface. See |
232 | * xdg_shell.get_xdg_popup. |
233 | * |
234 | * The client must call wl_surface.commit on the corresponding wl_surface |
235 | * for the xdg_popup_v5 state to take effect. |
236 | * |
237 | * For a surface to be mapped by the compositor the client must have |
238 | * committed both the xdg_popup_v5 state and a buffer. |
239 | */ |
240 | extern const struct wl_interface ; |
241 | |
242 | #ifndef XDG_SHELL_VERSION_ENUM |
243 | #define XDG_SHELL_VERSION_ENUM |
244 | /** |
245 | * @ingroup iface_xdg_shell |
246 | * latest protocol version |
247 | * |
248 | * The 'current' member of this enum gives the version of the |
249 | * protocol. Implementations can compare this to the version |
250 | * they implement using static_assert to ensure the protocol and |
251 | * implementation versions match. |
252 | */ |
253 | enum xdg_shell_version { |
254 | /** |
255 | * Always the latest version |
256 | */ |
257 | XDG_SHELL_VERSION_CURRENT = 5, |
258 | }; |
259 | #endif /* XDG_SHELL_VERSION_ENUM */ |
260 | |
261 | #ifndef XDG_SHELL_ERROR_ENUM |
262 | #define XDG_SHELL_ERROR_ENUM |
263 | enum xdg_shell_error { |
264 | /** |
265 | * given wl_surface has another role |
266 | */ |
267 | XDG_SHELL_ERROR_ROLE = 0, |
268 | /** |
269 | * xdg_shell_v5 was destroyed before children |
270 | */ |
271 | XDG_SHELL_ERROR_DEFUNCT_SURFACES = 1, |
272 | /** |
273 | * the client tried to map or destroy a non-topmost popup |
274 | */ |
275 | = 2, |
276 | /** |
277 | * the client specified an invalid popup parent surface |
278 | */ |
279 | = 3, |
280 | }; |
281 | #endif /* XDG_SHELL_ERROR_ENUM */ |
282 | |
283 | /** |
284 | * @ingroup iface_xdg_shell |
285 | * @struct xdg_shell_listener |
286 | */ |
287 | struct xdg_shell_listener { |
288 | /** |
289 | * check if the client is alive |
290 | * |
291 | * The ping event asks the client if it's still alive. Pass the |
292 | * serial specified in the event back to the compositor by sending |
293 | * a "pong" request back with the specified serial. |
294 | * |
295 | * Compositors can use this to determine if the client is still |
296 | * alive. It's unspecified what will happen if the client doesn't |
297 | * respond to the ping request, or in what timeframe. Clients |
298 | * should try to respond in a reasonable amount of time. |
299 | * |
300 | * A compositor is free to ping in any way it wants, but a client |
301 | * must always respond to any xdg_shell_v5 object it created. |
302 | * @param serial pass this to the pong request |
303 | */ |
304 | void (*ping)(void *data, |
305 | struct xdg_shell_v5 *xdg_shell_v5, |
306 | uint32_t serial); |
307 | }; |
308 | |
309 | /** |
310 | * @ingroup iface_xdg_shell |
311 | */ |
312 | static inline int |
313 | xdg_shell_add_listener(struct xdg_shell_v5 *xdg_shell, |
314 | const struct xdg_shell_listener *listener, void *data) |
315 | { |
316 | return wl_proxy_add_listener(proxy: (struct wl_proxy *) xdg_shell, |
317 | implementation: (void (**)(void)) listener, data); |
318 | } |
319 | |
320 | #define XDG_SHELL_DESTROY 0 |
321 | #define XDG_SHELL_USE_UNSTABLE_VERSION 1 |
322 | #define XDG_SHELL_GET_XDG_SURFACE 2 |
323 | #define 3 |
324 | #define XDG_SHELL_PONG 4 |
325 | |
326 | /** |
327 | * @ingroup iface_xdg_shell |
328 | */ |
329 | #define XDG_SHELL_PING_SINCE_VERSION 1 |
330 | |
331 | /** |
332 | * @ingroup iface_xdg_shell |
333 | */ |
334 | #define XDG_SHELL_DESTROY_SINCE_VERSION 1 |
335 | /** |
336 | * @ingroup iface_xdg_shell |
337 | */ |
338 | #define XDG_SHELL_USE_UNSTABLE_VERSION_SINCE_VERSION 1 |
339 | /** |
340 | * @ingroup iface_xdg_shell |
341 | */ |
342 | #define XDG_SHELL_GET_XDG_SURFACE_SINCE_VERSION 1 |
343 | /** |
344 | * @ingroup iface_xdg_shell |
345 | */ |
346 | #define 1 |
347 | /** |
348 | * @ingroup iface_xdg_shell |
349 | */ |
350 | #define XDG_SHELL_PONG_SINCE_VERSION 1 |
351 | |
352 | /** @ingroup iface_xdg_shell_v5 */ |
353 | static inline void |
354 | xdg_shell_set_user_data(struct xdg_shell_v5 *xdg_shell, void *user_data) |
355 | { |
356 | wl_proxy_set_user_data(proxy: (struct wl_proxy *) xdg_shell, user_data); |
357 | } |
358 | |
359 | /** @ingroup iface_xdg_shell_v5 */ |
360 | static inline void * |
361 | xdg_shell_get_user_data(struct xdg_shell_v5 *xdg_shell) |
362 | { |
363 | return wl_proxy_get_user_data(proxy: (struct wl_proxy *) xdg_shell); |
364 | } |
365 | |
366 | #if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 |
367 | static inline uint32_t |
368 | xdg_shell_get_version(struct xdg_shell_v5 *xdg_shell) |
369 | { |
370 | return wl_proxy_get_version(proxy: (struct wl_proxy *) xdg_shell); |
371 | } |
372 | #endif |
373 | |
374 | /** |
375 | * @ingroup iface_xdg_shell |
376 | * |
377 | * Destroy this xdg_shell_v5 object. |
378 | * |
379 | * Destroying a bound xdg_shell_v5 object while there are surfaces |
380 | * still alive created by this xdg_shell_v5 object instance is illegal |
381 | * and will result in a protocol error. |
382 | */ |
383 | static inline void |
384 | xdg_shell_destroy(struct xdg_shell_v5 *xdg_shell) |
385 | { |
386 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_shell, |
387 | XDG_SHELL_DESTROY); |
388 | |
389 | wl_proxy_destroy(proxy: (struct wl_proxy *) xdg_shell); |
390 | } |
391 | |
392 | /** |
393 | * @ingroup iface_xdg_shell |
394 | * |
395 | * Negotiate the unstable version of the interface. This |
396 | * mechanism is in place to ensure client and server agree on the |
397 | * unstable versions of the protocol that they speak or exit |
398 | * cleanly if they don't agree. This request will go away once |
399 | * the xdg-shell protocol is stable. |
400 | */ |
401 | static inline void |
402 | xdg_shell_use_unstable_version(struct xdg_shell_v5 *xdg_shell, int32_t version) |
403 | { |
404 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_shell, |
405 | XDG_SHELL_USE_UNSTABLE_VERSION, version); |
406 | } |
407 | |
408 | /** |
409 | * @ingroup iface_xdg_shell |
410 | * |
411 | * This creates an xdg_surface_v5 for the given surface and gives it the |
412 | * xdg_surface_v5 role. A wl_surface can only be given an xdg_surface_v5 role |
413 | * once. If get_xdg_surface_v5 is called with a wl_surface that already has |
414 | * an active xdg_surface_v5 associated with it, or if it had any other role, |
415 | * an error is raised. |
416 | * |
417 | * See the documentation of xdg_surface_v5 for more details about what an |
418 | * xdg_surface_v5 is and how it is used. |
419 | */ |
420 | static inline struct xdg_surface_v5 * |
421 | xdg_shell_get_xdg_surface(struct xdg_shell_v5 *xdg_shell, struct wl_surface *surface) |
422 | { |
423 | struct wl_proxy *id; |
424 | |
425 | id = wl_proxy_marshal_constructor(proxy: (struct wl_proxy *) xdg_shell, |
426 | XDG_SHELL_GET_XDG_SURFACE, interface: &xdg_surface_v5_interface, NULL, surface); |
427 | |
428 | return (struct xdg_surface_v5 *) id; |
429 | } |
430 | |
431 | /** |
432 | * @ingroup iface_xdg_shell |
433 | * |
434 | * This creates an xdg_popup_v5 for the given surface and gives it the |
435 | * xdg_popup_v5 role. A wl_surface can only be given an xdg_popup_v5 role |
436 | * once. If get_xdg_popup_v5 is called with a wl_surface that already has |
437 | * an active xdg_popup_v5 associated with it, or if it had any other role, |
438 | * an error is raised. |
439 | * |
440 | * This request must be used in response to some sort of user action |
441 | * like a button press, key press, or touch down event. |
442 | * |
443 | * See the documentation of xdg_popup_v5 for more details about what an |
444 | * xdg_popup_v5 is and how it is used. |
445 | */ |
446 | static inline struct xdg_popup_v5 * |
447 | (struct xdg_shell_v5 *xdg_shell, struct wl_surface *surface, struct wl_surface *parent, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y) |
448 | { |
449 | struct wl_proxy *id; |
450 | |
451 | id = wl_proxy_marshal_constructor(proxy: (struct wl_proxy *) xdg_shell, |
452 | XDG_SHELL_GET_XDG_POPUP, interface: &xdg_popup_v5_interface, NULL, surface, parent, seat, serial, x, y); |
453 | |
454 | return (struct xdg_popup_v5 *) id; |
455 | } |
456 | |
457 | /** |
458 | * @ingroup iface_xdg_shell |
459 | * |
460 | * A client must respond to a ping event with a pong request or |
461 | * the client may be deemed unresponsive. |
462 | */ |
463 | static inline void |
464 | xdg_shell_pong(struct xdg_shell_v5 *xdg_shell, uint32_t serial) |
465 | { |
466 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_shell, |
467 | XDG_SHELL_PONG, serial); |
468 | } |
469 | |
470 | #ifndef XDG_SURFACE_RESIZE_EDGE_ENUM |
471 | #define XDG_SURFACE_RESIZE_EDGE_ENUM |
472 | /** |
473 | * @ingroup iface_xdg_surface |
474 | * edge values for resizing |
475 | * |
476 | * These values are used to indicate which edge of a surface |
477 | * is being dragged in a resize operation. |
478 | */ |
479 | enum xdg_surface_resize_edge { |
480 | XDG_SURFACE_RESIZE_EDGE_NONE = 0, |
481 | XDG_SURFACE_RESIZE_EDGE_TOP = 1, |
482 | XDG_SURFACE_RESIZE_EDGE_BOTTOM = 2, |
483 | XDG_SURFACE_RESIZE_EDGE_LEFT = 4, |
484 | XDG_SURFACE_RESIZE_EDGE_TOP_LEFT = 5, |
485 | XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT = 6, |
486 | XDG_SURFACE_RESIZE_EDGE_RIGHT = 8, |
487 | XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT = 9, |
488 | XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT = 10, |
489 | }; |
490 | #endif /* XDG_SURFACE_RESIZE_EDGE_ENUM */ |
491 | |
492 | #ifndef XDG_SURFACE_STATE_ENUM |
493 | #define XDG_SURFACE_STATE_ENUM |
494 | /** |
495 | * @ingroup iface_xdg_surface |
496 | * types of state on the surface |
497 | * |
498 | * The different state values used on the surface. This is designed for |
499 | * state values like maximized, fullscreen. It is paired with the |
500 | * configure event to ensure that both the client and the compositor |
501 | * setting the state can be synchronized. |
502 | * |
503 | * States set in this way are double-buffered. They will get applied on |
504 | * the next commit. |
505 | * |
506 | * Desktop environments may extend this enum by taking up a range of |
507 | * values and documenting the range they chose in this description. |
508 | * They are not required to document the values for the range that they |
509 | * chose. Ideally, any good extensions from a desktop environment should |
510 | * make its way into standardization into this enum. |
511 | * |
512 | * The current reserved ranges are: |
513 | * |
514 | * 0x0000 - 0x0FFF: xdg-shell core values, documented below. |
515 | * 0x1000 - 0x1FFF: GNOME |
516 | */ |
517 | enum xdg_surface_state { |
518 | /** |
519 | * the surface is maximized |
520 | */ |
521 | XDG_SURFACE_STATE_MAXIMIZED = 1, |
522 | /** |
523 | * the surface is fullscreen |
524 | */ |
525 | XDG_SURFACE_STATE_FULLSCREEN = 2, |
526 | XDG_SURFACE_STATE_RESIZING = 3, |
527 | XDG_SURFACE_STATE_ACTIVATED = 4, |
528 | }; |
529 | #endif /* XDG_SURFACE_STATE_ENUM */ |
530 | |
531 | /** |
532 | * @ingroup iface_xdg_surface |
533 | * @struct xdg_surface_listener |
534 | */ |
535 | struct xdg_surface_listener { |
536 | /** |
537 | * suggest a surface change |
538 | * |
539 | * The configure event asks the client to resize its surface or |
540 | * to change its state. |
541 | * |
542 | * The width and height arguments specify a hint to the window |
543 | * about how its surface should be resized in window geometry |
544 | * coordinates. See set_window_geometry. |
545 | * |
546 | * If the width or height arguments are zero, it means the client |
547 | * should decide its own window dimension. This may happen when the |
548 | * compositor need to configure the state of the surface but |
549 | * doesn't have any information about any previous or expected |
550 | * dimension. |
551 | * |
552 | * The states listed in the event specify how the width/height |
553 | * arguments should be interpreted, and possibly how it should be |
554 | * drawn. |
555 | * |
556 | * Clients should arrange their surface for the new size and |
557 | * states, and then send a ack_configure request with the serial |
558 | * sent in this configure event at some point before committing the |
559 | * new surface. |
560 | * |
561 | * If the client receives multiple configure events before it can |
562 | * respond to one, it is free to discard all but the last event it |
563 | * received. |
564 | */ |
565 | void (*configure)(void *data, |
566 | struct xdg_surface_v5 *xdg_surface_v5, |
567 | int32_t width, |
568 | int32_t height, |
569 | struct wl_array *states, |
570 | uint32_t serial); |
571 | /** |
572 | * surface wants to be closed |
573 | * |
574 | * The close event is sent by the compositor when the user wants |
575 | * the surface to be closed. This should be equivalent to the user |
576 | * clicking the close button in client-side decorations, if your |
577 | * application has any... |
578 | * |
579 | * This is only a request that the user intends to close your |
580 | * window. The client may choose to ignore this request, or show a |
581 | * dialog to ask the user to save their data... |
582 | */ |
583 | void (*close)(void *data, |
584 | struct xdg_surface_v5 *xdg_surface_v5); |
585 | }; |
586 | |
587 | /** |
588 | * @ingroup iface_xdg_surface |
589 | */ |
590 | static inline int |
591 | xdg_surface_add_listener(struct xdg_surface_v5 *xdg_surface, |
592 | const struct xdg_surface_listener *listener, void *data) |
593 | { |
594 | return wl_proxy_add_listener(proxy: (struct wl_proxy *) xdg_surface, |
595 | implementation: (void (**)(void)) listener, data); |
596 | } |
597 | |
598 | #define XDG_SURFACE_DESTROY 0 |
599 | #define XDG_SURFACE_SET_PARENT 1 |
600 | #define XDG_SURFACE_SET_TITLE 2 |
601 | #define XDG_SURFACE_SET_APP_ID 3 |
602 | #define 4 |
603 | #define XDG_SURFACE_MOVE 5 |
604 | #define XDG_SURFACE_RESIZE 6 |
605 | #define XDG_SURFACE_ACK_CONFIGURE 7 |
606 | #define XDG_SURFACE_SET_WINDOW_GEOMETRY 8 |
607 | #define XDG_SURFACE_SET_MAXIMIZED 9 |
608 | #define XDG_SURFACE_UNSET_MAXIMIZED 10 |
609 | #define XDG_SURFACE_SET_FULLSCREEN 11 |
610 | #define XDG_SURFACE_UNSET_FULLSCREEN 12 |
611 | #define XDG_SURFACE_SET_MINIMIZED 13 |
612 | |
613 | /** |
614 | * @ingroup iface_xdg_surface |
615 | */ |
616 | #define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1 |
617 | /** |
618 | * @ingroup iface_xdg_surface |
619 | */ |
620 | #define XDG_SURFACE_CLOSE_SINCE_VERSION 1 |
621 | |
622 | /** |
623 | * @ingroup iface_xdg_surface |
624 | */ |
625 | #define XDG_SURFACE_DESTROY_SINCE_VERSION 1 |
626 | /** |
627 | * @ingroup iface_xdg_surface |
628 | */ |
629 | #define XDG_SURFACE_SET_PARENT_SINCE_VERSION 1 |
630 | /** |
631 | * @ingroup iface_xdg_surface |
632 | */ |
633 | #define XDG_SURFACE_SET_TITLE_SINCE_VERSION 1 |
634 | /** |
635 | * @ingroup iface_xdg_surface |
636 | */ |
637 | #define XDG_SURFACE_SET_APP_ID_SINCE_VERSION 1 |
638 | /** |
639 | * @ingroup iface_xdg_surface |
640 | */ |
641 | #define 1 |
642 | /** |
643 | * @ingroup iface_xdg_surface |
644 | */ |
645 | #define XDG_SURFACE_MOVE_SINCE_VERSION 1 |
646 | /** |
647 | * @ingroup iface_xdg_surface |
648 | */ |
649 | #define XDG_SURFACE_RESIZE_SINCE_VERSION 1 |
650 | /** |
651 | * @ingroup iface_xdg_surface |
652 | */ |
653 | #define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1 |
654 | /** |
655 | * @ingroup iface_xdg_surface |
656 | */ |
657 | #define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1 |
658 | /** |
659 | * @ingroup iface_xdg_surface |
660 | */ |
661 | #define XDG_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1 |
662 | /** |
663 | * @ingroup iface_xdg_surface |
664 | */ |
665 | #define XDG_SURFACE_UNSET_MAXIMIZED_SINCE_VERSION 1 |
666 | /** |
667 | * @ingroup iface_xdg_surface |
668 | */ |
669 | #define XDG_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1 |
670 | /** |
671 | * @ingroup iface_xdg_surface |
672 | */ |
673 | #define XDG_SURFACE_UNSET_FULLSCREEN_SINCE_VERSION 1 |
674 | /** |
675 | * @ingroup iface_xdg_surface |
676 | */ |
677 | #define XDG_SURFACE_SET_MINIMIZED_SINCE_VERSION 1 |
678 | |
679 | /** @ingroup iface_xdg_surface_v5 */ |
680 | static inline void |
681 | xdg_surface_set_user_data(struct xdg_surface_v5 *xdg_surface, void *user_data) |
682 | { |
683 | wl_proxy_set_user_data(proxy: (struct wl_proxy *) xdg_surface, user_data); |
684 | } |
685 | |
686 | /** @ingroup iface_xdg_surface_v5 */ |
687 | static inline void * |
688 | xdg_surface_get_user_data(struct xdg_surface_v5 *xdg_surface) |
689 | { |
690 | return wl_proxy_get_user_data(proxy: (struct wl_proxy *) xdg_surface); |
691 | } |
692 | |
693 | #if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 |
694 | static inline uint32_t |
695 | xdg_surface_get_version(struct xdg_surface_v5 *xdg_surface) |
696 | { |
697 | return wl_proxy_get_version(proxy: (struct wl_proxy *) xdg_surface); |
698 | } |
699 | #endif |
700 | |
701 | /** |
702 | * @ingroup iface_xdg_surface |
703 | * |
704 | * Unmap and destroy the window. The window will be effectively |
705 | * hidden from the user's point of view, and all state like |
706 | * maximization, fullscreen, and so on, will be lost. |
707 | */ |
708 | static inline void |
709 | xdg_surface_destroy(struct xdg_surface_v5 *xdg_surface) |
710 | { |
711 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
712 | XDG_SURFACE_DESTROY); |
713 | |
714 | wl_proxy_destroy(proxy: (struct wl_proxy *) xdg_surface); |
715 | } |
716 | |
717 | /** |
718 | * @ingroup iface_xdg_surface |
719 | * |
720 | * Set the "parent" of this surface. This window should be stacked |
721 | * above a parent. The parent surface must be mapped as long as this |
722 | * surface is mapped. |
723 | * |
724 | * Parent windows should be set on dialogs, toolboxes, or other |
725 | * "auxiliary" surfaces, so that the parent is raised when the dialog |
726 | * is raised. |
727 | */ |
728 | static inline void |
729 | xdg_surface_set_parent(struct xdg_surface_v5 *xdg_surface, struct xdg_surface_v5 *parent) |
730 | { |
731 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
732 | XDG_SURFACE_SET_PARENT, parent); |
733 | } |
734 | |
735 | /** |
736 | * @ingroup iface_xdg_surface |
737 | * |
738 | * Set a short title for the surface. |
739 | * |
740 | * This string may be used to identify the surface in a task bar, |
741 | * window list, or other user interface elements provided by the |
742 | * compositor. |
743 | * |
744 | * The string must be encoded in UTF-8. |
745 | */ |
746 | static inline void |
747 | xdg_surface_set_title(struct xdg_surface_v5 *xdg_surface, const char *title) |
748 | { |
749 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
750 | XDG_SURFACE_SET_TITLE, title); |
751 | } |
752 | |
753 | /** |
754 | * @ingroup iface_xdg_surface |
755 | * |
756 | * Set an application identifier for the surface. |
757 | * |
758 | * The app ID identifies the general class of applications to which |
759 | * the surface belongs. The compositor can use this to group multiple |
760 | * surfaces together, or to determine how to launch a new application. |
761 | * |
762 | * For D-Bus activatable applications, the app ID is used as the D-Bus |
763 | * service name. |
764 | * |
765 | * The compositor shell will try to group application surfaces together |
766 | * by their app ID. As a best practice, it is suggested to select app |
767 | * ID's that match the basename of the application's .desktop file. |
768 | * For example, "org.freedesktop.FooViewer" where the .desktop file is |
769 | * "org.freedesktop.FooViewer.desktop". |
770 | * |
771 | * See the desktop-entry specification [0] for more details on |
772 | * application identifiers and how they relate to well-known D-Bus |
773 | * names and .desktop files. |
774 | * |
775 | * [0] http://standards.freedesktop.org/desktop-entry-spec/ |
776 | */ |
777 | static inline void |
778 | xdg_surface_set_app_id(struct xdg_surface_v5 *xdg_surface, const char *app_id) |
779 | { |
780 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
781 | XDG_SURFACE_SET_APP_ID, app_id); |
782 | } |
783 | |
784 | /** |
785 | * @ingroup iface_xdg_surface |
786 | * |
787 | * Clients implementing client-side decorations might want to show |
788 | * a context menu when right-clicking on the decorations, giving the |
789 | * user a menu that they can use to maximize or minimize the window. |
790 | * |
791 | * This request asks the compositor to pop up such a window menu at |
792 | * the given position, relative to the local surface coordinates of |
793 | * the parent surface. There are no guarantees as to what menu items |
794 | * the window menu contains. |
795 | * |
796 | * This request must be used in response to some sort of user action |
797 | * like a button press, key press, or touch down event. |
798 | */ |
799 | static inline void |
800 | (struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y) |
801 | { |
802 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
803 | XDG_SURFACE_SHOW_WINDOW_MENU, seat, serial, x, y); |
804 | } |
805 | |
806 | /** |
807 | * @ingroup iface_xdg_surface |
808 | * |
809 | * Start an interactive, user-driven move of the surface. |
810 | * |
811 | * This request must be used in response to some sort of user action |
812 | * like a button press, key press, or touch down event. The passed |
813 | * serial is used to determine the type of interactive move (touch, |
814 | * pointer, etc). |
815 | * |
816 | * The server may ignore move requests depending on the state of |
817 | * the surface (e.g. fullscreen or maximized), or if the passed serial |
818 | * is no longer valid. |
819 | * |
820 | * If triggered, the surface will lose the focus of the device |
821 | * (wl_pointer, wl_touch, etc) used for the move. It is up to the |
822 | * compositor to visually indicate that the move is taking place, such as |
823 | * updating a pointer cursor, during the move. There is no guarantee |
824 | * that the device focus will return when the move is completed. |
825 | */ |
826 | static inline void |
827 | xdg_surface_move(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial) |
828 | { |
829 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
830 | XDG_SURFACE_MOVE, seat, serial); |
831 | } |
832 | |
833 | /** |
834 | * @ingroup iface_xdg_surface |
835 | * |
836 | * Start a user-driven, interactive resize of the surface. |
837 | * |
838 | * This request must be used in response to some sort of user action |
839 | * like a button press, key press, or touch down event. The passed |
840 | * serial is used to determine the type of interactive resize (touch, |
841 | * pointer, etc). |
842 | * |
843 | * The server may ignore resize requests depending on the state of |
844 | * the surface (e.g. fullscreen or maximized). |
845 | * |
846 | * If triggered, the client will receive configure events with the |
847 | * "resize" state enum value and the expected sizes. See the "resize" |
848 | * enum value for more details about what is required. The client |
849 | * must also acknowledge configure events using "ack_configure". After |
850 | * the resize is completed, the client will receive another "configure" |
851 | * event without the resize state. |
852 | * |
853 | * If triggered, the surface also will lose the focus of the device |
854 | * (wl_pointer, wl_touch, etc) used for the resize. It is up to the |
855 | * compositor to visually indicate that the resize is taking place, |
856 | * such as updating a pointer cursor, during the resize. There is no |
857 | * guarantee that the device focus will return when the resize is |
858 | * completed. |
859 | * |
860 | * The edges parameter specifies how the surface should be resized, |
861 | * and is one of the values of the resize_edge enum. The compositor |
862 | * may use this information to update the surface position for |
863 | * example when dragging the top left corner. The compositor may also |
864 | * use this information to adapt its behavior, e.g. choose an |
865 | * appropriate cursor image. |
866 | */ |
867 | static inline void |
868 | xdg_surface_resize(struct xdg_surface_v5 *xdg_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges) |
869 | { |
870 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
871 | XDG_SURFACE_RESIZE, seat, serial, edges); |
872 | } |
873 | |
874 | /** |
875 | * @ingroup iface_xdg_surface |
876 | * |
877 | * When a configure event is received, if a client commits the |
878 | * surface in response to the configure event, then the client |
879 | * must make a ack_configure request before the commit request, |
880 | * passing along the serial of the configure event. |
881 | * |
882 | * For instance, the compositor might use this information to move |
883 | * a surface to the top left only when the client has drawn itself |
884 | * for the maximized or fullscreen state. |
885 | * |
886 | * If the client receives multiple configure events before it |
887 | * can respond to one, it only has to ack the last configure event. |
888 | */ |
889 | static inline void |
890 | xdg_surface_ack_configure(struct xdg_surface_v5 *xdg_surface, uint32_t serial) |
891 | { |
892 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
893 | XDG_SURFACE_ACK_CONFIGURE, serial); |
894 | } |
895 | |
896 | /** |
897 | * @ingroup iface_xdg_surface |
898 | * |
899 | * The window geometry of a window is its "visible bounds" from the |
900 | * user's perspective. Client-side decorations often have invisible |
901 | * portions like drop-shadows which should be ignored for the |
902 | * purposes of aligning, placing and constraining windows. |
903 | * |
904 | * The window geometry is double buffered, and will be applied at the |
905 | * time wl_surface.commit of the corresponding wl_surface is called. |
906 | * |
907 | * Once the window geometry of the surface is set once, it is not |
908 | * possible to unset it, and it will remain the same until |
909 | * set_window_geometry is called again, even if a new subsurface or |
910 | * buffer is attached. |
911 | * |
912 | * If never set, the value is the full bounds of the surface, |
913 | * including any subsurfaces. This updates dynamically on every |
914 | * commit. This unset mode is meant for extremely simple clients. |
915 | * |
916 | * If responding to a configure event, the window geometry in here |
917 | * must respect the sizing negotiations specified by the states in |
918 | * the configure event. |
919 | * |
920 | * The arguments are given in the surface local coordinate space of |
921 | * the wl_surface associated with this xdg_surface. |
922 | * |
923 | * The width and height must be greater than zero. |
924 | */ |
925 | static inline void |
926 | xdg_surface_set_window_geometry(struct xdg_surface_v5 *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height) |
927 | { |
928 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
929 | XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height); |
930 | } |
931 | |
932 | /** |
933 | * @ingroup iface_xdg_surface |
934 | * |
935 | * Maximize the surface. |
936 | * |
937 | * After requesting that the surface should be maximized, the compositor |
938 | * will respond by emitting a configure event with the "maximized" state |
939 | * and the required window geometry. The client should then update its |
940 | * content, drawing it in a maximized state, i.e. without shadow or other |
941 | * decoration outside of the window geometry. The client must also |
942 | * acknowledge the configure when committing the new content (see |
943 | * ack_configure). |
944 | * |
945 | * It is up to the compositor to decide how and where to maximize the |
946 | * surface, for example which output and what region of the screen should |
947 | * be used. |
948 | * |
949 | * If the surface was already maximized, the compositor will still emit |
950 | * a configure event with the "maximized" state. |
951 | */ |
952 | static inline void |
953 | xdg_surface_set_maximized(struct xdg_surface_v5 *xdg_surface) |
954 | { |
955 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
956 | XDG_SURFACE_SET_MAXIMIZED); |
957 | } |
958 | |
959 | /** |
960 | * @ingroup iface_xdg_surface |
961 | * |
962 | * Unmaximize the surface. |
963 | * |
964 | * After requesting that the surface should be unmaximized, the compositor |
965 | * will respond by emitting a configure event without the "maximized" |
966 | * state. If available, the compositor will include the window geometry |
967 | * dimensions the window had prior to being maximized in the configure |
968 | * request. The client must then update its content, drawing it in a |
969 | * regular state, i.e. potentially with shadow, etc. The client must also |
970 | * acknowledge the configure when committing the new content (see |
971 | * ack_configure). |
972 | * |
973 | * It is up to the compositor to position the surface after it was |
974 | * unmaximized; usually the position the surface had before maximizing, if |
975 | * applicable. |
976 | * |
977 | * If the surface was already not maximized, the compositor will still |
978 | * emit a configure event without the "maximized" state. |
979 | */ |
980 | static inline void |
981 | xdg_surface_unset_maximized(struct xdg_surface_v5 *xdg_surface) |
982 | { |
983 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
984 | XDG_SURFACE_UNSET_MAXIMIZED); |
985 | } |
986 | |
987 | /** |
988 | * @ingroup iface_xdg_surface |
989 | * |
990 | * Make the surface fullscreen. |
991 | * |
992 | * You can specify an output that you would prefer to be fullscreen. |
993 | * If this value is NULL, it's up to the compositor to choose which |
994 | * display will be used to map this surface. |
995 | * |
996 | * If the surface doesn't cover the whole output, the compositor will |
997 | * position the surface in the center of the output and compensate with |
998 | * black borders filling the rest of the output. |
999 | */ |
1000 | static inline void |
1001 | xdg_surface_set_fullscreen(struct xdg_surface_v5 *xdg_surface, struct wl_output *output) |
1002 | { |
1003 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
1004 | XDG_SURFACE_SET_FULLSCREEN, output); |
1005 | } |
1006 | |
1007 | /** |
1008 | * @ingroup iface_xdg_surface |
1009 | */ |
1010 | static inline void |
1011 | xdg_surface_unset_fullscreen(struct xdg_surface_v5 *xdg_surface) |
1012 | { |
1013 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
1014 | XDG_SURFACE_UNSET_FULLSCREEN); |
1015 | } |
1016 | |
1017 | /** |
1018 | * @ingroup iface_xdg_surface |
1019 | * |
1020 | * Request that the compositor minimize your surface. There is no |
1021 | * way to know if the surface is currently minimized, nor is there |
1022 | * any way to unset minimization on this surface. |
1023 | * |
1024 | * If you are looking to throttle redrawing when minimized, please |
1025 | * instead use the wl_surface.frame event for this, as this will |
1026 | * also work with live previews on windows in Alt-Tab, Expose or |
1027 | * similar compositor features. |
1028 | */ |
1029 | static inline void |
1030 | xdg_surface_set_minimized(struct xdg_surface_v5 *xdg_surface) |
1031 | { |
1032 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_surface, |
1033 | XDG_SURFACE_SET_MINIMIZED); |
1034 | } |
1035 | |
1036 | /** |
1037 | * @ingroup iface_xdg_popup |
1038 | * @struct xdg_popup_listener |
1039 | */ |
1040 | struct { |
1041 | /** |
1042 | * popup interaction is done |
1043 | * |
1044 | * The popup_done event is sent out when a popup is dismissed by |
1045 | * the compositor. The client should destroy the xdg_popup_v5 object |
1046 | * at this point. |
1047 | */ |
1048 | void (*)(void *data, |
1049 | struct xdg_popup_v5 *); |
1050 | }; |
1051 | |
1052 | /** |
1053 | * @ingroup iface_xdg_popup |
1054 | */ |
1055 | static inline int |
1056 | (struct xdg_popup_v5 *, |
1057 | const struct xdg_popup_listener *listener, void *data) |
1058 | { |
1059 | return wl_proxy_add_listener(proxy: (struct wl_proxy *) xdg_popup, |
1060 | implementation: (void (**)(void)) listener, data); |
1061 | } |
1062 | |
1063 | #define 0 |
1064 | |
1065 | /** |
1066 | * @ingroup iface_xdg_popup |
1067 | */ |
1068 | #define 1 |
1069 | |
1070 | /** |
1071 | * @ingroup iface_xdg_popup |
1072 | */ |
1073 | #define 1 |
1074 | |
1075 | /** @ingroup iface_xdg_popup_v5 */ |
1076 | static inline void |
1077 | (struct xdg_popup_v5 *, void *user_data) |
1078 | { |
1079 | wl_proxy_set_user_data(proxy: (struct wl_proxy *) xdg_popup, user_data); |
1080 | } |
1081 | |
1082 | /** @ingroup iface_xdg_popup_v5 */ |
1083 | static inline void * |
1084 | (struct xdg_popup_v5 *) |
1085 | { |
1086 | return wl_proxy_get_user_data(proxy: (struct wl_proxy *) xdg_popup); |
1087 | } |
1088 | |
1089 | #if WAYLAND_VERSION_MAJOR > 1 || WAYLAND_VERSION_MINOR >= 10 |
1090 | static inline uint32_t |
1091 | (struct xdg_popup_v5 *) |
1092 | { |
1093 | return wl_proxy_get_version(proxy: (struct wl_proxy *) xdg_popup); |
1094 | } |
1095 | #endif |
1096 | |
1097 | /** |
1098 | * @ingroup iface_xdg_popup |
1099 | * |
1100 | * This destroys the popup. Explicitly destroying the xdg_popup |
1101 | * object will also dismiss the popup, and unmap the surface. |
1102 | * |
1103 | * If this xdg_popup_v5 is not the "topmost" popup, a protocol error |
1104 | * will be sent. |
1105 | */ |
1106 | static inline void |
1107 | (struct xdg_popup_v5 *) |
1108 | { |
1109 | wl_proxy_marshal(p: (struct wl_proxy *) xdg_popup, |
1110 | XDG_POPUP_DESTROY); |
1111 | |
1112 | wl_proxy_destroy(proxy: (struct wl_proxy *) xdg_popup); |
1113 | } |
1114 | |
1115 | #ifdef __cplusplus |
1116 | } |
1117 | #endif |
1118 | |
1119 | #endif |
1120 | |