1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: xdg_dialog_v1
3// Source: xdg-dialog-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2023 Carlos Garnacho
7//
8// Permission is hereby granted, free of charge, to any person obtaining a
9// copy of this software and associated documentation files (the "Software"),
10// to deal in the Software without restriction, including without limitation
11// the rights to use, copy, modify, merge, publish, distribute, sublicense,
12// and/or sell copies of the Software, and to permit persons to whom the
13// Software is furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice (including the next
16// paragraph) shall be included in all copies or substantial portions of the
17// Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25// DEALINGS IN THE SOFTWARE.
26
27package xdgdialog
28
29import (
30 cross_xdg_toplevel "github.com/bnema/go-wayland-bindings/client/xdgshell"
31 "github.com/bnema/wlturbo/wl"
32)
33
34// ERROR_ALREADY_USED is the error already_used value.
35const ERROR_ALREADY_USED = 0
36
37// XdgWmDialogInterface is the protocol interface name.
38const XdgWmDialogInterface = "xdg_wm_dialog_v1"
39
40// XdgWmDialog is the generated binding for xdg_wm_dialog_v1 version 1.
41type XdgWmDialog struct {
42 wl.BaseProxy
43}
44
45// NewXdgWmDialog returns an unbound XdgWmDialog.
46func NewXdgWmDialog(ctx *wl.Context) *XdgWmDialog {
47 obj := &XdgWmDialog{}
48 obj.SetContext(ctx)
49 ctx.Register(obj)
50 return obj
51}
52
53// Destroys the xdg_wm_dialog_v1 object. This does not affect the xdg_dialog_v1 objects generated through it.
54func (o *XdgWmDialog) Destroy() error {
55 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_wm_dialog_v1.destroy", Destructor: true}); err != nil {
56 return err
57 }
58 return nil
59}
60
61// Creates a xdg_dialog_v1 object for the given toplevel. See the interface description for more details. Compositors must raise an already_used error if clients attempt to create multiple xdg_dialog_v1 objects for the same xdg_toplevel.
62func (o *XdgWmDialog) GetXdgDialog(toplevel *cross_xdg_toplevel.XdgToplevel) (*XdgDialog, error) {
63 var arg1 wl.Object
64 if toplevel != nil {
65 arg1 = toplevel
66 }
67 child := &XdgDialog{}
68 child.SetContext(o.Context())
69 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_wm_dialog_v1.get_xdg_dialog", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
70 return nil, err
71 }
72 return child, nil
73}
74
75// EventSignature returns the declared event argument types in wire order.
76func (o *XdgWmDialog) EventSignature(opcode uint16) (string, bool) {
77 switch opcode {
78 default:
79 return "", false
80 }
81}
82
83// Dispatch decodes one event on xdg_wm_dialog_v1 and calls the registered handlers.
84func (o *XdgWmDialog) Dispatch(event *wl.Event) {
85 switch event.Opcode {
86 default:
87 }
88}
89
90// XdgDialogInterface is the protocol interface name.
91const XdgDialogInterface = "xdg_dialog_v1"
92
93// XdgDialog is the generated binding for xdg_dialog_v1 version 1.
94type XdgDialog struct {
95 wl.BaseProxy
96}
97
98// NewXdgDialog returns an unbound XdgDialog.
99func NewXdgDialog(ctx *wl.Context) *XdgDialog {
100 obj := &XdgDialog{}
101 obj.SetContext(ctx)
102 ctx.Register(obj)
103 return obj
104}
105
106// Destroys the xdg_dialog_v1 object. If this object is destroyed before the related xdg_toplevel, the compositor should unapply its effects.
107func (o *XdgDialog) Destroy() error {
108 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "xdg_dialog_v1.destroy", Destructor: true}); err != nil {
109 return err
110 }
111 return nil
112}
113
114// Hints that the dialog has "modal" behavior. Modal dialogs typically require to be fully addressed by the user (i.e. closed) before resuming interaction with the parent toplevel, and may require a distinct presentation. Clients must implement the logic to filter events in the parent toplevel on their own. Compositors may choose any policy in event delivery to the parent toplevel, from delivering all events unfiltered to using them for internal consumption.
115func (o *XdgDialog) SetModal() error {
116 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "xdg_dialog_v1.set_modal"}); err != nil {
117 return err
118 }
119 return nil
120}
121
122// Drops the hint that this dialog has "modal" behavior. See xdg_dialog_v1.set_modal for more details.
123func (o *XdgDialog) UnsetModal() error {
124 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "xdg_dialog_v1.unset_modal"}); err != nil {
125 return err
126 }
127 return nil
128}
129
130// EventSignature returns the declared event argument types in wire order.
131func (o *XdgDialog) EventSignature(opcode uint16) (string, bool) {
132 switch opcode {
133 default:
134 return "", false
135 }
136}
137
138// Dispatch decodes one event on xdg_dialog_v1 and calls the registered handlers.
139func (o *XdgDialog) Dispatch(event *wl.Event) {
140 switch event.Opcode {
141 default:
142 }
143}