detached a3a494e

style: format Go sources

Whitespace-only sweep so formatting checks describe this repository's
changes rather than its history.
commit
a3a494e518efc605059f17179dea07edb1132a84
author
brice · · 2026-09-13 06:40 UTC
parent
ca248e6
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
3 files · +53 -54
M event_pool.go +17 -17
@@ -24,10 +24,10 @@ type EventHandler func(event *Event)
2424 type EventDispatcher struct {
2525 // Lock-free handler lookup using atomic operations
2626 handlers [1024]atomic.Pointer[handlerEntry] // Fixed-size array for object IDs 0-1023
27-
27+
2828 // Extended handlers for object IDs >= 1024 (rare case)
2929 extHandlers sync.Map
30-
30+
3131 // Pre-allocated event objects to avoid allocations
3232 eventCache [64]Event
3333 eventIndex atomic.Uint32
@@ -37,7 +37,7 @@ type EventDispatcher struct {
3737 type handlerEntry struct {
3838 // Array of handlers indexed by opcode (most objects have < 16 opcodes)
3939 handlers [32]EventHandler
40-
40+
4141 // Extended handlers for opcodes >= 32 (very rare)
4242 extHandlers *sync.Map
4343 }
@@ -62,7 +62,7 @@ func (d *EventDispatcher) RegisterHandler(objectID uint32, opcode uint16, handle
6262 newEntry.extHandlers = &sync.Map{}
6363 newEntry.extHandlers.Store(opcode, handler)
6464 }
65-
65+
6666 // Try to set atomically
6767 if d.handlers[objectID].CompareAndSwap(nil, newEntry) {
6868 return
@@ -70,7 +70,7 @@ func (d *EventDispatcher) RegisterHandler(objectID uint32, opcode uint16, handle
7070 // Retry if someone else created it
7171 continue
7272 }
73-
73+
7474 // Entry exists, update it
7575 if opcode < 32 {
7676 // Direct array access (no locking needed for write)
@@ -88,7 +88,7 @@ func (d *EventDispatcher) RegisterHandler(objectID uint32, opcode uint16, handle
8888 // Slow path: use sync.Map for large object IDs
8989 entry, _ := d.extHandlers.LoadOrStore(objectID, &handlerEntry{})
9090 h := entry.(*handlerEntry)
91-
91+
9292 if opcode < 32 {
9393 h.handlers[opcode] = handler
9494 } else {
@@ -105,7 +105,7 @@ func (d *EventDispatcher) RegisterHandler(objectID uint32, opcode uint16, handle
105105 //go:inline
106106 func (d *EventDispatcher) Dispatch(objectID uint32, opcode uint16, data []byte) {
107107 var handler EventHandler
108-
108+
109109 // Fast lookup path
110110 if objectID < 1024 {
111111 entry := d.handlers[objectID].Load()
@@ -131,21 +131,21 @@ func (d *EventDispatcher) Dispatch(objectID uint32, opcode uint16, data []byte)
131131 }
132132 }
133133 }
134-
134+
135135 if handler == nil {
136136 return
137137 }
138-
138+
139139 // Get event from pool
140140 event := eventPool.Get().(*Event)
141141 event.ProxyID = objectID
142142 event.Opcode = opcode
143143 event.data = append(event.data[:0], data...) // Reuse backing array
144144 event.offset = 0
145-
145+
146146 // Call handler
147147 handler(event)
148-
148+
149149 // Return to pool
150150 eventPool.Put(event)
151151 }
@@ -169,11 +169,11 @@ type RawEvent struct {
169169 // DirectDispatcher provides the absolute fastest dispatch path for hot events
170170 type DirectDispatcher struct {
171171 // Direct function pointers for the hottest paths (e.g., pointer motion)
172- pointerMotion func(surfaceX, surfaceY Fixed)
173- pointerButton func(button, state uint32)
174- keyboardKey func(key, state uint32)
175- frameCallback func(callbackData uint32)
176-
172+ pointerMotion func(surfaceX, surfaceY Fixed)
173+ pointerButton func(button, state uint32)
174+ keyboardKey func(key, state uint32)
175+ frameCallback func(callbackData uint32)
176+
177177 // Fallback to regular dispatcher
178178 fallback *EventDispatcher
179179 }
@@ -216,4 +216,4 @@ func (s *PerformanceStats) GetAverageLatency() uint64 {
216216 return 0
217217 }
218218 return s.NanosecondsSpent.Load() / events
219-}⏎̸
219+}
@@ -24,10 +24,10 @@ type EventHandler func(event *Event)
24 type EventDispatcher struct {24 type EventDispatcher struct {
25 // Lock-free handler lookup using atomic operations25 // Lock-free handler lookup using atomic operations
26 handlers [1024]atomic.Pointer[handlerEntry] // Fixed-size array for object IDs 0-102326 handlers [1024]atomic.Pointer[handlerEntry] // Fixed-size array for object IDs 0-1023
27- 27+
28 // Extended handlers for object IDs >= 1024 (rare case)28 // Extended handlers for object IDs >= 1024 (rare case)
29 extHandlers sync.Map29 extHandlers sync.Map
30- 30+
31 // Pre-allocated event objects to avoid allocations31 // Pre-allocated event objects to avoid allocations
32 eventCache [64]Event32 eventCache [64]Event
33 eventIndex atomic.Uint3233 eventIndex atomic.Uint32
@@ -37,7 +37,7 @@ type EventDispatcher struct {
37 type handlerEntry struct {37 type handlerEntry struct {
38 // Array of handlers indexed by opcode (most objects have < 16 opcodes)38 // Array of handlers indexed by opcode (most objects have < 16 opcodes)
39 handlers [32]EventHandler39 handlers [32]EventHandler
40- 40+
41 // Extended handlers for opcodes >= 32 (very rare)41 // Extended handlers for opcodes >= 32 (very rare)
42 extHandlers *sync.Map42 extHandlers *sync.Map
43 }43 }
@@ -62,7 +62,7 @@ func (d *EventDispatcher) RegisterHandler(objectID uint32, opcode uint16, handle
62 newEntry.extHandlers = &sync.Map{}62 newEntry.extHandlers = &sync.Map{}
63 newEntry.extHandlers.Store(opcode, handler)63 newEntry.extHandlers.Store(opcode, handler)
64 }64 }
65- 65+
66 // Try to set atomically66 // Try to set atomically
67 if d.handlers[objectID].CompareAndSwap(nil, newEntry) {67 if d.handlers[objectID].CompareAndSwap(nil, newEntry) {
68 return68 return
@@ -70,7 +70,7 @@ func (d *EventDispatcher) RegisterHandler(objectID uint32, opcode uint16, handle
70 // Retry if someone else created it70 // Retry if someone else created it
71 continue71 continue
72 }72 }
73- 73+
74 // Entry exists, update it74 // Entry exists, update it
75 if opcode < 32 {75 if opcode < 32 {
76 // Direct array access (no locking needed for write)76 // Direct array access (no locking needed for write)
@@ -88,7 +88,7 @@ func (d *EventDispatcher) RegisterHandler(objectID uint32, opcode uint16, handle
88 // Slow path: use sync.Map for large object IDs88 // Slow path: use sync.Map for large object IDs
89 entry, _ := d.extHandlers.LoadOrStore(objectID, &handlerEntry{})89 entry, _ := d.extHandlers.LoadOrStore(objectID, &handlerEntry{})
90 h := entry.(*handlerEntry)90 h := entry.(*handlerEntry)
91- 91+
92 if opcode < 32 {92 if opcode < 32 {
93 h.handlers[opcode] = handler93 h.handlers[opcode] = handler
94 } else {94 } else {
@@ -105,7 +105,7 @@ func (d *EventDispatcher) RegisterHandler(objectID uint32, opcode uint16, handle
105 //go:inline105 //go:inline
106 func (d *EventDispatcher) Dispatch(objectID uint32, opcode uint16, data []byte) {106 func (d *EventDispatcher) Dispatch(objectID uint32, opcode uint16, data []byte) {
107 var handler EventHandler107 var handler EventHandler
108- 108+
109 // Fast lookup path109 // Fast lookup path
110 if objectID < 1024 {110 if objectID < 1024 {
111 entry := d.handlers[objectID].Load()111 entry := d.handlers[objectID].Load()
@@ -131,21 +131,21 @@ func (d *EventDispatcher) Dispatch(objectID uint32, opcode uint16, data []byte)
131 }131 }
132 }132 }
133 }133 }
134- 134+
135 if handler == nil {135 if handler == nil {
136 return136 return
137 }137 }
138- 138+
139 // Get event from pool139 // Get event from pool
140 event := eventPool.Get().(*Event)140 event := eventPool.Get().(*Event)
141 event.ProxyID = objectID141 event.ProxyID = objectID
142 event.Opcode = opcode142 event.Opcode = opcode
143 event.data = append(event.data[:0], data...) // Reuse backing array143 event.data = append(event.data[:0], data...) // Reuse backing array
144 event.offset = 0144 event.offset = 0
145- 145+
146 // Call handler146 // Call handler
147 handler(event)147 handler(event)
148- 148+
149 // Return to pool149 // Return to pool
150 eventPool.Put(event)150 eventPool.Put(event)
151 }151 }
@@ -169,11 +169,11 @@ type RawEvent struct {
169 // DirectDispatcher provides the absolute fastest dispatch path for hot events169 // DirectDispatcher provides the absolute fastest dispatch path for hot events
170 type DirectDispatcher struct {170 type DirectDispatcher struct {
171 // Direct function pointers for the hottest paths (e.g., pointer motion)171 // Direct function pointers for the hottest paths (e.g., pointer motion)
172- pointerMotion func(surfaceX, surfaceY Fixed)172+ pointerMotion func(surfaceX, surfaceY Fixed)
173- pointerButton func(button, state uint32)173+ pointerButton func(button, state uint32)
174- keyboardKey func(key, state uint32)174+ keyboardKey func(key, state uint32)
175- frameCallback func(callbackData uint32)175+ frameCallback func(callbackData uint32)
176- 176+
177 // Fallback to regular dispatcher177 // Fallback to regular dispatcher
178 fallback *EventDispatcher178 fallback *EventDispatcher
179 }179 }
@@ -216,4 +216,4 @@ func (s *PerformanceStats) GetAverageLatency() uint64 {
216 return 0216 return 0
217 }217 }
218 return s.NanosecondsSpent.Load() / events218 return s.NanosecondsSpent.Load() / events
219-}⏎̸219+}
M shm.go +14 -14
@@ -21,14 +21,14 @@ func CreateShmPool(size int) (*ShmPool, error) {
2121 if err != nil {
2222 return nil, fmt.Errorf("failed to create anonymous file: %w", err)
2323 }
24-
24+
2525 // Map the file into memory
2626 data, err := MapMemory(fd, size)
2727 if err != nil {
2828 unix.Close(fd)
2929 return nil, fmt.Errorf("failed to map memory: %w", err)
3030 }
31-
31+
3232 return &ShmPool{
3333 fd: fd,
3434 size: size,
@@ -44,14 +44,14 @@ func (p *ShmPool) Close() error {
4444 }
4545 p.data = nil
4646 }
47-
47+
4848 if p.fd >= 0 {
4949 if err := unix.Close(p.fd); err != nil {
5050 return err
5151 }
5252 p.fd = -1
5353 }
54-
54+
5555 return nil
5656 }
5757
@@ -83,11 +83,11 @@ type ShmBuffer struct {
8383 // AllocateBuffer allocates a buffer from the pool
8484 func (p *ShmPool) AllocateBuffer(width, height, stride int, format uint32) (*ShmBuffer, error) {
8585 size := height * stride
86-
86+
8787 if p.offset+size > p.size {
8888 return nil, fmt.Errorf("insufficient space in pool: need %d, have %d", size, p.size-p.offset)
8989 }
90-
90+
9191 buffer := &ShmBuffer{
9292 pool: p,
9393 offset: p.offset,
@@ -96,13 +96,13 @@ func (p *ShmPool) AllocateBuffer(width, height, stride int, format uint32) (*Shm
9696 stride: stride,
9797 format: format,
9898 }
99-
99+
100100 p.offset += size
101-
101+
102102 // Align to 64-byte boundary for cache efficiency
103103 padding := (64 - (p.offset % 64)) % 64
104104 p.offset += padding
105-
105+
106106 return buffer, nil
107107 }
108108
@@ -122,15 +122,15 @@ const (
122122 // 32-bit formats
123123 FormatARGB8888 = 0
124124 FormatXRGB8888 = 1
125-
126- // 24-bit formats
125+
126+ // 24-bit formats
127127 FormatRGB888 = 0x34324752 // 'RG24'
128128 FormatBGR888 = 0x34324742 // 'BG24'
129-
129+
130130 // 16-bit formats
131131 FormatRGB565 = 0x36314752 // 'RG16'
132132 FormatXRGB1555 = 0x35315258 // 'XR15'
133-
133+
134134 // 8-bit formats
135135 FormatY8 = 0x20203859 // 'Y8 '
136-)⏎̸
136+)
@@ -21,14 +21,14 @@ func CreateShmPool(size int) (*ShmPool, error) {
21 if err != nil {21 if err != nil {
22 return nil, fmt.Errorf("failed to create anonymous file: %w", err)22 return nil, fmt.Errorf("failed to create anonymous file: %w", err)
23 }23 }
24- 24+
25 // Map the file into memory25 // Map the file into memory
26 data, err := MapMemory(fd, size)26 data, err := MapMemory(fd, size)
27 if err != nil {27 if err != nil {
28 unix.Close(fd)28 unix.Close(fd)
29 return nil, fmt.Errorf("failed to map memory: %w", err)29 return nil, fmt.Errorf("failed to map memory: %w", err)
30 }30 }
31- 31+
32 return &ShmPool{32 return &ShmPool{
33 fd: fd,33 fd: fd,
34 size: size,34 size: size,
@@ -44,14 +44,14 @@ func (p *ShmPool) Close() error {
44 }44 }
45 p.data = nil45 p.data = nil
46 }46 }
47- 47+
48 if p.fd >= 0 {48 if p.fd >= 0 {
49 if err := unix.Close(p.fd); err != nil {49 if err := unix.Close(p.fd); err != nil {
50 return err50 return err
51 }51 }
52 p.fd = -152 p.fd = -1
53 }53 }
54- 54+
55 return nil55 return nil
56 }56 }
57 57
@@ -83,11 +83,11 @@ type ShmBuffer struct {
83 // AllocateBuffer allocates a buffer from the pool83 // AllocateBuffer allocates a buffer from the pool
84 func (p *ShmPool) AllocateBuffer(width, height, stride int, format uint32) (*ShmBuffer, error) {84 func (p *ShmPool) AllocateBuffer(width, height, stride int, format uint32) (*ShmBuffer, error) {
85 size := height * stride85 size := height * stride
86- 86+
87 if p.offset+size > p.size {87 if p.offset+size > p.size {
88 return nil, fmt.Errorf("insufficient space in pool: need %d, have %d", size, p.size-p.offset)88 return nil, fmt.Errorf("insufficient space in pool: need %d, have %d", size, p.size-p.offset)
89 }89 }
90- 90+
91 buffer := &ShmBuffer{91 buffer := &ShmBuffer{
92 pool: p,92 pool: p,
93 offset: p.offset,93 offset: p.offset,
@@ -96,13 +96,13 @@ func (p *ShmPool) AllocateBuffer(width, height, stride int, format uint32) (*Shm
96 stride: stride,96 stride: stride,
97 format: format,97 format: format,
98 }98 }
99- 99+
100 p.offset += size100 p.offset += size
101- 101+
102 // Align to 64-byte boundary for cache efficiency102 // Align to 64-byte boundary for cache efficiency
103 padding := (64 - (p.offset % 64)) % 64103 padding := (64 - (p.offset % 64)) % 64
104 p.offset += padding104 p.offset += padding
105- 105+
106 return buffer, nil106 return buffer, nil
107 }107 }
108 108
@@ -122,15 +122,15 @@ const (
122 // 32-bit formats122 // 32-bit formats
123 FormatARGB8888 = 0123 FormatARGB8888 = 0
124 FormatXRGB8888 = 1124 FormatXRGB8888 = 1
125- 125+
126- // 24-bit formats 126+ // 24-bit formats
127 FormatRGB888 = 0x34324752 // 'RG24'127 FormatRGB888 = 0x34324752 // 'RG24'
128 FormatBGR888 = 0x34324742 // 'BG24'128 FormatBGR888 = 0x34324742 // 'BG24'
129- 129+
130 // 16-bit formats130 // 16-bit formats
131 FormatRGB565 = 0x36314752 // 'RG16'131 FormatRGB565 = 0x36314752 // 'RG16'
132 FormatXRGB1555 = 0x35315258 // 'XR15'132 FormatXRGB1555 = 0x35315258 // 'XR15'
133- 133+
134 // 8-bit formats134 // 8-bit formats
135 FormatY8 = 0x20203859 // 'Y8 '135 FormatY8 = 0x20203859 // 'Y8 '
136-)⏎̸136+)
M wl/wl.go +22 -23
@@ -5,31 +5,30 @@ import (
55 "github.com/bnema/wlturbo"
66 )
77
8-
98 // Type aliases for compatibility
109 type (
11- Display = wlturbo.Display
12- Registry = wlturbo.Registry
13- Context = wlturbo.Context
14- Fixed = wlturbo.Fixed
15- Object = wlturbo.Object
16- Proxy = wlturbo.Proxy
17- BaseProxy = wlturbo.BaseProxy
18- Event = wlturbo.Event
19- Global = wlturbo.Global
20- GlobalHandler = wlturbo.GlobalHandler
21- RegistryGlobalHandler = wlturbo.RegistryGlobalHandler
10+ Display = wlturbo.Display
11+ Registry = wlturbo.Registry
12+ Context = wlturbo.Context
13+ Fixed = wlturbo.Fixed
14+ Object = wlturbo.Object
15+ Proxy = wlturbo.Proxy
16+ BaseProxy = wlturbo.BaseProxy
17+ Event = wlturbo.Event
18+ Global = wlturbo.Global
19+ GlobalHandler = wlturbo.GlobalHandler
20+ RegistryGlobalHandler = wlturbo.RegistryGlobalHandler
2221 RegistryGlobalRemoveHandler = wlturbo.RegistryGlobalRemoveHandler
23- RegistryGlobalEvent = wlturbo.RegistryGlobalEvent
24- RegistryGlobalRemoveEvent = wlturbo.RegistryGlobalRemoveEvent
25- Seat = wlturbo.Seat
26- Surface = wlturbo.Surface
27- Pointer = wlturbo.Pointer
28- Keyboard = wlturbo.Keyboard
29- Touch = wlturbo.Touch
30- Output = wlturbo.Output
31- Region = wlturbo.Region
32- Compositor = wlturbo.Compositor
22+ RegistryGlobalEvent = wlturbo.RegistryGlobalEvent
23+ RegistryGlobalRemoveEvent = wlturbo.RegistryGlobalRemoveEvent
24+ Seat = wlturbo.Seat
25+ Surface = wlturbo.Surface
26+ Pointer = wlturbo.Pointer
27+ Keyboard = wlturbo.Keyboard
28+ Touch = wlturbo.Touch
29+ Output = wlturbo.Output
30+ Region = wlturbo.Region
31+ Compositor = wlturbo.Compositor
3332 )
3433
3534 // Function aliases
@@ -50,4 +49,4 @@ const (
5049 SeatCapabilityPointer = wlturbo.SeatCapabilityPointer
5150 SeatCapabilityKeyboard = wlturbo.SeatCapabilityKeyboard
5251 SeatCapabilityTouch = wlturbo.SeatCapabilityTouch
53-)⏎̸
52+)
@@ -5,31 +5,30 @@ import (
5 "github.com/bnema/wlturbo"5 "github.com/bnema/wlturbo"
6 )6 )
7 7
8-
9 // Type aliases for compatibility8 // Type aliases for compatibility
10 type (9 type (
11- Display = wlturbo.Display10+ Display = wlturbo.Display
12- Registry = wlturbo.Registry11+ Registry = wlturbo.Registry
13- Context = wlturbo.Context12+ Context = wlturbo.Context
14- Fixed = wlturbo.Fixed13+ Fixed = wlturbo.Fixed
15- Object = wlturbo.Object14+ Object = wlturbo.Object
16- Proxy = wlturbo.Proxy15+ Proxy = wlturbo.Proxy
17- BaseProxy = wlturbo.BaseProxy16+ BaseProxy = wlturbo.BaseProxy
18- Event = wlturbo.Event17+ Event = wlturbo.Event
19- Global = wlturbo.Global18+ Global = wlturbo.Global
20- GlobalHandler = wlturbo.GlobalHandler19+ GlobalHandler = wlturbo.GlobalHandler
21- RegistryGlobalHandler = wlturbo.RegistryGlobalHandler20+ RegistryGlobalHandler = wlturbo.RegistryGlobalHandler
22 RegistryGlobalRemoveHandler = wlturbo.RegistryGlobalRemoveHandler21 RegistryGlobalRemoveHandler = wlturbo.RegistryGlobalRemoveHandler
23- RegistryGlobalEvent = wlturbo.RegistryGlobalEvent22+ RegistryGlobalEvent = wlturbo.RegistryGlobalEvent
24- RegistryGlobalRemoveEvent = wlturbo.RegistryGlobalRemoveEvent23+ RegistryGlobalRemoveEvent = wlturbo.RegistryGlobalRemoveEvent
25- Seat = wlturbo.Seat24+ Seat = wlturbo.Seat
26- Surface = wlturbo.Surface25+ Surface = wlturbo.Surface
27- Pointer = wlturbo.Pointer26+ Pointer = wlturbo.Pointer
28- Keyboard = wlturbo.Keyboard27+ Keyboard = wlturbo.Keyboard
29- Touch = wlturbo.Touch28+ Touch = wlturbo.Touch
30- Output = wlturbo.Output29+ Output = wlturbo.Output
31- Region = wlturbo.Region30+ Region = wlturbo.Region
32- Compositor = wlturbo.Compositor31+ Compositor = wlturbo.Compositor
33 )32 )
34 33
35 // Function aliases34 // Function aliases
@@ -50,4 +49,4 @@ const (
50 SeatCapabilityPointer = wlturbo.SeatCapabilityPointer49 SeatCapabilityPointer = wlturbo.SeatCapabilityPointer
51 SeatCapabilityKeyboard = wlturbo.SeatCapabilityKeyboard50 SeatCapabilityKeyboard = wlturbo.SeatCapabilityKeyboard
52 SeatCapabilityTouch = wlturbo.SeatCapabilityTouch51 SeatCapabilityTouch = wlturbo.SeatCapabilityTouch
53-)⏎̸52+)

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 8

↑↓ moveenter openesc close