detached 7f3cf6d

refactor(browser): fix focus_state_machine widget method calls

- Fixed 3 widget method call errors in focus_state_machine.go
- Replaced leaf.container.Allocation() with webkit.WidgetGetAllocation()
- Replaced viewWidget.GrabFocus() with webkit.WidgetGrabFocus()
- Replaced widget.AddController() with webkit.WidgetAddController()
- WidgetGrabFocus already existed in widgets.go, removed duplicate

All widget operations now use webkit helper functions consistently.
commit
7f3cf6d381e5a016359a72ecd2d21a27411cf8d0
author
bamen · · 2025-10-08 16:20 UTC
committer
bamen · · 2025-10-08 20:14 UTC
parent
70d31c4
signature
unsigned
1 file · +4 -7
M internal/app/browser/focus_state_machine.go +4 -7
@@ -561,13 +561,10 @@ func (fsm *FocusStateMachine) findTopLeftPane(leaves []*paneNode) *paneNode {
561561 continue
562562 }
563563
564- bounds := leaf.container.Allocation()
565- if bounds == nil {
566- continue
567- }
564+ x, y, _, _ := webkit.WidgetGetAllocation(leaf.container)
568565
569566 // Score based on distance from top-left corner (0,0)
570- score := float64(bounds.X()) + float64(bounds.Y())
567+ score := float64(x) + float64(y)
571568 if score < bestScore {
572569 bestScore = score
573570 bestPane = leaf
@@ -630,7 +627,7 @@ func (fsm *FocusStateMachine) applyGTKFocus(node *paneNode) error {
630627 return fmt.Errorf("webview has no valid widget")
631628 }
632629
633- viewWidget.GrabFocus()
630+ webkit.WidgetGrabFocus(viewWidget)
634631 return nil
635632 }
636633
@@ -939,7 +936,7 @@ func (fsm *FocusStateMachine) attachGTKController(node *paneNode) {
939936 })
940937
941938 // Add controller to widget
942- widget.AddController(controller)
939+ webkit.WidgetAddController(widget, controller)
943940
944941 // Store controller pointer as token for later removal
945942 node.focusControllerToken = uintptr(controller.Native())
@@ -561,13 +561,10 @@ func (fsm *FocusStateMachine) findTopLeftPane(leaves []*paneNode) *paneNode {
561 continue561 continue
562 }562 }
563 563
564- bounds := leaf.container.Allocation()564+ x, y, _, _ := webkit.WidgetGetAllocation(leaf.container)
565- if bounds == nil {
566- continue
567- }
568 565
569 // Score based on distance from top-left corner (0,0)566 // Score based on distance from top-left corner (0,0)
570- score := float64(bounds.X()) + float64(bounds.Y())567+ score := float64(x) + float64(y)
571 if score < bestScore {568 if score < bestScore {
572 bestScore = score569 bestScore = score
573 bestPane = leaf570 bestPane = leaf
@@ -630,7 +627,7 @@ func (fsm *FocusStateMachine) applyGTKFocus(node *paneNode) error {
630 return fmt.Errorf("webview has no valid widget")627 return fmt.Errorf("webview has no valid widget")
631 }628 }
632 629
633- viewWidget.GrabFocus()630+ webkit.WidgetGrabFocus(viewWidget)
634 return nil631 return nil
635 }632 }
636 633
@@ -939,7 +936,7 @@ func (fsm *FocusStateMachine) attachGTKController(node *paneNode) {
939 })936 })
940 937
941 // Add controller to widget938 // Add controller to widget
942- widget.AddController(controller)939+ webkit.WidgetAddController(widget, controller)
943 940
944 // Store controller pointer as token for later removal941 // Store controller pointer as token for later removal
945 node.focusControllerToken = uintptr(controller.Native())942 node.focusControllerToken = uintptr(controller.Native())

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