// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2015, 2021 Red Hat Inc. // // Permission to use, copy, modify, distribute, and sell this // software and its documentation for any purpose is hereby granted // without fee, provided that the above copyright notice appear in // all copies and that both that copyright notice and this permission // notice appear in supporting documentation, and that the name of // the copyright holders not be used in advertising or publicity // pertaining to distribution of the software without specific, // written prior permission. The copyright holders make no // representations about the suitability of this software for any // purpose. It is provided "as is" without express or implied // warranty. // // THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS // SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND // FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY // SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN // AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF // THIS SOFTWARE. package pointergestures import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var ZwpPointerGesturesV1Interface *server.Interface var ZwpPointerGestureSwipeV1Interface *server.Interface var ZwpPointerGesturePinchV1Interface *server.Interface var ZwpPointerGestureHoldV1Interface *server.Interface func init() { ZwpPointerGesturesV1Interface = &server.Interface{Name: "zwp_pointer_gestures_v1", Version: 3} ZwpPointerGestureSwipeV1Interface = &server.Interface{Name: "zwp_pointer_gesture_swipe_v1", Version: 3} ZwpPointerGesturePinchV1Interface = &server.Interface{Name: "zwp_pointer_gesture_pinch_v1", Version: 3} ZwpPointerGestureHoldV1Interface = &server.Interface{Name: "zwp_pointer_gesture_hold_v1", Version: 3} ZwpPointerGesturesV1Interface.Requests = []server.Message{ {Name: "get_swipe_gesture", Signature: "no", Types: []*server.Interface{ZwpPointerGestureSwipeV1Interface, wayland.PointerInterface}}, {Name: "get_pinch_gesture", Signature: "no", Types: []*server.Interface{ZwpPointerGesturePinchV1Interface, wayland.PointerInterface}}, {Name: "release", Signature: "2", Types: []*server.Interface{}}, {Name: "get_hold_gesture", Signature: "3no", Types: []*server.Interface{ZwpPointerGestureHoldV1Interface, wayland.PointerInterface}}, } ZwpPointerGesturesV1Interface.Events = []server.Message{} ZwpPointerGestureSwipeV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } ZwpPointerGestureSwipeV1Interface.Events = []server.Message{ {Name: "begin", Signature: "uuou", Types: []*server.Interface{nil, nil, wayland.SurfaceInterface, nil}}, {Name: "update", Signature: "uff", Types: []*server.Interface{nil, nil, nil}}, {Name: "end", Signature: "uui", Types: []*server.Interface{nil, nil, nil}}, } ZwpPointerGesturePinchV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } ZwpPointerGesturePinchV1Interface.Events = []server.Message{ {Name: "begin", Signature: "uuou", Types: []*server.Interface{nil, nil, wayland.SurfaceInterface, nil}}, {Name: "update", Signature: "uffff", Types: []*server.Interface{nil, nil, nil, nil, nil}}, {Name: "end", Signature: "uui", Types: []*server.Interface{nil, nil, nil}}, } ZwpPointerGestureHoldV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "3", Types: []*server.Interface{}}, } ZwpPointerGestureHoldV1Interface.Events = []server.Message{ {Name: "begin", Signature: "3uuou", Types: []*server.Interface{nil, nil, wayland.SurfaceInterface, nil}}, {Name: "end", Signature: "3uui", Types: []*server.Interface{nil, nil, nil}}, } if err := server.NewInterfaces(ZwpPointerGesturesV1Interface, ZwpPointerGestureSwipeV1Interface, ZwpPointerGesturePinchV1Interface, ZwpPointerGestureHoldV1Interface); err != nil { panic(err) } } // ZwpPointerGesturesV1 touchpad gestures. type ZwpPointerGesturesV1 struct{ *server.Resource } func WrapZwpPointerGesturesV1(r *server.Resource) *ZwpPointerGesturesV1 { if r == nil { return nil } return &ZwpPointerGesturesV1{r} } const ZwpPointerGesturesV1RequestGetSwipeGesture uint32 = 0 const ZwpPointerGesturesV1RequestGetPinchGesture uint32 = 1 const ZwpPointerGesturesV1RequestRelease uint32 = 2 const ZwpPointerGesturesV1RequestGetHoldGesture uint32 = 3 // ZwpPointerGesturesV1Handler handles zwp_pointer_gestures_v1 requests. type ZwpPointerGesturesV1Handler interface { GetSwipeGesture(self *ZwpPointerGesturesV1, id uint32, pointer *wayland.Pointer) GetPinchGesture(self *ZwpPointerGesturesV1, id uint32, pointer *wayland.Pointer) Release(self *ZwpPointerGesturesV1) GetHoldGesture(self *ZwpPointerGesturesV1, id uint32, pointer *wayland.Pointer) } func NewZwpPointerGesturesV1(c server.Client, version int32, id uint32, h ZwpPointerGesturesV1Handler) (*ZwpPointerGesturesV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_pointer_gestures_v1") } var self *ZwpPointerGesturesV1 r, err := c.CreateResource(ZwpPointerGesturesV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.GetSwipeGesture(self, args[0].NewID(), wayland.WrapPointer(args[1].Resource())) case 1: h.GetPinchGesture(self, args[0].NewID(), wayland.WrapPointer(args[1].Resource())) case 2: h.Release(self) self.Destroy() case 3: h.GetHoldGesture(self, args[0].NewID(), wayland.WrapPointer(args[1].Resource())) } }) if err != nil { return nil, err } self = WrapZwpPointerGesturesV1(r) r.Data = self return self, nil } func NewZwpPointerGesturesV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpPointerGesturesV1Interface, version, bind) } // ZwpPointerGestureSwipeV1 a swipe gesture object. type ZwpPointerGestureSwipeV1 struct{ *server.Resource } func WrapZwpPointerGestureSwipeV1(r *server.Resource) *ZwpPointerGestureSwipeV1 { if r == nil { return nil } return &ZwpPointerGestureSwipeV1{r} } const ZwpPointerGestureSwipeV1RequestDestroy uint32 = 0 const ZwpPointerGestureSwipeV1EventBegin uint32 = 0 const ZwpPointerGestureSwipeV1EventUpdate uint32 = 1 const ZwpPointerGestureSwipeV1EventEnd uint32 = 2 // ZwpPointerGestureSwipeV1Handler handles zwp_pointer_gesture_swipe_v1 requests. type ZwpPointerGestureSwipeV1Handler interface { Destroy(self *ZwpPointerGestureSwipeV1) } func NewZwpPointerGestureSwipeV1(c server.Client, version int32, id uint32, h ZwpPointerGestureSwipeV1Handler) (*ZwpPointerGestureSwipeV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_pointer_gesture_swipe_v1") } var self *ZwpPointerGestureSwipeV1 r, err := c.CreateResource(ZwpPointerGestureSwipeV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapZwpPointerGestureSwipeV1(r) r.Data = self return self, nil } // SendBegin multi-finger swipe begin. func (self *ZwpPointerGestureSwipeV1) SendBegin(serial uint32, time uint32, surface *wayland.Surface, fingers uint32) { self.PostEvent(ZwpPointerGestureSwipeV1EventBegin, server.Uint(serial), server.Uint(time), server.Object(resourceOf(surface)), server.Uint(fingers)) } // SendUpdate multi-finger swipe motion. func (self *ZwpPointerGestureSwipeV1) SendUpdate(time uint32, dx server.Fixed, dy server.Fixed) { self.PostEvent(ZwpPointerGestureSwipeV1EventUpdate, server.Uint(time), server.FixedArg(dx), server.FixedArg(dy)) } // SendEnd multi-finger swipe end. func (self *ZwpPointerGestureSwipeV1) SendEnd(serial uint32, time uint32, cancelled int32) { self.PostEvent(ZwpPointerGestureSwipeV1EventEnd, server.Uint(serial), server.Uint(time), server.Int(cancelled)) } func NewZwpPointerGestureSwipeV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpPointerGestureSwipeV1Interface, version, bind) } // ZwpPointerGesturePinchV1 a pinch gesture object. type ZwpPointerGesturePinchV1 struct{ *server.Resource } func WrapZwpPointerGesturePinchV1(r *server.Resource) *ZwpPointerGesturePinchV1 { if r == nil { return nil } return &ZwpPointerGesturePinchV1{r} } const ZwpPointerGesturePinchV1RequestDestroy uint32 = 0 const ZwpPointerGesturePinchV1EventBegin uint32 = 0 const ZwpPointerGesturePinchV1EventUpdate uint32 = 1 const ZwpPointerGesturePinchV1EventEnd uint32 = 2 // ZwpPointerGesturePinchV1Handler handles zwp_pointer_gesture_pinch_v1 requests. type ZwpPointerGesturePinchV1Handler interface { Destroy(self *ZwpPointerGesturePinchV1) } func NewZwpPointerGesturePinchV1(c server.Client, version int32, id uint32, h ZwpPointerGesturePinchV1Handler) (*ZwpPointerGesturePinchV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_pointer_gesture_pinch_v1") } var self *ZwpPointerGesturePinchV1 r, err := c.CreateResource(ZwpPointerGesturePinchV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapZwpPointerGesturePinchV1(r) r.Data = self return self, nil } // SendBegin multi-finger pinch begin. func (self *ZwpPointerGesturePinchV1) SendBegin(serial uint32, time uint32, surface *wayland.Surface, fingers uint32) { self.PostEvent(ZwpPointerGesturePinchV1EventBegin, server.Uint(serial), server.Uint(time), server.Object(resourceOf(surface)), server.Uint(fingers)) } // SendUpdate multi-finger pinch motion. func (self *ZwpPointerGesturePinchV1) SendUpdate(time uint32, dx server.Fixed, dy server.Fixed, scale server.Fixed, rotation server.Fixed) { self.PostEvent(ZwpPointerGesturePinchV1EventUpdate, server.Uint(time), server.FixedArg(dx), server.FixedArg(dy), server.FixedArg(scale), server.FixedArg(rotation)) } // SendEnd multi-finger pinch end. func (self *ZwpPointerGesturePinchV1) SendEnd(serial uint32, time uint32, cancelled int32) { self.PostEvent(ZwpPointerGesturePinchV1EventEnd, server.Uint(serial), server.Uint(time), server.Int(cancelled)) } func NewZwpPointerGesturePinchV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpPointerGesturePinchV1Interface, version, bind) } // ZwpPointerGestureHoldV1 a hold gesture object. type ZwpPointerGestureHoldV1 struct{ *server.Resource } func WrapZwpPointerGestureHoldV1(r *server.Resource) *ZwpPointerGestureHoldV1 { if r == nil { return nil } return &ZwpPointerGestureHoldV1{r} } const ZwpPointerGestureHoldV1RequestDestroy uint32 = 0 const ZwpPointerGestureHoldV1EventBegin uint32 = 0 const ZwpPointerGestureHoldV1EventEnd uint32 = 1 // ZwpPointerGestureHoldV1Handler handles zwp_pointer_gesture_hold_v1 requests. type ZwpPointerGestureHoldV1Handler interface { Destroy(self *ZwpPointerGestureHoldV1) } func NewZwpPointerGestureHoldV1(c server.Client, version int32, id uint32, h ZwpPointerGestureHoldV1Handler) (*ZwpPointerGestureHoldV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_pointer_gesture_hold_v1") } var self *ZwpPointerGestureHoldV1 r, err := c.CreateResource(ZwpPointerGestureHoldV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapZwpPointerGestureHoldV1(r) r.Data = self return self, nil } // SendBegin multi-finger hold begin (since version 3). func (self *ZwpPointerGestureHoldV1) SendBegin(serial uint32, time uint32, surface *wayland.Surface, fingers uint32) { self.PostEvent(ZwpPointerGestureHoldV1EventBegin, server.Uint(serial), server.Uint(time), server.Object(resourceOf(surface)), server.Uint(fingers)) } // SendEnd multi-finger hold end (since version 3). func (self *ZwpPointerGestureHoldV1) SendEnd(serial uint32, time uint32, cancelled int32) { self.PostEvent(ZwpPointerGestureHoldV1EventEnd, server.Uint(serial), server.Uint(time), server.Int(cancelled)) } func NewZwpPointerGestureHoldV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpPointerGestureHoldV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *ZwpPointerGesturesV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ZwpPointerGestureSwipeV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ZwpPointerGesturePinchV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ZwpPointerGestureHoldV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }