// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2023 Valve Corporation // // 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 fifo import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var WpFifoManagerV1Interface *server.Interface var WpFifoV1Interface *server.Interface func init() { WpFifoManagerV1Interface = &server.Interface{Name: "wp_fifo_manager_v1", Version: 1} WpFifoV1Interface = &server.Interface{Name: "wp_fifo_v1", Version: 1} WpFifoManagerV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "get_fifo", Signature: "no", Types: []*server.Interface{WpFifoV1Interface, wayland.SurfaceInterface}}, } WpFifoManagerV1Interface.Events = []server.Message{} WpFifoV1Interface.Requests = []server.Message{ {Name: "set_barrier", Signature: "", Types: []*server.Interface{}}, {Name: "wait_barrier", Signature: "", Types: []*server.Interface{}}, {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } WpFifoV1Interface.Events = []server.Message{} if err := server.NewInterfaces(WpFifoManagerV1Interface, WpFifoV1Interface); err != nil { panic(err) } } // WpFifoManagerV1 protocol for fifo constraints. type WpFifoManagerV1 struct{ *server.Resource } func WrapWpFifoManagerV1(r *server.Resource) *WpFifoManagerV1 { if r == nil { return nil } return &WpFifoManagerV1{r} } const WpFifoManagerV1RequestDestroy uint32 = 0 const WpFifoManagerV1RequestGetFifo uint32 = 1 // WpFifoManagerV1Error fatal presentation error. type WpFifoManagerV1Error uint32 const ( WpFifoManagerV1ErrorAlreadyExists WpFifoManagerV1Error = 0 ) // WpFifoManagerV1Handler handles wp_fifo_manager_v1 requests. type WpFifoManagerV1Handler interface { Destroy(self *WpFifoManagerV1) GetFifo(self *WpFifoManagerV1, id uint32, surface *wayland.Surface) } func NewWpFifoManagerV1(c server.Client, version int32, id uint32, h WpFifoManagerV1Handler) (*WpFifoManagerV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_fifo_manager_v1") } var self *WpFifoManagerV1 r, err := c.CreateResource(WpFifoManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.GetFifo(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource())) } }) if err != nil { return nil, err } self = WrapWpFifoManagerV1(r) r.Data = self return self, nil } func NewWpFifoManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpFifoManagerV1Interface, version, bind) } // WpFifoV1 fifo interface. type WpFifoV1 struct{ *server.Resource } func WrapWpFifoV1(r *server.Resource) *WpFifoV1 { if r == nil { return nil } return &WpFifoV1{r} } const WpFifoV1RequestSetBarrier uint32 = 0 const WpFifoV1RequestWaitBarrier uint32 = 1 const WpFifoV1RequestDestroy uint32 = 2 // WpFifoV1Error fatal error. type WpFifoV1Error uint32 const ( WpFifoV1ErrorSurfaceDestroyed WpFifoV1Error = 0 ) // WpFifoV1Handler handles wp_fifo_v1 requests. type WpFifoV1Handler interface { SetBarrier(self *WpFifoV1) WaitBarrier(self *WpFifoV1) Destroy(self *WpFifoV1) } func NewWpFifoV1(c server.Client, version int32, id uint32, h WpFifoV1Handler) (*WpFifoV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_fifo_v1") } var self *WpFifoV1 r, err := c.CreateResource(WpFifoV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.SetBarrier(self) case 1: h.WaitBarrier(self) case 2: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapWpFifoV1(r) r.Data = self return self, nil } func NewWpFifoV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpFifoV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *WpFifoManagerV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *WpFifoV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }