detached 1a6c6c9

presentationtime_generated.go RawHistoryFolder

1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: presentation_time
3// Source: presentation-time.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2013-2014 Collabora, Ltd.
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 presentationtime
28
29import (
30	"sync"
31
32	cross_wl_surface "github.com/bnema/go-wayland-bindings/client/wayland"
33	"github.com/bnema/wlturbo/wl"
34)
35
36// ERROR_INVALID_TIMESTAMP is the error invalid_timestamp value.
37const ERROR_INVALID_TIMESTAMP = 0
38
39// ERROR_INVALID_FLAG is the error invalid_flag value.
40const ERROR_INVALID_FLAG = 1
41
42// KIND_VSYNC is the kind vsync value.
43const KIND_VSYNC = 0x1
44
45// KIND_HW_CLOCK is the kind hw_clock value.
46const KIND_HW_CLOCK = 0x2
47
48// KIND_HW_COMPLETION is the kind hw_completion value.
49const KIND_HW_COMPLETION = 0x4
50
51// KIND_ZERO_COPY is the kind zero_copy value.
52const KIND_ZERO_COPY = 0x8
53
54// WpPresentationInterface is the protocol interface name.
55const WpPresentationInterface = "wp_presentation"
56
57// WpPresentation is the generated binding for wp_presentation version 2.
58type WpPresentation struct {
59	wl.BaseProxy
60	// handlersMu guards the handler slices: a client may register or replace
61	// handlers while another goroutine dispatches events.
62	handlersMu sync.Mutex
63	onClockId  []func(clkId uint32)
64}
65
66// NewWpPresentation returns an unbound WpPresentation.
67func NewWpPresentation(ctx *wl.Context) *WpPresentation {
68	obj := &WpPresentation{}
69	obj.SetContext(ctx)
70	ctx.Register(obj)
71	return obj
72}
73
74// Informs the server that the client will no longer be using this protocol object. Existing objects created by this object are not affected.
75func (o *WpPresentation) Destroy() error {
76	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "wp_presentation.destroy", Destructor: true}); err != nil {
77		return err
78	}
79	return nil
80}
81
82// Request presentation feedback for the current content submission on the given surface. This creates a new presentation_feedback object, which will deliver the feedback information once. If multiple presentation_feedback objects are created for the same submission, they will all deliver the same information. For details on what information is returned, see the presentation_feedback interface.
83func (o *WpPresentation) Feedback(surface *cross_wl_surface.Surface) (*WpPresentationFeedback, error) {
84	var arg0 wl.Object
85	if surface != nil {
86		arg0 = surface
87	}
88	child := &WpPresentationFeedback{}
89	child.SetContext(o.Context())
90	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "wp_presentation.feedback", Child: child}, wl.ArgObject(arg0), wl.ArgObject(child)); err != nil {
91		return nil, err
92	}
93	return child, nil
94}
95
96// OnClockId registers a handler for the clock_id event.
97//
98// Handlers are appended, so a second call adds another handler rather than
99// replacing the first. Registration is safe while another goroutine dispatches.
100func (o *WpPresentation) OnClockId(handler func(clkId uint32)) {
101	if handler == nil {
102		return
103	}
104	o.handlersMu.Lock()
105	defer o.handlersMu.Unlock()
106	o.onClockId = append(o.onClockId, handler)
107}
108
109// handlersForClockId returns the handlers registered for clock_id, taken
110// under the lock so a handler may register another handler while events are
111// being dispatched.
112func (o *WpPresentation) handlersForClockId() []func(clkId uint32) {
113	o.handlersMu.Lock()
114	defer o.handlersMu.Unlock()
115	return o.onClockId
116}
117
118// EventSignature returns the declared event argument types in wire order.
119func (o *WpPresentation) EventSignature(opcode uint16) (string, bool) {
120	switch opcode {
121	case 0:
122		return "uint,", true
123	default:
124		return "", false
125	}
126}
127
128// Dispatch decodes one event on wp_presentation and calls the registered handlers.
129func (o *WpPresentation) Dispatch(event *wl.Event) {
130	switch event.Opcode {
131	case 0: // clock_id
132		clkId := event.Uint32()
133
134		for i, handler := range o.handlersForClockId() {
135			_ = i
136			handler(clkId)
137		}
138	default:
139	}
140}
141
142// WpPresentationFeedbackInterface is the protocol interface name.
143const WpPresentationFeedbackInterface = "wp_presentation_feedback"
144
145// WpPresentationFeedback is the generated binding for wp_presentation_feedback version 2.
146type WpPresentationFeedback struct {
147	wl.BaseProxy
148	// handlersMu guards the handler slices: a client may register or replace
149	// handlers while another goroutine dispatches events.
150	handlersMu   sync.Mutex
151	onSyncOutput []func(outputID uint32)
152	onPresented  []func(tvSecHi uint32, tvSecLo uint32, tvNsec uint32, refresh uint32, seqHi uint32, seqLo uint32, flags uint32)
153	onDiscarded  []func()
154}
155
156// NewWpPresentationFeedback returns an unbound WpPresentationFeedback.
157func NewWpPresentationFeedback(ctx *wl.Context) *WpPresentationFeedback {
158	obj := &WpPresentationFeedback{}
159	obj.SetContext(ctx)
160	ctx.Register(obj)
161	return obj
162}
163
164// OnSyncOutput registers a handler for the sync_output event.
165//
166// Handlers are appended, so a second call adds another handler rather than
167// replacing the first. Registration is safe while another goroutine dispatches.
168func (o *WpPresentationFeedback) OnSyncOutput(handler func(outputID uint32)) {
169	if handler == nil {
170		return
171	}
172	o.handlersMu.Lock()
173	defer o.handlersMu.Unlock()
174	o.onSyncOutput = append(o.onSyncOutput, handler)
175}
176
177// handlersForSyncOutput returns the handlers registered for sync_output, taken
178// under the lock so a handler may register another handler while events are
179// being dispatched.
180func (o *WpPresentationFeedback) handlersForSyncOutput() []func(outputID uint32) {
181	o.handlersMu.Lock()
182	defer o.handlersMu.Unlock()
183	return o.onSyncOutput
184}
185
186// OnPresented registers a handler for the presented event.
187//
188// Handlers are appended, so a second call adds another handler rather than
189// replacing the first. Registration is safe while another goroutine dispatches.
190func (o *WpPresentationFeedback) OnPresented(handler func(tvSecHi uint32, tvSecLo uint32, tvNsec uint32, refresh uint32, seqHi uint32, seqLo uint32, flags uint32)) {
191	if handler == nil {
192		return
193	}
194	o.handlersMu.Lock()
195	defer o.handlersMu.Unlock()
196	o.onPresented = append(o.onPresented, handler)
197}
198
199// handlersForPresented returns the handlers registered for presented, taken
200// under the lock so a handler may register another handler while events are
201// being dispatched.
202func (o *WpPresentationFeedback) handlersForPresented() []func(tvSecHi uint32, tvSecLo uint32, tvNsec uint32, refresh uint32, seqHi uint32, seqLo uint32, flags uint32) {
203	o.handlersMu.Lock()
204	defer o.handlersMu.Unlock()
205	return o.onPresented
206}
207
208// OnDiscarded registers a handler for the discarded event.
209//
210// Handlers are appended, so a second call adds another handler rather than
211// replacing the first. Registration is safe while another goroutine dispatches.
212func (o *WpPresentationFeedback) OnDiscarded(handler func()) {
213	if handler == nil {
214		return
215	}
216	o.handlersMu.Lock()
217	defer o.handlersMu.Unlock()
218	o.onDiscarded = append(o.onDiscarded, handler)
219}
220
221// handlersForDiscarded returns the handlers registered for discarded, taken
222// under the lock so a handler may register another handler while events are
223// being dispatched.
224func (o *WpPresentationFeedback) handlersForDiscarded() []func() {
225	o.handlersMu.Lock()
226	defer o.handlersMu.Unlock()
227	return o.onDiscarded
228}
229
230// EventSignature returns the declared event argument types in wire order.
231func (o *WpPresentationFeedback) EventSignature(opcode uint16) (string, bool) {
232	switch opcode {
233	case 0:
234		return "object,", true
235	case 1:
236		return "uint,uint,uint,uint,uint,uint,uint,", true
237	case 2:
238		return "", true
239	default:
240		return "", false
241	}
242}
243
244// Dispatch decodes one event on wp_presentation_feedback and calls the registered handlers.
245func (o *WpPresentationFeedback) Dispatch(event *wl.Event) {
246	switch event.Opcode {
247	case 0: // sync_output
248		outputID := event.Uint32()
249
250		for i, handler := range o.handlersForSyncOutput() {
251			_ = i
252			handler(outputID)
253		}
254	case 1: // presented
255		tvSecHi := event.Uint32()
256		tvSecLo := event.Uint32()
257		tvNsec := event.Uint32()
258		refresh := event.Uint32()
259		seqHi := event.Uint32()
260		seqLo := event.Uint32()
261		flags := event.Uint32()
262
263		for i, handler := range o.handlersForPresented() {
264			_ = i
265			handler(tvSecHi, tvSecLo, tvNsec, refresh, seqHi, seqLo, flags)
266		}
267		o.Context().Unregister(o)
268	case 2: // discarded
269
270		for i, handler := range o.handlersForDiscarded() {
271			_ = i
272			handler()
273		}
274		o.Context().Unregister(o)
275	default:
276	}
277}

Keyboard shortcuts

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

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

Branches 1

Tags 1

↑↓ moveenter openesc close