// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2014 Jonas Ådahl // Copyright © 2015 Red Hat Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice (including the next // paragraph) shall be included in all copies or substantial portions of the // Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. package pointerconstraints import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var ZwpPointerConstraintsV1Interface *server.Interface var ZwpLockedPointerV1Interface *server.Interface var ZwpConfinedPointerV1Interface *server.Interface func init() { ZwpPointerConstraintsV1Interface = &server.Interface{Name: "zwp_pointer_constraints_v1", Version: 1} ZwpLockedPointerV1Interface = &server.Interface{Name: "zwp_locked_pointer_v1", Version: 1} ZwpConfinedPointerV1Interface = &server.Interface{Name: "zwp_confined_pointer_v1", Version: 1} ZwpPointerConstraintsV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "lock_pointer", Signature: "noo?ou", Types: []*server.Interface{ZwpLockedPointerV1Interface, wayland.SurfaceInterface, wayland.PointerInterface, wayland.RegionInterface, nil}}, {Name: "confine_pointer", Signature: "noo?ou", Types: []*server.Interface{ZwpConfinedPointerV1Interface, wayland.SurfaceInterface, wayland.PointerInterface, wayland.RegionInterface, nil}}, } ZwpPointerConstraintsV1Interface.Events = []server.Message{} ZwpLockedPointerV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "set_cursor_position_hint", Signature: "ff", Types: []*server.Interface{nil, nil}}, {Name: "set_region", Signature: "?o", Types: []*server.Interface{wayland.RegionInterface}}, } ZwpLockedPointerV1Interface.Events = []server.Message{ {Name: "locked", Signature: "", Types: []*server.Interface{}}, {Name: "unlocked", Signature: "", Types: []*server.Interface{}}, } ZwpConfinedPointerV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "set_region", Signature: "?o", Types: []*server.Interface{wayland.RegionInterface}}, } ZwpConfinedPointerV1Interface.Events = []server.Message{ {Name: "confined", Signature: "", Types: []*server.Interface{}}, {Name: "unconfined", Signature: "", Types: []*server.Interface{}}, } if err := server.NewInterfaces(ZwpPointerConstraintsV1Interface, ZwpLockedPointerV1Interface, ZwpConfinedPointerV1Interface); err != nil { panic(err) } } // ZwpPointerConstraintsV1 constrain the movement of a pointer. type ZwpPointerConstraintsV1 struct{ *server.Resource } func WrapZwpPointerConstraintsV1(r *server.Resource) *ZwpPointerConstraintsV1 { if r == nil { return nil } return &ZwpPointerConstraintsV1{r} } const ZwpPointerConstraintsV1RequestDestroy uint32 = 0 const ZwpPointerConstraintsV1RequestLockPointer uint32 = 1 const ZwpPointerConstraintsV1RequestConfinePointer uint32 = 2 // ZwpPointerConstraintsV1Error wp_pointer_constraints error values. type ZwpPointerConstraintsV1Error uint32 const ( ZwpPointerConstraintsV1ErrorAlreadyConstrained ZwpPointerConstraintsV1Error = 1 ) // ZwpPointerConstraintsV1Lifetime constraint lifetime. type ZwpPointerConstraintsV1Lifetime uint32 const ( ZwpPointerConstraintsV1LifetimeOneshot ZwpPointerConstraintsV1Lifetime = 1 ZwpPointerConstraintsV1LifetimePersistent ZwpPointerConstraintsV1Lifetime = 2 ) // ZwpPointerConstraintsV1Handler handles zwp_pointer_constraints_v1 requests. type ZwpPointerConstraintsV1Handler interface { Destroy(self *ZwpPointerConstraintsV1) LockPointer(self *ZwpPointerConstraintsV1, id uint32, surface *wayland.Surface, pointer *wayland.Pointer, region *wayland.Region, lifetime uint32) ConfinePointer(self *ZwpPointerConstraintsV1, id uint32, surface *wayland.Surface, pointer *wayland.Pointer, region *wayland.Region, lifetime uint32) } func NewZwpPointerConstraintsV1(c server.Client, version int32, id uint32, h ZwpPointerConstraintsV1Handler) (*ZwpPointerConstraintsV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_pointer_constraints_v1") } var self *ZwpPointerConstraintsV1 r, err := c.CreateResource(ZwpPointerConstraintsV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.LockPointer(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapPointer(args[2].Resource()), wayland.WrapRegion(args[3].Resource()), args[4].Uint()) case 2: h.ConfinePointer(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource()), wayland.WrapPointer(args[2].Resource()), wayland.WrapRegion(args[3].Resource()), args[4].Uint()) } }) if err != nil { return nil, err } self = WrapZwpPointerConstraintsV1(r) r.Data = self return self, nil } func NewZwpPointerConstraintsV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpPointerConstraintsV1Interface, version, bind) } // ZwpLockedPointerV1 receive relative pointer motion events. type ZwpLockedPointerV1 struct{ *server.Resource } func WrapZwpLockedPointerV1(r *server.Resource) *ZwpLockedPointerV1 { if r == nil { return nil } return &ZwpLockedPointerV1{r} } const ZwpLockedPointerV1RequestDestroy uint32 = 0 const ZwpLockedPointerV1RequestSetCursorPositionHint uint32 = 1 const ZwpLockedPointerV1RequestSetRegion uint32 = 2 const ZwpLockedPointerV1EventLocked uint32 = 0 const ZwpLockedPointerV1EventUnlocked uint32 = 1 // ZwpLockedPointerV1Handler handles zwp_locked_pointer_v1 requests. type ZwpLockedPointerV1Handler interface { Destroy(self *ZwpLockedPointerV1) SetCursorPositionHint(self *ZwpLockedPointerV1, surfaceX server.Fixed, surfaceY server.Fixed) SetRegion(self *ZwpLockedPointerV1, region *wayland.Region) } func NewZwpLockedPointerV1(c server.Client, version int32, id uint32, h ZwpLockedPointerV1Handler) (*ZwpLockedPointerV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_locked_pointer_v1") } var self *ZwpLockedPointerV1 r, err := c.CreateResource(ZwpLockedPointerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.SetCursorPositionHint(self, args[0].Fixed(), args[1].Fixed()) case 2: h.SetRegion(self, wayland.WrapRegion(args[0].Resource())) } }) if err != nil { return nil, err } self = WrapZwpLockedPointerV1(r) r.Data = self return self, nil } // SendLocked lock activation event. func (self *ZwpLockedPointerV1) SendLocked() { self.PostEvent(ZwpLockedPointerV1EventLocked) } // SendUnlocked lock deactivation event. func (self *ZwpLockedPointerV1) SendUnlocked() { self.PostEvent(ZwpLockedPointerV1EventUnlocked) } func NewZwpLockedPointerV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpLockedPointerV1Interface, version, bind) } // ZwpConfinedPointerV1 confined pointer object. type ZwpConfinedPointerV1 struct{ *server.Resource } func WrapZwpConfinedPointerV1(r *server.Resource) *ZwpConfinedPointerV1 { if r == nil { return nil } return &ZwpConfinedPointerV1{r} } const ZwpConfinedPointerV1RequestDestroy uint32 = 0 const ZwpConfinedPointerV1RequestSetRegion uint32 = 1 const ZwpConfinedPointerV1EventConfined uint32 = 0 const ZwpConfinedPointerV1EventUnconfined uint32 = 1 // ZwpConfinedPointerV1Handler handles zwp_confined_pointer_v1 requests. type ZwpConfinedPointerV1Handler interface { Destroy(self *ZwpConfinedPointerV1) SetRegion(self *ZwpConfinedPointerV1, region *wayland.Region) } func NewZwpConfinedPointerV1(c server.Client, version int32, id uint32, h ZwpConfinedPointerV1Handler) (*ZwpConfinedPointerV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for zwp_confined_pointer_v1") } var self *ZwpConfinedPointerV1 r, err := c.CreateResource(ZwpConfinedPointerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.SetRegion(self, wayland.WrapRegion(args[0].Resource())) } }) if err != nil { return nil, err } self = WrapZwpConfinedPointerV1(r) r.Data = self return self, nil } // SendConfined pointer confined. func (self *ZwpConfinedPointerV1) SendConfined() { self.PostEvent(ZwpConfinedPointerV1EventConfined) } // SendUnconfined pointer unconfined. func (self *ZwpConfinedPointerV1) SendUnconfined() { self.PostEvent(ZwpConfinedPointerV1EventUnconfined) } func NewZwpConfinedPointerV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(ZwpConfinedPointerV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *ZwpPointerConstraintsV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ZwpLockedPointerV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *ZwpConfinedPointerV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }