1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: content_type_v1
3// Source: content-type-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2021 Emmanuel Gil Peyrot
7// Copyright © 2022 Xaver Hugl
8//
9// Permission is hereby granted, free of charge, to any person obtaining a
10// copy of this software and associated documentation files (the "Software"),
11// to deal in the Software without restriction, including without limitation
12// the rights to use, copy, modify, merge, publish, distribute, sublicense,
13// and/or sell copies of the Software, and to permit persons to whom the
14// Software is furnished to do so, subject to the following conditions:
15//
16// The above copyright notice and this permission notice (including the next
17// paragraph) shall be included in all copies or substantial portions of the
18// Software.
19//
20// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26// DEALINGS IN THE SOFTWARE.
27
28package contenttype
29
30import (
31 cross_wl_surface "github.com/bnema/go-wayland-bindings/client/wayland"
32 "github.com/bnema/wlturbo/wl"
33)
34
35// ERROR_ALREADY_CONSTRUCTED is the error already_constructed value.
36const ERROR_ALREADY_CONSTRUCTED = 0
37
38// TYPE_NONE is the type none value.
39const TYPE_NONE = 0
40
41// TYPE_PHOTO is the type photo value.
42const TYPE_PHOTO = 1
43
44// TYPE_VIDEO is the type video value.
45const TYPE_VIDEO = 2
46
47// TYPE_GAME is the type game value.
48const TYPE_GAME = 3
49
50// WpContentTypeManagerInterface is the protocol interface name.
51const WpContentTypeManagerInterface = "wp_content_type_manager_v1"
52
53// WpContentTypeManager is the generated binding for wp_content_type_manager_v1 version 1.
54type WpContentTypeManager struct {
55 wl.BaseProxy
56}
57
58// NewWpContentTypeManager returns an unbound WpContentTypeManager.
59func NewWpContentTypeManager(ctx *wl.Context) *WpContentTypeManager {
60 obj := &WpContentTypeManager{}
61 obj.SetContext(ctx)
62 ctx.Register(obj)
63 return obj
64}
65
66// Destroy the content type manager. This doesn't destroy objects created with the manager.
67func (o *WpContentTypeManager) Destroy() error {
68 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_content_type_manager_v1.destroy", Destructor: true}); err != nil {
69 return err
70 }
71 return nil
72}
73
74// Create a new content type object associated with the given surface. Creating a wp_content_type_v1 from a wl_surface which already has one attached is a client error: already_constructed.
75func (o *WpContentTypeManager) GetSurfaceContentType(surface *cross_wl_surface.Surface) (*WpContentType, error) {
76 var arg1 wl.Object
77 if surface != nil {
78 arg1 = surface
79 }
80 child := &WpContentType{}
81 child.SetContext(o.Context())
82 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_content_type_manager_v1.get_surface_content_type", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
83 return nil, err
84 }
85 return child, nil
86}
87
88// EventSignature returns the declared event argument types in wire order.
89func (o *WpContentTypeManager) EventSignature(opcode uint16) (string, bool) {
90 switch opcode {
91 default:
92 return "", false
93 }
94}
95
96// Dispatch decodes one event on wp_content_type_manager_v1 and calls the registered handlers.
97func (o *WpContentTypeManager) Dispatch(event *wl.Event) {
98 switch event.Opcode {
99 default:
100 }
101}
102
103// WpContentTypeInterface is the protocol interface name.
104const WpContentTypeInterface = "wp_content_type_v1"
105
106// WpContentType is the generated binding for wp_content_type_v1 version 1.
107type WpContentType struct {
108 wl.BaseProxy
109}
110
111// NewWpContentType returns an unbound WpContentType.
112func NewWpContentType(ctx *wl.Context) *WpContentType {
113 obj := &WpContentType{}
114 obj.SetContext(ctx)
115 ctx.Register(obj)
116 return obj
117}
118
119// Switch back to not specifying the content type of this surface. This is equivalent to setting the content type to none, including double buffering semantics. See set_content_type for details.
120func (o *WpContentType) Destroy() error {
121 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_content_type_v1.destroy", Destructor: true}); err != nil {
122 return err
123 }
124 return nil
125}
126
127// Set the surface content type. This informs the compositor that the client believes it is displaying buffers matching this content type. This is purely a hint for the compositor, which can be used to adjust its behavior or hardware settings to fit the presented content best. The content type is double-buffered state, see wl_surface.commit for details.
128func (o *WpContentType) SetContentType(contentType uint32) error {
129 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_content_type_v1.set_content_type"}, wl.ArgUint(contentType)); err != nil {
130 return err
131 }
132 return nil
133}
134
135// EventSignature returns the declared event argument types in wire order.
136func (o *WpContentType) EventSignature(opcode uint16) (string, bool) {
137 switch opcode {
138 default:
139 return "", false
140 }
141}
142
143// Dispatch decodes one event on wp_content_type_v1 and calls the registered handlers.
144func (o *WpContentType) Dispatch(event *wl.Event) {
145 switch event.Opcode {
146 default:
147 }
148}