v0.3.0 cf370a0

tearing.go RawHistoryFolder

1package wayland
2
3import (
4	"github.com/bnema/go-wayland-bindings/server/tearingcontrol"
5	"github.com/bnema/go-wayland-bindings/server/wayland"
6	"github.com/bnema/purego-libwayland/server"
7)
8
9// Tearing control: a surface asks for async presentation. Outputs honour it
10// only when they scan the surface out directly (ADR 006); the hint is
11// double-buffered state applied on commit.
12
13func registerTearing(d *server.Display, s *Server) error {
14	return tearingcontrol.NewWpTearingControlManagerV1Global(d, 1, func(c server.Client, v, id uint32) {
15		_, _ = tearingcontrol.NewWpTearingControlManagerV1(c, int32(v), id, tearingManager{s})
16	})
17}
18
19type tearingManager struct{ server *Server }
20
21func (tearingManager) Destroy(*tearingcontrol.WpTearingControlManagerV1) {}
22
23func (m tearingManager) GetTearingControl(r *tearingcontrol.WpTearingControlManagerV1, id uint32, surf *wayland.Surface) {
24	var state *surface
25	if surf != nil {
26		state = m.server.surfaces[surf.Resource]
27	}
28	if state != nil && state.tearing != nil {
29		r.PostError(uint32(tearingcontrol.WpTearingControlManagerV1ErrorTearingControlExists), "surface already has a tearing control")
30		return
31	}
32	h := &tearingHandler{surface: state}
33	res, err := tearingcontrol.NewWpTearingControlV1(r.Client(), r.Version(), id, h)
34	if err != nil || state == nil {
35		return
36	}
37	state.tearing = h
38	res.OnDestroy = func() {
39		// Back to vsync on the next commit.
40		if state.tearing == h {
41			state.tearing = nil
42			state.next.async = false
43		}
44	}
45}
46
47type tearingHandler struct{ surface *surface }
48
49func (h *tearingHandler) SetPresentationHint(_ *tearingcontrol.WpTearingControlV1, hint uint32) {
50	if h.surface != nil && h.surface.tearing == h {
51		h.surface.next.async = hint == uint32(tearingcontrol.WpTearingControlV1PresentationHintAsync)
52	}
53}
54
55func (*tearingHandler) Destroy(*tearingcontrol.WpTearingControlV1) {}

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