v0.5.0 089fa12

color-representation-v1_generated.go RawHistoryFolder

1// Code generated by wlturbo-scanner. DO NOT EDIT.
2// Protocol: color_representation_v1
3// Source: color-representation-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright 2022 Simon Ser
7// Copyright 2022 Red Hat, Inc.
8// Copyright 2022 Collabora, Ltd.
9// Copyright 2022-2025 Red Hat, Inc.
10//
11// Permission is hereby granted, free of charge, to any person obtaining a
12// copy of this software and associated documentation files (the "Software"),
13// to deal in the Software without restriction, including without limitation
14// the rights to use, copy, modify, merge, publish, distribute, sublicense,
15// and/or sell copies of the Software, and to permit persons to whom the
16// Software is furnished to do so, subject to the following conditions:
17//
18// The above copyright notice and this permission notice (including the next
19// paragraph) shall be included in all copies or substantial portions of the
20// Software.
21//
22// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
25// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28// DEALINGS IN THE SOFTWARE.
29
30package colorrepresentation
31
32import (
33	"sync"
34
35	cross_wl_surface "github.com/bnema/wlturbo/protocol/core"
36	"github.com/bnema/wlturbo/wl"
37)
38
39// ERROR_SURFACE_EXISTS is the error surface_exists value.
40const ERROR_SURFACE_EXISTS = 1
41
42// ERROR_ALPHA_MODE is the error alpha_mode value.
43const ERROR_ALPHA_MODE = 1
44
45// ERROR_COEFFICIENTS is the error coefficients value.
46const ERROR_COEFFICIENTS = 2
47
48// ERROR_PIXEL_FORMAT is the error pixel_format value.
49const ERROR_PIXEL_FORMAT = 3
50
51// ERROR_INERT is the error inert value.
52const ERROR_INERT = 4
53
54// ERROR_CHROMA_LOCATION is the error chroma_location value.
55const ERROR_CHROMA_LOCATION = 5
56
57// ALPHA_MODE_PREMULTIPLIED_ELECTRICAL is the alpha_mode premultiplied_electrical value.
58const ALPHA_MODE_PREMULTIPLIED_ELECTRICAL = 0
59
60// ALPHA_MODE_PREMULTIPLIED_OPTICAL is the alpha_mode premultiplied_optical value.
61const ALPHA_MODE_PREMULTIPLIED_OPTICAL = 1
62
63// ALPHA_MODE_STRAIGHT is the alpha_mode straight value.
64const ALPHA_MODE_STRAIGHT = 2
65
66// COEFFICIENTS_IDENTITY is the coefficients identity value.
67const COEFFICIENTS_IDENTITY = 1
68
69// COEFFICIENTS_BT709 is the coefficients bt709 value.
70const COEFFICIENTS_BT709 = 2
71
72// COEFFICIENTS_FCC is the coefficients fcc value.
73const COEFFICIENTS_FCC = 3
74
75// COEFFICIENTS_BT601 is the coefficients bt601 value.
76const COEFFICIENTS_BT601 = 4
77
78// COEFFICIENTS_SMPTE240 is the coefficients smpte240 value.
79const COEFFICIENTS_SMPTE240 = 5
80
81// COEFFICIENTS_BT2020 is the coefficients bt2020 value.
82const COEFFICIENTS_BT2020 = 6
83
84// COEFFICIENTS_BT2020_CL is the coefficients bt2020_cl value.
85const COEFFICIENTS_BT2020_CL = 7
86
87// COEFFICIENTS_ICTCP is the coefficients ictcp value.
88const COEFFICIENTS_ICTCP = 8
89
90// RANGE_FULL is the range full value.
91const RANGE_FULL = 1
92
93// RANGE_LIMITED is the range limited value.
94const RANGE_LIMITED = 2
95
96// CHROMA_LOCATION_TYPE_0 is the chroma_location type_0 value.
97const CHROMA_LOCATION_TYPE_0 = 1
98
99// CHROMA_LOCATION_TYPE_1 is the chroma_location type_1 value.
100const CHROMA_LOCATION_TYPE_1 = 2
101
102// CHROMA_LOCATION_TYPE_2 is the chroma_location type_2 value.
103const CHROMA_LOCATION_TYPE_2 = 3
104
105// CHROMA_LOCATION_TYPE_3 is the chroma_location type_3 value.
106const CHROMA_LOCATION_TYPE_3 = 4
107
108// CHROMA_LOCATION_TYPE_4 is the chroma_location type_4 value.
109const CHROMA_LOCATION_TYPE_4 = 5
110
111// CHROMA_LOCATION_TYPE_5 is the chroma_location type_5 value.
112const CHROMA_LOCATION_TYPE_5 = 6
113
114// WpColorRepresentationManagerInterface is the protocol interface name.
115const WpColorRepresentationManagerInterface = "wp_color_representation_manager_v1"
116
117// WpColorRepresentationManager is the generated binding for wp_color_representation_manager_v1 version 1.
118type WpColorRepresentationManager struct {
119	wl.BaseProxy
120	// handlersMu guards the handler slices: a client may register or replace
121	// handlers while another goroutine dispatches events.
122	handlersMu                       sync.Mutex
123	onSupportedAlphaMode             []func(alphaMode uint32)
124	onSupportedCoefficientsAndRanges []func(coefficients uint32, rangeArg uint32)
125	onDone                           []func()
126}
127
128// NewWpColorRepresentationManager returns an unbound WpColorRepresentationManager.
129func NewWpColorRepresentationManager(ctx *wl.Context) *WpColorRepresentationManager {
130	obj := &WpColorRepresentationManager{}
131	obj.SetContext(ctx)
132	ctx.Register(obj)
133	return obj
134}
135
136// Destroy the wp_color_representation_manager_v1 object. This does not affect any other objects in any way.
137func (o *WpColorRepresentationManager) Destroy() error {
138	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_color_representation_manager_v1.destroy", Destructor: true}); err != nil {
139		return err
140	}
141	return nil
142}
143
144// If a wp_color_representation_surface_v1 object already exists for the given wl_surface, the protocol error surface_exists is raised. This creates a new color wp_color_representation_surface_v1 object for the given wl_surface. See the wp_color_representation_surface_v1 interface for more details.
145func (o *WpColorRepresentationManager) GetSurface(surface *cross_wl_surface.Surface) (*WpColorRepresentationSurface, error) {
146	var arg1 wl.Object
147	if surface != nil {
148		arg1 = surface
149	}
150	child := &WpColorRepresentationSurface{}
151	child.SetContext(o.Context())
152	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_color_representation_manager_v1.get_surface", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
153		return nil, err
154	}
155	return child, nil
156}
157
158// OnSupportedAlphaMode registers a handler for the supported_alpha_mode event.
159//
160// Handlers are appended, so a second call adds another handler rather than
161// replacing the first. Registration is safe while another goroutine dispatches.
162func (o *WpColorRepresentationManager) OnSupportedAlphaMode(handler func(alphaMode uint32)) {
163	if handler == nil {
164		return
165	}
166	o.handlersMu.Lock()
167	defer o.handlersMu.Unlock()
168	o.onSupportedAlphaMode = append(o.onSupportedAlphaMode, handler)
169}
170
171// handlersForSupportedAlphaMode returns the handlers registered for supported_alpha_mode, taken
172// under the lock so a handler may register another handler while events are
173// being dispatched.
174func (o *WpColorRepresentationManager) handlersForSupportedAlphaMode() []func(alphaMode uint32) {
175	o.handlersMu.Lock()
176	defer o.handlersMu.Unlock()
177	return o.onSupportedAlphaMode
178}
179
180// OnSupportedCoefficientsAndRanges registers a handler for the supported_coefficients_and_ranges event.
181//
182// Handlers are appended, so a second call adds another handler rather than
183// replacing the first. Registration is safe while another goroutine dispatches.
184func (o *WpColorRepresentationManager) OnSupportedCoefficientsAndRanges(handler func(coefficients uint32, rangeArg uint32)) {
185	if handler == nil {
186		return
187	}
188	o.handlersMu.Lock()
189	defer o.handlersMu.Unlock()
190	o.onSupportedCoefficientsAndRanges = append(o.onSupportedCoefficientsAndRanges, handler)
191}
192
193// handlersForSupportedCoefficientsAndRanges returns the handlers registered for supported_coefficients_and_ranges, taken
194// under the lock so a handler may register another handler while events are
195// being dispatched.
196func (o *WpColorRepresentationManager) handlersForSupportedCoefficientsAndRanges() []func(coefficients uint32, rangeArg uint32) {
197	o.handlersMu.Lock()
198	defer o.handlersMu.Unlock()
199	return o.onSupportedCoefficientsAndRanges
200}
201
202// OnDone registers a handler for the done event.
203//
204// Handlers are appended, so a second call adds another handler rather than
205// replacing the first. Registration is safe while another goroutine dispatches.
206func (o *WpColorRepresentationManager) OnDone(handler func()) {
207	if handler == nil {
208		return
209	}
210	o.handlersMu.Lock()
211	defer o.handlersMu.Unlock()
212	o.onDone = append(o.onDone, handler)
213}
214
215// handlersForDone returns the handlers registered for done, taken
216// under the lock so a handler may register another handler while events are
217// being dispatched.
218func (o *WpColorRepresentationManager) handlersForDone() []func() {
219	o.handlersMu.Lock()
220	defer o.handlersMu.Unlock()
221	return o.onDone
222}
223
224// EventSignature returns the declared event argument types in wire order.
225func (o *WpColorRepresentationManager) EventSignature(opcode uint16) (string, bool) {
226	switch opcode {
227	case 0:
228		return "uint,", true
229	case 1:
230		return "uint,uint,", true
231	case 2:
232		return "", true
233	default:
234		return "", false
235	}
236}
237
238// Dispatch decodes one event on wp_color_representation_manager_v1 and calls the registered handlers.
239func (o *WpColorRepresentationManager) Dispatch(event *wl.Event) {
240	switch event.Opcode {
241	case 0: // supported_alpha_mode
242		alphaMode := event.Uint32()
243
244		for i, handler := range o.handlersForSupportedAlphaMode() {
245			_ = i
246			handler(alphaMode)
247		}
248	case 1: // supported_coefficients_and_ranges
249		coefficients := event.Uint32()
250		rangeArg := event.Uint32()
251
252		for i, handler := range o.handlersForSupportedCoefficientsAndRanges() {
253			_ = i
254			handler(coefficients, rangeArg)
255		}
256	case 2: // done
257
258		for i, handler := range o.handlersForDone() {
259			_ = i
260			handler()
261		}
262	default:
263	}
264}
265
266// WpColorRepresentationSurfaceInterface is the protocol interface name.
267const WpColorRepresentationSurfaceInterface = "wp_color_representation_surface_v1"
268
269// WpColorRepresentationSurface is the generated binding for wp_color_representation_surface_v1 version 1.
270type WpColorRepresentationSurface struct {
271	wl.BaseProxy
272}
273
274// NewWpColorRepresentationSurface returns an unbound WpColorRepresentationSurface.
275func NewWpColorRepresentationSurface(ctx *wl.Context) *WpColorRepresentationSurface {
276	obj := &WpColorRepresentationSurface{}
277	obj.SetContext(ctx)
278	ctx.Register(obj)
279	return obj
280}
281
282// Destroy the wp_color_representation_surface_v1 object. Destroying this object unsets all the color representation metadata from the surface. See the wp_color_representation_surface_v1 interface description for how a compositor handles a surface without color representation metadata. Unsetting is double-buffered state, see wl_surface.commit.
283func (o *WpColorRepresentationSurface) Destroy() error {
284	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_color_representation_surface_v1.destroy", Destructor: true}); err != nil {
285		return err
286	}
287	return nil
288}
289
290// If this protocol object is inert, the protocol error inert is raised. Assuming an alpha channel exists, it is always linear. The alpha mode determines whether and how the color channels include pre-multiplied alpha. Using straight alpha might have performance benefits. Only alpha modes advertised by the compositor are allowed to be used as argument for this request. The "alpha_mode" protocol error is raised otherwise. Alpha mode is double buffered, see wl_surface.commit.
291func (o *WpColorRepresentationSurface) SetAlphaMode(alphaMode uint32) error {
292	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_color_representation_surface_v1.set_alpha_mode"}, wl.ArgUint(alphaMode)); err != nil {
293		return err
294	}
295	return nil
296}
297
298// If this protocol object is inert, the protocol error inert is raised. Set the matrix coefficients and video range which defines the formula and the related constants used to derive red, green and blue signals. Usually coefficients correspond to MatrixCoefficients code points in H.273. Only combinations advertised by the compositor are allowed to be used as argument for this request. The "coefficients" protocol error is raised otherwise. A call to wl_surface.commit verifies that the pixel format and the coefficients-range combination in the committed surface contents are compatible, if contents exist. The "pixel_format" protocol error is raised otherwise. A pixel format is compatible with the coefficients-range combination if the related equations and conventions as defined in H.273 can produce the color channels (RGB or YCbCr) of the pixel format. For the definition of the supported combination, see the wp_color_representation_surface_v1::coefficients and wp_color_representation_surface_v1::range enums. The coefficients-range combination is double-buffered, see wl_surface.commit.
299func (o *WpColorRepresentationSurface) SetCoefficientsAndRange(coefficients uint32, rangeArg uint32) error {
300	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "wp_color_representation_surface_v1.set_coefficients_and_range"}, wl.ArgUint(coefficients), wl.ArgUint(rangeArg)); err != nil {
301		return err
302	}
303	return nil
304}
305
306// If this protocol object is inert, the protocol error inert is raised. Set the chroma location type which defines the position of downsampled chroma samples, corresponding to Chroma420SampleLocType code points in H.273. An invalid chroma location enum value raises the "chroma_location" protocol error. A call to wl_surface.commit verifies that the pixel format and chroma location type in the committed surface contents are compatible, if contents exist. The "pixel_format" protocol error is raised otherwise. For the definition of the supported chroma location types, see the wp_color_representation_surface_v1::chroma_location enum. The chroma location type is double-buffered, see wl_surface.commit.
307func (o *WpColorRepresentationSurface) SetChromaLocation(chromaLocation uint32) error {
308	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 3, Name: "wp_color_representation_surface_v1.set_chroma_location"}, wl.ArgUint(chromaLocation)); err != nil {
309		return err
310	}
311	return nil
312}
313
314// EventSignature returns the declared event argument types in wire order.
315func (o *WpColorRepresentationSurface) EventSignature(opcode uint16) (string, bool) {
316	switch opcode {
317	default:
318		return "", false
319	}
320}
321
322// Dispatch decodes one event on wp_color_representation_surface_v1 and calls the registered handlers.
323func (o *WpColorRepresentationSurface) Dispatch(event *wl.Event) {
324	switch event.Opcode {
325	default:
326	}
327}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 8

↑↓ moveenter openesc close