// Code generated by wlbgen; DO NOT EDIT. // Upstream protocol copyright and license: // Copyright 2022 Simon Ser // Copyright 2022 Red Hat, Inc. // Copyright 2022 Collabora, Ltd. // Copyright 2022-2025 Red Hat, Inc. // // 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 colorrepresentation import ( "fmt" wayland "github.com/bnema/go-wayland-bindings/server/wayland" "github.com/bnema/purego-libwayland/server" ) var WpColorRepresentationManagerV1Interface *server.Interface var WpColorRepresentationSurfaceV1Interface *server.Interface func init() { WpColorRepresentationManagerV1Interface = &server.Interface{Name: "wp_color_representation_manager_v1", Version: 1} WpColorRepresentationSurfaceV1Interface = &server.Interface{Name: "wp_color_representation_surface_v1", Version: 1} WpColorRepresentationManagerV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "get_surface", Signature: "no", Types: []*server.Interface{WpColorRepresentationSurfaceV1Interface, wayland.SurfaceInterface}}, } WpColorRepresentationManagerV1Interface.Events = []server.Message{ {Name: "supported_alpha_mode", Signature: "u", Types: []*server.Interface{nil}}, {Name: "supported_coefficients_and_ranges", Signature: "uu", Types: []*server.Interface{nil, nil}}, {Name: "done", Signature: "", Types: []*server.Interface{}}, } WpColorRepresentationSurfaceV1Interface.Requests = []server.Message{ {Name: "destroy", Signature: "", Types: []*server.Interface{}}, {Name: "set_alpha_mode", Signature: "u", Types: []*server.Interface{nil}}, {Name: "set_coefficients_and_range", Signature: "uu", Types: []*server.Interface{nil, nil}}, {Name: "set_chroma_location", Signature: "u", Types: []*server.Interface{nil}}, } WpColorRepresentationSurfaceV1Interface.Events = []server.Message{} if err := server.NewInterfaces(WpColorRepresentationManagerV1Interface, WpColorRepresentationSurfaceV1Interface); err != nil { panic(err) } } // WpColorRepresentationManagerV1 color representation manager singleton. type WpColorRepresentationManagerV1 struct{ *server.Resource } func WrapWpColorRepresentationManagerV1(r *server.Resource) *WpColorRepresentationManagerV1 { if r == nil { return nil } return &WpColorRepresentationManagerV1{r} } const WpColorRepresentationManagerV1RequestDestroy uint32 = 0 const WpColorRepresentationManagerV1RequestGetSurface uint32 = 1 const WpColorRepresentationManagerV1EventSupportedAlphaMode uint32 = 0 const WpColorRepresentationManagerV1EventSupportedCoefficientsAndRanges uint32 = 1 const WpColorRepresentationManagerV1EventDone uint32 = 2 // WpColorRepresentationManagerV1Error protocol errors. type WpColorRepresentationManagerV1Error uint32 const ( WpColorRepresentationManagerV1ErrorSurfaceExists WpColorRepresentationManagerV1Error = 1 ) // WpColorRepresentationManagerV1Handler handles wp_color_representation_manager_v1 requests. type WpColorRepresentationManagerV1Handler interface { Destroy(self *WpColorRepresentationManagerV1) GetSurface(self *WpColorRepresentationManagerV1, id uint32, surface *wayland.Surface) } func NewWpColorRepresentationManagerV1(c server.Client, version int32, id uint32, h WpColorRepresentationManagerV1Handler) (*WpColorRepresentationManagerV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_color_representation_manager_v1") } var self *WpColorRepresentationManagerV1 r, err := c.CreateResource(WpColorRepresentationManagerV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.GetSurface(self, args[0].NewID(), wayland.WrapSurface(args[1].Resource())) } }) if err != nil { return nil, err } self = WrapWpColorRepresentationManagerV1(r) r.Data = self return self, nil } // SendSupportedAlphaMode supported alpha modes. func (self *WpColorRepresentationManagerV1) SendSupportedAlphaMode(alphaMode uint32) { self.PostEvent(WpColorRepresentationManagerV1EventSupportedAlphaMode, server.Uint(alphaMode)) } // SendSupportedCoefficientsAndRanges supported matrix coefficients and ranges. func (self *WpColorRepresentationManagerV1) SendSupportedCoefficientsAndRanges(coefficients uint32, rangeArg uint32) { self.PostEvent(WpColorRepresentationManagerV1EventSupportedCoefficientsAndRanges, server.Uint(coefficients), server.Uint(rangeArg)) } // SendDone all features have been sent. func (self *WpColorRepresentationManagerV1) SendDone() { self.PostEvent(WpColorRepresentationManagerV1EventDone) } func NewWpColorRepresentationManagerV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpColorRepresentationManagerV1Interface, version, bind) } // WpColorRepresentationSurfaceV1 color representation extension to a surface. type WpColorRepresentationSurfaceV1 struct{ *server.Resource } func WrapWpColorRepresentationSurfaceV1(r *server.Resource) *WpColorRepresentationSurfaceV1 { if r == nil { return nil } return &WpColorRepresentationSurfaceV1{r} } const WpColorRepresentationSurfaceV1RequestDestroy uint32 = 0 const WpColorRepresentationSurfaceV1RequestSetAlphaMode uint32 = 1 const WpColorRepresentationSurfaceV1RequestSetCoefficientsAndRange uint32 = 2 const WpColorRepresentationSurfaceV1RequestSetChromaLocation uint32 = 3 // WpColorRepresentationSurfaceV1Error protocol errors. type WpColorRepresentationSurfaceV1Error uint32 const ( WpColorRepresentationSurfaceV1ErrorAlphaMode WpColorRepresentationSurfaceV1Error = 1 WpColorRepresentationSurfaceV1ErrorCoefficients WpColorRepresentationSurfaceV1Error = 2 WpColorRepresentationSurfaceV1ErrorPixelFormat WpColorRepresentationSurfaceV1Error = 3 WpColorRepresentationSurfaceV1ErrorInert WpColorRepresentationSurfaceV1Error = 4 WpColorRepresentationSurfaceV1ErrorChromaLocation WpColorRepresentationSurfaceV1Error = 5 ) // WpColorRepresentationSurfaceV1AlphaMode alpha mode. type WpColorRepresentationSurfaceV1AlphaMode uint32 const ( WpColorRepresentationSurfaceV1AlphaModePremultipliedElectrical WpColorRepresentationSurfaceV1AlphaMode = 0 WpColorRepresentationSurfaceV1AlphaModePremultipliedOptical WpColorRepresentationSurfaceV1AlphaMode = 1 WpColorRepresentationSurfaceV1AlphaModeStraight WpColorRepresentationSurfaceV1AlphaMode = 2 ) // WpColorRepresentationSurfaceV1Coefficients named coefficients. type WpColorRepresentationSurfaceV1Coefficients uint32 const ( WpColorRepresentationSurfaceV1CoefficientsIdentity WpColorRepresentationSurfaceV1Coefficients = 1 WpColorRepresentationSurfaceV1CoefficientsBt709 WpColorRepresentationSurfaceV1Coefficients = 2 WpColorRepresentationSurfaceV1CoefficientsFcc WpColorRepresentationSurfaceV1Coefficients = 3 WpColorRepresentationSurfaceV1CoefficientsBt601 WpColorRepresentationSurfaceV1Coefficients = 4 WpColorRepresentationSurfaceV1CoefficientsSmpte240 WpColorRepresentationSurfaceV1Coefficients = 5 WpColorRepresentationSurfaceV1CoefficientsBt2020 WpColorRepresentationSurfaceV1Coefficients = 6 WpColorRepresentationSurfaceV1CoefficientsBt2020Cl WpColorRepresentationSurfaceV1Coefficients = 7 WpColorRepresentationSurfaceV1CoefficientsIctcp WpColorRepresentationSurfaceV1Coefficients = 8 ) // WpColorRepresentationSurfaceV1Range Color range values. type WpColorRepresentationSurfaceV1Range uint32 const ( WpColorRepresentationSurfaceV1RangeFull WpColorRepresentationSurfaceV1Range = 1 WpColorRepresentationSurfaceV1RangeLimited WpColorRepresentationSurfaceV1Range = 2 ) // WpColorRepresentationSurfaceV1ChromaLocation Chroma sample location for 4:2:0 YCbCr. type WpColorRepresentationSurfaceV1ChromaLocation uint32 const ( WpColorRepresentationSurfaceV1ChromaLocationType0 WpColorRepresentationSurfaceV1ChromaLocation = 1 WpColorRepresentationSurfaceV1ChromaLocationType1 WpColorRepresentationSurfaceV1ChromaLocation = 2 WpColorRepresentationSurfaceV1ChromaLocationType2 WpColorRepresentationSurfaceV1ChromaLocation = 3 WpColorRepresentationSurfaceV1ChromaLocationType3 WpColorRepresentationSurfaceV1ChromaLocation = 4 WpColorRepresentationSurfaceV1ChromaLocationType4 WpColorRepresentationSurfaceV1ChromaLocation = 5 WpColorRepresentationSurfaceV1ChromaLocationType5 WpColorRepresentationSurfaceV1ChromaLocation = 6 ) // WpColorRepresentationSurfaceV1Handler handles wp_color_representation_surface_v1 requests. type WpColorRepresentationSurfaceV1Handler interface { Destroy(self *WpColorRepresentationSurfaceV1) SetAlphaMode(self *WpColorRepresentationSurfaceV1, alphaMode uint32) SetCoefficientsAndRange(self *WpColorRepresentationSurfaceV1, coefficients uint32, rangeArg uint32) SetChromaLocation(self *WpColorRepresentationSurfaceV1, chromaLocation uint32) } func NewWpColorRepresentationSurfaceV1(c server.Client, version int32, id uint32, h WpColorRepresentationSurfaceV1Handler) (*WpColorRepresentationSurfaceV1, error) { if h == nil { return nil, fmt.Errorf("purego-libwayland: nil handler for wp_color_representation_surface_v1") } var self *WpColorRepresentationSurfaceV1 r, err := c.CreateResource(WpColorRepresentationSurfaceV1Interface, version, id, func(_ *server.Resource, opcode uint32, args []server.Arg) { switch opcode { case 0: h.Destroy(self) self.Destroy() case 1: h.SetAlphaMode(self, args[0].Uint()) case 2: h.SetCoefficientsAndRange(self, args[0].Uint(), args[1].Uint()) case 3: h.SetChromaLocation(self, args[0].Uint()) } }) if err != nil { return nil, err } self = WrapWpColorRepresentationSurfaceV1(r) r.Data = self return self, nil } func NewWpColorRepresentationSurfaceV1Global(d *server.Display, version int32, bind server.BindFunc) error { return d.CreateGlobal(WpColorRepresentationSurfaceV1Interface, version, bind) } func resourceOf(v interface{ GetResource() *server.Resource }) *server.Resource { if v == nil { return nil } return v.GetResource() } func (self *WpColorRepresentationManagerV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource } func (self *WpColorRepresentationSurfaceV1) GetResource() *server.Resource { if self == nil { return nil } return self.Resource }