// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright © 2022 Joshua Ashton // // 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 xwaylandshell import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var XwaylandShellV1Interface *server.Interface var XwaylandSurfaceV1Interface *server.Interface func init() { XwaylandShellV1Interface = &server.Interface{Name: "xwayland_shell_v1", Version: 1} XwaylandSurfaceV1Interface = &server.Interface{Name: "xwayland_surface_v1", Version: 1} XwaylandShellV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "get_xwayland_surface", Signature: "no", Types: []*server.Interface{XwaylandSurfaceV1Interface, wayland.SurfaceInterface}}, } XwaylandShellV1Interface.Events = []server.Message{} XwaylandSurfaceV1Interface.Requests = []server.Message{ {Name: "set_serial", Signature: "uu", Types: []*server.Interface{nil, nil}}, {Name: "destroy", Signature: "", Types: []*server.Interface{}}, } XwaylandSurfaceV1Interface.Events = []server.Message{} if err := server.NewInterfaces(XwaylandShellV1Interface, XwaylandSurfaceV1Interface); err != nil { panic(err) } } // XwaylandShellV1 context object for Xwayland shell. type XwaylandShellV1 struct{ *server.Resource } func WrapXwaylandShellV1(r *server.Resource) *XwaylandShellV1 { if r == nil { return nil } return &XwaylandShellV1{r} } const XwaylandShellV1RequestDestroy uint32 = 0 const XwaylandShellV1RequestGetXwaylandSurface uint32 = 1 // XwaylandShellV1Error . type XwaylandShellV1Error uint32 const ( XwaylandShellV1ErrorRole XwaylandShellV1Error = 0 ) // XwaylandShellV1Handler handles xwayland_shell_v1 requests. type XwaylandShellV1Handler interface { Destroy(self *XwaylandShellV1) GetXwaylandSurface(self *XwaylandShellV1, id uint32, surface *wayland.Surface) } func NewXwaylandShellV1(c server.Client, version int32, id uint32, h XwaylandShellV1Handler) (*XwaylandShellV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for xwayland_shell_v1") } var self *XwaylandShellV1 r, err := c.CreateResource(XwaylandShellV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.GetXwaylandSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource())) } }) if err != nil { return nil, err } self = WrapXwaylandShellV1(r) r.Data = self return self, nil } func NewXwaylandShellV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(XwaylandShellV1Interface, version, bind) } // XwaylandSurfaceV1 interface for associating Xwayland windows to wl_surfaces. type XwaylandSurfaceV1 struct{ *server.Resource } func WrapXwaylandSurfaceV1(r *server.Resource) *XwaylandSurfaceV1 { if r == nil { return nil } return &XwaylandSurfaceV1{r} } const XwaylandSurfaceV1RequestSetSerial uint32 = 0 const XwaylandSurfaceV1RequestDestroy uint32 = 1 // XwaylandSurfaceV1Error . type XwaylandSurfaceV1Error uint32 const ( XwaylandSurfaceV1ErrorAlreadyAssociated XwaylandSurfaceV1Error = 0 XwaylandSurfaceV1ErrorInvalidSerial XwaylandSurfaceV1Error = 1 ) // XwaylandSurfaceV1Handler handles xwayland_surface_v1 requests. type XwaylandSurfaceV1Handler interface { SetSerial(self *XwaylandSurfaceV1, serialLo uint32, serialHi uint32) Destroy(self *XwaylandSurfaceV1) } func NewXwaylandSurfaceV1(c server.Client, version int32, id uint32, h XwaylandSurfaceV1Handler) (*XwaylandSurfaceV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for xwayland_surface_v1") } var self *XwaylandSurfaceV1 r, err := c.CreateResource(XwaylandSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.SetSerial(self, args[0].Uint(), args[1].Uint()) case 1: h.Destroy(self) self.Destroy() } }) if err != nil { return nil, err } self = WrapXwaylandSurfaceV1(r) r.Data = self return self, nil } func NewXwaylandSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(XwaylandSurfaceV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *XwaylandShellV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *XwaylandSurfaceV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }