main 3d41bc5

exclusion.go RawHistoryFolder

1package testserver
2
3import (
4	"github.com/bnema/purego-libwayland/protocol/extimagecopycapture"
5	"github.com/bnema/purego-libwayland/protocol/wayland"
6
7	"github.com/bnema/nefercap/internal/adapters/wayland/testserver/neferwl"
8)
9
10type exclusionManager struct{ s *Server }
11
12func (exclusionManager) Destroy(*neferwl.NeferwlCaptureExclusionManagerV1) {}
13
14func (m exclusionManager) GetExclusion(self *neferwl.NeferwlCaptureExclusionManagerV1, id uint32, sess *extimagecopycapture.ExtImageCopyCaptureSessionV1) {
15	s := m.s
16	res, err := neferwl.NewNeferwlCaptureExclusionV1(self.Client(), 1, id, exclusionHandler{s})
17	if err != nil {
18		return
19	}
20	s.stats.Exclusions++
21	res.OnDestroy = func() { s.stats.DestroyedExclusions++ }
22	if s.cfg.ExclusionFail != 0 {
23		res.SendFailed(s.cfg.ExclusionFail - 1)
24		return
25	}
26	res.SendToken(Token)
27}
28
29func (m exclusionManager) AttachSurface(self *neferwl.NeferwlCaptureExclusionManagerV1, id uint32, token string, _ *wayland.Surface) {
30	s := m.s
31	res, err := neferwl.NewNeferwlCaptureLayerV1(self.Client(), 1, id, layerHandler{})
32	if err != nil {
33		return
34	}
35	s.stats.Attached = append(s.stats.Attached, token)
36	s.layers = append(s.layers, res.Resource)
37	layer := res
38	switch {
39	case s.cfg.AttachSilent:
40	case s.cfg.AttachFail != 0:
41		layer.SendFailed(s.cfg.AttachFail - 1)
42	default:
43		layer.SendAttached()
44	}
45}
46
47type exclusionHandler struct{ s *Server }
48
49func (exclusionHandler) Destroy(*neferwl.NeferwlCaptureExclusionV1) {}
50
51type layerHandler struct{}
52
53func (layerHandler) Destroy(*neferwl.NeferwlCaptureLayerV1) {}
54
55// Detach sends detached(reason) on the n-th attached layer.
56func (s *Server) Detach(n int, reason uint32) {
57	s.Do(func() {
58		if n < len(s.layers) {
59			neferwl.WrapNeferwlCaptureLayerV1(s.layers[n]).SendDetached(reason)
60		}
61	})
62}
63
64// SendRaw posts a layer event out of order, to test violations: opcode 0
65// attached, 1 failed, 2 detached.
66func (s *Server) SendRaw(n int, opcode uint32, arg uint32) {
67	s.Do(func() {
68		if n >= len(s.layers) {
69			return
70		}
71		l := neferwl.WrapNeferwlCaptureLayerV1(s.layers[n])
72		switch opcode {
73		case 0:
74			l.SendAttached()
75		case 1:
76			l.SendFailed(arg)
77		default:
78			l.SendDetached(arg)
79		}
80	})
81}

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 2

Tags 9

↑↓ moveenter openesc close