v0.4.0 9c230c3

wlr-screencopy-unstable-v1_generated.go RawHistoryFolder

1// Code generated by wlturbo-scanner. DO NOT EDIT.
2// Protocol: wlr_screencopy_unstable_v1
3// Source: wlr-screencopy-unstable-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2018 Simon Ser
7// Copyright © 2019 Andri Yngvason
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 screencopy
29
30import (
31	"sync"
32
33	cross_wl_buffer "github.com/bnema/wlturbo/protocol/core"
34	cross_wl_output "github.com/bnema/wlturbo/protocol/core"
35	"github.com/bnema/wlturbo/wl"
36)
37
38// ERROR_ALREADY_USED is the error already_used value.
39const ERROR_ALREADY_USED = 0
40
41// ERROR_INVALID_BUFFER is the error invalid_buffer value.
42const ERROR_INVALID_BUFFER = 1
43
44// FLAGS_Y_INVERT is the flags y_invert value.
45const FLAGS_Y_INVERT = 1
46
47// ScreencopyManagerInterface is the protocol interface name.
48const ScreencopyManagerInterface = "zwlr_screencopy_manager_v1"
49
50// ScreencopyManager is the generated binding for zwlr_screencopy_manager_v1 version 3.
51type ScreencopyManager struct {
52	wl.BaseProxy
53}
54
55// NewScreencopyManager returns an unbound ScreencopyManager.
56func NewScreencopyManager(ctx *wl.Context) *ScreencopyManager {
57	obj := &ScreencopyManager{}
58	obj.SetContext(ctx)
59	ctx.Register(obj)
60	return obj
61}
62
63// Capture the next frame of an entire output.
64func (o *ScreencopyManager) CaptureOutput(overlayCursor int32, output *cross_wl_output.Output) (*ScreencopyFrame, error) {
65	var arg2 wl.Object
66	if output != nil {
67		arg2 = output
68	}
69	child := &ScreencopyFrame{}
70	child.SetContext(o.Context())
71	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwlr_screencopy_manager_v1.capture_output", Child: child}, wl.ArgObject(child), wl.ArgInt(overlayCursor), wl.ArgObject(arg2)); err != nil {
72		return nil, err
73	}
74	return child, nil
75}
76
77// Capture the next frame of an output's region. The region is given in output logical coordinates, see xdg_output.logical_size. The region will be clipped to the output's extents.
78func (o *ScreencopyManager) CaptureOutputRegion(overlayCursor int32, output *cross_wl_output.Output, x int32, y int32, width int32, height int32) (*ScreencopyFrame, error) {
79	var arg2 wl.Object
80	if output != nil {
81		arg2 = output
82	}
83	child := &ScreencopyFrame{}
84	child.SetContext(o.Context())
85	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwlr_screencopy_manager_v1.capture_output_region", Child: child}, wl.ArgObject(child), wl.ArgInt(overlayCursor), wl.ArgObject(arg2), wl.ArgInt(x), wl.ArgInt(y), wl.ArgInt(width), wl.ArgInt(height)); err != nil {
86		return nil, err
87	}
88	return child, nil
89}
90
91// All objects created by the manager will still remain valid, until their appropriate destroy request has been called.
92func (o *ScreencopyManager) Destroy() error {
93	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwlr_screencopy_manager_v1.destroy", Destructor: true}); err != nil {
94		return err
95	}
96	return nil
97}
98
99// EventSignature returns the declared event argument types in wire order.
100func (o *ScreencopyManager) EventSignature(opcode uint16) (string, bool) {
101	switch opcode {
102	default:
103		return "", false
104	}
105}
106
107// Dispatch decodes one event on zwlr_screencopy_manager_v1 and calls the registered handlers.
108func (o *ScreencopyManager) Dispatch(event *wl.Event) {
109	switch event.Opcode {
110	default:
111	}
112}
113
114// ScreencopyFrameInterface is the protocol interface name.
115const ScreencopyFrameInterface = "zwlr_screencopy_frame_v1"
116
117// ScreencopyFrame is the generated binding for zwlr_screencopy_frame_v1 version 3.
118type ScreencopyFrame struct {
119	wl.BaseProxy
120	// handlersMu guards the handler slices: a client may register or replace
121	// handlers while another goroutine dispatches events.
122	handlersMu    sync.Mutex
123	onBuffer      []func(format uint32, width uint32, height uint32, stride uint32)
124	onFlags       []func(flags uint32)
125	onReady       []func(tvSecHi uint32, tvSecLo uint32, tvNsec uint32)
126	onFailed      []func()
127	onDamage      []func(x uint32, y uint32, width uint32, height uint32)
128	onLinuxDmabuf []func(format uint32, width uint32, height uint32)
129	onBufferDone  []func()
130}
131
132// NewScreencopyFrame returns an unbound ScreencopyFrame.
133func NewScreencopyFrame(ctx *wl.Context) *ScreencopyFrame {
134	obj := &ScreencopyFrame{}
135	obj.SetContext(ctx)
136	ctx.Register(obj)
137	return obj
138}
139
140// Copy the frame to the supplied buffer. The buffer must have the correct size, see zwlr_screencopy_frame_v1.buffer and zwlr_screencopy_frame_v1.linux_dmabuf. The buffer needs to have a supported format. If the frame is successfully copied, "flags" and "ready" events are sent. Otherwise, a "failed" event is sent.
141func (o *ScreencopyFrame) Copy(buffer *cross_wl_buffer.Buffer) error {
142	var arg0 wl.Object
143	if buffer != nil {
144		arg0 = buffer
145	}
146	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwlr_screencopy_frame_v1.copy"}, wl.ArgObject(arg0)); err != nil {
147		return err
148	}
149	return nil
150}
151
152// Destroys the frame. This request can be sent at any time by the client.
153func (o *ScreencopyFrame) Destroy() error {
154	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwlr_screencopy_frame_v1.destroy", Destructor: true}); err != nil {
155		return err
156	}
157	return nil
158}
159
160// Same as copy, except it waits until there is damage to copy.
161func (o *ScreencopyFrame) CopyWithDamage(buffer *cross_wl_buffer.Buffer) error {
162	var arg0 wl.Object
163	if buffer != nil {
164		arg0 = buffer
165	}
166	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwlr_screencopy_frame_v1.copy_with_damage", Since: 2}, wl.ArgObject(arg0)); err != nil {
167		return err
168	}
169	return nil
170}
171
172// OnBuffer registers a handler for the buffer event.
173//
174// Handlers are appended, so a second call adds another handler rather than
175// replacing the first. Registration is safe while another goroutine dispatches.
176func (o *ScreencopyFrame) OnBuffer(handler func(format uint32, width uint32, height uint32, stride uint32)) {
177	if handler == nil {
178		return
179	}
180	o.handlersMu.Lock()
181	defer o.handlersMu.Unlock()
182	o.onBuffer = append(o.onBuffer, handler)
183}
184
185// handlersForBuffer returns the handlers registered for buffer, taken
186// under the lock so a handler may register another handler while events are
187// being dispatched.
188func (o *ScreencopyFrame) handlersForBuffer() []func(format uint32, width uint32, height uint32, stride uint32) {
189	o.handlersMu.Lock()
190	defer o.handlersMu.Unlock()
191	return o.onBuffer
192}
193
194// OnFlags registers a handler for the flags event.
195//
196// Handlers are appended, so a second call adds another handler rather than
197// replacing the first. Registration is safe while another goroutine dispatches.
198func (o *ScreencopyFrame) OnFlags(handler func(flags uint32)) {
199	if handler == nil {
200		return
201	}
202	o.handlersMu.Lock()
203	defer o.handlersMu.Unlock()
204	o.onFlags = append(o.onFlags, handler)
205}
206
207// handlersForFlags returns the handlers registered for flags, taken
208// under the lock so a handler may register another handler while events are
209// being dispatched.
210func (o *ScreencopyFrame) handlersForFlags() []func(flags uint32) {
211	o.handlersMu.Lock()
212	defer o.handlersMu.Unlock()
213	return o.onFlags
214}
215
216// OnReady registers a handler for the ready event.
217//
218// Handlers are appended, so a second call adds another handler rather than
219// replacing the first. Registration is safe while another goroutine dispatches.
220func (o *ScreencopyFrame) OnReady(handler func(tvSecHi uint32, tvSecLo uint32, tvNsec uint32)) {
221	if handler == nil {
222		return
223	}
224	o.handlersMu.Lock()
225	defer o.handlersMu.Unlock()
226	o.onReady = append(o.onReady, handler)
227}
228
229// handlersForReady returns the handlers registered for ready, taken
230// under the lock so a handler may register another handler while events are
231// being dispatched.
232func (o *ScreencopyFrame) handlersForReady() []func(tvSecHi uint32, tvSecLo uint32, tvNsec uint32) {
233	o.handlersMu.Lock()
234	defer o.handlersMu.Unlock()
235	return o.onReady
236}
237
238// OnFailed registers a handler for the failed event.
239//
240// Handlers are appended, so a second call adds another handler rather than
241// replacing the first. Registration is safe while another goroutine dispatches.
242func (o *ScreencopyFrame) OnFailed(handler func()) {
243	if handler == nil {
244		return
245	}
246	o.handlersMu.Lock()
247	defer o.handlersMu.Unlock()
248	o.onFailed = append(o.onFailed, handler)
249}
250
251// handlersForFailed returns the handlers registered for failed, taken
252// under the lock so a handler may register another handler while events are
253// being dispatched.
254func (o *ScreencopyFrame) handlersForFailed() []func() {
255	o.handlersMu.Lock()
256	defer o.handlersMu.Unlock()
257	return o.onFailed
258}
259
260// OnDamage registers a handler for the damage event.
261//
262// Handlers are appended, so a second call adds another handler rather than
263// replacing the first. Registration is safe while another goroutine dispatches.
264func (o *ScreencopyFrame) OnDamage(handler func(x uint32, y uint32, width uint32, height uint32)) {
265	if handler == nil {
266		return
267	}
268	o.handlersMu.Lock()
269	defer o.handlersMu.Unlock()
270	o.onDamage = append(o.onDamage, handler)
271}
272
273// handlersForDamage returns the handlers registered for damage, taken
274// under the lock so a handler may register another handler while events are
275// being dispatched.
276func (o *ScreencopyFrame) handlersForDamage() []func(x uint32, y uint32, width uint32, height uint32) {
277	o.handlersMu.Lock()
278	defer o.handlersMu.Unlock()
279	return o.onDamage
280}
281
282// OnLinuxDmabuf registers a handler for the linux_dmabuf event.
283//
284// Handlers are appended, so a second call adds another handler rather than
285// replacing the first. Registration is safe while another goroutine dispatches.
286func (o *ScreencopyFrame) OnLinuxDmabuf(handler func(format uint32, width uint32, height uint32)) {
287	if handler == nil {
288		return
289	}
290	o.handlersMu.Lock()
291	defer o.handlersMu.Unlock()
292	o.onLinuxDmabuf = append(o.onLinuxDmabuf, handler)
293}
294
295// handlersForLinuxDmabuf returns the handlers registered for linux_dmabuf, taken
296// under the lock so a handler may register another handler while events are
297// being dispatched.
298func (o *ScreencopyFrame) handlersForLinuxDmabuf() []func(format uint32, width uint32, height uint32) {
299	o.handlersMu.Lock()
300	defer o.handlersMu.Unlock()
301	return o.onLinuxDmabuf
302}
303
304// OnBufferDone registers a handler for the buffer_done event.
305//
306// Handlers are appended, so a second call adds another handler rather than
307// replacing the first. Registration is safe while another goroutine dispatches.
308func (o *ScreencopyFrame) OnBufferDone(handler func()) {
309	if handler == nil {
310		return
311	}
312	o.handlersMu.Lock()
313	defer o.handlersMu.Unlock()
314	o.onBufferDone = append(o.onBufferDone, handler)
315}
316
317// handlersForBufferDone returns the handlers registered for buffer_done, taken
318// under the lock so a handler may register another handler while events are
319// being dispatched.
320func (o *ScreencopyFrame) handlersForBufferDone() []func() {
321	o.handlersMu.Lock()
322	defer o.handlersMu.Unlock()
323	return o.onBufferDone
324}
325
326// EventSignature returns the declared event argument types in wire order.
327func (o *ScreencopyFrame) EventSignature(opcode uint16) (string, bool) {
328	switch opcode {
329	case 0:
330		return "uint,uint,uint,uint,", true
331	case 1:
332		return "uint,", true
333	case 2:
334		return "uint,uint,uint,", true
335	case 3:
336		return "", true
337	case 4:
338		return "uint,uint,uint,uint,", true
339	case 5:
340		return "uint,uint,uint,", true
341	case 6:
342		return "", true
343	default:
344		return "", false
345	}
346}
347
348// Dispatch decodes one event on zwlr_screencopy_frame_v1 and calls the registered handlers.
349func (o *ScreencopyFrame) Dispatch(event *wl.Event) {
350	switch event.Opcode {
351	case 0: // buffer
352		format := event.Uint32()
353		width := event.Uint32()
354		height := event.Uint32()
355		stride := event.Uint32()
356
357		for i, handler := range o.handlersForBuffer() {
358			_ = i
359			handler(format, width, height, stride)
360		}
361	case 1: // flags
362		flags := event.Uint32()
363
364		for i, handler := range o.handlersForFlags() {
365			_ = i
366			handler(flags)
367		}
368	case 2: // ready
369		tvSecHi := event.Uint32()
370		tvSecLo := event.Uint32()
371		tvNsec := event.Uint32()
372
373		for i, handler := range o.handlersForReady() {
374			_ = i
375			handler(tvSecHi, tvSecLo, tvNsec)
376		}
377	case 3: // failed
378
379		for i, handler := range o.handlersForFailed() {
380			_ = i
381			handler()
382		}
383	case 4: // damage
384		x := event.Uint32()
385		y := event.Uint32()
386		width := event.Uint32()
387		height := event.Uint32()
388
389		for i, handler := range o.handlersForDamage() {
390			_ = i
391			handler(x, y, width, height)
392		}
393	case 5: // linux_dmabuf
394		format := event.Uint32()
395		width := event.Uint32()
396		height := event.Uint32()
397
398		for i, handler := range o.handlersForLinuxDmabuf() {
399			_ = i
400			handler(format, width, height)
401		}
402	case 6: // buffer_done
403
404		for i, handler := range o.handlersForBufferDone() {
405			_ = i
406			handler()
407		}
408	default:
409	}
410}

Keyboard shortcuts

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

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

Branches 1

Tags 8

↑↓ moveenter openesc close