detached 2b5245e

refactor(browser): fix workspace_navigation widget method calls

- Fixed 5 widget method call errors in workspace_navigation.go
- Replaced container.AddController() with webkit.WidgetAddController()
- Replaced all container.Allocation() calls with webkit.WidgetGetAllocation()
- Allocation() returned *gdk.Rectangle, now using (x, y, width, height) tuple

All geometric calculations for focus navigation now use webkit helpers.
commit
2b5245e53c1d7fce46b0d4fac7afe9ad1b6fed53
author
bamen · · 2025-10-08 18:01 UTC
committer
bamen · · 2025-10-08 16:23 UTC
parent
7f3cf6d
signature
unsigned
1 file · +13 -27
M internal/app/browser/workspace_navigation.go +13 -27
@@ -107,7 +107,7 @@ func (wm *WorkspaceManager) ensureHover(node *paneNode) {
107107 wm.SetActivePane(node, SourceMouse)
108108 })
109109
110- node.container.AddController(controller)
110+ webkit.WidgetAddController(node.container, controller)
111111 // Store controller pointer as token for later removal
112112 node.hoverToken = uintptr(controller.Native())
113113 if node.hoverToken == 0 {
@@ -252,14 +252,9 @@ func (wm *WorkspaceManager) focusAdjacent(direction string) bool {
252252 return true
253253 }
254254
255- currentBounds := currentFocused.container.Allocation()
256- if currentBounds == nil {
257- log.Printf("[workspace] unable to compute bounds for active pane")
258- return false
259- }
260-
261- cx := float64(currentBounds.X()) + float64(currentBounds.Width())/2.0
262- cy := float64(currentBounds.Y()) + float64(currentBounds.Height())/2.0
255+ curX, curY, curWidth, curHeight := webkit.WidgetGetAllocation(currentFocused.container)
256+ cx := float64(curX) + float64(curWidth)/2.0
257+ cy := float64(curY) + float64(curHeight)/2.0
263258
264259 leaves := wm.collectLeaves()
265260 bestScore := math.MaxFloat64
@@ -271,12 +266,9 @@ func (wm *WorkspaceManager) focusAdjacent(direction string) bool {
271266 continue
272267 }
273268
274- bounds := candidate.container.Allocation()
275- if bounds == nil {
276- continue
277- }
278- tx := float64(bounds.X()) + float64(bounds.Width())/2.0
279- ty := float64(bounds.Y()) + float64(bounds.Height())/2.0
269+ x, y, width, height := webkit.WidgetGetAllocation(candidate.container)
270+ tx := float64(x) + float64(width)/2.0
271+ ty := float64(y) + float64(height)/2.0
280272
281273 dx := tx - cx
282274 dy := ty - cy
@@ -332,12 +324,9 @@ func (wm *WorkspaceManager) structuralNeighbor(node *paneNode, direction string)
332324 return nil
333325 }
334326
335- refBounds := node.container.Allocation()
336- if refBounds == nil {
337- return nil
338- }
339- cx := float64(refBounds.X()) + float64(refBounds.Width())/2.0
340- cy := float64(refBounds.Y()) + float64(refBounds.Height())/2.0
327+ refX, refY, refWidth, refHeight := webkit.WidgetGetAllocation(node.container)
328+ cx := float64(refX) + float64(refWidth)/2.0
329+ cy := float64(refY) + float64(refHeight)/2.0
341330 axisVertical := direction == "up" || direction == "down"
342331
343332 for parent := node.parent; parent != nil; parent = parent.parent {
@@ -382,12 +371,9 @@ func (wm *WorkspaceManager) closestLeafFromSubtree(node *paneNode, cx, cy float6
382371 continue
383372 }
384373
385- bounds := leaf.container.Allocation()
386- if bounds == nil {
387- continue
388- }
389- tx := float64(bounds.X()) + float64(bounds.Width())/2.0
390- ty := float64(bounds.Y()) + float64(bounds.Height())/2.0
374+ x, y, width, height := webkit.WidgetGetAllocation(leaf.container)
375+ tx := float64(x) + float64(width)/2.0
376+ ty := float64(y) + float64(height)/2.0
391377 dx := tx - cx
392378 dy := ty - cy
393379 var score float64
@@ -107,7 +107,7 @@ func (wm *WorkspaceManager) ensureHover(node *paneNode) {
107 wm.SetActivePane(node, SourceMouse)107 wm.SetActivePane(node, SourceMouse)
108 })108 })
109 109
110- node.container.AddController(controller)110+ webkit.WidgetAddController(node.container, controller)
111 // Store controller pointer as token for later removal111 // Store controller pointer as token for later removal
112 node.hoverToken = uintptr(controller.Native())112 node.hoverToken = uintptr(controller.Native())
113 if node.hoverToken == 0 {113 if node.hoverToken == 0 {
@@ -252,14 +252,9 @@ func (wm *WorkspaceManager) focusAdjacent(direction string) bool {
252 return true252 return true
253 }253 }
254 254
255- currentBounds := currentFocused.container.Allocation()255+ curX, curY, curWidth, curHeight := webkit.WidgetGetAllocation(currentFocused.container)
256- if currentBounds == nil {256+ cx := float64(curX) + float64(curWidth)/2.0
257- log.Printf("[workspace] unable to compute bounds for active pane")257+ cy := float64(curY) + float64(curHeight)/2.0
258- return false
259- }
260-
261- cx := float64(currentBounds.X()) + float64(currentBounds.Width())/2.0
262- cy := float64(currentBounds.Y()) + float64(currentBounds.Height())/2.0
263 258
264 leaves := wm.collectLeaves()259 leaves := wm.collectLeaves()
265 bestScore := math.MaxFloat64260 bestScore := math.MaxFloat64
@@ -271,12 +266,9 @@ func (wm *WorkspaceManager) focusAdjacent(direction string) bool {
271 continue266 continue
272 }267 }
273 268
274- bounds := candidate.container.Allocation()269+ x, y, width, height := webkit.WidgetGetAllocation(candidate.container)
275- if bounds == nil {270+ tx := float64(x) + float64(width)/2.0
276- continue271+ ty := float64(y) + float64(height)/2.0
277- }
278- tx := float64(bounds.X()) + float64(bounds.Width())/2.0
279- ty := float64(bounds.Y()) + float64(bounds.Height())/2.0
280 272
281 dx := tx - cx273 dx := tx - cx
282 dy := ty - cy274 dy := ty - cy
@@ -332,12 +324,9 @@ func (wm *WorkspaceManager) structuralNeighbor(node *paneNode, direction string)
332 return nil324 return nil
333 }325 }
334 326
335- refBounds := node.container.Allocation()327+ refX, refY, refWidth, refHeight := webkit.WidgetGetAllocation(node.container)
336- if refBounds == nil {328+ cx := float64(refX) + float64(refWidth)/2.0
337- return nil329+ cy := float64(refY) + float64(refHeight)/2.0
338- }
339- cx := float64(refBounds.X()) + float64(refBounds.Width())/2.0
340- cy := float64(refBounds.Y()) + float64(refBounds.Height())/2.0
341 axisVertical := direction == "up" || direction == "down"330 axisVertical := direction == "up" || direction == "down"
342 331
343 for parent := node.parent; parent != nil; parent = parent.parent {332 for parent := node.parent; parent != nil; parent = parent.parent {
@@ -382,12 +371,9 @@ func (wm *WorkspaceManager) closestLeafFromSubtree(node *paneNode, cx, cy float6
382 continue371 continue
383 }372 }
384 373
385- bounds := leaf.container.Allocation()374+ x, y, width, height := webkit.WidgetGetAllocation(leaf.container)
386- if bounds == nil {375+ tx := float64(x) + float64(width)/2.0
387- continue376+ ty := float64(y) + float64(height)/2.0
388- }
389- tx := float64(bounds.X()) + float64(bounds.Width())/2.0
390- ty := float64(bounds.Y()) + float64(bounds.Height())/2.0
391 dx := tx - cx377 dx := tx - cx
392 dy := ty - cy378 dy := ty - cy
393 var score float64379 var score float64

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