// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2024 Neal Gompa // Copyright © 2024 Xaver Hugl // Copyright © 2024 Matthias Klumpp // Copyright © 2024 Vlad Zahorodnii // // 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 pointerwarp import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var WpPointerWarpV1Interface *server.Interface func init() { WpPointerWarpV1Interface = &server.Interface{Name: "wp_pointer_warp_v1", Version: 1} WpPointerWarpV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "warp_pointer", Signature: "ooffu", Types: []*server.Interface{wayland.SurfaceInterface, wayland.PointerInterface, nil, nil, nil}}, } WpPointerWarpV1Interface.Events = []server.Message{} if err := server.NewInterfaces(WpPointerWarpV1Interface); err != nil { panic(err) } } // WpPointerWarpV1 reposition the pointer to a location on a surface. type WpPointerWarpV1 struct{ *server.Resource } func WrapWpPointerWarpV1(r *server.Resource) *WpPointerWarpV1 { if r == nil { return nil } return &WpPointerWarpV1{r} } const WpPointerWarpV1RequestDestroy uint32 = 0 const WpPointerWarpV1RequestWarpPointer uint32 = 1 // WpPointerWarpV1Handler handles wp_pointer_warp_v1 requests. type WpPointerWarpV1Handler interface { Destroy(self *WpPointerWarpV1) WarpPointer(self *WpPointerWarpV1, surface *wayland.Surface, pointer *wayland.Pointer, x server.Fixed, y server.Fixed, serial uint32) } func NewWpPointerWarpV1(c server.Client, version int32, id uint32, h WpPointerWarpV1Handler) (*WpPointerWarpV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_pointer_warp_v1") } var self *WpPointerWarpV1 r, err := c.CreateResource(WpPointerWarpV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.WarpPointer(self, wayland.WrapSurface(args[0].Resource()), wayland.WrapPointer(args[1].Resource()), args[2].Fixed(), args[3].Fixed(), args[4].Uint()) } }) if err != nil { return nil, err } self = WrapWpPointerWarpV1(r) r.Data = self return self, nil } func NewWpPointerWarpV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpPointerWarpV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *WpPointerWarpV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }