1 /++
2  +  Module generated by wayland:scanner-v0.3.1 for xdg_shell_unstable_v6 protocol
3  +    xml protocol:   xdg-shell-unstable-v6.xml
4  +    generated code: client
5  +/
6 module zxdg_shell_v6;
7 /+
8  +  Protocol copyright:
9  +
10  +  Copyright © 2008-2013 Kristian Høgsberg
11  +  Copyright © 2013      Rafael Antognolli
12  +  Copyright © 2013      Jasper St. Pierre
13  +  Copyright © 2010-2013 Intel Corporation
14  +
15  +  Permission is hereby granted, free of charge, to any person obtaining a
16  +  copy of this software and associated documentation files (the "Software"),
17  +  to deal in the Software without restriction, including without limitation
18  +  the rights to use, copy, modify, merge, publish, distribute, sublicense,
19  +  and/or sell copies of the Software, and to permit persons to whom the
20  +  Software is furnished to do so, subject to the following conditions:
21  +
22  +  The above copyright notice and this permission notice (including the next
23  +  paragraph) shall be included in all copies or substantial portions of the
24  +  Software.
25  +
26  +  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27  +  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28  +  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
29  +  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30  +  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31  +  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32  +  DEALINGS IN THE SOFTWARE.
33  +/
34 /+
35  +  Bindings copyright:
36  +
37  +  Copyright © 2017-2019 Rémi Thebault
38  +/
39 import wayland.client;
40 import wayland.native.client;
41 import wayland.native.util;
42 import wayland.util;
43 
44 import std.exception : enforce;
45 import std..string : fromStringz, toStringz;
46 
47 /++
48  +  create desktop-style surfaces
49  +
50  +  xdg_shell allows clients to turn a wl_surface into a "real window"
51  +  which can be dragged, resized, stacked, and moved around by the
52  +  user. Everything about this interface is suited towards traditional
53  +  desktop environments.
54  +/
55 final class ZxdgShellV6 : WlProxy
56 {
57     /// Version of xdg_shell_unstable_v6.zxdg_shell_v6
58     enum ver = 1;
59 
60     /// Build a ZxdgShellV6 from a native object.
61     private this(wl_proxy* native)
62     {
63         super(native);
64         wl_proxy_add_listener(proxy, cast(void_func_t*)&wl_d_zxdg_shell_v6_listener, null);
65     }
66 
67     /// Interface object that creates ZxdgShellV6 objects.
68     static @property immutable(WlProxyInterface) iface()
69     {
70         return zxdgShellV6Iface;
71     }
72 
73     /// Op-code of ZxdgShellV6.destroy.
74     enum destroyOpCode = 0;
75     /// Op-code of ZxdgShellV6.createPositioner.
76     enum createPositionerOpCode = 1;
77     /// Op-code of ZxdgShellV6.getXdgSurface.
78     enum getXdgSurfaceOpCode = 2;
79     /// Op-code of ZxdgShellV6.pong.
80     enum pongOpCode = 3;
81 
82     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgShellV6.destroy.
83     enum destroySinceVersion = 1;
84     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgShellV6.createPositioner.
85     enum createPositionerSinceVersion = 1;
86     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgShellV6.getXdgSurface.
87     enum getXdgSurfaceSinceVersion = 1;
88     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgShellV6.pong.
89     enum pongSinceVersion = 1;
90 
91     /// xdg_shell_unstable_v6 protocol version introducing ZxdgShellV6.onPing.
92     enum onPingSinceVersion = 1;
93 
94     /// Event delegate signature of ZxdgShellV6.onPing.
95     alias OnPingEventDg = void delegate(ZxdgShellV6 zxdgShellV6,
96                                         uint serial);
97 
98     enum Error : uint
99     {
100         /// given wl_surface has another role
101         role = 0,
102         /// xdg_shell was destroyed before children
103         defunctSurfaces = 1,
104         /// the client tried to map or destroy a non-topmost popup
105         notTheTopmostPopup = 2,
106         /// the client specified an invalid popup parent surface
107         invalidPopupParent = 3,
108         /// the client provided an invalid surface state
109         invalidSurfaceState = 4,
110         /// the client provided an invalid positioner
111         invalidPositioner = 5,
112     }
113 
114     /++
115      +  destroy xdg_shell
116      +
117      +  Destroy this xdg_shell object.
118      +
119      +  Destroying a bound xdg_shell object while there are surfaces
120      +  still alive created by this xdg_shell object instance is illegal
121      +  and will result in a protocol error.
122      +/
123     void destroy()
124     {
125         wl_proxy_marshal(
126             proxy, destroyOpCode
127         );
128         super.destroyNotify();
129     }
130 
131     /++
132      +  create a positioner object
133      +
134      +  Create a positioner object. A positioner object is used to position
135      +  surfaces relative to some parent surface. See the interface description
136      +  and xdg_surface.get_popup for details.
137      +/
138     ZxdgPositionerV6 createPositioner()
139     {
140         auto _pp = wl_proxy_marshal_constructor(
141             proxy, createPositionerOpCode, ZxdgPositionerV6.iface.native, null
142         );
143         if (!_pp) return null;
144         auto _p = WlProxy.get(_pp);
145         if (_p) return cast(ZxdgPositionerV6)_p;
146         return new ZxdgPositionerV6(_pp);
147     }
148 
149     /++
150      +  create a shell surface from a surface
151      +
152      +  This creates an xdg_surface for the given surface. While xdg_surface
153      +  itself is not a role, the corresponding surface may only be assigned
154      +  a role extending xdg_surface, such as xdg_toplevel or xdg_popup.
155      +
156      +  This creates an xdg_surface for the given surface. An xdg_surface is
157      +  used as basis to define a role to a given surface, such as xdg_toplevel
158      +  or xdg_popup. It also manages functionality shared between xdg_surface
159      +  based surface roles.
160      +
161      +  See the documentation of xdg_surface for more details about what an
162      +  xdg_surface is and how it is used.
163      +/
164     ZxdgSurfaceV6 getXdgSurface(WlSurface surface)
165     {
166         auto _pp = wl_proxy_marshal_constructor(
167             proxy, getXdgSurfaceOpCode, ZxdgSurfaceV6.iface.native, null,
168             surface.proxy
169         );
170         if (!_pp) return null;
171         auto _p = WlProxy.get(_pp);
172         if (_p) return cast(ZxdgSurfaceV6)_p;
173         return new ZxdgSurfaceV6(_pp);
174     }
175 
176     /++
177      +  respond to a ping event
178      +
179      +  A client must respond to a ping event with a pong request or
180      +  the client may be deemed unresponsive. See xdg_shell.ping.
181      +/
182     void pong(uint serial)
183     {
184         wl_proxy_marshal(
185             proxy, pongOpCode, serial
186         );
187     }
188 
189     /++
190      +  check if the client is alive
191      +
192      +  The ping event asks the client if it's still alive. Pass the
193      +  serial specified in the event back to the compositor by sending
194      +  a "pong" request back with the specified serial. See xdg_shell.ping.
195      +
196      +  Compositors can use this to determine if the client is still
197      +  alive. It's unspecified what will happen if the client doesn't
198      +  respond to the ping request, or in what timeframe. Clients should
199      +  try to respond in a reasonable amount of time.
200      +
201      +  A compositor is free to ping in any way it wants, but a client must
202      +  always respond to any xdg_shell object it created.
203      +/
204     @property void onPing(OnPingEventDg dg)
205     {
206         _onPing = dg;
207     }
208 
209     private OnPingEventDg _onPing;
210 }
211 
212 /++
213  +  child surface positioner
214  +
215  +  The xdg_positioner provides a collection of rules for the placement of a
216  +  child surface relative to a parent surface. Rules can be defined to ensure
217  +  the child surface remains within the visible area's borders, and to
218  +  specify how the child surface changes its position, such as sliding along
219  +  an axis, or flipping around a rectangle. These positioner-created rules are
220  +  constrained by the requirement that a child surface must intersect with or
221  +  be at least partially adjacent to its parent surface.
222  +
223  +  See the various requests for details about possible rules.
224  +
225  +  At the time of the request, the compositor makes a copy of the rules
226  +  specified by the xdg_positioner. Thus, after the request is complete the
227  +  xdg_positioner object can be destroyed or reused; further changes to the
228  +  object will have no effect on previous usages.
229  +
230  +  For an xdg_positioner object to be considered complete, it must have a
231  +  non-zero size set by set_size, and a non-zero anchor rectangle set by
232  +  set_anchor_rect. Passing an incomplete xdg_positioner object when
233  +  positioning a surface raises an error.
234  +/
235 final class ZxdgPositionerV6 : WlProxy
236 {
237     /// Version of xdg_shell_unstable_v6.zxdg_positioner_v6
238     enum ver = 1;
239 
240     /// Build a ZxdgPositionerV6 from a native object.
241     private this(wl_proxy* native)
242     {
243         super(native);
244     }
245 
246     /// Interface object that creates ZxdgPositionerV6 objects.
247     static @property immutable(WlProxyInterface) iface()
248     {
249         return zxdgPositionerV6Iface;
250     }
251 
252     /// Op-code of ZxdgPositionerV6.destroy.
253     enum destroyOpCode = 0;
254     /// Op-code of ZxdgPositionerV6.setSize.
255     enum setSizeOpCode = 1;
256     /// Op-code of ZxdgPositionerV6.setAnchorRect.
257     enum setAnchorRectOpCode = 2;
258     /// Op-code of ZxdgPositionerV6.setAnchor.
259     enum setAnchorOpCode = 3;
260     /// Op-code of ZxdgPositionerV6.setGravity.
261     enum setGravityOpCode = 4;
262     /// Op-code of ZxdgPositionerV6.setConstraintAdjustment.
263     enum setConstraintAdjustmentOpCode = 5;
264     /// Op-code of ZxdgPositionerV6.setOffset.
265     enum setOffsetOpCode = 6;
266 
267     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPositionerV6.destroy.
268     enum destroySinceVersion = 1;
269     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPositionerV6.setSize.
270     enum setSizeSinceVersion = 1;
271     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPositionerV6.setAnchorRect.
272     enum setAnchorRectSinceVersion = 1;
273     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPositionerV6.setAnchor.
274     enum setAnchorSinceVersion = 1;
275     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPositionerV6.setGravity.
276     enum setGravitySinceVersion = 1;
277     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPositionerV6.setConstraintAdjustment.
278     enum setConstraintAdjustmentSinceVersion = 1;
279     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPositionerV6.setOffset.
280     enum setOffsetSinceVersion = 1;
281 
282     enum Error : uint
283     {
284         /// invalid input provided
285         invalidInput = 0,
286     }
287 
288     enum Anchor : uint
289     {
290         /// the center of the anchor rectangle
291         none = 0,
292         /// the top edge of the anchor rectangle
293         top = 1,
294         /// the bottom edge of the anchor rectangle
295         bottom = 2,
296         /// the left edge of the anchor rectangle
297         left = 4,
298         /// the right edge of the anchor rectangle
299         right = 8,
300     }
301 
302     enum Gravity : uint
303     {
304         /// center over the anchor edge
305         none = 0,
306         /// position above the anchor edge
307         top = 1,
308         /// position below the anchor edge
309         bottom = 2,
310         /// position to the left of the anchor edge
311         left = 4,
312         /// position to the right of the anchor edge
313         right = 8,
314     }
315 
316     /++
317      +  constraint adjustments
318      +
319      +  The constraint adjustment value define ways the compositor will adjust
320      +  the position of the surface, if the unadjusted position would result
321      +  in the surface being partly constrained.
322      +
323      +  Whether a surface is considered 'constrained' is left to the compositor
324      +  to determine. For example, the surface may be partly outside the
325      +  compositor's defined 'work area', thus necessitating the child surface's
326      +  position be adjusted until it is entirely inside the work area.
327      +
328      +  The adjustments can be combined, according to a defined precedence: 1$(RPAREN)
329      +  Flip, 2$(RPAREN) Slide, 3$(RPAREN) Resize.
330      +/
331     enum ConstraintAdjustment : uint
332     {
333         none = 0,
334         slideX = 1,
335         slideY = 2,
336         flipX = 4,
337         flipY = 8,
338         resizeX = 16,
339         resizeY = 32,
340     }
341 
342     /++
343      +  destroy the xdg_positioner object
344      +
345      +  Notify the compositor that the xdg_positioner will no longer be used.
346      +/
347     void destroy()
348     {
349         wl_proxy_marshal(
350             proxy, destroyOpCode
351         );
352         super.destroyNotify();
353     }
354 
355     /++
356      +  set the size of the to-be positioned rectangle
357      +
358      +  Set the size of the surface that is to be positioned with the positioner
359      +  object. The size is in surface-local coordinates and corresponds to the
360      +  window geometry. See xdg_surface.set_window_geometry.
361      +
362      +  If a zero or negative size is set the invalid_input error is raised.
363      +/
364     void setSize(int width,
365                  int height)
366     {
367         wl_proxy_marshal(
368             proxy, setSizeOpCode, width, height
369         );
370     }
371 
372     /++
373      +  set the anchor rectangle within the parent surface
374      +
375      +  Specify the anchor rectangle within the parent surface that the child
376      +  surface will be placed relative to. The rectangle is relative to the
377      +  window geometry as defined by xdg_surface.set_window_geometry of the
378      +  parent surface. The rectangle must be at least 1x1 large.
379      +
380      +  When the xdg_positioner object is used to position a child surface, the
381      +  anchor rectangle may not extend outside the window geometry of the
382      +  positioned child's parent surface.
383      +
384      +  If a zero or negative size is set the invalid_input error is raised.
385      +/
386     void setAnchorRect(int x,
387                        int y,
388                        int width,
389                        int height)
390     {
391         wl_proxy_marshal(
392             proxy, setAnchorRectOpCode, x, y, width, height
393         );
394     }
395 
396     /++
397      +  set anchor rectangle anchor edges
398      +
399      +  Defines a set of edges for the anchor rectangle. These are used to
400      +  derive an anchor point that the child surface will be positioned
401      +  relative to. If two orthogonal edges are specified $(LPAREN)e.g. 'top' and
402      +  'left'$(RPAREN), then the anchor point will be the intersection of the edges
403      +  $(LPAREN)e.g. the top left position of the rectangle$(RPAREN); otherwise, the derived
404      +  anchor point will be centered on the specified edge, or in the center of
405      +  the anchor rectangle if no edge is specified.
406      +
407      +  If two parallel anchor edges are specified $(LPAREN)e.g. 'left' and 'right'$(RPAREN),
408      +  the invalid_input error is raised.
409      +/
410     void setAnchor(Anchor anchor)
411     {
412         wl_proxy_marshal(
413             proxy, setAnchorOpCode, anchor
414         );
415     }
416 
417     /++
418      +  set child surface gravity
419      +
420      +  Defines in what direction a surface should be positioned, relative to
421      +  the anchor point of the parent surface. If two orthogonal gravities are
422      +  specified $(LPAREN)e.g. 'bottom' and 'right'$(RPAREN), then the child surface will be
423      +  placed in the specified direction; otherwise, the child surface will be
424      +  centered over the anchor point on any axis that had no gravity
425      +  specified.
426      +
427      +  If two parallel gravities are specified $(LPAREN)e.g. 'left' and 'right'$(RPAREN), the
428      +  invalid_input error is raised.
429      +/
430     void setGravity(Gravity gravity)
431     {
432         wl_proxy_marshal(
433             proxy, setGravityOpCode, gravity
434         );
435     }
436 
437     /++
438      +  set the adjustment to be done when constrained
439      +
440      +  Specify how the window should be positioned if the originally intended
441      +  position caused the surface to be constrained, meaning at least
442      +  partially outside positioning boundaries set by the compositor. The
443      +  adjustment is set by constructing a bitmask describing the adjustment to
444      +  be made when the surface is constrained on that axis.
445      +
446      +  If no bit for one axis is set, the compositor will assume that the child
447      +  surface should not change its position on that axis when constrained.
448      +
449      +  If more than one bit for one axis is set, the order of how adjustments
450      +  are applied is specified in the corresponding adjustment descriptions.
451      +
452      +  The default adjustment is none.
453      +/
454     void setConstraintAdjustment(uint constraintAdjustment)
455     {
456         wl_proxy_marshal(
457             proxy, setConstraintAdjustmentOpCode, constraintAdjustment
458         );
459     }
460 
461     /++
462      +  set surface position offset
463      +
464      +  Specify the surface position offset relative to the position of the
465      +  anchor on the anchor rectangle and the anchor on the surface. For
466      +  example if the anchor of the anchor rectangle is at $(LPAREN)x, y$(RPAREN), the surface
467      +  has the gravity bottom|right, and the offset is $(LPAREN)ox, oy$(RPAREN), the calculated
468      +  surface position will be $(LPAREN)x + ox, y + oy$(RPAREN). The offset position of the
469      +  surface is the one used for constraint testing. See
470      +  set_constraint_adjustment.
471      +
472      +  An example use case is placing a popup menu on top of a user interface
473      +  element, while aligning the user interface element of the parent surface
474      +  with some user interface element placed somewhere in the popup surface.
475      +/
476     void setOffset(int x,
477                    int y)
478     {
479         wl_proxy_marshal(
480             proxy, setOffsetOpCode, x, y
481         );
482     }
483 }
484 
485 /++
486  +  desktop user interface surface base interface
487  +
488  +  An interface that may be implemented by a wl_surface, for
489  +  implementations that provide a desktop-style user interface.
490  +
491  +  It provides a base set of functionality required to construct user
492  +  interface elements requiring management by the compositor, such as
493  +  toplevel windows, menus, etc. The types of functionality are split into
494  +  xdg_surface roles.
495  +
496  +  Creating an xdg_surface does not set the role for a wl_surface. In order
497  +  to map an xdg_surface, the client must create a role-specific object
498  +  using, e.g., get_toplevel, get_popup. The wl_surface for any given
499  +  xdg_surface can have at most one role, and may not be assigned any role
500  +  not based on xdg_surface.
501  +
502  +  A role must be assigned before any other requests are made to the
503  +  xdg_surface object.
504  +
505  +  The client must call wl_surface.commit on the corresponding wl_surface
506  +  for the xdg_surface state to take effect.
507  +
508  +  Creating an xdg_surface from a wl_surface which has a buffer attached or
509  +  committed is a client error, and any attempts by a client to attach or
510  +  manipulate a buffer prior to the first xdg_surface.configure call must
511  +  also be treated as errors.
512  +
513  +  For a surface to be mapped by the compositor, the following conditions
514  +  must be met: $(LPAREN)1$(RPAREN) the client has assigned a xdg_surface based role to the
515  +  surface, $(LPAREN)2$(RPAREN) the client has set and committed the xdg_surface state and
516  +  the role dependent state to the surface and $(LPAREN)3$(RPAREN) the client has committed a
517  +  buffer to the surface.
518  +/
519 final class ZxdgSurfaceV6 : WlProxy
520 {
521     /// Version of xdg_shell_unstable_v6.zxdg_surface_v6
522     enum ver = 1;
523 
524     /// Build a ZxdgSurfaceV6 from a native object.
525     private this(wl_proxy* native)
526     {
527         super(native);
528         wl_proxy_add_listener(proxy, cast(void_func_t*)&wl_d_zxdg_surface_v6_listener, null);
529     }
530 
531     /// Interface object that creates ZxdgSurfaceV6 objects.
532     static @property immutable(WlProxyInterface) iface()
533     {
534         return zxdgSurfaceV6Iface;
535     }
536 
537     /// Op-code of ZxdgSurfaceV6.destroy.
538     enum destroyOpCode = 0;
539     /// Op-code of ZxdgSurfaceV6.getToplevel.
540     enum getToplevelOpCode = 1;
541     /// Op-code of ZxdgSurfaceV6.getPopup.
542     enum getPopupOpCode = 2;
543     /// Op-code of ZxdgSurfaceV6.setWindowGeometry.
544     enum setWindowGeometryOpCode = 3;
545     /// Op-code of ZxdgSurfaceV6.ackConfigure.
546     enum ackConfigureOpCode = 4;
547 
548     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgSurfaceV6.destroy.
549     enum destroySinceVersion = 1;
550     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgSurfaceV6.getToplevel.
551     enum getToplevelSinceVersion = 1;
552     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgSurfaceV6.getPopup.
553     enum getPopupSinceVersion = 1;
554     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgSurfaceV6.setWindowGeometry.
555     enum setWindowGeometrySinceVersion = 1;
556     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgSurfaceV6.ackConfigure.
557     enum ackConfigureSinceVersion = 1;
558 
559     /// xdg_shell_unstable_v6 protocol version introducing ZxdgSurfaceV6.onConfigure.
560     enum onConfigureSinceVersion = 1;
561 
562     /// Event delegate signature of ZxdgSurfaceV6.onConfigure.
563     alias OnConfigureEventDg = void delegate(ZxdgSurfaceV6 zxdgSurfaceV6,
564                                              uint serial);
565 
566     enum Error : uint
567     {
568         notConstructed = 1,
569         alreadyConstructed = 2,
570         unconfiguredBuffer = 3,
571     }
572 
573     /++
574      +  destroy the xdg_surface
575      +
576      +  Destroy the xdg_surface object. An xdg_surface must only be destroyed
577      +  after its role object has been destroyed.
578      +/
579     void destroy()
580     {
581         wl_proxy_marshal(
582             proxy, destroyOpCode
583         );
584         super.destroyNotify();
585     }
586 
587     /++
588      +  assign the xdg_toplevel surface role
589      +
590      +  This creates an xdg_toplevel object for the given xdg_surface and gives
591      +  the associated wl_surface the xdg_toplevel role.
592      +
593      +  See the documentation of xdg_toplevel for more details about what an
594      +  xdg_toplevel is and how it is used.
595      +/
596     ZxdgToplevelV6 getToplevel()
597     {
598         auto _pp = wl_proxy_marshal_constructor(
599             proxy, getToplevelOpCode, ZxdgToplevelV6.iface.native, null
600         );
601         if (!_pp) return null;
602         auto _p = WlProxy.get(_pp);
603         if (_p) return cast(ZxdgToplevelV6)_p;
604         return new ZxdgToplevelV6(_pp);
605     }
606 
607     /++
608      +  assign the xdg_popup surface role
609      +
610      +  This creates an xdg_popup object for the given xdg_surface and gives the
611      +  associated wl_surface the xdg_popup role.
612      +
613      +  See the documentation of xdg_popup for more details about what an
614      +  xdg_popup is and how it is used.
615      +/
616     ZxdgPopupV6 getPopup(ZxdgSurfaceV6 parent,
617                          ZxdgPositionerV6 positioner)
618     {
619         auto _pp = wl_proxy_marshal_constructor(
620             proxy, getPopupOpCode, ZxdgPopupV6.iface.native, null, parent.proxy,
621             positioner.proxy
622         );
623         if (!_pp) return null;
624         auto _p = WlProxy.get(_pp);
625         if (_p) return cast(ZxdgPopupV6)_p;
626         return new ZxdgPopupV6(_pp);
627     }
628 
629     /++
630      +  set the new window geometry
631      +
632      +  The window geometry of a surface is its "visible bounds" from the
633      +  user's perspective. Client-side decorations often have invisible
634      +  portions like drop-shadows which should be ignored for the
635      +  purposes of aligning, placing and constraining windows.
636      +
637      +  The window geometry is double buffered, and will be applied at the
638      +  time wl_surface.commit of the corresponding wl_surface is called.
639      +
640      +  Once the window geometry of the surface is set, it is not possible to
641      +  unset it, and it will remain the same until set_window_geometry is
642      +  called again, even if a new subsurface or buffer is attached.
643      +
644      +  If never set, the value is the full bounds of the surface,
645      +  including any subsurfaces. This updates dynamically on every
646      +  commit. This unset is meant for extremely simple clients.
647      +
648      +  The arguments are given in the surface-local coordinate space of
649      +  the wl_surface associated with this xdg_surface.
650      +
651      +  The width and height must be greater than zero. Setting an invalid size
652      +  will raise an error. When applied, the effective window geometry will be
653      +  the set window geometry clamped to the bounding rectangle of the
654      +  combined geometry of the surface of the xdg_surface and the associated
655      +  subsurfaces.
656      +/
657     void setWindowGeometry(int x,
658                            int y,
659                            int width,
660                            int height)
661     {
662         wl_proxy_marshal(
663             proxy, setWindowGeometryOpCode, x, y, width, height
664         );
665     }
666 
667     /++
668      +  ack a configure event
669      +
670      +  When a configure event is received, if a client commits the
671      +  surface in response to the configure event, then the client
672      +  must make an ack_configure request sometime before the commit
673      +  request, passing along the serial of the configure event.
674      +
675      +  For instance, for toplevel surfaces the compositor might use this
676      +  information to move a surface to the top left only when the client has
677      +  drawn itself for the maximized or fullscreen state.
678      +
679      +  If the client receives multiple configure events before it
680      +  can respond to one, it only has to ack the last configure event.
681      +
682      +  A client is not required to commit immediately after sending
683      +  an ack_configure request - it may even ack_configure several times
684      +  before its next surface commit.
685      +
686      +  A client may send multiple ack_configure requests before committing, but
687      +  only the last request sent before a commit indicates which configure
688      +  event the client really is responding to.
689      +/
690     void ackConfigure(uint serial)
691     {
692         wl_proxy_marshal(
693             proxy, ackConfigureOpCode, serial
694         );
695     }
696 
697     /++
698      +  suggest a surface change
699      +
700      +  The configure event marks the end of a configure sequence. A configure
701      +  sequence is a set of one or more events configuring the state of the
702      +  xdg_surface, including the final xdg_surface.configure event.
703      +
704      +  Where applicable, xdg_surface surface roles will during a configure
705      +  sequence extend this event as a latched state sent as events before the
706      +  xdg_surface.configure event. Such events should be considered to make up
707      +  a set of atomically applied configuration states, where the
708      +  xdg_surface.configure commits the accumulated state.
709      +
710      +  Clients should arrange their surface for the new states, and then send
711      +  an ack_configure request with the serial sent in this configure event at
712      +  some point before committing the new surface.
713      +
714      +  If the client receives multiple configure events before it can respond
715      +  to one, it is free to discard all but the last event it received.
716      +/
717     @property void onConfigure(OnConfigureEventDg dg)
718     {
719         _onConfigure = dg;
720     }
721 
722     private OnConfigureEventDg _onConfigure;
723 }
724 
725 /++
726  +  toplevel surface
727  +
728  +  This interface defines an xdg_surface role which allows a surface to,
729  +  among other things, set window-like properties such as maximize,
730  +  fullscreen, and minimize, set application-specific metadata like title and
731  +  id, and well as trigger user interactive operations such as interactive
732  +  resize and move.
733  +/
734 final class ZxdgToplevelV6 : WlProxy
735 {
736     /// Version of xdg_shell_unstable_v6.zxdg_toplevel_v6
737     enum ver = 1;
738 
739     /// Build a ZxdgToplevelV6 from a native object.
740     private this(wl_proxy* native)
741     {
742         super(native);
743         wl_proxy_add_listener(proxy, cast(void_func_t*)&wl_d_zxdg_toplevel_v6_listener, null);
744     }
745 
746     /// Interface object that creates ZxdgToplevelV6 objects.
747     static @property immutable(WlProxyInterface) iface()
748     {
749         return zxdgToplevelV6Iface;
750     }
751 
752     /// Op-code of ZxdgToplevelV6.destroy.
753     enum destroyOpCode = 0;
754     /// Op-code of ZxdgToplevelV6.setParent.
755     enum setParentOpCode = 1;
756     /// Op-code of ZxdgToplevelV6.setTitle.
757     enum setTitleOpCode = 2;
758     /// Op-code of ZxdgToplevelV6.setAppId.
759     enum setAppIdOpCode = 3;
760     /// Op-code of ZxdgToplevelV6.showWindowMenu.
761     enum showWindowMenuOpCode = 4;
762     /// Op-code of ZxdgToplevelV6.move.
763     enum moveOpCode = 5;
764     /// Op-code of ZxdgToplevelV6.resize.
765     enum resizeOpCode = 6;
766     /// Op-code of ZxdgToplevelV6.setMaxSize.
767     enum setMaxSizeOpCode = 7;
768     /// Op-code of ZxdgToplevelV6.setMinSize.
769     enum setMinSizeOpCode = 8;
770     /// Op-code of ZxdgToplevelV6.setMaximized.
771     enum setMaximizedOpCode = 9;
772     /// Op-code of ZxdgToplevelV6.unsetMaximized.
773     enum unsetMaximizedOpCode = 10;
774     /// Op-code of ZxdgToplevelV6.setFullscreen.
775     enum setFullscreenOpCode = 11;
776     /// Op-code of ZxdgToplevelV6.unsetFullscreen.
777     enum unsetFullscreenOpCode = 12;
778     /// Op-code of ZxdgToplevelV6.setMinimized.
779     enum setMinimizedOpCode = 13;
780 
781     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.destroy.
782     enum destroySinceVersion = 1;
783     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.setParent.
784     enum setParentSinceVersion = 1;
785     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.setTitle.
786     enum setTitleSinceVersion = 1;
787     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.setAppId.
788     enum setAppIdSinceVersion = 1;
789     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.showWindowMenu.
790     enum showWindowMenuSinceVersion = 1;
791     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.move.
792     enum moveSinceVersion = 1;
793     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.resize.
794     enum resizeSinceVersion = 1;
795     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.setMaxSize.
796     enum setMaxSizeSinceVersion = 1;
797     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.setMinSize.
798     enum setMinSizeSinceVersion = 1;
799     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.setMaximized.
800     enum setMaximizedSinceVersion = 1;
801     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.unsetMaximized.
802     enum unsetMaximizedSinceVersion = 1;
803     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.setFullscreen.
804     enum setFullscreenSinceVersion = 1;
805     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.unsetFullscreen.
806     enum unsetFullscreenSinceVersion = 1;
807     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgToplevelV6.setMinimized.
808     enum setMinimizedSinceVersion = 1;
809 
810     /// xdg_shell_unstable_v6 protocol version introducing ZxdgToplevelV6.onConfigure.
811     enum onConfigureSinceVersion = 1;
812     /// xdg_shell_unstable_v6 protocol version introducing ZxdgToplevelV6.onClose.
813     enum onCloseSinceVersion = 1;
814 
815     /// Event delegate signature of ZxdgToplevelV6.onConfigure.
816     alias OnConfigureEventDg = void delegate(ZxdgToplevelV6 zxdgToplevelV6,
817                                              int width,
818                                              int height,
819                                              wl_array* states);
820     /// Event delegate signature of ZxdgToplevelV6.onClose.
821     alias OnCloseEventDg = void delegate(ZxdgToplevelV6 zxdgToplevelV6);
822 
823     /++
824      +  edge values for resizing
825      +
826      +  These values are used to indicate which edge of a surface
827      +  is being dragged in a resize operation.
828      +/
829     enum ResizeEdge : uint
830     {
831         none = 0,
832         top = 1,
833         bottom = 2,
834         left = 4,
835         topLeft = 5,
836         bottomLeft = 6,
837         right = 8,
838         topRight = 9,
839         bottomRight = 10,
840     }
841 
842     /++
843      +  types of state on the surface
844      +
845      +  The different state values used on the surface. This is designed for
846      +  state values like maximized, fullscreen. It is paired with the
847      +  configure event to ensure that both the client and the compositor
848      +  setting the state can be synchronized.
849      +
850      +  States set in this way are double-buffered. They will get applied on
851      +  the next commit.
852      +/
853     enum State : uint
854     {
855         /// the surface is maximized
856         maximized = 1,
857         /// the surface is fullscreen
858         fullscreen = 2,
859         /// the surface is being resized
860         resizing = 3,
861         /// the surface is now activated
862         activated = 4,
863     }
864 
865     /++
866      +  destroy the xdg_toplevel
867      +
868      +  Unmap and destroy the window. The window will be effectively
869      +  hidden from the user's point of view, and all state like
870      +  maximization, fullscreen, and so on, will be lost.
871      +/
872     void destroy()
873     {
874         wl_proxy_marshal(
875             proxy, destroyOpCode
876         );
877         super.destroyNotify();
878     }
879 
880     /++
881      +  set the parent of this surface
882      +
883      +  Set the "parent" of this surface. This window should be stacked
884      +  above a parent. The parent surface must be mapped as long as this
885      +  surface is mapped.
886      +
887      +  Parent windows should be set on dialogs, toolboxes, or other
888      +  "auxiliary" surfaces, so that the parent is raised when the dialog
889      +  is raised.
890      +/
891     void setParent(ZxdgToplevelV6 parent)
892     {
893         wl_proxy_marshal(
894             proxy, setParentOpCode, parent.proxy
895         );
896     }
897 
898     /++
899      +  set surface title
900      +
901      +  Set a short title for the surface.
902      +
903      +  This string may be used to identify the surface in a task bar,
904      +  window list, or other user interface elements provided by the
905      +  compositor.
906      +
907      +  The string must be encoded in UTF-8.
908      +/
909     void setTitle(string title)
910     {
911         wl_proxy_marshal(
912             proxy, setTitleOpCode, toStringz(title)
913         );
914     }
915 
916     /++
917      +  set application ID
918      +
919      +  Set an application identifier for the surface.
920      +
921      +  The app ID identifies the general class of applications to which
922      +  the surface belongs. The compositor can use this to group multiple
923      +  surfaces together, or to determine how to launch a new application.
924      +
925      +  For D-Bus activatable applications, the app ID is used as the D-Bus
926      +  service name.
927      +
928      +  The compositor shell will try to group application surfaces together
929      +  by their app ID. As a best practice, it is suggested to select app
930      +  ID's that match the basename of the application's .desktop file.
931      +  For example, "org.freedesktop.FooViewer" where the .desktop file is
932      +  "org.freedesktop.FooViewer.desktop".
933      +
934      +  See the desktop-entry specification [0] for more details on
935      +  application identifiers and how they relate to well-known D-Bus
936      +  names and .desktop files.
937      +
938      +  [0] http://standards.freedesktop.org/desktop-entry-spec/
939      +/
940     void setAppId(string appId)
941     {
942         wl_proxy_marshal(
943             proxy, setAppIdOpCode, toStringz(appId)
944         );
945     }
946 
947     /++
948      +  show the window menu
949      +
950      +  Clients implementing client-side decorations might want to show
951      +  a context menu when right-clicking on the decorations, giving the
952      +  user a menu that they can use to maximize or minimize the window.
953      +
954      +  This request asks the compositor to pop up such a window menu at
955      +  the given position, relative to the local surface coordinates of
956      +  the parent surface. There are no guarantees as to what menu items
957      +  the window menu contains.
958      +
959      +  This request must be used in response to some sort of user action
960      +  like a button press, key press, or touch down event.
961      +/
962     void showWindowMenu(WlSeat seat,
963                         uint serial,
964                         int x,
965                         int y)
966     {
967         wl_proxy_marshal(
968             proxy, showWindowMenuOpCode, seat.proxy, serial, x, y
969         );
970     }
971 
972     /++
973      +  start an interactive move
974      +
975      +  Start an interactive, user-driven move of the surface.
976      +
977      +  This request must be used in response to some sort of user action
978      +  like a button press, key press, or touch down event. The passed
979      +  serial is used to determine the type of interactive move $(LPAREN)touch,
980      +  pointer, etc$(RPAREN).
981      +
982      +  The server may ignore move requests depending on the state of
983      +  the surface $(LPAREN)e.g. fullscreen or maximized$(RPAREN), or if the passed serial
984      +  is no longer valid.
985      +
986      +  If triggered, the surface will lose the focus of the device
987      +  $(LPAREN)wl_pointer, wl_touch, etc$(RPAREN) used for the move. It is up to the
988      +  compositor to visually indicate that the move is taking place, such as
989      +  updating a pointer cursor, during the move. There is no guarantee
990      +  that the device focus will return when the move is completed.
991      +/
992     void move(WlSeat seat,
993               uint serial)
994     {
995         wl_proxy_marshal(
996             proxy, moveOpCode, seat.proxy, serial
997         );
998     }
999 
1000     /++
1001      +  start an interactive resize
1002      +
1003      +  Start a user-driven, interactive resize of the surface.
1004      +
1005      +  This request must be used in response to some sort of user action
1006      +  like a button press, key press, or touch down event. The passed
1007      +  serial is used to determine the type of interactive resize $(LPAREN)touch,
1008      +  pointer, etc$(RPAREN).
1009      +
1010      +  The server may ignore resize requests depending on the state of
1011      +  the surface $(LPAREN)e.g. fullscreen or maximized$(RPAREN).
1012      +
1013      +  If triggered, the client will receive configure events with the
1014      +  "resize" state enum value and the expected sizes. See the "resize"
1015      +  enum value for more details about what is required. The client
1016      +  must also acknowledge configure events using "ack_configure". After
1017      +  the resize is completed, the client will receive another "configure"
1018      +  event without the resize state.
1019      +
1020      +  If triggered, the surface also will lose the focus of the device
1021      +  $(LPAREN)wl_pointer, wl_touch, etc$(RPAREN) used for the resize. It is up to the
1022      +  compositor to visually indicate that the resize is taking place,
1023      +  such as updating a pointer cursor, during the resize. There is no
1024      +  guarantee that the device focus will return when the resize is
1025      +  completed.
1026      +
1027      +  The edges parameter specifies how the surface should be resized,
1028      +  and is one of the values of the resize_edge enum. The compositor
1029      +  may use this information to update the surface position for
1030      +  example when dragging the top left corner. The compositor may also
1031      +  use this information to adapt its behavior, e.g. choose an
1032      +  appropriate cursor image.
1033      +/
1034     void resize(WlSeat seat,
1035                 uint serial,
1036                 uint edges)
1037     {
1038         wl_proxy_marshal(
1039             proxy, resizeOpCode, seat.proxy, serial, edges
1040         );
1041     }
1042 
1043     /++
1044      +  set the maximum size
1045      +
1046      +  Set a maximum size for the window.
1047      +
1048      +  The client can specify a maximum size so that the compositor does
1049      +  not try to configure the window beyond this size.
1050      +
1051      +  The width and height arguments are in window geometry coordinates.
1052      +  See xdg_surface.set_window_geometry.
1053      +
1054      +  Values set in this way are double-buffered. They will get applied
1055      +  on the next commit.
1056      +
1057      +  The compositor can use this information to allow or disallow
1058      +  different states like maximize or fullscreen and draw accurate
1059      +  animations.
1060      +
1061      +  Similarly, a tiling window manager may use this information to
1062      +  place and resize client windows in a more effective way.
1063      +
1064      +  The client should not rely on the compositor to obey the maximum
1065      +  size. The compositor may decide to ignore the values set by the
1066      +  client and request a larger size.
1067      +
1068      +  If never set, or a value of zero in the request, means that the
1069      +  client has no expected maximum size in the given dimension.
1070      +  As a result, a client wishing to reset the maximum size
1071      +  to an unspecified state can use zero for width and height in the
1072      +  request.
1073      +
1074      +  Requesting a maximum size to be smaller than the minimum size of
1075      +  a surface is illegal and will result in a protocol error.
1076      +
1077      +  The width and height must be greater than or equal to zero. Using
1078      +  strictly negative values for width and height will result in a
1079      +  protocol error.
1080      +/
1081     void setMaxSize(int width,
1082                     int height)
1083     {
1084         wl_proxy_marshal(
1085             proxy, setMaxSizeOpCode, width, height
1086         );
1087     }
1088 
1089     /++
1090      +  set the minimum size
1091      +
1092      +  Set a minimum size for the window.
1093      +
1094      +  The client can specify a minimum size so that the compositor does
1095      +  not try to configure the window below this size.
1096      +
1097      +  The width and height arguments are in window geometry coordinates.
1098      +  See xdg_surface.set_window_geometry.
1099      +
1100      +  Values set in this way are double-buffered. They will get applied
1101      +  on the next commit.
1102      +
1103      +  The compositor can use this information to allow or disallow
1104      +  different states like maximize or fullscreen and draw accurate
1105      +  animations.
1106      +
1107      +  Similarly, a tiling window manager may use this information to
1108      +  place and resize client windows in a more effective way.
1109      +
1110      +  The client should not rely on the compositor to obey the minimum
1111      +  size. The compositor may decide to ignore the values set by the
1112      +  client and request a smaller size.
1113      +
1114      +  If never set, or a value of zero in the request, means that the
1115      +  client has no expected minimum size in the given dimension.
1116      +  As a result, a client wishing to reset the minimum size
1117      +  to an unspecified state can use zero for width and height in the
1118      +  request.
1119      +
1120      +  Requesting a minimum size to be larger than the maximum size of
1121      +  a surface is illegal and will result in a protocol error.
1122      +
1123      +  The width and height must be greater than or equal to zero. Using
1124      +  strictly negative values for width and height will result in a
1125      +  protocol error.
1126      +/
1127     void setMinSize(int width,
1128                     int height)
1129     {
1130         wl_proxy_marshal(
1131             proxy, setMinSizeOpCode, width, height
1132         );
1133     }
1134 
1135     /++
1136      +  maximize the window
1137      +
1138      +  Maximize the surface.
1139      +
1140      +  After requesting that the surface should be maximized, the compositor
1141      +  will respond by emitting a configure event with the "maximized" state
1142      +  and the required window geometry. The client should then update its
1143      +  content, drawing it in a maximized state, i.e. without shadow or other
1144      +  decoration outside of the window geometry. The client must also
1145      +  acknowledge the configure when committing the new content $(LPAREN)see
1146      +  ack_configure$(RPAREN).
1147      +
1148      +  It is up to the compositor to decide how and where to maximize the
1149      +  surface, for example which output and what region of the screen should
1150      +  be used.
1151      +
1152      +  If the surface was already maximized, the compositor will still emit
1153      +  a configure event with the "maximized" state.
1154      +/
1155     void setMaximized()
1156     {
1157         wl_proxy_marshal(
1158             proxy, setMaximizedOpCode
1159         );
1160     }
1161 
1162     /++
1163      +  unmaximize the window
1164      +
1165      +  Unmaximize the surface.
1166      +
1167      +  After requesting that the surface should be unmaximized, the compositor
1168      +  will respond by emitting a configure event without the "maximized"
1169      +  state. If available, the compositor will include the window geometry
1170      +  dimensions the window had prior to being maximized in the configure
1171      +  request. The client must then update its content, drawing it in a
1172      +  regular state, i.e. potentially with shadow, etc. The client must also
1173      +  acknowledge the configure when committing the new content $(LPAREN)see
1174      +  ack_configure$(RPAREN).
1175      +
1176      +  It is up to the compositor to position the surface after it was
1177      +  unmaximized; usually the position the surface had before maximizing, if
1178      +  applicable.
1179      +
1180      +  If the surface was already not maximized, the compositor will still
1181      +  emit a configure event without the "maximized" state.
1182      +/
1183     void unsetMaximized()
1184     {
1185         wl_proxy_marshal(
1186             proxy, unsetMaximizedOpCode
1187         );
1188     }
1189 
1190     /++
1191      +  set the window as fullscreen on a monitor
1192      +
1193      +  Make the surface fullscreen.
1194      +
1195      +  You can specify an output that you would prefer to be fullscreen.
1196      +  If this value is NULL, it's up to the compositor to choose which
1197      +  display will be used to map this surface.
1198      +
1199      +  If the surface doesn't cover the whole output, the compositor will
1200      +  position the surface in the center of the output and compensate with
1201      +  black borders filling the rest of the output.
1202      +/
1203     void setFullscreen(WlOutput output)
1204     {
1205         wl_proxy_marshal(
1206             proxy, setFullscreenOpCode, output.proxy
1207         );
1208     }
1209 
1210     void unsetFullscreen()
1211     {
1212         wl_proxy_marshal(
1213             proxy, unsetFullscreenOpCode
1214         );
1215     }
1216 
1217     /++
1218      +  set the window as minimized
1219      +
1220      +  Request that the compositor minimize your surface. There is no
1221      +  way to know if the surface is currently minimized, nor is there
1222      +  any way to unset minimization on this surface.
1223      +
1224      +  If you are looking to throttle redrawing when minimized, please
1225      +  instead use the wl_surface.frame event for this, as this will
1226      +  also work with live previews on windows in Alt-Tab, Expose or
1227      +  similar compositor features.
1228      +/
1229     void setMinimized()
1230     {
1231         wl_proxy_marshal(
1232             proxy, setMinimizedOpCode
1233         );
1234     }
1235 
1236     /++
1237      +  suggest a surface change
1238      +
1239      +  This configure event asks the client to resize its toplevel surface or
1240      +  to change its state. The configured state should not be applied
1241      +  immediately. See xdg_surface.configure for details.
1242      +
1243      +  The width and height arguments specify a hint to the window
1244      +  about how its surface should be resized in window geometry
1245      +  coordinates. See set_window_geometry.
1246      +
1247      +  If the width or height arguments are zero, it means the client
1248      +  should decide its own window dimension. This may happen when the
1249      +  compositor needs to configure the state of the surface but doesn't
1250      +  have any information about any previous or expected dimension.
1251      +
1252      +  The states listed in the event specify how the width/height
1253      +  arguments should be interpreted, and possibly how it should be
1254      +  drawn.
1255      +
1256      +  Clients must send an ack_configure in response to this event. See
1257      +  xdg_surface.configure and xdg_surface.ack_configure for details.
1258      +/
1259     @property void onConfigure(OnConfigureEventDg dg)
1260     {
1261         _onConfigure = dg;
1262     }
1263 
1264     /++
1265      +  surface wants to be closed
1266      +
1267      +  The close event is sent by the compositor when the user
1268      +  wants the surface to be closed. This should be equivalent to
1269      +  the user clicking the close button in client-side decorations,
1270      +  if your application has any.
1271      +
1272      +  This is only a request that the user intends to close the
1273      +  window. The client may choose to ignore this request, or show
1274      +  a dialog to ask the user to save their data, etc.
1275      +/
1276     @property void onClose(OnCloseEventDg dg)
1277     {
1278         _onClose = dg;
1279     }
1280 
1281     private OnConfigureEventDg _onConfigure;
1282     private OnCloseEventDg _onClose;
1283 }
1284 
1285 /++
1286  +  short-lived, popup surfaces for menus
1287  +
1288  +  A popup surface is a short-lived, temporary surface. It can be used to
1289  +  implement for example menus, popovers, tooltips and other similar user
1290  +  interface concepts.
1291  +
1292  +  A popup can be made to take an explicit grab. See xdg_popup.grab for
1293  +  details.
1294  +
1295  +  When the popup is dismissed, a popup_done event will be sent out, and at
1296  +  the same time the surface will be unmapped. See the xdg_popup.popup_done
1297  +  event for details.
1298  +
1299  +  Explicitly destroying the xdg_popup object will also dismiss the popup and
1300  +  unmap the surface. Clients that want to dismiss the popup when another
1301  +  surface of their own is clicked should dismiss the popup using the destroy
1302  +  request.
1303  +
1304  +  The parent surface must have either the xdg_toplevel or xdg_popup surface
1305  +  role.
1306  +
1307  +  A newly created xdg_popup will be stacked on top of all previously created
1308  +  xdg_popup surfaces associated with the same xdg_toplevel.
1309  +
1310  +  The parent of an xdg_popup must be mapped $(LPAREN)see the xdg_surface
1311  +  description$(RPAREN) before the xdg_popup itself.
1312  +
1313  +  The x and y arguments passed when creating the popup object specify
1314  +  where the top left of the popup should be placed, relative to the
1315  +  local surface coordinates of the parent surface. See
1316  +  xdg_surface.get_popup. An xdg_popup must intersect with or be at least
1317  +  partially adjacent to its parent surface.
1318  +
1319  +  The client must call wl_surface.commit on the corresponding wl_surface
1320  +  for the xdg_popup state to take effect.
1321  +/
1322 final class ZxdgPopupV6 : WlProxy
1323 {
1324     /// Version of xdg_shell_unstable_v6.zxdg_popup_v6
1325     enum ver = 1;
1326 
1327     /// Build a ZxdgPopupV6 from a native object.
1328     private this(wl_proxy* native)
1329     {
1330         super(native);
1331         wl_proxy_add_listener(proxy, cast(void_func_t*)&wl_d_zxdg_popup_v6_listener, null);
1332     }
1333 
1334     /// Interface object that creates ZxdgPopupV6 objects.
1335     static @property immutable(WlProxyInterface) iface()
1336     {
1337         return zxdgPopupV6Iface;
1338     }
1339 
1340     /// Op-code of ZxdgPopupV6.destroy.
1341     enum destroyOpCode = 0;
1342     /// Op-code of ZxdgPopupV6.grab.
1343     enum grabOpCode = 1;
1344 
1345     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPopupV6.destroy.
1346     enum destroySinceVersion = 1;
1347     /// Version of xdg_shell_unstable_v6 protocol introducing ZxdgPopupV6.grab.
1348     enum grabSinceVersion = 1;
1349 
1350     /// xdg_shell_unstable_v6 protocol version introducing ZxdgPopupV6.onConfigure.
1351     enum onConfigureSinceVersion = 1;
1352     /// xdg_shell_unstable_v6 protocol version introducing ZxdgPopupV6.onPopupDone.
1353     enum onPopupDoneSinceVersion = 1;
1354 
1355     /// Event delegate signature of ZxdgPopupV6.onConfigure.
1356     alias OnConfigureEventDg = void delegate(ZxdgPopupV6 zxdgPopupV6,
1357                                              int x,
1358                                              int y,
1359                                              int width,
1360                                              int height);
1361     /// Event delegate signature of ZxdgPopupV6.onPopupDone.
1362     alias OnPopupDoneEventDg = void delegate(ZxdgPopupV6 zxdgPopupV6);
1363 
1364     enum Error : uint
1365     {
1366         /// tried to grab after being mapped
1367         invalidGrab = 0,
1368     }
1369 
1370     /++
1371      +  remove xdg_popup interface
1372      +
1373      +  This destroys the popup. Explicitly destroying the xdg_popup
1374      +  object will also dismiss the popup, and unmap the surface.
1375      +
1376      +  If this xdg_popup is not the "topmost" popup, a protocol error
1377      +  will be sent.
1378      +/
1379     void destroy()
1380     {
1381         wl_proxy_marshal(
1382             proxy, destroyOpCode
1383         );
1384         super.destroyNotify();
1385     }
1386 
1387     /++
1388      +  make the popup take an explicit grab
1389      +
1390      +  This request makes the created popup take an explicit grab. An explicit
1391      +  grab will be dismissed when the user dismisses the popup, or when the
1392      +  client destroys the xdg_popup. This can be done by the user clicking
1393      +  outside the surface, using the keyboard, or even locking the screen
1394      +  through closing the lid or a timeout.
1395      +
1396      +  If the compositor denies the grab, the popup will be immediately
1397      +  dismissed.
1398      +
1399      +  This request must be used in response to some sort of user action like a
1400      +  button press, key press, or touch down event. The serial number of the
1401      +  event should be passed as 'serial'.
1402      +
1403      +  The parent of a grabbing popup must either be an xdg_toplevel surface or
1404      +  another xdg_popup with an explicit grab. If the parent is another
1405      +  xdg_popup it means that the popups are nested, with this popup now being
1406      +  the topmost popup.
1407      +
1408      +  Nested popups must be destroyed in the reverse order they were created
1409      +  in, e.g. the only popup you are allowed to destroy at all times is the
1410      +  topmost one.
1411      +
1412      +  When compositors choose to dismiss a popup, they may dismiss every
1413      +  nested grabbing popup as well. When a compositor dismisses popups, it
1414      +  will follow the same dismissing order as required from the client.
1415      +
1416      +  The parent of a grabbing popup must either be another xdg_popup with an
1417      +  active explicit grab, or an xdg_popup or xdg_toplevel, if there are no
1418      +  explicit grabs already taken.
1419      +
1420      +  If the topmost grabbing popup is destroyed, the grab will be returned to
1421      +  the parent of the popup, if that parent previously had an explicit grab.
1422      +
1423      +  If the parent is a grabbing popup which has already been dismissed, this
1424      +  popup will be immediately dismissed. If the parent is a popup that did
1425      +  not take an explicit grab, an error will be raised.
1426      +
1427      +  During a popup grab, the client owning the grab will receive pointer
1428      +  and touch events for all their surfaces as normal $(LPAREN)similar to an
1429      +  "owner-events" grab in X11 parlance$(RPAREN), while the top most grabbing popup
1430      +  will always have keyboard focus.
1431      +/
1432     void grab(WlSeat seat,
1433               uint serial)
1434     {
1435         wl_proxy_marshal(
1436             proxy, grabOpCode, seat.proxy, serial
1437         );
1438     }
1439 
1440     /++
1441      +  configure the popup surface
1442      +
1443      +  This event asks the popup surface to configure itself given the
1444      +  configuration. The configured state should not be applied immediately.
1445      +  See xdg_surface.configure for details.
1446      +
1447      +  The x and y arguments represent the position the popup was placed at
1448      +  given the xdg_positioner rule, relative to the upper left corner of the
1449      +  window geometry of the parent surface.
1450      +/
1451     @property void onConfigure(OnConfigureEventDg dg)
1452     {
1453         _onConfigure = dg;
1454     }
1455 
1456     /++
1457      +  popup interaction is done
1458      +
1459      +  The popup_done event is sent out when a popup is dismissed by the
1460      +  compositor. The client should destroy the xdg_popup object at this
1461      +  point.
1462      +/
1463     @property void onPopupDone(OnPopupDoneEventDg dg)
1464     {
1465         _onPopupDone = dg;
1466     }
1467 
1468     private OnConfigureEventDg _onConfigure;
1469     private OnPopupDoneEventDg _onPopupDone;
1470 }
1471 
1472 private:
1473 
1474 immutable WlProxyInterface zxdgShellV6Iface;
1475 immutable WlProxyInterface zxdgPositionerV6Iface;
1476 immutable WlProxyInterface zxdgSurfaceV6Iface;
1477 immutable WlProxyInterface zxdgToplevelV6Iface;
1478 immutable WlProxyInterface zxdgPopupV6Iface;
1479 
1480 immutable final class ZxdgShellV6Iface : WlProxyInterface
1481 {
1482     this(immutable wl_interface* native)
1483     {
1484         super(native);
1485     }
1486     override WlProxy makeProxy(wl_proxy* proxy) immutable
1487     {
1488         return new ZxdgShellV6(proxy);
1489     }
1490 }
1491 
1492 immutable final class ZxdgPositionerV6Iface : WlProxyInterface
1493 {
1494     this(immutable wl_interface* native)
1495     {
1496         super(native);
1497     }
1498     override WlProxy makeProxy(wl_proxy* proxy) immutable
1499     {
1500         return new ZxdgPositionerV6(proxy);
1501     }
1502 }
1503 
1504 immutable final class ZxdgSurfaceV6Iface : WlProxyInterface
1505 {
1506     this(immutable wl_interface* native)
1507     {
1508         super(native);
1509     }
1510     override WlProxy makeProxy(wl_proxy* proxy) immutable
1511     {
1512         return new ZxdgSurfaceV6(proxy);
1513     }
1514 }
1515 
1516 immutable final class ZxdgToplevelV6Iface : WlProxyInterface
1517 {
1518     this(immutable wl_interface* native)
1519     {
1520         super(native);
1521     }
1522     override WlProxy makeProxy(wl_proxy* proxy) immutable
1523     {
1524         return new ZxdgToplevelV6(proxy);
1525     }
1526 }
1527 
1528 immutable final class ZxdgPopupV6Iface : WlProxyInterface
1529 {
1530     this(immutable wl_interface* native)
1531     {
1532         super(native);
1533     }
1534     override WlProxy makeProxy(wl_proxy* proxy) immutable
1535     {
1536         return new ZxdgPopupV6(proxy);
1537     }
1538 }
1539 
1540 immutable wl_interface[] wl_ifaces;
1541 
1542 enum zxdgShellV6Index = 0;
1543 enum zxdgPositionerV6Index = 1;
1544 enum zxdgSurfaceV6Index = 2;
1545 enum zxdgToplevelV6Index = 3;
1546 enum zxdgPopupV6Index = 4;
1547 
1548 shared static this()
1549 {
1550     auto ifaces = new wl_interface[5];
1551 
1552     auto msgTypes = [
1553         null,
1554         null,
1555         null,
1556         null,
1557         &ifaces[zxdgPositionerV6Index],
1558         &ifaces[zxdgSurfaceV6Index],
1559         cast(wl_interface*)WlSurface.iface.native,
1560         &ifaces[zxdgToplevelV6Index],
1561         &ifaces[zxdgPopupV6Index],
1562         &ifaces[zxdgSurfaceV6Index],
1563         &ifaces[zxdgPositionerV6Index],
1564         &ifaces[zxdgToplevelV6Index],
1565         cast(wl_interface*)WlSeat.iface.native,
1566         null,
1567         null,
1568         null,
1569         cast(wl_interface*)WlSeat.iface.native,
1570         null,
1571         cast(wl_interface*)WlSeat.iface.native,
1572         null,
1573         null,
1574         cast(wl_interface*)WlOutput.iface.native,
1575         cast(wl_interface*)WlSeat.iface.native,
1576         null,
1577     ];
1578 
1579     auto zxdg_shell_v6_requests = [
1580         wl_message("destroy", "", &msgTypes[0]),
1581         wl_message("create_positioner", "n", &msgTypes[4]),
1582         wl_message("get_xdg_surface", "no", &msgTypes[5]),
1583         wl_message("pong", "u", &msgTypes[0]),
1584     ];
1585     auto zxdg_shell_v6_events = [
1586         wl_message("ping", "u", &msgTypes[0]),
1587     ];
1588     ifaces[zxdgShellV6Index].name = "zxdg_shell_v6";
1589     ifaces[zxdgShellV6Index].version_ = 1;
1590     ifaces[zxdgShellV6Index].method_count = 4;
1591     ifaces[zxdgShellV6Index].methods = zxdg_shell_v6_requests.ptr;
1592     ifaces[zxdgShellV6Index].event_count = 1;
1593     ifaces[zxdgShellV6Index].events = zxdg_shell_v6_events.ptr;
1594 
1595     auto zxdg_positioner_v6_requests = [
1596         wl_message("destroy", "", &msgTypes[0]),
1597         wl_message("set_size", "ii", &msgTypes[0]),
1598         wl_message("set_anchor_rect", "iiii", &msgTypes[0]),
1599         wl_message("set_anchor", "u", &msgTypes[0]),
1600         wl_message("set_gravity", "u", &msgTypes[0]),
1601         wl_message("set_constraint_adjustment", "u", &msgTypes[0]),
1602         wl_message("set_offset", "ii", &msgTypes[0]),
1603     ];
1604     ifaces[zxdgPositionerV6Index].name = "zxdg_positioner_v6";
1605     ifaces[zxdgPositionerV6Index].version_ = 1;
1606     ifaces[zxdgPositionerV6Index].method_count = 7;
1607     ifaces[zxdgPositionerV6Index].methods = zxdg_positioner_v6_requests.ptr;
1608 
1609     auto zxdg_surface_v6_requests = [
1610         wl_message("destroy", "", &msgTypes[0]),
1611         wl_message("get_toplevel", "n", &msgTypes[7]),
1612         wl_message("get_popup", "noo", &msgTypes[8]),
1613         wl_message("set_window_geometry", "iiii", &msgTypes[0]),
1614         wl_message("ack_configure", "u", &msgTypes[0]),
1615     ];
1616     auto zxdg_surface_v6_events = [
1617         wl_message("configure", "u", &msgTypes[0]),
1618     ];
1619     ifaces[zxdgSurfaceV6Index].name = "zxdg_surface_v6";
1620     ifaces[zxdgSurfaceV6Index].version_ = 1;
1621     ifaces[zxdgSurfaceV6Index].method_count = 5;
1622     ifaces[zxdgSurfaceV6Index].methods = zxdg_surface_v6_requests.ptr;
1623     ifaces[zxdgSurfaceV6Index].event_count = 1;
1624     ifaces[zxdgSurfaceV6Index].events = zxdg_surface_v6_events.ptr;
1625 
1626     auto zxdg_toplevel_v6_requests = [
1627         wl_message("destroy", "", &msgTypes[0]),
1628         wl_message("set_parent", "?o", &msgTypes[11]),
1629         wl_message("set_title", "s", &msgTypes[0]),
1630         wl_message("set_app_id", "s", &msgTypes[0]),
1631         wl_message("show_window_menu", "ouii", &msgTypes[12]),
1632         wl_message("move", "ou", &msgTypes[16]),
1633         wl_message("resize", "ouu", &msgTypes[18]),
1634         wl_message("set_max_size", "ii", &msgTypes[0]),
1635         wl_message("set_min_size", "ii", &msgTypes[0]),
1636         wl_message("set_maximized", "", &msgTypes[0]),
1637         wl_message("unset_maximized", "", &msgTypes[0]),
1638         wl_message("set_fullscreen", "?o", &msgTypes[21]),
1639         wl_message("unset_fullscreen", "", &msgTypes[0]),
1640         wl_message("set_minimized", "", &msgTypes[0]),
1641     ];
1642     auto zxdg_toplevel_v6_events = [
1643         wl_message("configure", "iia", &msgTypes[0]),
1644         wl_message("close", "", &msgTypes[0]),
1645     ];
1646     ifaces[zxdgToplevelV6Index].name = "zxdg_toplevel_v6";
1647     ifaces[zxdgToplevelV6Index].version_ = 1;
1648     ifaces[zxdgToplevelV6Index].method_count = 14;
1649     ifaces[zxdgToplevelV6Index].methods = zxdg_toplevel_v6_requests.ptr;
1650     ifaces[zxdgToplevelV6Index].event_count = 2;
1651     ifaces[zxdgToplevelV6Index].events = zxdg_toplevel_v6_events.ptr;
1652 
1653     auto zxdg_popup_v6_requests = [
1654         wl_message("destroy", "", &msgTypes[0]),
1655         wl_message("grab", "ou", &msgTypes[22]),
1656     ];
1657     auto zxdg_popup_v6_events = [
1658         wl_message("configure", "iiii", &msgTypes[0]),
1659         wl_message("popup_done", "", &msgTypes[0]),
1660     ];
1661     ifaces[zxdgPopupV6Index].name = "zxdg_popup_v6";
1662     ifaces[zxdgPopupV6Index].version_ = 1;
1663     ifaces[zxdgPopupV6Index].method_count = 2;
1664     ifaces[zxdgPopupV6Index].methods = zxdg_popup_v6_requests.ptr;
1665     ifaces[zxdgPopupV6Index].event_count = 2;
1666     ifaces[zxdgPopupV6Index].events = zxdg_popup_v6_events.ptr;
1667 
1668     import std.exception : assumeUnique;
1669     wl_ifaces = assumeUnique(ifaces);
1670 
1671     zxdgShellV6Iface = new immutable ZxdgShellV6Iface( &wl_ifaces[zxdgShellV6Index] );
1672     zxdgPositionerV6Iface = new immutable ZxdgPositionerV6Iface( &wl_ifaces[zxdgPositionerV6Index] );
1673     zxdgSurfaceV6Iface = new immutable ZxdgSurfaceV6Iface( &wl_ifaces[zxdgSurfaceV6Index] );
1674     zxdgToplevelV6Iface = new immutable ZxdgToplevelV6Iface( &wl_ifaces[zxdgToplevelV6Index] );
1675     zxdgPopupV6Iface = new immutable ZxdgPopupV6Iface( &wl_ifaces[zxdgPopupV6Index] );
1676 }
1677 
1678 extern(C) nothrow
1679 {
1680     struct zxdg_shell_v6_listener
1681     {
1682         void function(void* data,
1683                       wl_proxy* proxy,
1684                       uint serial) ping;
1685     }
1686 
1687     __gshared wl_d_zxdg_shell_v6_listener = zxdg_shell_v6_listener (&wl_d_on_zxdg_shell_v6_ping);
1688 
1689     void wl_d_on_zxdg_shell_v6_ping(void* data,
1690                                     wl_proxy* proxy,
1691                                     uint serial)
1692     {
1693         nothrowFnWrapper!({
1694             auto _p = WlProxy.get(proxy);
1695             assert(_p, "listener stub without proxy");
1696             auto _i = cast(ZxdgShellV6)_p;
1697             assert(_i, "listener stub proxy is not ZxdgShellV6");
1698             if (_i._onPing)
1699             {
1700                 _i._onPing(_i, serial);
1701             }
1702         });
1703     }
1704 
1705 
1706     struct zxdg_surface_v6_listener
1707     {
1708         void function(void* data,
1709                       wl_proxy* proxy,
1710                       uint serial) configure;
1711     }
1712 
1713     __gshared wl_d_zxdg_surface_v6_listener = zxdg_surface_v6_listener (&wl_d_on_zxdg_surface_v6_configure);
1714 
1715     void wl_d_on_zxdg_surface_v6_configure(void* data,
1716                                            wl_proxy* proxy,
1717                                            uint serial)
1718     {
1719         nothrowFnWrapper!({
1720             auto _p = WlProxy.get(proxy);
1721             assert(_p, "listener stub without proxy");
1722             auto _i = cast(ZxdgSurfaceV6)_p;
1723             assert(_i, "listener stub proxy is not ZxdgSurfaceV6");
1724             if (_i._onConfigure)
1725             {
1726                 _i._onConfigure(_i, serial);
1727             }
1728         });
1729     }
1730 
1731     struct zxdg_toplevel_v6_listener
1732     {
1733         void function(void* data,
1734                       wl_proxy* proxy,
1735                       int width,
1736                       int height,
1737                       wl_array* states) configure;
1738         void function(void* data,
1739                       wl_proxy* proxy) close;
1740     }
1741 
1742     __gshared wl_d_zxdg_toplevel_v6_listener = zxdg_toplevel_v6_listener (&wl_d_on_zxdg_toplevel_v6_configure,
1743                                                                           &wl_d_on_zxdg_toplevel_v6_close);
1744 
1745     void wl_d_on_zxdg_toplevel_v6_configure(void* data,
1746                                             wl_proxy* proxy,
1747                                             int width,
1748                                             int height,
1749                                             wl_array* states)
1750     {
1751         nothrowFnWrapper!({
1752             auto _p = WlProxy.get(proxy);
1753             assert(_p, "listener stub without proxy");
1754             auto _i = cast(ZxdgToplevelV6)_p;
1755             assert(_i, "listener stub proxy is not ZxdgToplevelV6");
1756             if (_i._onConfigure)
1757             {
1758                 _i._onConfigure(_i, width, height, states);
1759             }
1760         });
1761     }
1762 
1763     void wl_d_on_zxdg_toplevel_v6_close(void* data,
1764                                         wl_proxy* proxy)
1765     {
1766         nothrowFnWrapper!({
1767             auto _p = WlProxy.get(proxy);
1768             assert(_p, "listener stub without proxy");
1769             auto _i = cast(ZxdgToplevelV6)_p;
1770             assert(_i, "listener stub proxy is not ZxdgToplevelV6");
1771             if (_i._onClose)
1772             {
1773                 _i._onClose(_i);
1774             }
1775         });
1776     }
1777 
1778     struct zxdg_popup_v6_listener
1779     {
1780         void function(void* data,
1781                       wl_proxy* proxy,
1782                       int x,
1783                       int y,
1784                       int width,
1785                       int height) configure;
1786         void function(void* data,
1787                       wl_proxy* proxy) popup_done;
1788     }
1789 
1790     __gshared wl_d_zxdg_popup_v6_listener = zxdg_popup_v6_listener (&wl_d_on_zxdg_popup_v6_configure,
1791                                                                     &wl_d_on_zxdg_popup_v6_popup_done);
1792 
1793     void wl_d_on_zxdg_popup_v6_configure(void* data,
1794                                          wl_proxy* proxy,
1795                                          int x,
1796                                          int y,
1797                                          int width,
1798                                          int height)
1799     {
1800         nothrowFnWrapper!({
1801             auto _p = WlProxy.get(proxy);
1802             assert(_p, "listener stub without proxy");
1803             auto _i = cast(ZxdgPopupV6)_p;
1804             assert(_i, "listener stub proxy is not ZxdgPopupV6");
1805             if (_i._onConfigure)
1806             {
1807                 _i._onConfigure(_i, x, y, width, height);
1808             }
1809         });
1810     }
1811 
1812     void wl_d_on_zxdg_popup_v6_popup_done(void* data,
1813                                           wl_proxy* proxy)
1814     {
1815         nothrowFnWrapper!({
1816             auto _p = WlProxy.get(proxy);
1817             assert(_p, "listener stub without proxy");
1818             auto _i = cast(ZxdgPopupV6)_p;
1819             assert(_i, "listener stub proxy is not ZxdgPopupV6");
1820             if (_i._onPopupDone)
1821             {
1822                 _i._onPopupDone(_i);
1823             }
1824         });
1825     }
1826 }