1// Code generated by wlbgen; DO NOT EDIT.
2
3// Upstream protocol copyright and license:
4// Copyright © 2017 Collabora, Ltd.
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 inputtimestamps
26
27import (
28 "fmt"
29 wayland "github.com/bnema/go-wayland-bindings/server/wayland"
30 "github.com/bnema/purego-libwayland/server"
31)
32
33var ZwpInputTimestampsManagerV1Interface *server.Interface
34var ZwpInputTimestampsV1Interface *server.Interface
35
36func init() {
37 ZwpInputTimestampsManagerV1Interface = &server.Interface{Name: "zwp_input_timestamps_manager_v1", Version: 1}
38 ZwpInputTimestampsV1Interface = &server.Interface{Name: "zwp_input_timestamps_v1", Version: 1}
39 ZwpInputTimestampsManagerV1Interface.Requests = []server.Message{
40 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
41 {Name: "get_keyboard_timestamps", Signature: "no", Types: []*server.Interface{ZwpInputTimestampsV1Interface, wayland.KeyboardInterface}},
42 {Name: "get_pointer_timestamps", Signature: "no", Types: []*server.Interface{ZwpInputTimestampsV1Interface, wayland.PointerInterface}},
43 {Name: "get_touch_timestamps", Signature: "no", Types: []*server.Interface{ZwpInputTimestampsV1Interface, wayland.TouchInterface}},
44 }
45 ZwpInputTimestampsManagerV1Interface.Events = []server.Message{}
46 ZwpInputTimestampsV1Interface.Requests = []server.Message{
47 {Name: "destroy", Signature: "", Types: []*server.Interface{}},
48 }
49 ZwpInputTimestampsV1Interface.Events = []server.Message{
50 {Name: "timestamp", Signature: "uuu", Types: []*server.Interface{nil, nil, nil}},
51 }
52 if err := server.NewInterfaces(ZwpInputTimestampsManagerV1Interface, ZwpInputTimestampsV1Interface); err != nil {
53 panic(err)
54 }
55}
56
57// ZwpInputTimestampsManagerV1 context object for high-resolution input timestamps.
58type ZwpInputTimestampsManagerV1 struct{ *server.Resource }
59
60func WrapZwpInputTimestampsManagerV1(r *server.Resource) *ZwpInputTimestampsManagerV1 {
61 if r == nil {
62 return nil
63 }
64 return &ZwpInputTimestampsManagerV1{r}
65}
66
67const ZwpInputTimestampsManagerV1RequestDestroy uint32 = 0
68const ZwpInputTimestampsManagerV1RequestGetKeyboardTimestamps uint32 = 1
69const ZwpInputTimestampsManagerV1RequestGetPointerTimestamps uint32 = 2
70const ZwpInputTimestampsManagerV1RequestGetTouchTimestamps uint32 = 3
71
72// ZwpInputTimestampsManagerV1Handler handles zwp_input_timestamps_manager_v1 requests.
73type ZwpInputTimestampsManagerV1Handler interface {
74 Destroy(self *ZwpInputTimestampsManagerV1)
75 GetKeyboardTimestamps(self *ZwpInputTimestampsManagerV1, id uint32, keyboard *wayland.Keyboard)
76 GetPointerTimestamps(self *ZwpInputTimestampsManagerV1, id uint32, pointer *wayland.Pointer)
77 GetTouchTimestamps(self *ZwpInputTimestampsManagerV1, id uint32, touch *wayland.Touch)
78}
79
80func NewZwpInputTimestampsManagerV1(c server.Client, version int32, id uint32, h ZwpInputTimestampsManagerV1Handler) (*ZwpInputTimestampsManagerV1, error) {
81 if h == nil {
82 return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_input_timestamps_manager_v1")
83 }
84 var self *ZwpInputTimestampsManagerV1
85 r, err := c.CreateResource(ZwpInputTimestampsManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
86 switch opcode {
87 case 0:
88 h.Destroy(self)
89 self.Destroy()
90 case 1:
91 h.GetKeyboardTimestamps(self, args[0].NewID(), wayland.WrapKeyboard(args[1].Resource()))
92 case 2:
93 h.GetPointerTimestamps(self, args[0].NewID(), wayland.WrapPointer(args[1].Resource()))
94 case 3:
95 h.GetTouchTimestamps(self, args[0].NewID(), wayland.WrapTouch(args[1].Resource()))
96 }
97 })
98 if err != nil {
99 return nil, err
100 }
101 self = WrapZwpInputTimestampsManagerV1(r)
102 r.Data = self
103 return self, nil
104}
105func NewZwpInputTimestampsManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error {
106 return d.CreateGlobal(ZwpInputTimestampsManagerV1Interface, version, bind)
107}
108
109// ZwpInputTimestampsV1 context object for input timestamps.
110type ZwpInputTimestampsV1 struct{ *server.Resource }
111
112func WrapZwpInputTimestampsV1(r *server.Resource) *ZwpInputTimestampsV1 {
113 if r == nil {
114 return nil
115 }
116 return &ZwpInputTimestampsV1{r}
117}
118
119const ZwpInputTimestampsV1RequestDestroy uint32 = 0
120const ZwpInputTimestampsV1EventTimestamp uint32 = 0
121
122// ZwpInputTimestampsV1Handler handles zwp_input_timestamps_v1 requests.
123type ZwpInputTimestampsV1Handler interface {
124 Destroy(self *ZwpInputTimestampsV1)
125}
126
127func NewZwpInputTimestampsV1(c server.Client, version int32, id uint32, h ZwpInputTimestampsV1Handler) (*ZwpInputTimestampsV1, error) {
128 if h == nil {
129 return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_input_timestamps_v1")
130 }
131 var self *ZwpInputTimestampsV1
132 r, err := c.CreateResource(ZwpInputTimestampsV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) {
133 switch opcode {
134 case 0:
135 h.Destroy(self)
136 self.Destroy()
137 }
138 })
139 if err != nil {
140 return nil, err
141 }
142 self = WrapZwpInputTimestampsV1(r)
143 r.Data = self
144 return self, nil
145}
146
147// SendTimestamp high-resolution timestamp event.
148func (self *ZwpInputTimestampsV1) SendTimestamp(tvSecHi uint32, tvSecLo uint32, tvNsec uint32) {
149 self.PostEvent(ZwpInputTimestampsV1EventTimestamp, server.Uint(tvSecHi), server.Uint(tvSecLo), server.Uint(tvNsec))
150}
151func NewZwpInputTimestampsV1Global(d *server.Display, version int32, bind server.BindFunc) error {
152 return d.CreateGlobal(ZwpInputTimestampsV1Interface, version, bind)
153}
154func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource {
155 if v == nil {
156 return nil
157 }
158 return v.GetResource()
159}
160func (self *ZwpInputTimestampsManagerV1) GetResource() *server.Resource {
161 if self == nil {
162 return nil
163 }
164 return self.Resource
165}
166func (self *ZwpInputTimestampsV1) GetResource() *server.Resource {
167 if self == nil {
168 return nil
169 }
170 return self.Resource
171}