main f2d166b

singlepixel.go RawHistoryFolder

1package wayland
2
3import (
4	"math"
5
6	"github.com/bnema/go-wayland-bindings/server/singlepixelbuffer"
7	"github.com/bnema/go-wayland-bindings/server/wayland"
8	"github.com/bnema/neferwl/internal/ports"
9	"github.com/bnema/purego-libwayland/server"
10)
11
12// wp_single_pixel_buffer_v1: a 1x1 wl_buffer of one color. Clients use it
13// for solid backgrounds and letterbox bars; the renderer draws it as a fill
14// (ports.SurfaceContent.Solid) and no pixels are ever read or imported.
15
16func registerSinglePixelBuffer(d *server.Display, s *Server) error {
17	return singlepixelbuffer.NewWpSinglePixelBufferManagerV1Global(d, 1, func(c server.Client, v, id uint32) {
18		_, _ = singlepixelbuffer.NewWpSinglePixelBufferManagerV1(c, int32(v), id, singlePixelManager{s})
19	})
20}
21
22type singlePixelManager struct{ server *Server }
23
24func (singlePixelManager) Destroy(*singlepixelbuffer.WpSinglePixelBufferManagerV1) {}
25
26// CreateU32RgbaBuffer takes 32-bit components already premultiplied by
27// alpha, like client pixels; they become unit floats.
28func (m singlePixelManager) CreateU32RgbaBuffer(r *singlepixelbuffer.WpSinglePixelBufferManagerV1, id, red, green, blue, alpha uint32) {
29	unit := func(v uint32) float32 { return float32(float64(v) / math.MaxUint32) }
30	buf := &singlePixelBuffer{
31		color:  ports.SolidColor{R: unit(red), G: unit(green), B: unit(blue), A: unit(alpha)},
32		opaque: alpha == math.MaxUint32,
33	}
34	res, err := wayland.NewBuffer(r.Client(), 1, id, buf)
35	if err != nil {
36		return
37	}
38	m.server.addBuffer(res, buf)
39}
40
41// singlePixelBuffer is a wl_buffer of one color. The color is never mutated,
42// so content shares it between commits.
43type singlePixelBuffer struct {
44	color  ports.SolidColor
45	opaque bool
46}
47
48func (*singlePixelBuffer) Destroy(*wayland.Buffer) {}
49
50func (*singlePixelBuffer) size() (int, int) { return 1, 1 }
51
52func (b *singlePixelBuffer) content(id ports.WindowID) (ports.SurfaceContent, bool) {
53	return ports.SurfaceContent{ID: id, Width: 1, Height: 1, Opaque: b.opaque, Solid: &b.color}, true
54}

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 25

Tags 10

↑↓ moveenter openesc close