// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2021 Xaver Hugl // // 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 tearingcontrol import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var WpTearingControlManagerV1Interface *server.Interface var WpTearingControlV1Interface *server.Interface func init() { WpTearingControlManagerV1Interface = &server.Interface{Name: "wp_tearing_control_manager_v1", Version: 1} WpTearingControlV1Interface = &server.Interface{Name: "wp_tearing_control_v1", Version: 1} WpTearingControlManagerV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "get_tearing_control", Signature: "no", Types: []*server.Interface{WpTearingControlV1Interface, wayland.SurfaceInterface}}, } WpTearingControlManagerV1Interface.Events = []server.Message{} WpTearingControlV1Interface.Requests = []server.Message{ {Name: "set_presentation_hint", Signature: "u", Types: []*server.Interface{nil}}, {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } WpTearingControlV1Interface.Events = []server.Message{} if err := server.NewInterfaces(WpTearingControlManagerV1Interface, WpTearingControlV1Interface); err != nil { panic(err) } } // WpTearingControlManagerV1 protocol for tearing control. type WpTearingControlManagerV1 struct{ *server.Resource } func WrapWpTearingControlManagerV1(r *server.Resource) *WpTearingControlManagerV1 { if r == nil { return nil } return &WpTearingControlManagerV1{r} } const WpTearingControlManagerV1RequestDestroy uint32 = 0 const WpTearingControlManagerV1RequestGetTearingControl uint32 = 1 // WpTearingControlManagerV1Error . type WpTearingControlManagerV1Error uint32 const ( WpTearingControlManagerV1ErrorTearingControlExists WpTearingControlManagerV1Error = 0 ) // WpTearingControlManagerV1Handler handles wp_tearing_control_manager_v1 requests. type WpTearingControlManagerV1Handler interface { Destroy(self *WpTearingControlManagerV1) GetTearingControl(self *WpTearingControlManagerV1, id uint32, surface *wayland.Surface) } func NewWpTearingControlManagerV1(c server.Client, version int32, id uint32, h WpTearingControlManagerV1Handler) (*WpTearingControlManagerV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_tearing_control_manager_v1") } var self *WpTearingControlManagerV1 r, err := c.CreateResource(WpTearingControlManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.GetTearingControl(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource())) } }) if err != nil { return nil, err } self = WrapWpTearingControlManagerV1(r) r.Data = self return self, nil } func NewWpTearingControlManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpTearingControlManagerV1Interface, version, bind) } // WpTearingControlV1 per-surface tearing control interface. type WpTearingControlV1 struct{ *server.Resource } func WrapWpTearingControlV1(r *server.Resource) *WpTearingControlV1 { if r == nil { return nil } return &WpTearingControlV1{r} } const WpTearingControlV1RequestSetPresentationHint uint32 = 0 const WpTearingControlV1RequestDestroy uint32 = 1 // WpTearingControlV1PresentationHint presentation hint values. type WpTearingControlV1PresentationHint uint32 const ( WpTearingControlV1PresentationHintVsync WpTearingControlV1PresentationHint = 0 WpTearingControlV1PresentationHintAsync WpTearingControlV1PresentationHint = 1 ) // WpTearingControlV1Handler handles wp_tearing_control_v1 requests. type WpTearingControlV1Handler interface { SetPresentationHint(self *WpTearingControlV1, hint uint32) Destroy(self *WpTearingControlV1) } func NewWpTearingControlV1(c server.Client, version int32, id uint32, h WpTearingControlV1Handler) (*WpTearingControlV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_tearing_control_v1") } var self *WpTearingControlV1 r, err := c.CreateResource(WpTearingControlV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.SetPresentationHint(self, args[0].Uint()) case 1: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapWpTearingControlV1(r) r.Data = self return self, nil } func NewWpTearingControlV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpTearingControlV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *WpTearingControlManagerV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *WpTearingControlV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }