1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: wlr_virtual_pointer_unstable_v1
3// Source: wlr-virtual-pointer-unstable-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2019 Josef Gajdusek
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 wlrvirtualpointer
28
29import (
30 cross_wl_output "github.com/bnema/go-wayland-bindings/client/wayland"
31 cross_wl_seat "github.com/bnema/go-wayland-bindings/client/wayland"
32 "github.com/bnema/wlturbo/wl"
33)
34
35// ERROR_INVALID_AXIS is the error invalid_axis value.
36const ERROR_INVALID_AXIS = 0
37
38// ERROR_INVALID_AXIS_SOURCE is the error invalid_axis_source value.
39const ERROR_INVALID_AXIS_SOURCE = 1
40
41// VirtualPointerInterface is the protocol interface name.
42const VirtualPointerInterface = "zwlr_virtual_pointer_v1"
43
44// VirtualPointer is the generated binding for zwlr_virtual_pointer_v1 version 2.
45type VirtualPointer struct {
46 wl.BaseProxy
47}
48
49// NewVirtualPointer returns an unbound VirtualPointer.
50func NewVirtualPointer(ctx *wl.Context) *VirtualPointer {
51 obj := &VirtualPointer{}
52 obj.SetContext(ctx)
53 ctx.Register(obj)
54 return obj
55}
56
57// The pointer has moved by a relative amount to the previous request. Values are in the global compositor space.
58func (o *VirtualPointer) Motion(time uint32, dx wl.Fixed, dy wl.Fixed) error {
59 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwlr_virtual_pointer_v1.motion"}, wl.ArgUint(time), wl.ArgFixed(dx), wl.ArgFixed(dy)); err != nil {
60 return err
61 }
62 return nil
63}
64
65// The pointer has moved in an absolute coordinate frame. Value of x can range from 0 to x_extent, value of y can range from 0 to y_extent.
66func (o *VirtualPointer) MotionAbsolute(time uint32, x uint32, y uint32, xExtent uint32, yExtent uint32) error {
67 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwlr_virtual_pointer_v1.motion_absolute"}, wl.ArgUint(time), wl.ArgUint(x), wl.ArgUint(y), wl.ArgUint(xExtent), wl.ArgUint(yExtent)); err != nil {
68 return err
69 }
70 return nil
71}
72
73// A button was pressed or released.
74func (o *VirtualPointer) Button(time uint32, button uint32, state uint32) error {
75 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwlr_virtual_pointer_v1.button"}, wl.ArgUint(time), wl.ArgUint(button), wl.ArgUint(state)); err != nil {
76 return err
77 }
78 return nil
79}
80
81// Scroll and other axis requests.
82func (o *VirtualPointer) Axis(time uint32, axis uint32, value wl.Fixed) error {
83 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 3, Name: "zwlr_virtual_pointer_v1.axis"}, wl.ArgUint(time), wl.ArgUint(axis), wl.ArgFixed(value)); err != nil {
84 return err
85 }
86 return nil
87}
88
89// Indicates the set of events that logically belong together.
90func (o *VirtualPointer) Frame() error {
91 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 4, Name: "zwlr_virtual_pointer_v1.frame"}); err != nil {
92 return err
93 }
94 return nil
95}
96
97// Source information for scroll and other axis.
98func (o *VirtualPointer) AxisSource(axisSource uint32) error {
99 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 5, Name: "zwlr_virtual_pointer_v1.axis_source"}, wl.ArgUint(axisSource)); err != nil {
100 return err
101 }
102 return nil
103}
104
105// Stop notification for scroll and other axes.
106func (o *VirtualPointer) AxisStop(time uint32, axis uint32) error {
107 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 6, Name: "zwlr_virtual_pointer_v1.axis_stop"}, wl.ArgUint(time), wl.ArgUint(axis)); err != nil {
108 return err
109 }
110 return nil
111}
112
113// Discrete step information for scroll and other axes. This event allows the client to extend data normally sent using the axis event with discrete value.
114func (o *VirtualPointer) AxisDiscrete(time uint32, axis uint32, value wl.Fixed, discrete int32) error {
115 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 7, Name: "zwlr_virtual_pointer_v1.axis_discrete"}, wl.ArgUint(time), wl.ArgUint(axis), wl.ArgFixed(value), wl.ArgInt(discrete)); err != nil {
116 return err
117 }
118 return nil
119}
120
121// destroy the virtual pointer object
122func (o *VirtualPointer) Destroy() error {
123 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 8, Name: "zwlr_virtual_pointer_v1.destroy", Destructor: true}); err != nil {
124 return err
125 }
126 return nil
127}
128
129// EventSignature returns the declared event argument types in wire order.
130func (o *VirtualPointer) EventSignature(opcode uint16) (string, bool) {
131 switch opcode {
132 default:
133 return "", false
134 }
135}
136
137// Dispatch decodes one event on zwlr_virtual_pointer_v1 and calls the registered handlers.
138func (o *VirtualPointer) Dispatch(event *wl.Event) {
139 switch event.Opcode {
140 default:
141 }
142}
143
144// VirtualPointerManagerInterface is the protocol interface name.
145const VirtualPointerManagerInterface = "zwlr_virtual_pointer_manager_v1"
146
147// VirtualPointerManager is the generated binding for zwlr_virtual_pointer_manager_v1 version 2.
148type VirtualPointerManager struct {
149 wl.BaseProxy
150}
151
152// NewVirtualPointerManager returns an unbound VirtualPointerManager.
153func NewVirtualPointerManager(ctx *wl.Context) *VirtualPointerManager {
154 obj := &VirtualPointerManager{}
155 obj.SetContext(ctx)
156 ctx.Register(obj)
157 return obj
158}
159
160// Creates a new virtual pointer. The optional seat is a suggestion to the compositor.
161func (o *VirtualPointerManager) CreateVirtualPointer(seat *cross_wl_seat.Seat) (*VirtualPointer, error) {
162 var arg0 wl.Object
163 if seat != nil {
164 arg0 = seat
165 }
166 child := &VirtualPointer{}
167 child.SetContext(o.Context())
168 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwlr_virtual_pointer_manager_v1.create_virtual_pointer", Child: child}, wl.ArgObject(arg0), wl.ArgObject(child)); err != nil {
169 return nil, err
170 }
171 return child, nil
172}
173
174// destroy the virtual pointer manager
175func (o *VirtualPointerManager) Destroy() error {
176 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwlr_virtual_pointer_manager_v1.destroy", Destructor: true}); err != nil {
177 return err
178 }
179 return nil
180}
181
182// Creates a new virtual pointer. The seat and the output arguments are optional. If the seat argument is set, the compositor should assign the input device to the requested seat. If the output argument is set, the compositor should map the input device to the requested output.
183func (o *VirtualPointerManager) CreateVirtualPointerWithOutput(seat *cross_wl_seat.Seat, output *cross_wl_output.Output) (*VirtualPointer, error) {
184 var arg0 wl.Object
185 if seat != nil {
186 arg0 = seat
187 }
188 var arg1 wl.Object
189 if output != nil {
190 arg1 = output
191 }
192 child := &VirtualPointer{}
193 child.SetContext(o.Context())
194 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwlr_virtual_pointer_manager_v1.create_virtual_pointer_with_output", Since: 2, Child: child}, wl.ArgObject(arg0), wl.ArgObject(arg1), wl.ArgObject(child)); err != nil {
195 return nil, err
196 }
197 return child, nil
198}
199
200// EventSignature returns the declared event argument types in wire order.
201func (o *VirtualPointerManager) EventSignature(opcode uint16) (string, bool) {
202 switch opcode {
203 default:
204 return "", false
205 }
206}
207
208// Dispatch decodes one event on zwlr_virtual_pointer_manager_v1 and calls the registered handlers.
209func (o *VirtualPointerManager) Dispatch(event *wl.Event) {
210 switch event.Opcode {
211 default:
212 }
213}