feat/data-dnd e05cb15

front.go RawHistoryFolder

1package drm
2
3import (
4	"slices"
5
6	"github.com/bnema/neferwl/internal/ports"
7)
8
9// frontImage is what the output image last committed by a composed frame
10// holds: the scene drawn into it and the content Seq of each window and
11// layer it lists. When only the window on the overlay plane changes, the
12// next frame commits that image again with the new overlay buffer: no GPU
13// pass, no fence. Paths that draw into an output image outside
14// submitFrame (security, protection, image setup, the async probe) forget
15// it.
16type frontImage struct {
17	fb    uint32 // 0: unknown
18	scene ports.Scene
19	seqs  []uint64 // Seq of each window, then each layer, of scene
20	// Backing arrays of scene's slices, reused across frames.
21	windows    []ports.SceneWindow
22	separators []ports.Separator
23	layers     []ports.SceneLayer
24	hints      []ports.Rect
25	indicators []ports.CaptureIndicator
26}
27
28// forget drops the image's contents: the next frame composes.
29func (f *frontImage) forget() { f.fb = 0 }
30
31// hold records that fb holds s drawn from surfaces. A capture scene is not
32// recorded (SameAs never matches it).
33func (f *frontImage) hold(fb uint32, s ports.Scene, surfaces map[ports.WindowID]ports.SurfaceContent) {
34	if s.Capture != nil || s.CaptureScene != nil {
35		f.forget()
36		return
37	}
38	f.windows = append(f.windows[:0], s.Windows...)
39	f.separators = append(f.separators[:0], s.Separators...)
40	f.layers = append(f.layers[:0], s.Layers...)
41	f.hints = append(f.hints[:0], s.DropHints...)
42	f.indicators = append(f.indicators[:0], s.CaptureIndicators...)
43	f.scene = s
44	f.scene.Windows, f.scene.Separators, f.scene.Layers = f.windows, f.separators, f.layers
45	f.scene.DropHints, f.scene.CaptureIndicators = f.hints, f.indicators
46	f.seqs = appendSeqs(f.seqs[:0], s, surfaces)
47	f.fb = fb
48}
49
50// holds reports whether fb holds exactly what drawing s from surfaces would.
51func (f *frontImage) holds(fb uint32, s ports.Scene, surfaces map[ports.WindowID]ports.SurfaceContent) bool {
52	if f.fb == 0 || f.fb != fb || !s.SameAs(f.scene) {
53		return false
54	}
55	i := 0
56	for _, w := range s.Windows {
57		if surfaces[w.ID].Seq != f.seqs[i] {
58			return false
59		}
60		i++
61	}
62	for _, l := range s.Layers {
63		if surfaces[l.ID].Seq != f.seqs[i] {
64			return false
65		}
66		i++
67	}
68	return true
69}
70
71func appendSeqs(seqs []uint64, s ports.Scene, surfaces map[ports.WindowID]ports.SurfaceContent) []uint64 {
72	seqs = slices.Grow(seqs, len(s.Windows)+len(s.Layers))
73	for _, w := range s.Windows {
74		seqs = append(seqs, surfaces[w.ID].Seq)
75	}
76	for _, l := range s.Layers {
77		seqs = append(seqs, surfaces[l.ID].Seq)
78	}
79	return seqs
80}

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 26

Tags 10

↑↓ moveenter openesc close