detached 0458bb4

fix(cef): align handler signatures with purego-cef type resolution fixes

Update all CEF handler method signatures to match the improved purego-cef
generator which now resolves bare cef_xxx_t* pointer types correctly.
Changes: uintptr → typed pointers for Rect, ScreenInfo, Size, PopupFeatures,
CursorInfo, TouchHandleState, Range, AcceleratedPaintInfo across RenderHandler,
DisplayHandler, and LifeSpanHandler. OnPaint still uses count+pointer (uintptr)
for dirty rects pending parser fix.
commit
0458bb4b9a9ad3eb836a8310836e33e02dac6e7d
author
brice · · 2026-03-19 16:07 UTC
committer
brice · · 2026-03-28 04:35 UTC
parent
6da4a3b
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +31 -25
M internal/infrastructure/cef/webview_handlers.go +31 -25
@@ -58,13 +58,13 @@ func (h *handlerSet) OnProcessMessageReceived(_ purecef.Browser, _ purecef.Frame
5858
5959 func (h *handlerSet) GetAccessibilityHandler() purecef.AccessibilityHandler { return nil }
6060
61-func (h *handlerSet) GetRootScreenRect(_ purecef.Browser, _ uintptr) int32 { return 0 }
61+func (h *handlerSet) GetRootScreenRect(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }
6262
6363 // GetViewRect fills the rect struct with the pipeline dimensions.
6464 // The rect pointer points to a cef_rect_t: {HostLayout padding, X, Y, Width, Height} all int32.
6565 // The HostLayout field occupies 0 bytes on most platforms but we use the Rect type alias to be safe.
66-func (h *handlerSet) GetViewRect(_ purecef.Browser, rect uintptr) {
67- if rect == 0 {
66+func (h *handlerSet) GetViewRect(_ purecef.Browser, rect *purecef.Rect) {
67+ if rect == nil {
6868 return
6969 }
7070 h.wv.pipeline.mu.Lock()
@@ -72,41 +72,47 @@ func (h *handlerSet) GetViewRect(_ purecef.Browser, rect uintptr) {
7272 ht := h.wv.pipeline.height
7373 h.wv.pipeline.mu.Unlock()
7474
75- r := (*purecef.Rect)(unsafe.Pointer(rect))
76- r.X = 0
77- r.Y = 0
78- r.Width = w
79- r.Height = ht
75+ rect.X = 0
76+ rect.Y = 0
77+ rect.Width = w
78+ rect.Height = ht
8079 }
8180
8281 func (h *handlerSet) GetScreenPoint(_ purecef.Browser, _ int32, _ int32, _ unsafe.Pointer, _ unsafe.Pointer) int32 {
8382 return 0
8483 }
8584
86-func (h *handlerSet) GetScreenInfo(_ purecef.Browser, _ uintptr) int32 { return 0 }
85+func (h *handlerSet) GetScreenInfo(_ purecef.Browser, _ *purecef.ScreenInfo) int32 { return 0 }
8786
8887 func (h *handlerSet) OnPopupShow(_ purecef.Browser, _ int32) {}
8988
90-func (h *handlerSet) OnPopupSize(_ purecef.Browser, _ uintptr) {}
89+func (h *handlerSet) OnPopupSize(_ purecef.Browser, _ *purecef.Rect) {}
9190
9291 // OnPaint receives the BGRA pixel buffer from CEF and forwards dirty rects
9392 // to the render pipeline for GPU upload.
94-func (h *handlerSet) OnPaint(_ purecef.Browser, _ purecef.PaintElementType, dirtyRects []purecef.Rect, buffer unsafe.Pointer, width int32, height int32) {
95- // Convert purecef.Rect (which has HostLayout padding) to our local rect type.
96- rects := make([]rect, len(dirtyRects))
97- for i, dr := range dirtyRects {
98- rects[i] = rect{X: dr.X, Y: dr.Y, Width: dr.Width, Height: dr.Height}
93+// NOTE: dirty rects are still count+pointer (uintptr) because the purego-cef
94+// parser doesn't preserve the C type for this parameter yet. Decode manually.
95+func (h *handlerSet) OnPaint(_ purecef.Browser, _ purecef.PaintElementType, dirtyrectscount int, dirtyrects uintptr, buffer unsafe.Pointer, width int32, height int32) {
96+ var rects []rect
97+ if dirtyrectscount > 0 && dirtyrects != 0 {
98+ // Each cef_rect_t is {x, y, width, height} as int32, but purecef.Rect
99+ // has a HostLayout padding prefix. Use unsafe.Slice on the raw pointer.
100+ cefRects := unsafe.Slice((*purecef.Rect)(unsafe.Pointer(dirtyrects)), dirtyrectscount)
101+ rects = make([]rect, dirtyrectscount)
102+ for i, dr := range cefRects {
103+ rects[i] = rect{X: dr.X, Y: dr.Y, Width: dr.Width, Height: dr.Height}
104+ }
99105 }
100106 h.wv.pipeline.handlePaint(buffer, width, height, rects)
101107 }
102108
103-func (h *handlerSet) OnAcceleratedPaint(_ purecef.Browser, _ purecef.PaintElementType, _ int, _ uintptr, _ uintptr) {
109+func (h *handlerSet) OnAcceleratedPaint(_ purecef.Browser, _ purecef.PaintElementType, _ int, _ uintptr, _ *purecef.AcceleratedPaintInfo) {
104110 }
105111
106-func (h *handlerSet) GetTouchHandleSize(_ purecef.Browser, _ purecef.HorizontalAlignment, _ uintptr) {
112+func (h *handlerSet) GetTouchHandleSize(_ purecef.Browser, _ purecef.HorizontalAlignment, _ *purecef.Size) {
107113 }
108114
109-func (h *handlerSet) OnTouchHandleStateChanged(_ purecef.Browser, _ uintptr) {}
115+func (h *handlerSet) OnTouchHandleStateChanged(_ purecef.Browser, _ *purecef.TouchHandleState) {}
110116
111117 func (h *handlerSet) StartDragging(_ purecef.Browser, _ purecef.DragData, _ purecef.DragOperationsMask, _ int32, _ int32) int32 {
112118 return 0
@@ -116,10 +122,10 @@ func (h *handlerSet) UpdateDragCursor(_ purecef.Browser, _ purecef.DragOperation
116122
117123 func (h *handlerSet) OnScrollOffsetChanged(_ purecef.Browser, _ float64, _ float64) {}
118124
119-func (h *handlerSet) OnImeCompositionRangeChanged(_ purecef.Browser, _ uintptr, _ int, _ uintptr) {
125+func (h *handlerSet) OnImeCompositionRangeChanged(_ purecef.Browser, _ *purecef.Range, _ int, _ uintptr) {
120126 }
121127
122-func (h *handlerSet) OnTextSelectionChanged(_ purecef.Browser, _ string, _ uintptr) {}
128+func (h *handlerSet) OnTextSelectionChanged(_ purecef.Browser, _ string, _ *purecef.Range) {}
123129
124130 func (h *handlerSet) OnVirtualKeyboardRequested(_ purecef.Browser, _ purecef.TextInputMode) {}
125131
@@ -176,22 +182,22 @@ func (h *handlerSet) OnConsoleMessage(_ purecef.Browser, _ purecef.LogSeverity,
176182 return 0
177183 }
178184
179-func (h *handlerSet) OnAutoResize(_ purecef.Browser, _ uintptr) int32 { return 0 }
185+func (h *handlerSet) OnAutoResize(_ purecef.Browser, _ *purecef.Size) int32 { return 0 }
180186
181187 // OnLoadingProgressChange updates the cached progress value.
182188 func (h *handlerSet) OnLoadingProgressChange(_ purecef.Browser, progress float64) {
183189 h.wv.updateProgress(progress)
184190 }
185191
186-func (h *handlerSet) OnCursorChange(_ purecef.Browser, _ uintptr, _ purecef.CursorType, _ uintptr) int32 {
192+func (h *handlerSet) OnCursorChange(_ purecef.Browser, _ uintptr, _ purecef.CursorType, _ *purecef.CursorInfo) int32 {
187193 return 0
188194 }
189195
190196 func (h *handlerSet) OnMediaAccessChange(_ purecef.Browser, _ int32, _ int32) {}
191197
192-func (h *handlerSet) OnContentsBoundsChange(_ purecef.Browser, _ uintptr) int32 { return 0 }
198+func (h *handlerSet) OnContentsBoundsChange(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }
193199
194-func (h *handlerSet) GetRootWindowScreenRect(_ purecef.Browser, _ uintptr) int32 { return 0 }
200+func (h *handlerSet) GetRootWindowScreenRect(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }
195201
196202 // ===========================================================================
197203 // LoadHandler (4 methods)
@@ -254,7 +260,7 @@ func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.E
254260 // ===========================================================================
255261
256262 // OnBeforePopup blocks all popups in Phase 1.
257-func (h *handlerSet) OnBeforePopup(_ purecef.Browser, _ purecef.Frame, _ int32, _ string, _ string, _ purecef.WindowOpenDisposition, _ int32, _ uintptr, _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings, _ unsafe.Pointer, _ unsafe.Pointer) bool {
263+func (h *handlerSet) OnBeforePopup(_ purecef.Browser, _ purecef.Frame, _ int32, _ string, _ string, _ purecef.WindowOpenDisposition, _ int32, _ *purecef.PopupFeatures, _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings, _ unsafe.Pointer, _ unsafe.Pointer) bool {
258264 return true // block
259265 }
260266
@@ -58,13 +58,13 @@ func (h *handlerSet) OnProcessMessageReceived(_ purecef.Browser, _ purecef.Frame
58 58
59 func (h *handlerSet) GetAccessibilityHandler() purecef.AccessibilityHandler { return nil }59 func (h *handlerSet) GetAccessibilityHandler() purecef.AccessibilityHandler { return nil }
60 60
61-func (h *handlerSet) GetRootScreenRect(_ purecef.Browser, _ uintptr) int32 { return 0 }61+func (h *handlerSet) GetRootScreenRect(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }
62 62
63 // GetViewRect fills the rect struct with the pipeline dimensions.63 // GetViewRect fills the rect struct with the pipeline dimensions.
64 // The rect pointer points to a cef_rect_t: {HostLayout padding, X, Y, Width, Height} all int32.64 // The rect pointer points to a cef_rect_t: {HostLayout padding, X, Y, Width, Height} all int32.
65 // The HostLayout field occupies 0 bytes on most platforms but we use the Rect type alias to be safe.65 // The HostLayout field occupies 0 bytes on most platforms but we use the Rect type alias to be safe.
66-func (h *handlerSet) GetViewRect(_ purecef.Browser, rect uintptr) {66+func (h *handlerSet) GetViewRect(_ purecef.Browser, rect *purecef.Rect) {
67- if rect == 0 {67+ if rect == nil {
68 return68 return
69 }69 }
70 h.wv.pipeline.mu.Lock()70 h.wv.pipeline.mu.Lock()
@@ -72,41 +72,47 @@ func (h *handlerSet) GetViewRect(_ purecef.Browser, rect uintptr) {
72 ht := h.wv.pipeline.height72 ht := h.wv.pipeline.height
73 h.wv.pipeline.mu.Unlock()73 h.wv.pipeline.mu.Unlock()
74 74
75- r := (*purecef.Rect)(unsafe.Pointer(rect))75+ rect.X = 0
76- r.X = 076+ rect.Y = 0
77- r.Y = 077+ rect.Width = w
78- r.Width = w78+ rect.Height = ht
79- r.Height = ht
80 }79 }
81 80
82 func (h *handlerSet) GetScreenPoint(_ purecef.Browser, _ int32, _ int32, _ unsafe.Pointer, _ unsafe.Pointer) int32 {81 func (h *handlerSet) GetScreenPoint(_ purecef.Browser, _ int32, _ int32, _ unsafe.Pointer, _ unsafe.Pointer) int32 {
83 return 082 return 0
84 }83 }
85 84
86-func (h *handlerSet) GetScreenInfo(_ purecef.Browser, _ uintptr) int32 { return 0 }85+func (h *handlerSet) GetScreenInfo(_ purecef.Browser, _ *purecef.ScreenInfo) int32 { return 0 }
87 86
88 func (h *handlerSet) OnPopupShow(_ purecef.Browser, _ int32) {}87 func (h *handlerSet) OnPopupShow(_ purecef.Browser, _ int32) {}
89 88
90-func (h *handlerSet) OnPopupSize(_ purecef.Browser, _ uintptr) {}89+func (h *handlerSet) OnPopupSize(_ purecef.Browser, _ *purecef.Rect) {}
91 90
92 // OnPaint receives the BGRA pixel buffer from CEF and forwards dirty rects91 // OnPaint receives the BGRA pixel buffer from CEF and forwards dirty rects
93 // to the render pipeline for GPU upload.92 // to the render pipeline for GPU upload.
94-func (h *handlerSet) OnPaint(_ purecef.Browser, _ purecef.PaintElementType, dirtyRects []purecef.Rect, buffer unsafe.Pointer, width int32, height int32) {93+// NOTE: dirty rects are still count+pointer (uintptr) because the purego-cef
95- // Convert purecef.Rect (which has HostLayout padding) to our local rect type.94+// parser doesn't preserve the C type for this parameter yet. Decode manually.
96- rects := make([]rect, len(dirtyRects))95+func (h *handlerSet) OnPaint(_ purecef.Browser, _ purecef.PaintElementType, dirtyrectscount int, dirtyrects uintptr, buffer unsafe.Pointer, width int32, height int32) {
97- for i, dr := range dirtyRects {96+ var rects []rect
98- rects[i] = rect{X: dr.X, Y: dr.Y, Width: dr.Width, Height: dr.Height}97+ if dirtyrectscount > 0 && dirtyrects != 0 {
98+ // Each cef_rect_t is {x, y, width, height} as int32, but purecef.Rect
99+ // has a HostLayout padding prefix. Use unsafe.Slice on the raw pointer.
100+ cefRects := unsafe.Slice((*purecef.Rect)(unsafe.Pointer(dirtyrects)), dirtyrectscount)
101+ rects = make([]rect, dirtyrectscount)
102+ for i, dr := range cefRects {
103+ rects[i] = rect{X: dr.X, Y: dr.Y, Width: dr.Width, Height: dr.Height}
104+ }
99 }105 }
100 h.wv.pipeline.handlePaint(buffer, width, height, rects)106 h.wv.pipeline.handlePaint(buffer, width, height, rects)
101 }107 }
102 108
103-func (h *handlerSet) OnAcceleratedPaint(_ purecef.Browser, _ purecef.PaintElementType, _ int, _ uintptr, _ uintptr) {109+func (h *handlerSet) OnAcceleratedPaint(_ purecef.Browser, _ purecef.PaintElementType, _ int, _ uintptr, _ *purecef.AcceleratedPaintInfo) {
104 }110 }
105 111
106-func (h *handlerSet) GetTouchHandleSize(_ purecef.Browser, _ purecef.HorizontalAlignment, _ uintptr) {112+func (h *handlerSet) GetTouchHandleSize(_ purecef.Browser, _ purecef.HorizontalAlignment, _ *purecef.Size) {
107 }113 }
108 114
109-func (h *handlerSet) OnTouchHandleStateChanged(_ purecef.Browser, _ uintptr) {}115+func (h *handlerSet) OnTouchHandleStateChanged(_ purecef.Browser, _ *purecef.TouchHandleState) {}
110 116
111 func (h *handlerSet) StartDragging(_ purecef.Browser, _ purecef.DragData, _ purecef.DragOperationsMask, _ int32, _ int32) int32 {117 func (h *handlerSet) StartDragging(_ purecef.Browser, _ purecef.DragData, _ purecef.DragOperationsMask, _ int32, _ int32) int32 {
112 return 0118 return 0
@@ -116,10 +122,10 @@ func (h *handlerSet) UpdateDragCursor(_ purecef.Browser, _ purecef.DragOperation
116 122
117 func (h *handlerSet) OnScrollOffsetChanged(_ purecef.Browser, _ float64, _ float64) {}123 func (h *handlerSet) OnScrollOffsetChanged(_ purecef.Browser, _ float64, _ float64) {}
118 124
119-func (h *handlerSet) OnImeCompositionRangeChanged(_ purecef.Browser, _ uintptr, _ int, _ uintptr) {125+func (h *handlerSet) OnImeCompositionRangeChanged(_ purecef.Browser, _ *purecef.Range, _ int, _ uintptr) {
120 }126 }
121 127
122-func (h *handlerSet) OnTextSelectionChanged(_ purecef.Browser, _ string, _ uintptr) {}128+func (h *handlerSet) OnTextSelectionChanged(_ purecef.Browser, _ string, _ *purecef.Range) {}
123 129
124 func (h *handlerSet) OnVirtualKeyboardRequested(_ purecef.Browser, _ purecef.TextInputMode) {}130 func (h *handlerSet) OnVirtualKeyboardRequested(_ purecef.Browser, _ purecef.TextInputMode) {}
125 131
@@ -176,22 +182,22 @@ func (h *handlerSet) OnConsoleMessage(_ purecef.Browser, _ purecef.LogSeverity,
176 return 0182 return 0
177 }183 }
178 184
179-func (h *handlerSet) OnAutoResize(_ purecef.Browser, _ uintptr) int32 { return 0 }185+func (h *handlerSet) OnAutoResize(_ purecef.Browser, _ *purecef.Size) int32 { return 0 }
180 186
181 // OnLoadingProgressChange updates the cached progress value.187 // OnLoadingProgressChange updates the cached progress value.
182 func (h *handlerSet) OnLoadingProgressChange(_ purecef.Browser, progress float64) {188 func (h *handlerSet) OnLoadingProgressChange(_ purecef.Browser, progress float64) {
183 h.wv.updateProgress(progress)189 h.wv.updateProgress(progress)
184 }190 }
185 191
186-func (h *handlerSet) OnCursorChange(_ purecef.Browser, _ uintptr, _ purecef.CursorType, _ uintptr) int32 {192+func (h *handlerSet) OnCursorChange(_ purecef.Browser, _ uintptr, _ purecef.CursorType, _ *purecef.CursorInfo) int32 {
187 return 0193 return 0
188 }194 }
189 195
190 func (h *handlerSet) OnMediaAccessChange(_ purecef.Browser, _ int32, _ int32) {}196 func (h *handlerSet) OnMediaAccessChange(_ purecef.Browser, _ int32, _ int32) {}
191 197
192-func (h *handlerSet) OnContentsBoundsChange(_ purecef.Browser, _ uintptr) int32 { return 0 }198+func (h *handlerSet) OnContentsBoundsChange(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }
193 199
194-func (h *handlerSet) GetRootWindowScreenRect(_ purecef.Browser, _ uintptr) int32 { return 0 }200+func (h *handlerSet) GetRootWindowScreenRect(_ purecef.Browser, _ *purecef.Rect) int32 { return 0 }
195 201
196 // ===========================================================================202 // ===========================================================================
197 // LoadHandler (4 methods)203 // LoadHandler (4 methods)
@@ -254,7 +260,7 @@ func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.E
254 // ===========================================================================260 // ===========================================================================
255 261
256 // OnBeforePopup blocks all popups in Phase 1.262 // OnBeforePopup blocks all popups in Phase 1.
257-func (h *handlerSet) OnBeforePopup(_ purecef.Browser, _ purecef.Frame, _ int32, _ string, _ string, _ purecef.WindowOpenDisposition, _ int32, _ uintptr, _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings, _ unsafe.Pointer, _ unsafe.Pointer) bool {263+func (h *handlerSet) OnBeforePopup(_ purecef.Browser, _ purecef.Frame, _ int32, _ string, _ string, _ purecef.WindowOpenDisposition, _ int32, _ *purecef.PopupFeatures, _ *purecef.WindowInfo, _ unsafe.Pointer, _ *purecef.BrowserSettings, _ unsafe.Pointer, _ unsafe.Pointer) bool {
258 return true // block264 return true // block
259 }265 }
260 266

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 8

Tags 42

↑↓ moveenter openesc close