1// Code generated by wlturbo-scanner. DO NOT EDIT.
2// Protocol: tearing_control_v1
3// Source: tearing-control-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2021 Xaver Hugl
7//
8// Permission is hereby granted, free of charge, to any person obtaining a
9// copy of this software and associated documentation files (the "Software"),
10// to deal in the Software without restriction, including without limitation
11// the rights to use, copy, modify, merge, publish, distribute, sublicense,
12// and/or sell copies of the Software, and to permit persons to whom the
13// Software is furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice (including the next
16// paragraph) shall be included in all copies or substantial portions of the
17// Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25// DEALINGS IN THE SOFTWARE.
26
27package tearingcontrol
28
29import (
30 cross_wl_surface "github.com/bnema/wlturbo/protocol/core"
31 "github.com/bnema/wlturbo/wl"
32)
33
34// ERROR_TEARING_CONTROL_EXISTS is the error tearing_control_exists value.
35const ERROR_TEARING_CONTROL_EXISTS = 0
36
37// PRESENTATION_HINT_VSYNC is the presentation_hint vsync value.
38const PRESENTATION_HINT_VSYNC = 0
39
40// PRESENTATION_HINT_ASYNC is the presentation_hint async value.
41const PRESENTATION_HINT_ASYNC = 1
42
43// WpTearingControlManagerInterface is the protocol interface name.
44const WpTearingControlManagerInterface = "wp_tearing_control_manager_v1"
45
46// WpTearingControlManager is the generated binding for wp_tearing_control_manager_v1 version 1.
47type WpTearingControlManager struct {
48 wl.BaseProxy
49}
50
51// NewWpTearingControlManager returns an unbound WpTearingControlManager.
52func NewWpTearingControlManager(ctx *wl.Context) *WpTearingControlManager {
53 obj := &WpTearingControlManager{}
54 obj.SetContext(ctx)
55 ctx.Register(obj)
56 return obj
57}
58
59// Destroy this tearing control factory object. Other objects, including wp_tearing_control_v1 objects created by this factory, are not affected by this request.
60func (o *WpTearingControlManager) Destroy() error {
61 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_tearing_control_manager_v1.destroy", Destructor: true}); err != nil {
62 return err
63 }
64 return nil
65}
66
67// Instantiate an interface extension for the given wl_surface to request asynchronous page flips for presentation. If the given wl_surface already has a wp_tearing_control_v1 object associated, the tearing_control_exists protocol error is raised.
68func (o *WpTearingControlManager) GetTearingControl(surface *cross_wl_surface.Surface) (*WpTearingControl, error) {
69 var arg1 wl.Object
70 if surface != nil {
71 arg1 = surface
72 }
73 child := &WpTearingControl{}
74 child.SetContext(o.Context())
75 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_tearing_control_manager_v1.get_tearing_control", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
76 return nil, err
77 }
78 return child, nil
79}
80
81// EventSignature returns the declared event argument types in wire order.
82func (o *WpTearingControlManager) EventSignature(opcode uint16) (string, bool) {
83 switch opcode {
84 default:
85 return "", false
86 }
87}
88
89// Dispatch decodes one event on wp_tearing_control_manager_v1 and calls the registered handlers.
90func (o *WpTearingControlManager) Dispatch(event *wl.Event) {
91 switch event.Opcode {
92 default:
93 }
94}
95
96// WpTearingControlInterface is the protocol interface name.
97const WpTearingControlInterface = "wp_tearing_control_v1"
98
99// WpTearingControl is the generated binding for wp_tearing_control_v1 version 1.
100type WpTearingControl struct {
101 wl.BaseProxy
102}
103
104// NewWpTearingControl returns an unbound WpTearingControl.
105func NewWpTearingControl(ctx *wl.Context) *WpTearingControl {
106 obj := &WpTearingControl{}
107 obj.SetContext(ctx)
108 ctx.Register(obj)
109 return obj
110}
111
112// Set the presentation hint for the associated wl_surface. This state is double-buffered, see wl_surface.commit. The compositor is free to dynamically respect or ignore this hint based on various conditions like hardware capabilities, surface state and user preferences.
113func (o *WpTearingControl) SetPresentationHint(hint uint32) error {
114 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_tearing_control_v1.set_presentation_hint"}, wl.ArgUint(hint)); err != nil {
115 return err
116 }
117 return nil
118}
119
120// Destroy this surface tearing object and revert the presentation hint to vsync. The change will be applied on the next wl_surface.commit.
121func (o *WpTearingControl) Destroy() error {
122 if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_tearing_control_v1.destroy", Destructor: true}); err != nil {
123 return err
124 }
125 return nil
126}
127
128// EventSignature returns the declared event argument types in wire order.
129func (o *WpTearingControl) EventSignature(opcode uint16) (string, bool) {
130 switch opcode {
131 default:
132 return "", false
133 }
134}
135
136// Dispatch decodes one event on wp_tearing_control_v1 and calls the registered handlers.
137func (o *WpTearingControl) Dispatch(event *wl.Event) {
138 switch event.Opcode {
139 default:
140 }
141}