keyboardshortcutsinhibit_generated.go RawHistoryFolder
1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright © 2017 Red Hat Inc.
5//
6// Permission is hereby granted, free of charge, to any person obtaining a
7// copy of this software and associated documentation files (the "Software"),
8// to deal in the Software without restriction, including without limitation
9// the rights to use, copy, modify, merge, publish, distribute, sublicense,
10// and/or sell copies of the Software, and to permit persons to whom the
11// Software is furnished to do so, subject to the following conditions:
12//
13// The above copyright notice and this permission notice (including the next
14// paragraph) shall be included in all copies or substantial portions of the
15// Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE.
24
25package keyboardshortcutsinhibit
26
27import (
28 "fmt"
29 wayland "github.com/bnema/go-wayland-bindings/server/wayland"
30 "github.com/bnema/purego-libwayland/server"
31)
32
33var ZwpKeyboardShortcutsInhibitManagerV1Interface *server.Interface
34var ZwpKeyboardShortcutsInhibitorV1Interface *server.Interface
35
36func init() {
37 ZwpKeyboardShortcutsInhibitManagerV1Interface = &server.Interface{Name: "zwp_keyboard_shortcuts_inhibit_manager_v1", Version: 1}
38 ZwpKeyboardShortcutsInhibitorV1Interface = &server.Interface{Name: "zwp_keyboard_shortcuts_inhibitor_v1", Version: 1}
39 ZwpKeyboardShortcutsInhibitManagerV1Interface.Requests = []server.Message{
40 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
41 {Name: "inhibit_shortcuts", Signature: "noo", Types: []*server.Interface{ZwpKeyboardShortcutsInhibitorV1Interface, wayland.SurfaceInterface, wayland.SeatInterface}},
42 }
43 ZwpKeyboardShortcutsInhibitManagerV1Interface.Events = []server.Message{}
44 ZwpKeyboardShortcutsInhibitorV1Interface.Requests = []server.Message{
45 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
46 }
47 ZwpKeyboardShortcutsInhibitorV1Interface.Events = []server.Message{
48 {Name: "active", Signature: "", Types: []*server.Interface{}},
49 {Name: "inactive", Signature: "", Types: []*server.Interface{}},
50 }
51 if err := server.NewInterfaces(ZwpKeyboardShortcutsInhibitManagerV1Interface, ZwpKeyboardShortcutsInhibitorV1Interface); err != nil {
52 panic(err)
53 }
54}
55
56// ZwpKeyboardShortcutsInhibitManagerV1 context object for keyboard grab_manager.
57type ZwpKeyboardShortcutsInhibitManagerV1 struct{ *server.Resource }
58
59func WrapZwpKeyboardShortcutsInhibitManagerV1(r *server.Resource) *ZwpKeyboardShortcutsInhibitManagerV1 {
60 if r == nil {
61 return nil
62 }
63 return &ZwpKeyboardShortcutsInhibitManagerV1{r}
64}
65
66const ZwpKeyboardShortcutsInhibitManagerV1RequestDestroy uint32 = 0
67const ZwpKeyboardShortcutsInhibitManagerV1RequestInhibitShortcuts uint32 = 1
68
69// ZwpKeyboardShortcutsInhibitManagerV1Error .
70type ZwpKeyboardShortcutsInhibitManagerV1Error uint32
71
72const (
73 ZwpKeyboardShortcutsInhibitManagerV1ErrorAlreadyInhibited ZwpKeyboardShortcutsInhibitManagerV1Error = 0
74)
75
76// ZwpKeyboardShortcutsInhibitManagerV1Handler handles zwp_keyboard_shortcuts_inhibit_manager_v1 requests.
77type ZwpKeyboardShortcutsInhibitManagerV1Handler interface {
78 Destroy(self *ZwpKeyboardShortcutsInhibitManagerV1)
79 InhibitShortcuts(self *ZwpKeyboardShortcutsInhibitManagerV1, id uint32, surface *wayland.Surface, seat *wayland.Seat)
80}
81
82func NewZwpKeyboardShortcutsInhibitManagerV1(c server.Client, version int32, id uint32, h ZwpKeyboardShortcutsInhibitManagerV1Handler) (*ZwpKeyboardShortcutsInhibitManagerV1, error) {
83 if h == nil {
84 return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_keyboard_shortcuts_inhibit_manager_v1")
85 }
86 var self *ZwpKeyboardShortcutsInhibitManagerV1
87 r, err := c.CreateResource(ZwpKeyboardShortcutsInhibitManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
88 switch opcode {
89 case 0:
90 h.Destroy(self)
91 self.Destroy()
92 case 1:
93 h.InhibitShortcuts(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapSeat(args[2].Resource()))
94 }
95 })
96 if err != nil {
97 return nil, err
98 }
99 self = WrapZwpKeyboardShortcutsInhibitManagerV1(r)
100 r.Data = self
101 return self, nil
102}
103func NewZwpKeyboardShortcutsInhibitManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
104 return d.CreateGlobal(ZwpKeyboardShortcutsInhibitManagerV1Interface, version, bind)
105}
106
107// ZwpKeyboardShortcutsInhibitorV1 context object for keyboard shortcuts inhibitor.
108type ZwpKeyboardShortcutsInhibitorV1 struct{ *server.Resource }
109
110func WrapZwpKeyboardShortcutsInhibitorV1(r *server.Resource) *ZwpKeyboardShortcutsInhibitorV1 {
111 if r == nil {
112 return nil
113 }
114 return &ZwpKeyboardShortcutsInhibitorV1{r}
115}
116
117const ZwpKeyboardShortcutsInhibitorV1RequestDestroy uint32 = 0
118const ZwpKeyboardShortcutsInhibitorV1EventActive uint32 = 0
119const ZwpKeyboardShortcutsInhibitorV1EventInactive uint32 = 1
120
121// ZwpKeyboardShortcutsInhibitorV1Handler handles zwp_keyboard_shortcuts_inhibitor_v1 requests.
122type ZwpKeyboardShortcutsInhibitorV1Handler interface {
123 Destroy(self *ZwpKeyboardShortcutsInhibitorV1)
124}
125
126func NewZwpKeyboardShortcutsInhibitorV1(c server.Client, version int32, id uint32, h ZwpKeyboardShortcutsInhibitorV1Handler) (*ZwpKeyboardShortcutsInhibitorV1, error) {
127 if h == nil {
128 return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_keyboard_shortcuts_inhibitor_v1")
129 }
130 var self *ZwpKeyboardShortcutsInhibitorV1
131 r, err := c.CreateResource(ZwpKeyboardShortcutsInhibitorV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
132 switch opcode {
133 case 0:
134 h.Destroy(self)
135 self.Destroy()
136 }
137 })
138 if err != nil {
139 return nil, err
140 }
141 self = WrapZwpKeyboardShortcutsInhibitorV1(r)
142 r.Data = self
143 return self, nil
144}
145
146// SendActive shortcuts are inhibited.
147func (self *ZwpKeyboardShortcutsInhibitorV1) SendActive() {
148 self.PostEvent(ZwpKeyboardShortcutsInhibitorV1EventActive)
149}
150
151// SendInactive shortcuts are restored.
152func (self *ZwpKeyboardShortcutsInhibitorV1) SendInactive() {
153 self.PostEvent(ZwpKeyboardShortcutsInhibitorV1EventInactive)
154}
155func NewZwpKeyboardShortcutsInhibitorV1Global(d *server.Display, version int32, bind server.BindFunc) error {
156 return d.CreateGlobal(ZwpKeyboardShortcutsInhibitorV1Interface, version, bind)
157}
158func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
159 if v == nil {
160 return nil
161 }
162 return v.GetResource()
163}
164func (self *ZwpKeyboardShortcutsInhibitManagerV1) GetResource() *server.Resource {
165 if self == nil {
166 return nil
167 }
168 return self.Resource
169}
170func (self *ZwpKeyboardShortcutsInhibitorV1) GetResource() *server.Resource {
171 if self == nil {
172 return nil
173 }
174 return self.Resource
175}