1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: single_pixel_buffer_v1
3// Source: single-pixel-buffer-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2022 Simon Ser
7//
8// Permission is hereby granted, free of charge, to any person obtaining a
9// copy of this software and associated documentation files (the "Software"),
10// to deal in the Software without restriction, including without limitation
11// the rights to use, copy, modify, merge, publish, distribute, sublicense,
12// and/or sell copies of the Software, and to permit persons to whom the
13// Software is furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice (including the next
16// paragraph) shall be included in all copies or substantial portions of the
17// Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25// DEALINGS IN THE SOFTWARE.
26
27package singlepixelbuffer
28
29import (
30 cross_wl_buffer "github.com/bnema/go-wayland-bindings/client/wayland"
31 "github.com/bnema/wlturbo/wl"
32)
33
34// WpSinglePixelBufferManagerInterface is the protocol interface name.
35const WpSinglePixelBufferManagerInterface = "wp_single_pixel_buffer_manager_v1"
36
37// WpSinglePixelBufferManager is the generated binding for wp_single_pixel_buffer_manager_v1 version 1.
38type WpSinglePixelBufferManager struct {
39 wl.BaseProxy
40}
41
42// NewWpSinglePixelBufferManager returns an unbound WpSinglePixelBufferManager.
43func NewWpSinglePixelBufferManager(ctx *wl.Context) *WpSinglePixelBufferManager {
44 obj := &WpSinglePixelBufferManager{}
45 obj.SetContext(ctx)
46 ctx.Register(obj)
47 return obj
48}
49
50// Destroy the wp_single_pixel_buffer_manager_v1 object. The child objects created via this interface are unaffected.
51func (o *WpSinglePixelBufferManager) Destroy() error {
52 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_single_pixel_buffer_manager_v1.destroy", Destructor: true}); err != nil {
53 return err
54 }
55 return nil
56}
57
58// Create a single-pixel buffer from four 32-bit RGBA values. Unless specified in another protocol extension, the RGBA values use pre-multiplied alpha. The width and height of the buffer are 1. The r, g, b and a arguments valid range is from UINT32_MIN (0) to UINT32_MAX (0xffffffff). These arguments should be interpreted as a percentage, i.e. - UINT32_MIN = 0% of the given color component - UINT32_MAX = 100% of the given color component
59func (o *WpSinglePixelBufferManager) CreateU32RgbaBuffer(r uint32, g uint32, b uint32, a uint32) (*cross_wl_buffer.Buffer, error) {
60 child := cross_wl_buffer.NewBuffer(o.Context())
61 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_single_pixel_buffer_manager_v1.create_u32_rgba_buffer", Child: child}, wl.ArgObject(child), wl.ArgUint(r), wl.ArgUint(g), wl.ArgUint(b), wl.ArgUint(a)); err != nil {
62 return nil, err
63 }
64 return child, nil
65}
66
67// EventSignature returns the declared event argument types in wire order.
68func (o *WpSinglePixelBufferManager) EventSignature(opcode uint16) (string, bool) {
69 switch opcode {
70 default:
71 return "", false
72 }
73}
74
75// Dispatch decodes one event on wp_single_pixel_buffer_manager_v1 and calls the registered handlers.
76func (o *WpSinglePixelBufferManager) Dispatch(event *wl.Event) {
77 switch event.Opcode {
78 default:
79 }
80}