v0.4.0 2de4e1d

cursor.go RawHistoryFolder

1package wayland
2
3import "github.com/bnema/wlturbo/protocol/cursorshape"
4
5// Cursor shapes NeferGUI maps from CSS `cursor`, in wp_cursor_shape_device_v1
6// enum values.
7const (
8	CursorDefault    = cursorshape.SHAPE_DEFAULT
9	CursorPointer    = cursorshape.SHAPE_POINTER
10	CursorText       = cursorshape.SHAPE_TEXT
11	CursorNotAllowed = cursorshape.SHAPE_NOT_ALLOWED
12)
13
14// cursorState is owned by the session loop. The shape device belongs to the
15// current wl_pointer; set_shape needs the serial of its latest enter.
16type cursorState struct {
17	device *cursorshape.WpCursorShapeDevice
18	serial uint32 // latest enter serial, 0 while outside the surface
19	shape  uint32 // last shape sent at serial
20}
21
22// PointerEntered records the enter serial and resets the sent shape: the
23// compositor forgets the client cursor when the pointer leaves the surface.
24// An enter from a released pointer (gen not current) is ignored.
25func (w *Window) PointerEntered(serial uint32, gen uint64) {
26	if w.Pointer == nil || gen != w.pointerGen {
27		return
28	}
29	w.cursor.serial, w.cursor.shape = serial, 0
30}
31
32// PointerLeft marks the pointer outside; shapes are not sent until enter.
33func (w *Window) PointerLeft() { w.cursor.serial, w.cursor.shape = 0, 0 }
34
35// SetCursor requests shape for the pointer over the surface. It is a no-op
36// without cursor-shape support, outside the surface, or when unchanged.
37func (w *Window) SetCursor(shape uint32) error {
38	if w.CursorShapes == nil || w.Pointer == nil || w.cursor.serial == 0 || shape == w.cursor.shape {
39		return nil
40	}
41	if w.cursor.device == nil {
42		device, err := w.CursorShapes.GetPointer(w.Pointer)
43		if err != nil {
44			return err
45		}
46		w.cursor.device = device
47	}
48	if err := w.cursor.device.SetShape(w.cursor.serial, shape); err != nil {
49		return err
50	}
51	w.cursor.shape = shape
52	return nil
53}
54
55// dropCursorDevice destroys the shape device; call it before its wl_pointer
56// is released. The enter serial belongs to that pointer, so it is cleared:
57// a replacement pointer sets shapes only after its own enter.
58func (w *Window) dropCursorDevice() {
59	if w.cursor.device != nil {
60		_ = w.cursor.device.Destroy()
61	}
62	w.cursor = cursorState{}
63}

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 12

↑↓ moveenter openesc close