-
Notifications
You must be signed in to change notification settings - Fork 0
/
xdg-shell-client-protocol.h
2327 lines (2227 loc) · 82.1 KB
/
xdg-shell-client-protocol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Generated by wayland-scanner 1.22.0 */
#ifndef XDG_SHELL_CLIENT_PROTOCOL_H
#define XDG_SHELL_CLIENT_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-client.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @page page_xdg_shell The xdg_shell protocol
* @section page_ifaces_xdg_shell Interfaces
* - @subpage page_iface_xdg_wm_base - create desktop-style surfaces
* - @subpage page_iface_xdg_positioner - child surface positioner
* - @subpage page_iface_xdg_surface - desktop user interface surface base interface
* - @subpage page_iface_xdg_toplevel - toplevel surface
* - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus
* @section page_copyright_xdg_shell Copyright
* <pre>
*
* Copyright © 2008-2013 Kristian Høgsberg
* Copyright © 2013 Rafael Antognolli
* Copyright © 2013 Jasper St. Pierre
* Copyright © 2010-2013 Intel Corporation
* Copyright © 2015-2017 Samsung Electronics Co., Ltd
* Copyright © 2015-2017 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
* </pre>
*/
struct wl_output;
struct wl_seat;
struct wl_surface;
struct xdg_popup;
struct xdg_positioner;
struct xdg_surface;
struct xdg_toplevel;
struct xdg_wm_base;
#ifndef XDG_WM_BASE_INTERFACE
#define XDG_WM_BASE_INTERFACE
/**
* @page page_iface_xdg_wm_base xdg_wm_base
* @section page_iface_xdg_wm_base_desc Description
*
* The xdg_wm_base interface is exposed as a global object enabling clients
* to turn their wl_surfaces into windows in a desktop environment. It
* defines the basic functionality needed for clients and the compositor to
* create windows that can be dragged, resized, maximized, etc, as well as
* creating transient windows such as popup menus.
* @section page_iface_xdg_wm_base_api API
* See @ref iface_xdg_wm_base.
*/
/**
* @defgroup iface_xdg_wm_base The xdg_wm_base interface
*
* The xdg_wm_base interface is exposed as a global object enabling clients
* to turn their wl_surfaces into windows in a desktop environment. It
* defines the basic functionality needed for clients and the compositor to
* create windows that can be dragged, resized, maximized, etc, as well as
* creating transient windows such as popup menus.
*/
extern const struct wl_interface xdg_wm_base_interface;
#endif
#ifndef XDG_POSITIONER_INTERFACE
#define XDG_POSITIONER_INTERFACE
/**
* @page page_iface_xdg_positioner xdg_positioner
* @section page_iface_xdg_positioner_desc Description
*
* The xdg_positioner provides a collection of rules for the placement of a
* child surface relative to a parent surface. Rules can be defined to ensure
* the child surface remains within the visible area's borders, and to
* specify how the child surface changes its position, such as sliding along
* an axis, or flipping around a rectangle. These positioner-created rules are
* constrained by the requirement that a child surface must intersect with or
* be at least partially adjacent to its parent surface.
*
* See the various requests for details about possible rules.
*
* At the time of the request, the compositor makes a copy of the rules
* specified by the xdg_positioner. Thus, after the request is complete the
* xdg_positioner object can be destroyed or reused; further changes to the
* object will have no effect on previous usages.
*
* For an xdg_positioner object to be considered complete, it must have a
* non-zero size set by set_size, and a non-zero anchor rectangle set by
* set_anchor_rect. Passing an incomplete xdg_positioner object when
* positioning a surface raises an invalid_positioner error.
* @section page_iface_xdg_positioner_api API
* See @ref iface_xdg_positioner.
*/
/**
* @defgroup iface_xdg_positioner The xdg_positioner interface
*
* The xdg_positioner provides a collection of rules for the placement of a
* child surface relative to a parent surface. Rules can be defined to ensure
* the child surface remains within the visible area's borders, and to
* specify how the child surface changes its position, such as sliding along
* an axis, or flipping around a rectangle. These positioner-created rules are
* constrained by the requirement that a child surface must intersect with or
* be at least partially adjacent to its parent surface.
*
* See the various requests for details about possible rules.
*
* At the time of the request, the compositor makes a copy of the rules
* specified by the xdg_positioner. Thus, after the request is complete the
* xdg_positioner object can be destroyed or reused; further changes to the
* object will have no effect on previous usages.
*
* For an xdg_positioner object to be considered complete, it must have a
* non-zero size set by set_size, and a non-zero anchor rectangle set by
* set_anchor_rect. Passing an incomplete xdg_positioner object when
* positioning a surface raises an invalid_positioner error.
*/
extern const struct wl_interface xdg_positioner_interface;
#endif
#ifndef XDG_SURFACE_INTERFACE
#define XDG_SURFACE_INTERFACE
/**
* @page page_iface_xdg_surface xdg_surface
* @section page_iface_xdg_surface_desc Description
*
* An interface that may be implemented by a wl_surface, for
* implementations that provide a desktop-style user interface.
*
* It provides a base set of functionality required to construct user
* interface elements requiring management by the compositor, such as
* toplevel windows, menus, etc. The types of functionality are split into
* xdg_surface roles.
*
* Creating an xdg_surface does not set the role for a wl_surface. In order
* to map an xdg_surface, the client must create a role-specific object
* using, e.g., get_toplevel, get_popup. The wl_surface for any given
* xdg_surface can have at most one role, and may not be assigned any role
* not based on xdg_surface.
*
* A role must be assigned before any other requests are made to the
* xdg_surface object.
*
* The client must call wl_surface.commit on the corresponding wl_surface
* for the xdg_surface state to take effect.
*
* Creating an xdg_surface from a wl_surface which has a buffer attached or
* committed is a client error, and any attempts by a client to attach or
* manipulate a buffer prior to the first xdg_surface.configure call must
* also be treated as errors.
*
* After creating a role-specific object and setting it up, the client must
* perform an initial commit without any buffer attached. The compositor
* will reply with initial wl_surface state such as
* wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
* event. The client must acknowledge it and is then allowed to attach a
* buffer to map the surface.
*
* Mapping an xdg_surface-based role surface is defined as making it
* possible for the surface to be shown by the compositor. Note that
* a mapped surface is not guaranteed to be visible once it is mapped.
*
* For an xdg_surface to be mapped by the compositor, the following
* conditions must be met:
* (1) the client has assigned an xdg_surface-based role to the surface
* (2) the client has set and committed the xdg_surface state and the
* role-dependent state to the surface
* (3) the client has committed a buffer to the surface
*
* A newly-unmapped surface is considered to have met condition (1) out
* of the 3 required conditions for mapping a surface if its role surface
* has not been destroyed, i.e. the client must perform the initial commit
* again before attaching a buffer.
* @section page_iface_xdg_surface_api API
* See @ref iface_xdg_surface.
*/
/**
* @defgroup iface_xdg_surface The xdg_surface interface
*
* An interface that may be implemented by a wl_surface, for
* implementations that provide a desktop-style user interface.
*
* It provides a base set of functionality required to construct user
* interface elements requiring management by the compositor, such as
* toplevel windows, menus, etc. The types of functionality are split into
* xdg_surface roles.
*
* Creating an xdg_surface does not set the role for a wl_surface. In order
* to map an xdg_surface, the client must create a role-specific object
* using, e.g., get_toplevel, get_popup. The wl_surface for any given
* xdg_surface can have at most one role, and may not be assigned any role
* not based on xdg_surface.
*
* A role must be assigned before any other requests are made to the
* xdg_surface object.
*
* The client must call wl_surface.commit on the corresponding wl_surface
* for the xdg_surface state to take effect.
*
* Creating an xdg_surface from a wl_surface which has a buffer attached or
* committed is a client error, and any attempts by a client to attach or
* manipulate a buffer prior to the first xdg_surface.configure call must
* also be treated as errors.
*
* After creating a role-specific object and setting it up, the client must
* perform an initial commit without any buffer attached. The compositor
* will reply with initial wl_surface state such as
* wl_surface.preferred_buffer_scale followed by an xdg_surface.configure
* event. The client must acknowledge it and is then allowed to attach a
* buffer to map the surface.
*
* Mapping an xdg_surface-based role surface is defined as making it
* possible for the surface to be shown by the compositor. Note that
* a mapped surface is not guaranteed to be visible once it is mapped.
*
* For an xdg_surface to be mapped by the compositor, the following
* conditions must be met:
* (1) the client has assigned an xdg_surface-based role to the surface
* (2) the client has set and committed the xdg_surface state and the
* role-dependent state to the surface
* (3) the client has committed a buffer to the surface
*
* A newly-unmapped surface is considered to have met condition (1) out
* of the 3 required conditions for mapping a surface if its role surface
* has not been destroyed, i.e. the client must perform the initial commit
* again before attaching a buffer.
*/
extern const struct wl_interface xdg_surface_interface;
#endif
#ifndef XDG_TOPLEVEL_INTERFACE
#define XDG_TOPLEVEL_INTERFACE
/**
* @page page_iface_xdg_toplevel xdg_toplevel
* @section page_iface_xdg_toplevel_desc Description
*
* This interface defines an xdg_surface role which allows a surface to,
* among other things, set window-like properties such as maximize,
* fullscreen, and minimize, set application-specific metadata like title and
* id, and well as trigger user interactive operations such as interactive
* resize and move.
*
* A xdg_toplevel by default is responsible for providing the full intended
* visual representation of the toplevel, which depending on the window
* state, may mean things like a title bar, window controls and drop shadow.
*
* Unmapping an xdg_toplevel means that the surface cannot be shown
* by the compositor until it is explicitly mapped again.
* All active operations (e.g., move, resize) are canceled and all
* attributes (e.g. title, state, stacking, ...) are discarded for
* an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
* the state it had right after xdg_surface.get_toplevel. The client
* can re-map the toplevel by perfoming a commit without any buffer
* attached, waiting for a configure event and handling it as usual (see
* xdg_surface description).
*
* Attaching a null buffer to a toplevel unmaps the surface.
* @section page_iface_xdg_toplevel_api API
* See @ref iface_xdg_toplevel.
*/
/**
* @defgroup iface_xdg_toplevel The xdg_toplevel interface
*
* This interface defines an xdg_surface role which allows a surface to,
* among other things, set window-like properties such as maximize,
* fullscreen, and minimize, set application-specific metadata like title and
* id, and well as trigger user interactive operations such as interactive
* resize and move.
*
* A xdg_toplevel by default is responsible for providing the full intended
* visual representation of the toplevel, which depending on the window
* state, may mean things like a title bar, window controls and drop shadow.
*
* Unmapping an xdg_toplevel means that the surface cannot be shown
* by the compositor until it is explicitly mapped again.
* All active operations (e.g., move, resize) are canceled and all
* attributes (e.g. title, state, stacking, ...) are discarded for
* an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
* the state it had right after xdg_surface.get_toplevel. The client
* can re-map the toplevel by perfoming a commit without any buffer
* attached, waiting for a configure event and handling it as usual (see
* xdg_surface description).
*
* Attaching a null buffer to a toplevel unmaps the surface.
*/
extern const struct wl_interface xdg_toplevel_interface;
#endif
#ifndef XDG_POPUP_INTERFACE
#define XDG_POPUP_INTERFACE
/**
* @page page_iface_xdg_popup xdg_popup
* @section page_iface_xdg_popup_desc Description
*
* A popup surface is a short-lived, temporary surface. It can be used to
* implement for example menus, popovers, tooltips and other similar user
* interface concepts.
*
* A popup can be made to take an explicit grab. See xdg_popup.grab for
* details.
*
* When the popup is dismissed, a popup_done event will be sent out, and at
* the same time the surface will be unmapped. See the xdg_popup.popup_done
* event for details.
*
* Explicitly destroying the xdg_popup object will also dismiss the popup and
* unmap the surface. Clients that want to dismiss the popup when another
* surface of their own is clicked should dismiss the popup using the destroy
* request.
*
* A newly created xdg_popup will be stacked on top of all previously created
* xdg_popup surfaces associated with the same xdg_toplevel.
*
* The parent of an xdg_popup must be mapped (see the xdg_surface
* description) before the xdg_popup itself.
*
* The client must call wl_surface.commit on the corresponding wl_surface
* for the xdg_popup state to take effect.
* @section page_iface_xdg_popup_api API
* See @ref iface_xdg_popup.
*/
/**
* @defgroup iface_xdg_popup The xdg_popup interface
*
* A popup surface is a short-lived, temporary surface. It can be used to
* implement for example menus, popovers, tooltips and other similar user
* interface concepts.
*
* A popup can be made to take an explicit grab. See xdg_popup.grab for
* details.
*
* When the popup is dismissed, a popup_done event will be sent out, and at
* the same time the surface will be unmapped. See the xdg_popup.popup_done
* event for details.
*
* Explicitly destroying the xdg_popup object will also dismiss the popup and
* unmap the surface. Clients that want to dismiss the popup when another
* surface of their own is clicked should dismiss the popup using the destroy
* request.
*
* A newly created xdg_popup will be stacked on top of all previously created
* xdg_popup surfaces associated with the same xdg_toplevel.
*
* The parent of an xdg_popup must be mapped (see the xdg_surface
* description) before the xdg_popup itself.
*
* The client must call wl_surface.commit on the corresponding wl_surface
* for the xdg_popup state to take effect.
*/
extern const struct wl_interface xdg_popup_interface;
#endif
#ifndef XDG_WM_BASE_ERROR_ENUM
#define XDG_WM_BASE_ERROR_ENUM
enum xdg_wm_base_error {
/**
* given wl_surface has another role
*/
XDG_WM_BASE_ERROR_ROLE = 0,
/**
* xdg_wm_base was destroyed before children
*/
XDG_WM_BASE_ERROR_DEFUNCT_SURFACES = 1,
/**
* the client tried to map or destroy a non-topmost popup
*/
XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP = 2,
/**
* the client specified an invalid popup parent surface
*/
XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT = 3,
/**
* the client provided an invalid surface state
*/
XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE = 4,
/**
* the client provided an invalid positioner
*/
XDG_WM_BASE_ERROR_INVALID_POSITIONER = 5,
/**
* the client didn’t respond to a ping event in time
*/
XDG_WM_BASE_ERROR_UNRESPONSIVE = 6,
};
#endif /* XDG_WM_BASE_ERROR_ENUM */
/**
* @ingroup iface_xdg_wm_base
* @struct xdg_wm_base_listener
*/
struct xdg_wm_base_listener {
/**
* check if the client is alive
*
* The ping event asks the client if it's still alive. Pass the
* serial specified in the event back to the compositor by sending
* a "pong" request back with the specified serial. See
* xdg_wm_base.pong.
*
* Compositors can use this to determine if the client is still
* alive. It's unspecified what will happen if the client doesn't
* respond to the ping request, or in what timeframe. Clients
* should try to respond in a reasonable amount of time. The
* “unresponsive” error is provided for compositors that wish
* to disconnect unresponsive clients.
*
* A compositor is free to ping in any way it wants, but a client
* must always respond to any xdg_wm_base object it created.
* @param serial pass this to the pong request
*/
void (*ping)(void *data,
struct xdg_wm_base *xdg_wm_base,
uint32_t serial);
};
/**
* @ingroup iface_xdg_wm_base
*/
static inline int
xdg_wm_base_add_listener(struct xdg_wm_base *xdg_wm_base,
const struct xdg_wm_base_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) xdg_wm_base,
(void (**)(void)) listener, data);
}
#define XDG_WM_BASE_DESTROY 0
#define XDG_WM_BASE_CREATE_POSITIONER 1
#define XDG_WM_BASE_GET_XDG_SURFACE 2
#define XDG_WM_BASE_PONG 3
/**
* @ingroup iface_xdg_wm_base
*/
#define XDG_WM_BASE_PING_SINCE_VERSION 1
/**
* @ingroup iface_xdg_wm_base
*/
#define XDG_WM_BASE_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_xdg_wm_base
*/
#define XDG_WM_BASE_CREATE_POSITIONER_SINCE_VERSION 1
/**
* @ingroup iface_xdg_wm_base
*/
#define XDG_WM_BASE_GET_XDG_SURFACE_SINCE_VERSION 1
/**
* @ingroup iface_xdg_wm_base
*/
#define XDG_WM_BASE_PONG_SINCE_VERSION 1
/** @ingroup iface_xdg_wm_base */
static inline void
xdg_wm_base_set_user_data(struct xdg_wm_base *xdg_wm_base, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) xdg_wm_base, user_data);
}
/** @ingroup iface_xdg_wm_base */
static inline void *
xdg_wm_base_get_user_data(struct xdg_wm_base *xdg_wm_base)
{
return wl_proxy_get_user_data((struct wl_proxy *) xdg_wm_base);
}
static inline uint32_t
xdg_wm_base_get_version(struct xdg_wm_base *xdg_wm_base)
{
return wl_proxy_get_version((struct wl_proxy *) xdg_wm_base);
}
/**
* @ingroup iface_xdg_wm_base
*
* Destroy this xdg_wm_base object.
*
* Destroying a bound xdg_wm_base object while there are surfaces
* still alive created by this xdg_wm_base object instance is illegal
* and will result in a defunct_surfaces error.
*/
static inline void
xdg_wm_base_destroy(struct xdg_wm_base *xdg_wm_base)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
XDG_WM_BASE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), WL_MARSHAL_FLAG_DESTROY);
}
/**
* @ingroup iface_xdg_wm_base
*
* Create a positioner object. A positioner object is used to position
* surfaces relative to some parent surface. See the interface description
* and xdg_surface.get_popup for details.
*/
static inline struct xdg_positioner *
xdg_wm_base_create_positioner(struct xdg_wm_base *xdg_wm_base)
{
struct wl_proxy *id;
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
XDG_WM_BASE_CREATE_POSITIONER, &xdg_positioner_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL);
return (struct xdg_positioner *) id;
}
/**
* @ingroup iface_xdg_wm_base
*
* This creates an xdg_surface for the given surface. While xdg_surface
* itself is not a role, the corresponding surface may only be assigned
* a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is
* illegal to create an xdg_surface for a wl_surface which already has an
* assigned role and this will result in a role error.
*
* This creates an xdg_surface for the given surface. An xdg_surface is
* used as basis to define a role to a given surface, such as xdg_toplevel
* or xdg_popup. It also manages functionality shared between xdg_surface
* based surface roles.
*
* See the documentation of xdg_surface for more details about what an
* xdg_surface is and how it is used.
*/
static inline struct xdg_surface *
xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *surface)
{
struct wl_proxy *id;
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
XDG_WM_BASE_GET_XDG_SURFACE, &xdg_surface_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL, surface);
return (struct xdg_surface *) id;
}
/**
* @ingroup iface_xdg_wm_base
*
* A client must respond to a ping event with a pong request or
* the client may be deemed unresponsive. See xdg_wm_base.ping
* and xdg_wm_base.error.unresponsive.
*/
static inline void
xdg_wm_base_pong(struct xdg_wm_base *xdg_wm_base, uint32_t serial)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
XDG_WM_BASE_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, serial);
}
#ifndef XDG_POSITIONER_ERROR_ENUM
#define XDG_POSITIONER_ERROR_ENUM
enum xdg_positioner_error {
/**
* invalid input provided
*/
XDG_POSITIONER_ERROR_INVALID_INPUT = 0,
};
#endif /* XDG_POSITIONER_ERROR_ENUM */
#ifndef XDG_POSITIONER_ANCHOR_ENUM
#define XDG_POSITIONER_ANCHOR_ENUM
enum xdg_positioner_anchor {
XDG_POSITIONER_ANCHOR_NONE = 0,
XDG_POSITIONER_ANCHOR_TOP = 1,
XDG_POSITIONER_ANCHOR_BOTTOM = 2,
XDG_POSITIONER_ANCHOR_LEFT = 3,
XDG_POSITIONER_ANCHOR_RIGHT = 4,
XDG_POSITIONER_ANCHOR_TOP_LEFT = 5,
XDG_POSITIONER_ANCHOR_BOTTOM_LEFT = 6,
XDG_POSITIONER_ANCHOR_TOP_RIGHT = 7,
XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT = 8,
};
#endif /* XDG_POSITIONER_ANCHOR_ENUM */
#ifndef XDG_POSITIONER_GRAVITY_ENUM
#define XDG_POSITIONER_GRAVITY_ENUM
enum xdg_positioner_gravity {
XDG_POSITIONER_GRAVITY_NONE = 0,
XDG_POSITIONER_GRAVITY_TOP = 1,
XDG_POSITIONER_GRAVITY_BOTTOM = 2,
XDG_POSITIONER_GRAVITY_LEFT = 3,
XDG_POSITIONER_GRAVITY_RIGHT = 4,
XDG_POSITIONER_GRAVITY_TOP_LEFT = 5,
XDG_POSITIONER_GRAVITY_BOTTOM_LEFT = 6,
XDG_POSITIONER_GRAVITY_TOP_RIGHT = 7,
XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT = 8,
};
#endif /* XDG_POSITIONER_GRAVITY_ENUM */
#ifndef XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
#define XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
/**
* @ingroup iface_xdg_positioner
* constraint adjustments
*
* The constraint adjustment value define ways the compositor will adjust
* the position of the surface, if the unadjusted position would result
* in the surface being partly constrained.
*
* Whether a surface is considered 'constrained' is left to the compositor
* to determine. For example, the surface may be partly outside the
* compositor's defined 'work area', thus necessitating the child surface's
* position be adjusted until it is entirely inside the work area.
*
* The adjustments can be combined, according to a defined precedence: 1)
* Flip, 2) Slide, 3) Resize.
*/
enum xdg_positioner_constraint_adjustment {
/**
* don't move the child surface when constrained
*
* Don't alter the surface position even if it is constrained on
* some axis, for example partially outside the edge of an output.
*/
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE = 0,
/**
* move along the x axis until unconstrained
*
* Slide the surface along the x axis until it is no longer
* constrained.
*
* First try to slide towards the direction of the gravity on the x
* axis until either the edge in the opposite direction of the
* gravity is unconstrained or the edge in the direction of the
* gravity is constrained.
*
* Then try to slide towards the opposite direction of the gravity
* on the x axis until either the edge in the direction of the
* gravity is unconstrained or the edge in the opposite direction
* of the gravity is constrained.
*/
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1,
/**
* move along the y axis until unconstrained
*
* Slide the surface along the y axis until it is no longer
* constrained.
*
* First try to slide towards the direction of the gravity on the y
* axis until either the edge in the opposite direction of the
* gravity is unconstrained or the edge in the direction of the
* gravity is constrained.
*
* Then try to slide towards the opposite direction of the gravity
* on the y axis until either the edge in the direction of the
* gravity is unconstrained or the edge in the opposite direction
* of the gravity is constrained.
*/
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2,
/**
* invert the anchor and gravity on the x axis
*
* Invert the anchor and gravity on the x axis if the surface is
* constrained on the x axis. For example, if the left edge of the
* surface is constrained, the gravity is 'left' and the anchor is
* 'left', change the gravity to 'right' and the anchor to 'right'.
*
* If the adjusted position also ends up being constrained, the
* resulting position of the flip_x adjustment will be the one
* before the adjustment.
*/
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X = 4,
/**
* invert the anchor and gravity on the y axis
*
* Invert the anchor and gravity on the y axis if the surface is
* constrained on the y axis. For example, if the bottom edge of
* the surface is constrained, the gravity is 'bottom' and the
* anchor is 'bottom', change the gravity to 'top' and the anchor
* to 'top'.
*
* The adjusted position is calculated given the original anchor
* rectangle and offset, but with the new flipped anchor and
* gravity values.
*
* If the adjusted position also ends up being constrained, the
* resulting position of the flip_y adjustment will be the one
* before the adjustment.
*/
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8,
/**
* horizontally resize the surface
*
* Resize the surface horizontally so that it is completely
* unconstrained.
*/
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16,
/**
* vertically resize the surface
*
* Resize the surface vertically so that it is completely
* unconstrained.
*/
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32,
};
#endif /* XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM */
#define XDG_POSITIONER_DESTROY 0
#define XDG_POSITIONER_SET_SIZE 1
#define XDG_POSITIONER_SET_ANCHOR_RECT 2
#define XDG_POSITIONER_SET_ANCHOR 3
#define XDG_POSITIONER_SET_GRAVITY 4
#define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT 5
#define XDG_POSITIONER_SET_OFFSET 6
#define XDG_POSITIONER_SET_REACTIVE 7
#define XDG_POSITIONER_SET_PARENT_SIZE 8
#define XDG_POSITIONER_SET_PARENT_CONFIGURE 9
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_SIZE_SINCE_VERSION 1
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_ANCHOR_RECT_SINCE_VERSION 1
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_ANCHOR_SINCE_VERSION 1
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_GRAVITY_SINCE_VERSION 1
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION 1
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3
/**
* @ingroup iface_xdg_positioner
*/
#define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3
/** @ingroup iface_xdg_positioner */
static inline void
xdg_positioner_set_user_data(struct xdg_positioner *xdg_positioner, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) xdg_positioner, user_data);
}
/** @ingroup iface_xdg_positioner */
static inline void *
xdg_positioner_get_user_data(struct xdg_positioner *xdg_positioner)
{
return wl_proxy_get_user_data((struct wl_proxy *) xdg_positioner);
}
static inline uint32_t
xdg_positioner_get_version(struct xdg_positioner *xdg_positioner)
{
return wl_proxy_get_version((struct wl_proxy *) xdg_positioner);
}
/**
* @ingroup iface_xdg_positioner
*
* Notify the compositor that the xdg_positioner will no longer be used.
*/
static inline void
xdg_positioner_destroy(struct xdg_positioner *xdg_positioner)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), WL_MARSHAL_FLAG_DESTROY);
}
/**
* @ingroup iface_xdg_positioner
*
* Set the size of the surface that is to be positioned with the positioner
* object. The size is in surface-local coordinates and corresponds to the
* window geometry. See xdg_surface.set_window_geometry.
*
* If a zero or negative size is set the invalid_input error is raised.
*/
static inline void
xdg_positioner_set_size(struct xdg_positioner *xdg_positioner, int32_t width, int32_t height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, width, height);
}
/**
* @ingroup iface_xdg_positioner
*
* Specify the anchor rectangle within the parent surface that the child
* surface will be placed relative to. The rectangle is relative to the
* window geometry as defined by xdg_surface.set_window_geometry of the
* parent surface.
*
* When the xdg_positioner object is used to position a child surface, the
* anchor rectangle may not extend outside the window geometry of the
* positioned child's parent surface.
*
* If a negative size is set the invalid_input error is raised.
*/
static inline void
xdg_positioner_set_anchor_rect(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y, int32_t width, int32_t height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_ANCHOR_RECT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y, width, height);
}
/**
* @ingroup iface_xdg_positioner
*
* Defines the anchor point for the anchor rectangle. The specified anchor
* is used derive an anchor point that the child surface will be
* positioned relative to. If a corner anchor is set (e.g. 'top_left' or
* 'bottom_right'), the anchor point will be at the specified corner;
* otherwise, the derived anchor point will be centered on the specified
* edge, or in the center of the anchor rectangle if no edge is specified.
*/
static inline void
xdg_positioner_set_anchor(struct xdg_positioner *xdg_positioner, uint32_t anchor)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_ANCHOR, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, anchor);
}
/**
* @ingroup iface_xdg_positioner
*
* Defines in what direction a surface should be positioned, relative to
* the anchor point of the parent surface. If a corner gravity is
* specified (e.g. 'bottom_right' or 'top_left'), then the child surface
* will be placed towards the specified gravity; otherwise, the child
* surface will be centered over the anchor point on any axis that had no
* gravity specified. If the gravity is not in the ‘gravity’ enum, an
* invalid_input error is raised.
*/
static inline void
xdg_positioner_set_gravity(struct xdg_positioner *xdg_positioner, uint32_t gravity)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_GRAVITY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, gravity);
}
/**
* @ingroup iface_xdg_positioner
*
* Specify how the window should be positioned if the originally intended
* position caused the surface to be constrained, meaning at least
* partially outside positioning boundaries set by the compositor. The
* adjustment is set by constructing a bitmask describing the adjustment to
* be made when the surface is constrained on that axis.
*
* If no bit for one axis is set, the compositor will assume that the child
* surface should not change its position on that axis when constrained.
*
* If more than one bit for one axis is set, the order of how adjustments
* are applied is specified in the corresponding adjustment descriptions.
*
* The default adjustment is none.
*/
static inline void
xdg_positioner_set_constraint_adjustment(struct xdg_positioner *xdg_positioner, uint32_t constraint_adjustment)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, constraint_adjustment);
}
/**
* @ingroup iface_xdg_positioner
*
* Specify the surface position offset relative to the position of the
* anchor on the anchor rectangle and the anchor on the surface. For
* example if the anchor of the anchor rectangle is at (x, y), the surface
* has the gravity bottom|right, and the offset is (ox, oy), the calculated
* surface position will be (x + ox, y + oy). The offset position of the
* surface is the one used for constraint testing. See
* set_constraint_adjustment.
*
* An example use case is placing a popup menu on top of a user interface
* element, while aligning the user interface element of the parent surface
* with some user interface element placed somewhere in the popup surface.
*/
static inline void
xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_OFFSET, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y);
}
/**
* @ingroup iface_xdg_positioner
*
* When set reactive, the surface is reconstrained if the conditions used
* for constraining changed, e.g. the parent window moved.
*
* If the conditions changed and the popup was reconstrained, an
* xdg_popup.configure event is sent with updated geometry, followed by an
* xdg_surface.configure event.
*/
static inline void
xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_REACTIVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0);
}
/**
* @ingroup iface_xdg_positioner
*
* Set the parent window geometry the compositor should use when
* positioning the popup. The compositor may use this information to
* determine the future state the popup should be constrained using. If
* this doesn't match the dimension of the parent the popup is eventually
* positioned against, the behavior is undefined.
*
* The arguments are given in the surface-local coordinate space.
*/
static inline void
xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t parent_width, int32_t parent_height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_PARENT_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, parent_width, parent_height);
}
/**
* @ingroup iface_xdg_positioner
*
* Set the serial of an xdg_surface.configure event this positioner will be
* used in response to. The compositor may use this information together
* with set_parent_size to determine what future state the popup should be
* constrained using.
*/
static inline void
xdg_positioner_set_parent_configure(struct xdg_positioner *xdg_positioner, uint32_t serial)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_PARENT_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, serial);
}
#ifndef XDG_SURFACE_ERROR_ENUM
#define XDG_SURFACE_ERROR_ENUM
enum xdg_surface_error {
/**
* Surface was not fully constructed
*/
XDG_SURFACE_ERROR_NOT_CONSTRUCTED = 1,
/**
* Surface was already constructed
*/
XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED = 2,
/**
* Attaching a buffer to an unconfigured surface
*/
XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER = 3,
/**
* Invalid serial number when acking a configure event
*/
XDG_SURFACE_ERROR_INVALID_SERIAL = 4,
/**
* Width or height was zero or negative
*/
XDG_SURFACE_ERROR_INVALID_SIZE = 5,
/**
* Surface was destroyed before its role object
*/
XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT = 6,
};
#endif /* XDG_SURFACE_ERROR_ENUM */
/**
* @ingroup iface_xdg_surface
* @struct xdg_surface_listener
*/