// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2022 Simon Ser // // 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 singlepixelbuffer import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var WpSinglePixelBufferManagerV1Interface *server.Interface func init() { WpSinglePixelBufferManagerV1Interface = &server.Interface{Name: "wp_single_pixel_buffer_manager_v1", Version: 1} WpSinglePixelBufferManagerV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "create_u32_rgba_buffer", Signature: "nuuuu", Types: []*server.Interface{wayland.BufferInterface, nil, nil, nil, nil}}, } WpSinglePixelBufferManagerV1Interface.Events = []server.Message{} if err := server.NewInterfaces(WpSinglePixelBufferManagerV1Interface); err != nil { panic(err) } } // WpSinglePixelBufferManagerV1 global factory for single-pixel buffers. type WpSinglePixelBufferManagerV1 struct{ *server.Resource } func WrapWpSinglePixelBufferManagerV1(r *server.Resource) *WpSinglePixelBufferManagerV1 { if r == nil { return nil } return &WpSinglePixelBufferManagerV1{r} } const WpSinglePixelBufferManagerV1RequestDestroy uint32 = 0 const WpSinglePixelBufferManagerV1RequestCreateU32RgbaBuffer uint32 = 1 // WpSinglePixelBufferManagerV1Handler handles wp_single_pixel_buffer_manager_v1 requests. type WpSinglePixelBufferManagerV1Handler interface { Destroy(self *WpSinglePixelBufferManagerV1) CreateU32RgbaBuffer(self *WpSinglePixelBufferManagerV1, id uint32, r uint32, g uint32, b uint32, a uint32) } func NewWpSinglePixelBufferManagerV1(c server.Client, version int32, id uint32, h WpSinglePixelBufferManagerV1Handler) (*WpSinglePixelBufferManagerV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_single_pixel_buffer_manager_v1") } var self *WpSinglePixelBufferManagerV1 r, err := c.CreateResource(WpSinglePixelBufferManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.CreateU32RgbaBuffer(self, args[0].NewID(), args[1].Uint(), args[2].Uint(), args[3].Uint(), args[4].Uint()) } }) if err != nil { return nil, err } self = WrapWpSinglePixelBufferManagerV1(r) r.Data = self return self, nil } func NewWpSinglePixelBufferManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpSinglePixelBufferManagerV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *WpSinglePixelBufferManagerV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }