1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: color_management_v1
3// Source: color-management-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright 2019 Sebastian Wick
7// Copyright 2019 Erwin Burema
8// Copyright 2020 AMD
9// Copyright 2020-2024 Collabora, Ltd.
10// Copyright 2024 Xaver Hugl
11// Copyright 2022-2025 Red Hat, Inc.
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice (including the next
21// paragraph) shall be included in all copies or substantial portions of the
22// Software.
23//
24// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30// DEALINGS IN THE SOFTWARE.
31
32package colormanagement
33
34import (
35 "sync"
36
37 cross_wl_output "github.com/bnema/go-wayland-bindings/client/wayland"
38 cross_wl_surface "github.com/bnema/go-wayland-bindings/client/wayland"
39 "github.com/bnema/wlturbo/wl"
40)
41
42// WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE is the error unsupported_feature value.
43const WP_COLOR_MANAGER_V1_ERROR_UNSUPPORTED_FEATURE = 0
44
45// ERROR_SURFACE_EXISTS is the error surface_exists value.
46const ERROR_SURFACE_EXISTS = 1
47
48// RENDER_INTENT_PERCEPTUAL is the render_intent perceptual value.
49const RENDER_INTENT_PERCEPTUAL = 0
50
51// RENDER_INTENT_RELATIVE is the render_intent relative value.
52const RENDER_INTENT_RELATIVE = 1
53
54// RENDER_INTENT_SATURATION is the render_intent saturation value.
55const RENDER_INTENT_SATURATION = 2
56
57// RENDER_INTENT_ABSOLUTE is the render_intent absolute value.
58const RENDER_INTENT_ABSOLUTE = 3
59
60// RENDER_INTENT_RELATIVE_BPC is the render_intent relative_bpc value.
61const RENDER_INTENT_RELATIVE_BPC = 4
62
63// RENDER_INTENT_ABSOLUTE_NO_ADAPTATION is the render_intent absolute_no_adaptation value.
64const RENDER_INTENT_ABSOLUTE_NO_ADAPTATION = 5
65
66// FEATURE_ICC_V2_V4 is the feature icc_v2_v4 value.
67const FEATURE_ICC_V2_V4 = 0
68
69// FEATURE_PARAMETRIC is the feature parametric value.
70const FEATURE_PARAMETRIC = 1
71
72// FEATURE_SET_PRIMARIES is the feature set_primaries value.
73const FEATURE_SET_PRIMARIES = 2
74
75// FEATURE_SET_TF_POWER is the feature set_tf_power value.
76const FEATURE_SET_TF_POWER = 3
77
78// FEATURE_SET_LUMINANCES is the feature set_luminances value.
79const FEATURE_SET_LUMINANCES = 4
80
81// FEATURE_SET_MASTERING_DISPLAY_PRIMARIES is the feature set_mastering_display_primaries value.
82const FEATURE_SET_MASTERING_DISPLAY_PRIMARIES = 5
83
84// FEATURE_EXTENDED_TARGET_VOLUME is the feature extended_target_volume value.
85const FEATURE_EXTENDED_TARGET_VOLUME = 6
86
87// FEATURE_WINDOWS_SCRGB is the feature windows_scrgb value.
88const FEATURE_WINDOWS_SCRGB = 7
89
90// FEATURE_WINDOWS_BT2100 is the feature windows_bt2100 value.
91const FEATURE_WINDOWS_BT2100 = 8
92
93// PRIMARIES_SRGB is the primaries srgb value.
94const PRIMARIES_SRGB = 1
95
96// PRIMARIES_PAL_M is the primaries pal_m value.
97const PRIMARIES_PAL_M = 2
98
99// PRIMARIES_PAL is the primaries pal value.
100const PRIMARIES_PAL = 3
101
102// PRIMARIES_NTSC is the primaries ntsc value.
103const PRIMARIES_NTSC = 4
104
105// PRIMARIES_GENERIC_FILM is the primaries generic_film value.
106const PRIMARIES_GENERIC_FILM = 5
107
108// PRIMARIES_BT2020 is the primaries bt2020 value.
109const PRIMARIES_BT2020 = 6
110
111// PRIMARIES_CIE1931_XYZ is the primaries cie1931_xyz value.
112const PRIMARIES_CIE1931_XYZ = 7
113
114// PRIMARIES_DCI_P3 is the primaries dci_p3 value.
115const PRIMARIES_DCI_P3 = 8
116
117// PRIMARIES_DISPLAY_P3 is the primaries display_p3 value.
118const PRIMARIES_DISPLAY_P3 = 9
119
120// PRIMARIES_ADOBE_RGB is the primaries adobe_rgb value.
121const PRIMARIES_ADOBE_RGB = 10
122
123// TRANSFER_FUNCTION_BT1886 is the transfer_function bt1886 value.
124const TRANSFER_FUNCTION_BT1886 = 1
125
126// TRANSFER_FUNCTION_GAMMA22 is the transfer_function gamma22 value.
127const TRANSFER_FUNCTION_GAMMA22 = 2
128
129// TRANSFER_FUNCTION_GAMMA28 is the transfer_function gamma28 value.
130const TRANSFER_FUNCTION_GAMMA28 = 3
131
132// TRANSFER_FUNCTION_ST240 is the transfer_function st240 value.
133const TRANSFER_FUNCTION_ST240 = 4
134
135// TRANSFER_FUNCTION_EXT_LINEAR is the transfer_function ext_linear value.
136const TRANSFER_FUNCTION_EXT_LINEAR = 5
137
138// TRANSFER_FUNCTION_LOG_100 is the transfer_function log_100 value.
139const TRANSFER_FUNCTION_LOG_100 = 6
140
141// TRANSFER_FUNCTION_LOG_316 is the transfer_function log_316 value.
142const TRANSFER_FUNCTION_LOG_316 = 7
143
144// TRANSFER_FUNCTION_XVYCC is the transfer_function xvycc value.
145const TRANSFER_FUNCTION_XVYCC = 8
146
147// TRANSFER_FUNCTION_SRGB is the transfer_function srgb value.
148const TRANSFER_FUNCTION_SRGB = 9
149
150// TRANSFER_FUNCTION_EXT_SRGB is the transfer_function ext_srgb value.
151const TRANSFER_FUNCTION_EXT_SRGB = 10
152
153// TRANSFER_FUNCTION_ST2084_PQ is the transfer_function st2084_pq value.
154const TRANSFER_FUNCTION_ST2084_PQ = 11
155
156// TRANSFER_FUNCTION_ST428 is the transfer_function st428 value.
157const TRANSFER_FUNCTION_ST428 = 12
158
159// TRANSFER_FUNCTION_HLG is the transfer_function hlg value.
160const TRANSFER_FUNCTION_HLG = 13
161
162// TRANSFER_FUNCTION_COMPOUND_POWER_2_4 is the transfer_function compound_power_2_4 value.
163const TRANSFER_FUNCTION_COMPOUND_POWER_2_4 = 14
164
165// ERROR_RENDER_INTENT is the error render_intent value.
166const ERROR_RENDER_INTENT = 0
167
168// ERROR_IMAGE_DESCRIPTION is the error image_description value.
169const ERROR_IMAGE_DESCRIPTION = 1
170
171// WP_COLOR_MANAGEMENT_SURFACE_V1_ERROR_INERT is the error inert value.
172const WP_COLOR_MANAGEMENT_SURFACE_V1_ERROR_INERT = 2
173
174// WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_INERT is the error inert value.
175const WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_INERT = 0
176
177// WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_UNSUPPORTED_FEATURE is the error unsupported_feature value.
178const WP_COLOR_MANAGEMENT_SURFACE_FEEDBACK_V1_ERROR_UNSUPPORTED_FEATURE = 1
179
180// WP_IMAGE_DESCRIPTION_CREATOR_ICC_V1_ERROR_INCOMPLETE_SET is the error incomplete_set value.
181const WP_IMAGE_DESCRIPTION_CREATOR_ICC_V1_ERROR_INCOMPLETE_SET = 0
182
183// WP_IMAGE_DESCRIPTION_CREATOR_ICC_V1_ERROR_ALREADY_SET is the error already_set value.
184const WP_IMAGE_DESCRIPTION_CREATOR_ICC_V1_ERROR_ALREADY_SET = 1
185
186// ERROR_BAD_FD is the error bad_fd value.
187const ERROR_BAD_FD = 2
188
189// ERROR_BAD_SIZE is the error bad_size value.
190const ERROR_BAD_SIZE = 3
191
192// ERROR_OUT_OF_FILE is the error out_of_file value.
193const ERROR_OUT_OF_FILE = 4
194
195// WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_INCOMPLETE_SET is the error incomplete_set value.
196const WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_INCOMPLETE_SET = 0
197
198// WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET is the error already_set value.
199const WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET = 1
200
201// WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_UNSUPPORTED_FEATURE is the error unsupported_feature value.
202const WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_UNSUPPORTED_FEATURE = 2
203
204// ERROR_INVALID_TF is the error invalid_tf value.
205const ERROR_INVALID_TF = 3
206
207// ERROR_INVALID_PRIMARIES_NAMED is the error invalid_primaries_named value.
208const ERROR_INVALID_PRIMARIES_NAMED = 4
209
210// ERROR_INVALID_LUMINANCE is the error invalid_luminance value.
211const ERROR_INVALID_LUMINANCE = 5
212
213// ERROR_NOT_READY is the error not_ready value.
214const ERROR_NOT_READY = 0
215
216// ERROR_NO_INFORMATION is the error no_information value.
217const ERROR_NO_INFORMATION = 1
218
219// CAUSE_LOW_VERSION is the cause low_version value.
220const CAUSE_LOW_VERSION = 0
221
222// CAUSE_UNSUPPORTED is the cause unsupported value.
223const CAUSE_UNSUPPORTED = 1
224
225// CAUSE_OPERATING_SYSTEM is the cause operating_system value.
226const CAUSE_OPERATING_SYSTEM = 2
227
228// CAUSE_NO_OUTPUT is the cause no_output value.
229const CAUSE_NO_OUTPUT = 3
230
231// WpColorManagerInterface is the protocol interface name.
232const WpColorManagerInterface = "wp_color_manager_v1"
233
234// WpColorManager is the generated binding for wp_color_manager_v1 version 3.
235type WpColorManager struct {
236 wl.BaseProxy
237 // handlersMu guards the handler slices: a client may register or replace
238 // handlers while another goroutine dispatches events.
239 handlersMu sync.Mutex
240 onSupportedIntent []func(renderIntent uint32)
241 onSupportedFeature []func(feature uint32)
242 onSupportedTfNamed []func(tf uint32)
243 onSupportedPrimariesNamed []func(primaries uint32)
244 onDone []func()
245}
246
247// NewWpColorManager returns an unbound WpColorManager.
248func NewWpColorManager(ctx *wl.Context) *WpColorManager {
249 obj := &WpColorManager{}
250 obj.SetContext(ctx)
251 ctx.Register(obj)
252 return obj
253}
254
255// Destroy the wp_color_manager_v1 object. This does not affect any other objects in any way.
256func (o *WpColorManager) Destroy() error {
257 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_color_manager_v1.destroy", Destructor: true}); err != nil {
258 return err
259 }
260 return nil
261}
262
263// This creates a new wp_color_management_output_v1 object for the given wl_output. See the wp_color_management_output_v1 interface for more details.
264func (o *WpColorManager) GetOutput(output *cross_wl_output.Output) (*WpColorManagementOutput, error) {
265 var arg1 wl.Object
266 if output != nil {
267 arg1 = output
268 }
269 child := &WpColorManagementOutput{}
270 child.SetContext(o.Context())
271 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_color_manager_v1.get_output", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
272 return nil, err
273 }
274 return child, nil
275}
276
277// If a wp_color_management_surface_v1 object already exists for the given wl_surface, the protocol error surface_exists is raised. This creates a new color wp_color_management_surface_v1 object for the given wl_surface. See the wp_color_management_surface_v1 interface for more details.
278func (o *WpColorManager) GetSurface(surface *cross_wl_surface.Surface) (*WpColorManagementSurface, error) {
279 var arg1 wl.Object
280 if surface != nil {
281 arg1 = surface
282 }
283 child := &WpColorManagementSurface{}
284 child.SetContext(o.Context())
285 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "wp_color_manager_v1.get_surface", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
286 return nil, err
287 }
288 return child, nil
289}
290
291// This creates a new color wp_color_management_surface_feedback_v1 object for the given wl_surface. See the wp_color_management_surface_feedback_v1 interface for more details.
292func (o *WpColorManager) GetSurfaceFeedback(surface *cross_wl_surface.Surface) (*WpColorManagementSurfaceFeedback, error) {
293 var arg1 wl.Object
294 if surface != nil {
295 arg1 = surface
296 }
297 child := &WpColorManagementSurfaceFeedback{}
298 child.SetContext(o.Context())
299 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 3, Name: "wp_color_manager_v1.get_surface_feedback", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
300 return nil, err
301 }
302 return child, nil
303}
304
305// Makes a new ICC-based image description creator object with all properties initially unset. The client can then use the object's interface to define all the required properties for an image description and finally create a wp_image_description_v1 object. This request can be used when the compositor advertises wp_color_manager_v1.feature.icc_v2_v4. Otherwise this request raises the protocol error unsupported_feature.
306func (o *WpColorManager) CreateIccCreator() (*WpImageDescriptionCreatorIcc, error) {
307 child := &WpImageDescriptionCreatorIcc{}
308 child.SetContext(o.Context())
309 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 4, Name: "wp_color_manager_v1.create_icc_creator", Child: child}, wl.ArgObject(child)); err != nil {
310 return nil, err
311 }
312 return child, nil
313}
314
315// Makes a new parametric image description creator object with all properties initially unset. The client can then use the object's interface to define all the required properties for an image description and finally create a wp_image_description_v1 object. This request can be used when the compositor advertises wp_color_manager_v1.feature.parametric. Otherwise this request raises the protocol error unsupported_feature.
316func (o *WpColorManager) CreateParametricCreator() (*WpImageDescriptionCreatorParams, error) {
317 child := &WpImageDescriptionCreatorParams{}
318 child.SetContext(o.Context())
319 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 5, Name: "wp_color_manager_v1.create_parametric_creator", Child: child}, wl.ArgObject(child)); err != nil {
320 return nil, err
321 }
322 return child, nil
323}
324
325// This creates a pre-defined image description for the so-called Windows-scRGB stimulus encoding. This comes from the Windows 10 handling of its own definition of an scRGB color space for an HDR screen driven in BT.2100/PQ signalling mode. Windows-scRGB uses sRGB (BT.709) color primaries and white point. The transfer characteristic is extended linear. The nominal color channel value range is extended, meaning it includes negative and greater than 1.0 values. Negative values are used to escape the sRGB color gamut boundaries. To make use of the extended range, the client needs to use a pixel format that can represent those values, e.g. floating-point 16 bits per channel. Nominal color value R=G=B=0.0 corresponds to BT.2100/PQ system 0 cd/m², and R=G=B=1.0 corresponds to BT.2100/PQ system 80 cd/m². The maximum is R=G=B=125.0 corresponding to 10k cd/m². Windows-scRGB is displayed by Windows 10 by converting it to BT.2100/PQ, maintaining the CIE 1931 chromaticity and mapping the luminance as above. No adjustment is made to the signal to account for the viewing conditions. The reference white level of Windows-scRGB is unknown. If a reference white level must be assumed for compositor processing, it should be R=G=B=2.5375 corresponding to 203 cd/m² of Report ITU-R BT.2408-7. The target color volume of Windows-scRGB is unknown. The color gamut may be anything between sRGB and BT.2100. Note: EGL_EXT_gl_colorspace_scrgb_linear definition differs from Windows-scRGB by using R=G=B=1.0 as the reference white level, while Windows-scRGB reference white level is unknown or varies. However, it seems probable that Windows implements both EGL_EXT_gl_colorspace_scrgb_linear and Vulkan VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT as Windows-scRGB. This request can be used when the compositor advertises wp_color_manager_v1.feature.windows_scrgb. Otherwise this request raises the protocol error unsupported_feature. The resulting image description object does not allow get_information request. The wp_image_description_v1.ready event shall be sent.
326func (o *WpColorManager) CreateWindowsScrgb() (*WpImageDescription, error) {
327 child := &WpImageDescription{}
328 child.SetContext(o.Context())
329 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 6, Name: "wp_color_manager_v1.create_windows_scrgb", Child: child}, wl.ArgObject(child)); err != nil {
330 return nil, err
331 }
332 return child, nil
333}
334
335// This request retrieves the image description backing a reference. The get_information request can be used if and only if the request that creates the reference allows it.
336func (o *WpColorManager) GetImageDescription(reference *WpImageDescriptionReference) (*WpImageDescription, error) {
337 var arg1 wl.Object
338 if reference != nil {
339 arg1 = reference
340 }
341 child := &WpImageDescription{}
342 child.SetContext(o.Context())
343 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 7, Name: "wp_color_manager_v1.get_image_description", Since: 2, Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
344 return nil, err
345 }
346 return child, nil
347}
348
349// This creates a pre-defined image description for the so-called Windows-BT.2100 stimulus encoding. This comes from the Windows 10 handling of its own definition of a BT.2100 color space for an HDR screen driven in BT.2100/PQ signalling mode. Windows-BT.2100 uses BT.2020 color primaries and white point. The transfer characteristic is st2084_pq. Windows-BT.2100 is generally displayed by Windows 10 without any adjustments to the signal to account for viewing conditions. The reference white level of Windows-BT.2100 is unknown. If a reference white level must be assumed for compositor processing, it should be 203 cd/m² of Report ITU-R BT.2408-7. The target color volume of Windows-BT.2100 is unknown. The color gamut may be anything up to BT.2100. This request can be used when the compositor advertises wp_color_manager_v1.feature.windows_bt2100. Otherwise this request raises the protocol error unsupported_feature. The resulting image description object does not allow get_information request. The wp_image_description_v1.ready event shall be sent.
350func (o *WpColorManager) CreateWindowsBt2100() (*WpImageDescription, error) {
351 child := &WpImageDescription{}
352 child.SetContext(o.Context())
353 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 8, Name: "wp_color_manager_v1.create_windows_bt2100", Since: 3, Child: child}, wl.ArgObject(child)); err != nil {
354 return nil, err
355 }
356 return child, nil
357}
358
359// OnSupportedIntent registers a handler for the supported_intent event.
360//
361// Handlers are appended, so a second call adds another handler rather than
362// replacing the first. Registration is safe while another goroutine dispatches.
363func (o *WpColorManager) OnSupportedIntent(handler func(renderIntent uint32)) {
364 if handler == nil {
365 return
366 }
367 o.handlersMu.Lock()
368 defer o.handlersMu.Unlock()
369 o.onSupportedIntent = append(o.onSupportedIntent, handler)
370}
371
372// handlersForSupportedIntent returns the handlers registered for supported_intent, taken
373// under the lock so a handler may register another handler while events are
374// being dispatched.
375func (o *WpColorManager) handlersForSupportedIntent() []func(renderIntent uint32) {
376 o.handlersMu.Lock()
377 defer o.handlersMu.Unlock()
378 return o.onSupportedIntent
379}
380
381// OnSupportedFeature registers a handler for the supported_feature event.
382//
383// Handlers are appended, so a second call adds another handler rather than
384// replacing the first. Registration is safe while another goroutine dispatches.
385func (o *WpColorManager) OnSupportedFeature(handler func(feature uint32)) {
386 if handler == nil {
387 return
388 }
389 o.handlersMu.Lock()
390 defer o.handlersMu.Unlock()
391 o.onSupportedFeature = append(o.onSupportedFeature, handler)
392}
393
394// handlersForSupportedFeature returns the handlers registered for supported_feature, taken
395// under the lock so a handler may register another handler while events are
396// being dispatched.
397func (o *WpColorManager) handlersForSupportedFeature() []func(feature uint32) {
398 o.handlersMu.Lock()
399 defer o.handlersMu.Unlock()
400 return o.onSupportedFeature
401}
402
403// OnSupportedTfNamed registers a handler for the supported_tf_named event.
404//
405// Handlers are appended, so a second call adds another handler rather than
406// replacing the first. Registration is safe while another goroutine dispatches.
407func (o *WpColorManager) OnSupportedTfNamed(handler func(tf uint32)) {
408 if handler == nil {
409 return
410 }
411 o.handlersMu.Lock()
412 defer o.handlersMu.Unlock()
413 o.onSupportedTfNamed = append(o.onSupportedTfNamed, handler)
414}
415
416// handlersForSupportedTfNamed returns the handlers registered for supported_tf_named, taken
417// under the lock so a handler may register another handler while events are
418// being dispatched.
419func (o *WpColorManager) handlersForSupportedTfNamed() []func(tf uint32) {
420 o.handlersMu.Lock()
421 defer o.handlersMu.Unlock()
422 return o.onSupportedTfNamed
423}
424
425// OnSupportedPrimariesNamed registers a handler for the supported_primaries_named event.
426//
427// Handlers are appended, so a second call adds another handler rather than
428// replacing the first. Registration is safe while another goroutine dispatches.
429func (o *WpColorManager) OnSupportedPrimariesNamed(handler func(primaries uint32)) {
430 if handler == nil {
431 return
432 }
433 o.handlersMu.Lock()
434 defer o.handlersMu.Unlock()
435 o.onSupportedPrimariesNamed = append(o.onSupportedPrimariesNamed, handler)
436}
437
438// handlersForSupportedPrimariesNamed returns the handlers registered for supported_primaries_named, taken
439// under the lock so a handler may register another handler while events are
440// being dispatched.
441func (o *WpColorManager) handlersForSupportedPrimariesNamed() []func(primaries uint32) {
442 o.handlersMu.Lock()
443 defer o.handlersMu.Unlock()
444 return o.onSupportedPrimariesNamed
445}
446
447// OnDone registers a handler for the done event.
448//
449// Handlers are appended, so a second call adds another handler rather than
450// replacing the first. Registration is safe while another goroutine dispatches.
451func (o *WpColorManager) OnDone(handler func()) {
452 if handler == nil {
453 return
454 }
455 o.handlersMu.Lock()
456 defer o.handlersMu.Unlock()
457 o.onDone = append(o.onDone, handler)
458}
459
460// handlersForDone returns the handlers registered for done, taken
461// under the lock so a handler may register another handler while events are
462// being dispatched.
463func (o *WpColorManager) handlersForDone() []func() {
464 o.handlersMu.Lock()
465 defer o.handlersMu.Unlock()
466 return o.onDone
467}
468
469// EventSignature returns the declared event argument types in wire order.
470func (o *WpColorManager) EventSignature(opcode uint16) (string, bool) {
471 switch opcode {
472 case 0:
473 return "uint,", true
474 case 1:
475 return "uint,", true
476 case 2:
477 return "uint,", true
478 case 3:
479 return "uint,", true
480 case 4:
481 return "", true
482 default:
483 return "", false
484 }
485}
486
487// Dispatch decodes one event on wp_color_manager_v1 and calls the registered handlers.
488func (o *WpColorManager) Dispatch(event *wl.Event) {
489 switch event.Opcode {
490 case 0: // supported_intent
491 renderIntent := event.Uint32()
492
493 for i, handler := range o.handlersForSupportedIntent() {
494 _ = i
495 handler(renderIntent)
496 }
497 case 1: // supported_feature
498 feature := event.Uint32()
499
500 for i, handler := range o.handlersForSupportedFeature() {
501 _ = i
502 handler(feature)
503 }
504 case 2: // supported_tf_named
505 tf := event.Uint32()
506
507 for i, handler := range o.handlersForSupportedTfNamed() {
508 _ = i
509 handler(tf)
510 }
511 case 3: // supported_primaries_named
512 primaries := event.Uint32()
513
514 for i, handler := range o.handlersForSupportedPrimariesNamed() {
515 _ = i
516 handler(primaries)
517 }
518 case 4: // done
519
520 for i, handler := range o.handlersForDone() {
521 _ = i
522 handler()
523 }
524 default:
525 }
526}
527
528// WpColorManagementOutputInterface is the protocol interface name.
529const WpColorManagementOutputInterface = "wp_color_management_output_v1"
530
531// WpColorManagementOutput is the generated binding for wp_color_management_output_v1 version 3.
532type WpColorManagementOutput struct {
533 wl.BaseProxy
534 // handlersMu guards the handler slices: a client may register or replace
535 // handlers while another goroutine dispatches events.
536 handlersMu sync.Mutex
537 onImageDescriptionChanged []func()
538}
539
540// NewWpColorManagementOutput returns an unbound WpColorManagementOutput.
541func NewWpColorManagementOutput(ctx *wl.Context) *WpColorManagementOutput {
542 obj := &WpColorManagementOutput{}
543 obj.SetContext(ctx)
544 ctx.Register(obj)
545 return obj
546}
547
548// Destroy the color wp_color_management_output_v1 object. This does not affect any remaining protocol objects.
549func (o *WpColorManagementOutput) Destroy() error {
550 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_color_management_output_v1.destroy", Destructor: true}); err != nil {
551 return err
552 }
553 return nil
554}
555
556// This creates a new wp_image_description_v1 object for the current image description of the output. There always is exactly one image description active for an output so the client should destroy the image description created by earlier invocations of this request. This request is usually sent as a reaction to the image_description_changed event or when creating a wp_color_management_output_v1 object. The image description of an output represents the color encoding the output expects. There might be performance and power advantages, as well as improved color reproduction, if a content update matches the image description of the output it is being shown on. If a content update is shown on any other output than the one it matches the image description of, then the color reproduction on those outputs might be considerably worse. The created wp_image_description_v1 object preserves the image description of the output from the time the object was created. The resulting image description object allows get_information request. If this protocol object is inert, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the no_output cause. If the interface version is inadequate for the output's image description, meaning that the client does not support all the events needed to deliver the crucial information, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the low_version cause. Otherwise the object shall immediately deliver the ready event.
557func (o *WpColorManagementOutput) GetImageDescription() (*WpImageDescription, error) {
558 child := &WpImageDescription{}
559 child.SetContext(o.Context())
560 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_color_management_output_v1.get_image_description", Child: child}, wl.ArgObject(child)); err != nil {
561 return nil, err
562 }
563 return child, nil
564}
565
566// OnImageDescriptionChanged registers a handler for the image_description_changed event.
567//
568// Handlers are appended, so a second call adds another handler rather than
569// replacing the first. Registration is safe while another goroutine dispatches.
570func (o *WpColorManagementOutput) OnImageDescriptionChanged(handler func()) {
571 if handler == nil {
572 return
573 }
574 o.handlersMu.Lock()
575 defer o.handlersMu.Unlock()
576 o.onImageDescriptionChanged = append(o.onImageDescriptionChanged, handler)
577}
578
579// handlersForImageDescriptionChanged returns the handlers registered for image_description_changed, taken
580// under the lock so a handler may register another handler while events are
581// being dispatched.
582func (o *WpColorManagementOutput) handlersForImageDescriptionChanged() []func() {
583 o.handlersMu.Lock()
584 defer o.handlersMu.Unlock()
585 return o.onImageDescriptionChanged
586}
587
588// EventSignature returns the declared event argument types in wire order.
589func (o *WpColorManagementOutput) EventSignature(opcode uint16) (string, bool) {
590 switch opcode {
591 case 0:
592 return "", true
593 default:
594 return "", false
595 }
596}
597
598// Dispatch decodes one event on wp_color_management_output_v1 and calls the registered handlers.
599func (o *WpColorManagementOutput) Dispatch(event *wl.Event) {
600 switch event.Opcode {
601 case 0: // image_description_changed
602
603 for i, handler := range o.handlersForImageDescriptionChanged() {
604 _ = i
605 handler()
606 }
607 default:
608 }
609}
610
611// WpColorManagementSurfaceInterface is the protocol interface name.
612const WpColorManagementSurfaceInterface = "wp_color_management_surface_v1"
613
614// WpColorManagementSurface is the generated binding for wp_color_management_surface_v1 version 3.
615type WpColorManagementSurface struct {
616 wl.BaseProxy
617}
618
619// NewWpColorManagementSurface returns an unbound WpColorManagementSurface.
620func NewWpColorManagementSurface(ctx *wl.Context) *WpColorManagementSurface {
621 obj := &WpColorManagementSurface{}
622 obj.SetContext(ctx)
623 ctx.Register(obj)
624 return obj
625}
626
627// Destroy the wp_color_management_surface_v1 object and do the same as unset_image_description.
628func (o *WpColorManagementSurface) Destroy() error {
629 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_color_management_surface_v1.destroy", Destructor: true}); err != nil {
630 return err
631 }
632 return nil
633}
634
635// If this protocol object is inert, the protocol error inert is raised. Set the image description of the underlying surface. The image description and rendering intent are double-buffered state, see wl_surface.commit. It is the client's responsibility to understand the image description it sets on a surface, and to provide content that matches that image description. Compositors might convert images to match their own or any other image descriptions. Image descriptions which are not ready (see wp_image_description_v1) are forbidden in this request, and in such case the protocol error image_description is raised. All image descriptions which are ready (see wp_image_description_v1) are allowed and must always be accepted by the compositor. When an image description is set on a surface, it establishes an explicit link between surface pixel values and surface colorimetry. This link may be undefined for some pixel values, see the image description creator interfaces for the conditions. Non-finite floating-point values (NaN, Inf) always have an undefined colorimetry. A rendering intent provides the client's preference on how surface colorimetry should be mapped to each output. The render_intent value must be one advertised by the compositor with wp_color_manager_v1.render_intent event, otherwise the protocol error render_intent is raised. By default, a surface does not have an associated image description nor a rendering intent. The handling of color on such surfaces is compositor implementation defined. Compositors should handle such surfaces as sRGB, but may handle them differently if they have specific requirements. Setting the image description has copy semantics; after this request, the image description can be immediately destroyed without affecting the pending state of the surface.
636func (o *WpColorManagementSurface) SetImageDescription(imageDescription *WpImageDescription, renderIntent uint32) error {
637 var arg0 wl.Object
638 if imageDescription != nil {
639 arg0 = imageDescription
640 }
641 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_color_management_surface_v1.set_image_description"}, wl.ArgObject(arg0), wl.ArgUint(renderIntent)); err != nil {
642 return err
643 }
644 return nil
645}
646
647// If this protocol object is inert, the protocol error inert is raised. This request removes any image description from the surface. See set_image_description for how a compositor handles a surface without an image description. This is double-buffered state, see wl_surface.commit.
648func (o *WpColorManagementSurface) UnsetImageDescription() error {
649 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "wp_color_management_surface_v1.unset_image_description"}); err != nil {
650 return err
651 }
652 return nil
653}
654
655// EventSignature returns the declared event argument types in wire order.
656func (o *WpColorManagementSurface) EventSignature(opcode uint16) (string, bool) {
657 switch opcode {
658 default:
659 return "", false
660 }
661}
662
663// Dispatch decodes one event on wp_color_management_surface_v1 and calls the registered handlers.
664func (o *WpColorManagementSurface) Dispatch(event *wl.Event) {
665 switch event.Opcode {
666 default:
667 }
668}
669
670// WpColorManagementSurfaceFeedbackInterface is the protocol interface name.
671const WpColorManagementSurfaceFeedbackInterface = "wp_color_management_surface_feedback_v1"
672
673// WpColorManagementSurfaceFeedback is the generated binding for wp_color_management_surface_feedback_v1 version 3.
674type WpColorManagementSurfaceFeedback struct {
675 wl.BaseProxy
676 // handlersMu guards the handler slices: a client may register or replace
677 // handlers while another goroutine dispatches events.
678 handlersMu sync.Mutex
679 onPreferredChanged []func(identity uint32)
680 onPreferredChanged2 []func(identityHi uint32, identityLo uint32)
681}
682
683// NewWpColorManagementSurfaceFeedback returns an unbound WpColorManagementSurfaceFeedback.
684func NewWpColorManagementSurfaceFeedback(ctx *wl.Context) *WpColorManagementSurfaceFeedback {
685 obj := &WpColorManagementSurfaceFeedback{}
686 obj.SetContext(ctx)
687 ctx.Register(obj)
688 return obj
689}
690
691// Destroy the wp_color_management_surface_feedback_v1 object.
692func (o *WpColorManagementSurfaceFeedback) Destroy() error {
693 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_color_management_surface_feedback_v1.destroy", Destructor: true}); err != nil {
694 return err
695 }
696 return nil
697}
698
699// If this protocol object is inert, the protocol error inert is raised. The preferred image description represents the compositor's preferred color encoding for this wl_surface at the current time. There might be performance and power advantages, as well as improved color reproduction, if the image description of a content update matches the preferred image description. This creates a new wp_image_description_v1 object for the currently preferred image description for the wl_surface. The client should stop using and destroy the image descriptions created by earlier invocations of this request for the associated wl_surface. This request is usually sent as a reaction to the preferred_changed event or when creating a wp_color_management_surface_feedback_v1 object if the client is capable of adapting to image descriptions. The created wp_image_description_v1 object preserves the preferred image description of the wl_surface from the time the object was created. The resulting image description object allows get_information request. If the image description is parametric, the client should set it on its wl_surface only if the image description is an exact match with the client content. Particularly if everything else matches, but the target color volume is greater than what the client needs, the client should create its own parameric image description with its exact parameters. If the interface version is inadequate for the preferred image description, meaning that the client does not support all the events needed to deliver the crucial information, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the low_version cause, otherwise the object shall immediately deliver the ready event.
700func (o *WpColorManagementSurfaceFeedback) GetPreferred() (*WpImageDescription, error) {
701 child := &WpImageDescription{}
702 child.SetContext(o.Context())
703 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_color_management_surface_feedback_v1.get_preferred", Child: child}, wl.ArgObject(child)); err != nil {
704 return nil, err
705 }
706 return child, nil
707}
708
709// The same description as for get_preferred applies, except the returned image description is guaranteed to be parametric. This is meant for clients that can only deal with parametric image descriptions. If the compositor doesn't support parametric image descriptions, the unsupported_feature error is emitted.
710func (o *WpColorManagementSurfaceFeedback) GetPreferredParametric() (*WpImageDescription, error) {
711 child := &WpImageDescription{}
712 child.SetContext(o.Context())
713 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "wp_color_management_surface_feedback_v1.get_preferred_parametric", Child: child}, wl.ArgObject(child)); err != nil {
714 return nil, err
715 }
716 return child, nil
717}
718
719// OnPreferredChanged registers a handler for the preferred_changed event.
720//
721// Handlers are appended, so a second call adds another handler rather than
722// replacing the first. Registration is safe while another goroutine dispatches.
723func (o *WpColorManagementSurfaceFeedback) OnPreferredChanged(handler func(identity uint32)) {
724 if handler == nil {
725 return
726 }
727 o.handlersMu.Lock()
728 defer o.handlersMu.Unlock()
729 o.onPreferredChanged = append(o.onPreferredChanged, handler)
730}
731
732// handlersForPreferredChanged returns the handlers registered for preferred_changed, taken
733// under the lock so a handler may register another handler while events are
734// being dispatched.
735func (o *WpColorManagementSurfaceFeedback) handlersForPreferredChanged() []func(identity uint32) {
736 o.handlersMu.Lock()
737 defer o.handlersMu.Unlock()
738 return o.onPreferredChanged
739}
740
741// OnPreferredChanged2 registers a handler for the preferred_changed2 event.
742//
743// Handlers are appended, so a second call adds another handler rather than
744// replacing the first. Registration is safe while another goroutine dispatches.
745func (o *WpColorManagementSurfaceFeedback) OnPreferredChanged2(handler func(identityHi uint32, identityLo uint32)) {
746 if handler == nil {
747 return
748 }
749 o.handlersMu.Lock()
750 defer o.handlersMu.Unlock()
751 o.onPreferredChanged2 = append(o.onPreferredChanged2, handler)
752}
753
754// handlersForPreferredChanged2 returns the handlers registered for preferred_changed2, taken
755// under the lock so a handler may register another handler while events are
756// being dispatched.
757func (o *WpColorManagementSurfaceFeedback) handlersForPreferredChanged2() []func(identityHi uint32, identityLo uint32) {
758 o.handlersMu.Lock()
759 defer o.handlersMu.Unlock()
760 return o.onPreferredChanged2
761}
762
763// EventSignature returns the declared event argument types in wire order.
764func (o *WpColorManagementSurfaceFeedback) EventSignature(opcode uint16) (string, bool) {
765 switch opcode {
766 case 0:
767 return "uint,", true
768 case 1:
769 return "uint,uint,", true
770 default:
771 return "", false
772 }
773}
774
775// Dispatch decodes one event on wp_color_management_surface_feedback_v1 and calls the registered handlers.
776func (o *WpColorManagementSurfaceFeedback) Dispatch(event *wl.Event) {
777 switch event.Opcode {
778 case 0: // preferred_changed
779 identity := event.Uint32()
780
781 for i, handler := range o.handlersForPreferredChanged() {
782 _ = i
783 handler(identity)
784 }
785 case 1: // preferred_changed2
786 identityHi := event.Uint32()
787 identityLo := event.Uint32()
788
789 for i, handler := range o.handlersForPreferredChanged2() {
790 _ = i
791 handler(identityHi, identityLo)
792 }
793 default:
794 }
795}
796
797// WpImageDescriptionCreatorIccInterface is the protocol interface name.
798const WpImageDescriptionCreatorIccInterface = "wp_image_description_creator_icc_v1"
799
800// WpImageDescriptionCreatorIcc is the generated binding for wp_image_description_creator_icc_v1 version 3.
801type WpImageDescriptionCreatorIcc struct {
802 wl.BaseProxy
803}
804
805// NewWpImageDescriptionCreatorIcc returns an unbound WpImageDescriptionCreatorIcc.
806func NewWpImageDescriptionCreatorIcc(ctx *wl.Context) *WpImageDescriptionCreatorIcc {
807 obj := &WpImageDescriptionCreatorIcc{}
808 obj.SetContext(ctx)
809 ctx.Register(obj)
810 return obj
811}
812
813// Create an image description object based on the ICC information previously set on this object. A compositor must parse the ICC data in some undefined but finite amount of time. The completeness of the parameter set is verified. If the set is not complete, the protocol error incomplete_set is raised. For the definition of a complete set, see the description of this interface. If the particular combination of the information is not supported by the compositor, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the 'unsupported' cause. If a valid image description was created from the information, the wp_image_description_v1.ready event will eventually be sent instead. This request destroys the wp_image_description_creator_icc_v1 object. The resulting image description object does not allow get_information request.
814func (o *WpImageDescriptionCreatorIcc) Create() (*WpImageDescription, error) {
815 child := &WpImageDescription{}
816 child.SetContext(o.Context())
817 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_image_description_creator_icc_v1.create", Destructor: true, Child: child}, wl.ArgObject(child)); err != nil {
818 return nil, err
819 }
820 return child, nil
821}
822
823// Sets the ICC profile file to be used as the basis of the image description. The data shall be found through the given fd at the given offset, having the given length. The fd must be seekable and readable. Violating these requirements raises the bad_fd protocol error. If reading the data fails due to an error independent of the client, the compositor shall send the wp_image_description_v1.failed event on the created wp_image_description_v1 with the 'operating_system' cause. The maximum size of the ICC profile is 32 MB. If length is greater than that or zero, the protocol error bad_size is raised. If offset + length exceeds the file size, the protocol error out_of_file is raised. A compositor may read the file at any time starting from this request and only until whichever happens first: - If create request was issued, the wp_image_description_v1 object delivers either failed or ready event; or - if create request was not issued, this wp_image_description_creator_icc_v1 object is destroyed. A compositor shall not modify the contents of the file, and the fd may be sealed for writes and size changes. The client must ensure to its best ability that the data does not change while the compositor is reading it. The data must represent a valid ICC profile. The ICC profile version must be 2 or 4, it must be a 3 channel profile and the class must be Display or ColorSpace. Violating these requirements will not result in a protocol error, but will eventually send the wp_image_description_v1.failed event on the created wp_image_description_v1 with the 'unsupported' cause. See the International Color Consortium specification ICC.1:2022 for more details about ICC profiles. If ICC file has already been set on this object, the protocol error already_set is raised.
824func (o *WpImageDescriptionCreatorIcc) SetIccFile(iccProfile int, offset uint32, length uint32) error {
825 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_image_description_creator_icc_v1.set_icc_file", FDs: []int{iccProfile}}, wl.ArgFD(), wl.ArgUint(offset), wl.ArgUint(length)); err != nil {
826 return err
827 }
828 return nil
829}
830
831// EventSignature returns the declared event argument types in wire order.
832func (o *WpImageDescriptionCreatorIcc) EventSignature(opcode uint16) (string, bool) {
833 switch opcode {
834 default:
835 return "", false
836 }
837}
838
839// Dispatch decodes one event on wp_image_description_creator_icc_v1 and calls the registered handlers.
840func (o *WpImageDescriptionCreatorIcc) Dispatch(event *wl.Event) {
841 switch event.Opcode {
842 default:
843 }
844}
845
846// WpImageDescriptionCreatorParamsInterface is the protocol interface name.
847const WpImageDescriptionCreatorParamsInterface = "wp_image_description_creator_params_v1"
848
849// WpImageDescriptionCreatorParams is the generated binding for wp_image_description_creator_params_v1 version 3.
850type WpImageDescriptionCreatorParams struct {
851 wl.BaseProxy
852}
853
854// NewWpImageDescriptionCreatorParams returns an unbound WpImageDescriptionCreatorParams.
855func NewWpImageDescriptionCreatorParams(ctx *wl.Context) *WpImageDescriptionCreatorParams {
856 obj := &WpImageDescriptionCreatorParams{}
857 obj.SetContext(ctx)
858 ctx.Register(obj)
859 return obj
860}
861
862// Create an image description object based on the parameters previously set on this object. The completeness of the parameter set is verified. If the set is not complete, the protocol error incomplete_set is raised. For the definition of a complete set, see the description of this interface. When both max_cll and max_fall are set, max_fall must be less or equal to max_cll otherwise the invalid_luminance protocol error is raised. In version 1, these following conditions also result in the invalid_luminance protocol error. Version 2 and later do not have this requirement. - When max_cll is set, it must be greater than min L and less or equal to max L of the mastering luminance range. - When max_fall is set, it must be greater than min L and less or equal to max L of the mastering luminance range. If the particular combination of the parameter set is not supported by the compositor, the resulting image description object shall immediately deliver the wp_image_description_v1.failed event with the 'unsupported' cause. If a valid image description was created from the parameter set, the wp_image_description_v1.ready event will eventually be sent instead. This request destroys the wp_image_description_creator_params_v1 object. The resulting image description object does not allow get_information request.
863func (o *WpImageDescriptionCreatorParams) Create() (*WpImageDescription, error) {
864 child := &WpImageDescription{}
865 child.SetContext(o.Context())
866 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_image_description_creator_params_v1.create", Destructor: true, Child: child}, wl.ArgObject(child)); err != nil {
867 return nil, err
868 }
869 return child, nil
870}
871
872// Sets the transfer characteristic using explicitly enumerated named functions. When the resulting image description is attached to an image, the content should be decoded according to the industry standard practices for the transfer characteristic. Only names advertised with wp_color_manager_v1 event supported_tf_named are allowed. Other values shall raise the protocol error invalid_tf. If transfer characteristic has already been set on this object, the protocol error already_set is raised.
873func (o *WpImageDescriptionCreatorParams) SetTfNamed(tf uint32) error {
874 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_image_description_creator_params_v1.set_tf_named"}, wl.ArgUint(tf)); err != nil {
875 return err
876 }
877 return nil
878}
879
880// Sets the color component transfer characteristic to a power curve with the given exponent. Negative values are handled by mirroring the positive half of the curve through the origin. The valid domain and range of the curve are all finite real numbers. This curve represents the conversion from electrical to optical color channel values. The curve exponent shall be multiplied by 10000 to get the argument eexp value to carry the precision of 4 decimals. The curve exponent must be at least 1.0 and at most 10.0. Otherwise the protocol error invalid_tf is raised. If transfer characteristic has already been set on this object, the protocol error already_set is raised. This request can be used when the compositor advertises wp_color_manager_v1.feature.set_tf_power. Otherwise this request raises the protocol error unsupported_feature.
881func (o *WpImageDescriptionCreatorParams) SetTfPower(eexp uint32) error {
882 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "wp_image_description_creator_params_v1.set_tf_power"}, wl.ArgUint(eexp)); err != nil {
883 return err
884 }
885 return nil
886}
887
888// Sets the color primaries and white point using explicitly named sets. This describes the primary color volume which is the basis for color value encoding. Only names advertised with wp_color_manager_v1 event supported_primaries_named are allowed. Other values shall raise the protocol error invalid_primaries_named. If primaries have already been set on this object, the protocol error already_set is raised.
889func (o *WpImageDescriptionCreatorParams) SetPrimariesNamed(primaries uint32) error {
890 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 3, Name: "wp_image_description_creator_params_v1.set_primaries_named"}, wl.ArgUint(primaries)); err != nil {
891 return err
892 }
893 return nil
894}
895
896// Sets the color primaries and white point using CIE 1931 xy chromaticity coordinates. This describes the primary color volume which is the basis for color value encoding. Each coordinate value is multiplied by 1 million to get the argument value to carry precision of 6 decimals. If primaries have already been set on this object, the protocol error already_set is raised. This request can be used if the compositor advertises wp_color_manager_v1.feature.set_primaries. Otherwise this request raises the protocol error unsupported_feature.
897func (o *WpImageDescriptionCreatorParams) SetPrimaries(rX int32, rY int32, gX int32, gY int32, bX int32, bY int32, wX int32, wY int32) error {
898 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 4, Name: "wp_image_description_creator_params_v1.set_primaries"}, wl.ArgInt(rX), wl.ArgInt(rY), wl.ArgInt(gX), wl.ArgInt(gY), wl.ArgInt(bX), wl.ArgInt(bY), wl.ArgInt(wX), wl.ArgInt(wY)); err != nil {
899 return err
900 }
901 return nil
902}
903
904// Sets the primary color volume luminance range and the reference white luminance level. These values include the minimum display emission, but not external flare. The minimum display emission is assumed to have the chromaticity of the primary color volume white point. The default luminances from https://www.color.org/chardata/rgb/srgb.xalter are - primary color volume minimum: 0.2 cd/m² - primary color volume maximum: 80 cd/m² - reference white: 80 cd/m² Setting a named transfer characteristic can imply other default luminances. The default luminances get overwritten when this request is used. With transfer_function.st2084_pq the given 'max_lum' value is ignored, and 'max_lum' is taken as 'min_lum' + 10000 cd/m². 'min_lum' and 'max_lum' specify the minimum and maximum luminances of the primary color volume as reproduced by the targeted display. 'reference_lum' specifies the luminance of the reference white as reproduced by the targeted display, and reflects the targeted viewing environment. Compositors should make sure that all content is anchored, meaning that an input signal level of 'reference_lum' on one image description and another input signal level of 'reference_lum' on another image description should produce the same output level, even though the 'reference_lum' on both image representations can be different. 'reference_lum' may be higher than 'max_lum'. In that case reaching the reference white output level in image content requires the 'extended_target_volume' feature support. If 'max_lum' or 'reference_lum' are less than or equal to 'min_lum', the protocol error invalid_luminance is raised. The minimum luminance is multiplied by 10000 to get the argument 'min_lum' value and carries precision of 4 decimals. The maximum luminance and reference white luminance values are unscaled. If the primary color volume luminance range and the reference white luminance level have already been set on this object, the protocol error already_set is raised. This request can be used if the compositor advertises wp_color_manager_v1.feature.set_luminances. Otherwise this request raises the protocol error unsupported_feature.
905func (o *WpImageDescriptionCreatorParams) SetLuminances(minLum uint32, maxLum uint32, referenceLum uint32) error {
906 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 5, Name: "wp_image_description_creator_params_v1.set_luminances"}, wl.ArgUint(minLum), wl.ArgUint(maxLum), wl.ArgUint(referenceLum)); err != nil {
907 return err
908 }
909 return nil
910}
911
912// Provides the color primaries and white point of the mastering display using CIE 1931 xy chromaticity coordinates. This is compatible with the SMPTE ST 2086 definition of HDR static metadata. The mastering display primaries and mastering display luminances define the target color volume. If mastering display primaries are not explicitly set, the target color volume is assumed to have the same primaries as the primary color volume. The target color volume is defined by all tristimulus values between 0.0 and 1.0 (inclusive) of the color space defined by the given mastering display primaries and white point. The colorimetry is identical between the container color space and the mastering display color space, including that no chromatic adaptation is applied even if the white points differ. The target color volume can exceed the primary color volume to allow for a greater color volume with an existing color space definition (for example scRGB). It can be smaller than the primary color volume to minimize gamut and tone mapping distances for big color spaces (HDR metadata). To make use of the entire target color volume a suitable pixel format has to be chosen (e.g. floating point to exceed the primary color volume, or abusing limited quantization range as with xvYCC). Each coordinate value is multiplied by 1 million to get the argument value to carry precision of 6 decimals. If mastering display primaries have already been set on this object, the protocol error already_set is raised. This request can be used if the compositor advertises wp_color_manager_v1.feature.set_mastering_display_primaries. Otherwise this request raises the protocol error unsupported_feature. The advertisement implies support only for target color volumes fully contained within the primary color volume. If a compositor additionally supports target color volume exceeding the primary color volume, it must advertise wp_color_manager_v1.feature.extended_target_volume. If a client uses target color volume exceeding the primary color volume and the compositor does not support it, the result is implementation defined. Compositors are recommended to detect this case and fail the image description gracefully, but it may as well result in color artifacts.
913func (o *WpImageDescriptionCreatorParams) SetMasteringDisplayPrimaries(rX int32, rY int32, gX int32, gY int32, bX int32, bY int32, wX int32, wY int32) error {
914 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 6, Name: "wp_image_description_creator_params_v1.set_mastering_display_primaries"}, wl.ArgInt(rX), wl.ArgInt(rY), wl.ArgInt(gX), wl.ArgInt(gY), wl.ArgInt(bX), wl.ArgInt(bY), wl.ArgInt(wX), wl.ArgInt(wY)); err != nil {
915 return err
916 }
917 return nil
918}
919
920// Sets the luminance range that was used during the content mastering process as the minimum and maximum absolute luminance L. These values include the minimum display emission and ambient flare luminances, assumed to be optically additive and have the chromaticity of the primary color volume white point. This should be compatible with the SMPTE ST 2086 definition of HDR static metadata. The mastering display primaries and mastering display luminances define the target color volume. If mastering luminances are not explicitly set, the target color volume is assumed to have the same min and max luminances as the primary color volume. If max L is less than or equal to min L, the protocol error invalid_luminance is raised. Min L value is multiplied by 10000 to get the argument min_lum value and carry precision of 4 decimals. Max L value is unscaled for max_lum. This request can be used if the compositor advertises wp_color_manager_v1.feature.set_mastering_display_primaries. Otherwise this request raises the protocol error unsupported_feature. The advertisement implies support only for target color volumes fully contained within the primary color volume. If a compositor additionally supports target color volume exceeding the primary color volume, it must advertise wp_color_manager_v1.feature.extended_target_volume. If a client uses target color volume exceeding the primary color volume and the compositor does not support it, the result is implementation defined. Compositors are recommended to detect this case and fail the image description gracefully, but it may as well result in color artifacts.
921func (o *WpImageDescriptionCreatorParams) SetMasteringLuminance(minLum uint32, maxLum uint32) error {
922 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 7, Name: "wp_image_description_creator_params_v1.set_mastering_luminance"}, wl.ArgUint(minLum), wl.ArgUint(maxLum)); err != nil {
923 return err
924 }
925 return nil
926}
927
928// Sets the maximum content light level (max_cll) as defined by CTA-861-H. max_cll is undefined by default.
929func (o *WpImageDescriptionCreatorParams) SetMaxCll(maxCll uint32) error {
930 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 8, Name: "wp_image_description_creator_params_v1.set_max_cll"}, wl.ArgUint(maxCll)); err != nil {
931 return err
932 }
933 return nil
934}
935
936// Sets the maximum frame-average light level (max_fall) as defined by CTA-861-H. max_fall is undefined by default.
937func (o *WpImageDescriptionCreatorParams) SetMaxFall(maxFall uint32) error {
938 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 9, Name: "wp_image_description_creator_params_v1.set_max_fall"}, wl.ArgUint(maxFall)); err != nil {
939 return err
940 }
941 return nil
942}
943
944// EventSignature returns the declared event argument types in wire order.
945func (o *WpImageDescriptionCreatorParams) EventSignature(opcode uint16) (string, bool) {
946 switch opcode {
947 default:
948 return "", false
949 }
950}
951
952// Dispatch decodes one event on wp_image_description_creator_params_v1 and calls the registered handlers.
953func (o *WpImageDescriptionCreatorParams) Dispatch(event *wl.Event) {
954 switch event.Opcode {
955 default:
956 }
957}
958
959// WpImageDescriptionInterface is the protocol interface name.
960const WpImageDescriptionInterface = "wp_image_description_v1"
961
962// WpImageDescription is the generated binding for wp_image_description_v1 version 3.
963type WpImageDescription struct {
964 wl.BaseProxy
965 // handlersMu guards the handler slices: a client may register or replace
966 // handlers while another goroutine dispatches events.
967 handlersMu sync.Mutex
968 onFailed []func(cause uint32, msg string)
969 onReady []func(identity uint32)
970 onReady2 []func(identityHi uint32, identityLo uint32)
971}
972
973// NewWpImageDescription returns an unbound WpImageDescription.
974func NewWpImageDescription(ctx *wl.Context) *WpImageDescription {
975 obj := &WpImageDescription{}
976 obj.SetContext(ctx)
977 ctx.Register(obj)
978 return obj
979}
980
981// Destroy this object. It is safe to destroy an object which is not ready. Destroying a wp_image_description_v1 object has no side-effects, not even if a wp_color_management_surface_v1.set_image_description has not yet been followed by a wl_surface.commit.
982func (o *WpImageDescription) Destroy() error {
983 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_image_description_v1.destroy", Destructor: true}); err != nil {
984 return err
985 }
986 return nil
987}
988
989// Creates a wp_image_description_info_v1 object which delivers the information that makes up the image description. Not all image description protocol objects allow get_information request. Whether it is allowed or not is defined by the request that created the object. If get_information is not allowed, the protocol error no_information is raised.
990func (o *WpImageDescription) GetInformation() (*WpImageDescriptionInfo, error) {
991 child := &WpImageDescriptionInfo{}
992 child.SetContext(o.Context())
993 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_image_description_v1.get_information", Child: child}, wl.ArgObject(child)); err != nil {
994 return nil, err
995 }
996 return child, nil
997}
998
999// OnFailed registers a handler for the failed event.
1000//
1001// Handlers are appended, so a second call adds another handler rather than
1002// replacing the first. Registration is safe while another goroutine dispatches.
1003func (o *WpImageDescription) OnFailed(handler func(cause uint32, msg string)) {
1004 if handler == nil {
1005 return
1006 }
1007 o.handlersMu.Lock()
1008 defer o.handlersMu.Unlock()
1009 o.onFailed = append(o.onFailed, handler)
1010}
1011
1012// handlersForFailed returns the handlers registered for failed, taken
1013// under the lock so a handler may register another handler while events are
1014// being dispatched.
1015func (o *WpImageDescription) handlersForFailed() []func(cause uint32, msg string) {
1016 o.handlersMu.Lock()
1017 defer o.handlersMu.Unlock()
1018 return o.onFailed
1019}
1020
1021// OnReady registers a handler for the ready event.
1022//
1023// Handlers are appended, so a second call adds another handler rather than
1024// replacing the first. Registration is safe while another goroutine dispatches.
1025func (o *WpImageDescription) OnReady(handler func(identity uint32)) {
1026 if handler == nil {
1027 return
1028 }
1029 o.handlersMu.Lock()
1030 defer o.handlersMu.Unlock()
1031 o.onReady = append(o.onReady, handler)
1032}
1033
1034// handlersForReady returns the handlers registered for ready, taken
1035// under the lock so a handler may register another handler while events are
1036// being dispatched.
1037func (o *WpImageDescription) handlersForReady() []func(identity uint32) {
1038 o.handlersMu.Lock()
1039 defer o.handlersMu.Unlock()
1040 return o.onReady
1041}
1042
1043// OnReady2 registers a handler for the ready2 event.
1044//
1045// Handlers are appended, so a second call adds another handler rather than
1046// replacing the first. Registration is safe while another goroutine dispatches.
1047func (o *WpImageDescription) OnReady2(handler func(identityHi uint32, identityLo uint32)) {
1048 if handler == nil {
1049 return
1050 }
1051 o.handlersMu.Lock()
1052 defer o.handlersMu.Unlock()
1053 o.onReady2 = append(o.onReady2, handler)
1054}
1055
1056// handlersForReady2 returns the handlers registered for ready2, taken
1057// under the lock so a handler may register another handler while events are
1058// being dispatched.
1059func (o *WpImageDescription) handlersForReady2() []func(identityHi uint32, identityLo uint32) {
1060 o.handlersMu.Lock()
1061 defer o.handlersMu.Unlock()
1062 return o.onReady2
1063}
1064
1065// EventSignature returns the declared event argument types in wire order.
1066func (o *WpImageDescription) EventSignature(opcode uint16) (string, bool) {
1067 switch opcode {
1068 case 0:
1069 return "uint,string,", true
1070 case 1:
1071 return "uint,", true
1072 case 2:
1073 return "uint,uint,", true
1074 default:
1075 return "", false
1076 }
1077}
1078
1079// Dispatch decodes one event on wp_image_description_v1 and calls the registered handlers.
1080func (o *WpImageDescription) Dispatch(event *wl.Event) {
1081 switch event.Opcode {
1082 case 0: // failed
1083 cause := event.Uint32()
1084 msg := event.String()
1085
1086 for i, handler := range o.handlersForFailed() {
1087 _ = i
1088 handler(cause, msg)
1089 }
1090 case 1: // ready
1091 identity := event.Uint32()
1092
1093 for i, handler := range o.handlersForReady() {
1094 _ = i
1095 handler(identity)
1096 }
1097 case 2: // ready2
1098 identityHi := event.Uint32()
1099 identityLo := event.Uint32()
1100
1101 for i, handler := range o.handlersForReady2() {
1102 _ = i
1103 handler(identityHi, identityLo)
1104 }
1105 default:
1106 }
1107}
1108
1109// WpImageDescriptionInfoInterface is the protocol interface name.
1110const WpImageDescriptionInfoInterface = "wp_image_description_info_v1"
1111
1112// WpImageDescriptionInfo is the generated binding for wp_image_description_info_v1 version 3.
1113type WpImageDescriptionInfo struct {
1114 wl.BaseProxy
1115 // handlersMu guards the handler slices: a client may register or replace
1116 // handlers while another goroutine dispatches events.
1117 handlersMu sync.Mutex
1118 onDone []func()
1119 onIccFile []func(icc *wl.OwnedFD, iccSize uint32)
1120 onPrimaries []func(rX int32, rY int32, gX int32, gY int32, bX int32, bY int32, wX int32, wY int32)
1121 onPrimariesNamed []func(primaries uint32)
1122 onTfPower []func(eexp uint32)
1123 onTfNamed []func(tf uint32)
1124 onLuminances []func(minLum uint32, maxLum uint32, referenceLum uint32)
1125 onTargetPrimaries []func(rX int32, rY int32, gX int32, gY int32, bX int32, bY int32, wX int32, wY int32)
1126 onTargetLuminance []func(minLum uint32, maxLum uint32)
1127 onTargetMaxCll []func(maxCll uint32)
1128 onTargetMaxFall []func(maxFall uint32)
1129}
1130
1131// NewWpImageDescriptionInfo returns an unbound WpImageDescriptionInfo.
1132func NewWpImageDescriptionInfo(ctx *wl.Context) *WpImageDescriptionInfo {
1133 obj := &WpImageDescriptionInfo{}
1134 obj.SetContext(ctx)
1135 ctx.Register(obj)
1136 return obj
1137}
1138
1139// OnDone registers a handler for the done event.
1140//
1141// Handlers are appended, so a second call adds another handler rather than
1142// replacing the first. Registration is safe while another goroutine dispatches.
1143func (o *WpImageDescriptionInfo) OnDone(handler func()) {
1144 if handler == nil {
1145 return
1146 }
1147 o.handlersMu.Lock()
1148 defer o.handlersMu.Unlock()
1149 o.onDone = append(o.onDone, handler)
1150}
1151
1152// handlersForDone returns the handlers registered for done, taken
1153// under the lock so a handler may register another handler while events are
1154// being dispatched.
1155func (o *WpImageDescriptionInfo) handlersForDone() []func() {
1156 o.handlersMu.Lock()
1157 defer o.handlersMu.Unlock()
1158 return o.onDone
1159}
1160
1161// OnIccFile registers a handler for the icc_file event.
1162//
1163// Handlers are appended, so a second call adds another handler rather than
1164// replacing the first. Registration is safe while another goroutine dispatches.
1165func (o *WpImageDescriptionInfo) OnIccFile(handler func(icc *wl.OwnedFD, iccSize uint32)) {
1166 if handler == nil {
1167 return
1168 }
1169 o.handlersMu.Lock()
1170 defer o.handlersMu.Unlock()
1171 o.onIccFile = append(o.onIccFile, handler)
1172}
1173
1174// handlersForIccFile returns the handlers registered for icc_file, taken
1175// under the lock so a handler may register another handler while events are
1176// being dispatched.
1177func (o *WpImageDescriptionInfo) handlersForIccFile() []func(icc *wl.OwnedFD, iccSize uint32) {
1178 o.handlersMu.Lock()
1179 defer o.handlersMu.Unlock()
1180 return o.onIccFile
1181}
1182
1183// OnPrimaries registers a handler for the primaries event.
1184//
1185// Handlers are appended, so a second call adds another handler rather than
1186// replacing the first. Registration is safe while another goroutine dispatches.
1187func (o *WpImageDescriptionInfo) OnPrimaries(handler func(rX int32, rY int32, gX int32, gY int32, bX int32, bY int32, wX int32, wY int32)) {
1188 if handler == nil {
1189 return
1190 }
1191 o.handlersMu.Lock()
1192 defer o.handlersMu.Unlock()
1193 o.onPrimaries = append(o.onPrimaries, handler)
1194}
1195
1196// handlersForPrimaries returns the handlers registered for primaries, taken
1197// under the lock so a handler may register another handler while events are
1198// being dispatched.
1199func (o *WpImageDescriptionInfo) handlersForPrimaries() []func(rX int32, rY int32, gX int32, gY int32, bX int32, bY int32, wX int32, wY int32) {
1200 o.handlersMu.Lock()
1201 defer o.handlersMu.Unlock()
1202 return o.onPrimaries
1203}
1204
1205// OnPrimariesNamed registers a handler for the primaries_named event.
1206//
1207// Handlers are appended, so a second call adds another handler rather than
1208// replacing the first. Registration is safe while another goroutine dispatches.
1209func (o *WpImageDescriptionInfo) OnPrimariesNamed(handler func(primaries uint32)) {
1210 if handler == nil {
1211 return
1212 }
1213 o.handlersMu.Lock()
1214 defer o.handlersMu.Unlock()
1215 o.onPrimariesNamed = append(o.onPrimariesNamed, handler)
1216}
1217
1218// handlersForPrimariesNamed returns the handlers registered for primaries_named, taken
1219// under the lock so a handler may register another handler while events are
1220// being dispatched.
1221func (o *WpImageDescriptionInfo) handlersForPrimariesNamed() []func(primaries uint32) {
1222 o.handlersMu.Lock()
1223 defer o.handlersMu.Unlock()
1224 return o.onPrimariesNamed
1225}
1226
1227// OnTfPower registers a handler for the tf_power event.
1228//
1229// Handlers are appended, so a second call adds another handler rather than
1230// replacing the first. Registration is safe while another goroutine dispatches.
1231func (o *WpImageDescriptionInfo) OnTfPower(handler func(eexp uint32)) {
1232 if handler == nil {
1233 return
1234 }
1235 o.handlersMu.Lock()
1236 defer o.handlersMu.Unlock()
1237 o.onTfPower = append(o.onTfPower, handler)
1238}
1239
1240// handlersForTfPower returns the handlers registered for tf_power, taken
1241// under the lock so a handler may register another handler while events are
1242// being dispatched.
1243func (o *WpImageDescriptionInfo) handlersForTfPower() []func(eexp uint32) {
1244 o.handlersMu.Lock()
1245 defer o.handlersMu.Unlock()
1246 return o.onTfPower
1247}
1248
1249// OnTfNamed registers a handler for the tf_named event.
1250//
1251// Handlers are appended, so a second call adds another handler rather than
1252// replacing the first. Registration is safe while another goroutine dispatches.
1253func (o *WpImageDescriptionInfo) OnTfNamed(handler func(tf uint32)) {
1254 if handler == nil {
1255 return
1256 }
1257 o.handlersMu.Lock()
1258 defer o.handlersMu.Unlock()
1259 o.onTfNamed = append(o.onTfNamed, handler)
1260}
1261
1262// handlersForTfNamed returns the handlers registered for tf_named, taken
1263// under the lock so a handler may register another handler while events are
1264// being dispatched.
1265func (o *WpImageDescriptionInfo) handlersForTfNamed() []func(tf uint32) {
1266 o.handlersMu.Lock()
1267 defer o.handlersMu.Unlock()
1268 return o.onTfNamed
1269}
1270
1271// OnLuminances registers a handler for the luminances event.
1272//
1273// Handlers are appended, so a second call adds another handler rather than
1274// replacing the first. Registration is safe while another goroutine dispatches.
1275func (o *WpImageDescriptionInfo) OnLuminances(handler func(minLum uint32, maxLum uint32, referenceLum uint32)) {
1276 if handler == nil {
1277 return
1278 }
1279 o.handlersMu.Lock()
1280 defer o.handlersMu.Unlock()
1281 o.onLuminances = append(o.onLuminances, handler)
1282}
1283
1284// handlersForLuminances returns the handlers registered for luminances, taken
1285// under the lock so a handler may register another handler while events are
1286// being dispatched.
1287func (o *WpImageDescriptionInfo) handlersForLuminances() []func(minLum uint32, maxLum uint32, referenceLum uint32) {
1288 o.handlersMu.Lock()
1289 defer o.handlersMu.Unlock()
1290 return o.onLuminances
1291}
1292
1293// OnTargetPrimaries registers a handler for the target_primaries event.
1294//
1295// Handlers are appended, so a second call adds another handler rather than
1296// replacing the first. Registration is safe while another goroutine dispatches.
1297func (o *WpImageDescriptionInfo) OnTargetPrimaries(handler func(rX int32, rY int32, gX int32, gY int32, bX int32, bY int32, wX int32, wY int32)) {
1298 if handler == nil {
1299 return
1300 }
1301 o.handlersMu.Lock()
1302 defer o.handlersMu.Unlock()
1303 o.onTargetPrimaries = append(o.onTargetPrimaries, handler)
1304}
1305
1306// handlersForTargetPrimaries returns the handlers registered for target_primaries, taken
1307// under the lock so a handler may register another handler while events are
1308// being dispatched.
1309func (o *WpImageDescriptionInfo) handlersForTargetPrimaries() []func(rX int32, rY int32, gX int32, gY int32, bX int32, bY int32, wX int32, wY int32) {
1310 o.handlersMu.Lock()
1311 defer o.handlersMu.Unlock()
1312 return o.onTargetPrimaries
1313}
1314
1315// OnTargetLuminance registers a handler for the target_luminance event.
1316//
1317// Handlers are appended, so a second call adds another handler rather than
1318// replacing the first. Registration is safe while another goroutine dispatches.
1319func (o *WpImageDescriptionInfo) OnTargetLuminance(handler func(minLum uint32, maxLum uint32)) {
1320 if handler == nil {
1321 return
1322 }
1323 o.handlersMu.Lock()
1324 defer o.handlersMu.Unlock()
1325 o.onTargetLuminance = append(o.onTargetLuminance, handler)
1326}
1327
1328// handlersForTargetLuminance returns the handlers registered for target_luminance, taken
1329// under the lock so a handler may register another handler while events are
1330// being dispatched.
1331func (o *WpImageDescriptionInfo) handlersForTargetLuminance() []func(minLum uint32, maxLum uint32) {
1332 o.handlersMu.Lock()
1333 defer o.handlersMu.Unlock()
1334 return o.onTargetLuminance
1335}
1336
1337// OnTargetMaxCll registers a handler for the target_max_cll event.
1338//
1339// Handlers are appended, so a second call adds another handler rather than
1340// replacing the first. Registration is safe while another goroutine dispatches.
1341func (o *WpImageDescriptionInfo) OnTargetMaxCll(handler func(maxCll uint32)) {
1342 if handler == nil {
1343 return
1344 }
1345 o.handlersMu.Lock()
1346 defer o.handlersMu.Unlock()
1347 o.onTargetMaxCll = append(o.onTargetMaxCll, handler)
1348}
1349
1350// handlersForTargetMaxCll returns the handlers registered for target_max_cll, taken
1351// under the lock so a handler may register another handler while events are
1352// being dispatched.
1353func (o *WpImageDescriptionInfo) handlersForTargetMaxCll() []func(maxCll uint32) {
1354 o.handlersMu.Lock()
1355 defer o.handlersMu.Unlock()
1356 return o.onTargetMaxCll
1357}
1358
1359// OnTargetMaxFall registers a handler for the target_max_fall event.
1360//
1361// Handlers are appended, so a second call adds another handler rather than
1362// replacing the first. Registration is safe while another goroutine dispatches.
1363func (o *WpImageDescriptionInfo) OnTargetMaxFall(handler func(maxFall uint32)) {
1364 if handler == nil {
1365 return
1366 }
1367 o.handlersMu.Lock()
1368 defer o.handlersMu.Unlock()
1369 o.onTargetMaxFall = append(o.onTargetMaxFall, handler)
1370}
1371
1372// handlersForTargetMaxFall returns the handlers registered for target_max_fall, taken
1373// under the lock so a handler may register another handler while events are
1374// being dispatched.
1375func (o *WpImageDescriptionInfo) handlersForTargetMaxFall() []func(maxFall uint32) {
1376 o.handlersMu.Lock()
1377 defer o.handlersMu.Unlock()
1378 return o.onTargetMaxFall
1379}
1380
1381// EventSignature returns the declared event argument types in wire order.
1382func (o *WpImageDescriptionInfo) EventSignature(opcode uint16) (string, bool) {
1383 switch opcode {
1384 case 0:
1385 return "", true
1386 case 1:
1387 return "fd,uint,", true
1388 case 2:
1389 return "int,int,int,int,int,int,int,int,", true
1390 case 3:
1391 return "uint,", true
1392 case 4:
1393 return "uint,", true
1394 case 5:
1395 return "uint,", true
1396 case 6:
1397 return "uint,uint,uint,", true
1398 case 7:
1399 return "int,int,int,int,int,int,int,int,", true
1400 case 8:
1401 return "uint,uint,", true
1402 case 9:
1403 return "uint,", true
1404 case 10:
1405 return "uint,", true
1406 default:
1407 return "", false
1408 }
1409}
1410
1411// Dispatch decodes one event on wp_image_description_info_v1 and calls the registered handlers.
1412func (o *WpImageDescriptionInfo) Dispatch(event *wl.Event) {
1413 switch event.Opcode {
1414 case 0: // done
1415
1416 for i, handler := range o.handlersForDone() {
1417 _ = i
1418 handler()
1419 }
1420 o.Context().Unregister(o)
1421 case 1: // icc_file
1422 icc := event.FD()
1423 iccSize := event.Uint32()
1424 ownedicc := icc
1425 defer ownedicc.Close()
1426
1427 for i, handler := range o.handlersForIccFile() {
1428 if i > 0 {
1429 icc = nil
1430 }
1431 handler(icc, iccSize)
1432 }
1433 case 2: // primaries
1434 rX := event.Int32()
1435 rY := event.Int32()
1436 gX := event.Int32()
1437 gY := event.Int32()
1438 bX := event.Int32()
1439 bY := event.Int32()
1440 wX := event.Int32()
1441 wY := event.Int32()
1442
1443 for i, handler := range o.handlersForPrimaries() {
1444 _ = i
1445 handler(rX, rY, gX, gY, bX, bY, wX, wY)
1446 }
1447 case 3: // primaries_named
1448 primaries := event.Uint32()
1449
1450 for i, handler := range o.handlersForPrimariesNamed() {
1451 _ = i
1452 handler(primaries)
1453 }
1454 case 4: // tf_power
1455 eexp := event.Uint32()
1456
1457 for i, handler := range o.handlersForTfPower() {
1458 _ = i
1459 handler(eexp)
1460 }
1461 case 5: // tf_named
1462 tf := event.Uint32()
1463
1464 for i, handler := range o.handlersForTfNamed() {
1465 _ = i
1466 handler(tf)
1467 }
1468 case 6: // luminances
1469 minLum := event.Uint32()
1470 maxLum := event.Uint32()
1471 referenceLum := event.Uint32()
1472
1473 for i, handler := range o.handlersForLuminances() {
1474 _ = i
1475 handler(minLum, maxLum, referenceLum)
1476 }
1477 case 7: // target_primaries
1478 rX := event.Int32()
1479 rY := event.Int32()
1480 gX := event.Int32()
1481 gY := event.Int32()
1482 bX := event.Int32()
1483 bY := event.Int32()
1484 wX := event.Int32()
1485 wY := event.Int32()
1486
1487 for i, handler := range o.handlersForTargetPrimaries() {
1488 _ = i
1489 handler(rX, rY, gX, gY, bX, bY, wX, wY)
1490 }
1491 case 8: // target_luminance
1492 minLum := event.Uint32()
1493 maxLum := event.Uint32()
1494
1495 for i, handler := range o.handlersForTargetLuminance() {
1496 _ = i
1497 handler(minLum, maxLum)
1498 }
1499 case 9: // target_max_cll
1500 maxCll := event.Uint32()
1501
1502 for i, handler := range o.handlersForTargetMaxCll() {
1503 _ = i
1504 handler(maxCll)
1505 }
1506 case 10: // target_max_fall
1507 maxFall := event.Uint32()
1508
1509 for i, handler := range o.handlersForTargetMaxFall() {
1510 _ = i
1511 handler(maxFall)
1512 }
1513 default:
1514 }
1515}
1516
1517// WpImageDescriptionReferenceInterface is the protocol interface name.
1518const WpImageDescriptionReferenceInterface = "wp_image_description_reference_v1"
1519
1520// WpImageDescriptionReference is the generated binding for wp_image_description_reference_v1 version 1.
1521type WpImageDescriptionReference struct {
1522 wl.BaseProxy
1523}
1524
1525// NewWpImageDescriptionReference returns an unbound WpImageDescriptionReference.
1526func NewWpImageDescriptionReference(ctx *wl.Context) *WpImageDescriptionReference {
1527 obj := &WpImageDescriptionReference{}
1528 obj.SetContext(ctx)
1529 ctx.Register(obj)
1530 return obj
1531}
1532
1533// Destroy this object. This has no effect on the referenced image description.
1534func (o *WpImageDescriptionReference) Destroy() error {
1535 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_image_description_reference_v1.destroy", Destructor: true}); err != nil {
1536 return err
1537 }
1538 return nil
1539}
1540
1541// EventSignature returns the declared event argument types in wire order.
1542func (o *WpImageDescriptionReference) EventSignature(opcode uint16) (string, bool) {
1543 switch opcode {
1544 default:
1545 return "", false
1546 }
1547}
1548
1549// Dispatch decodes one event on wp_image_description_reference_v1 and calls the registered handlers.
1550func (o *WpImageDescriptionReference) Dispatch(event *wl.Event) {
1551 switch event.Opcode {
1552 default:
1553 }
1554}