fix(browser): fix quick wins - shortcuts, diagnostics, geometry validator
Fix shortcuts.go (3 errors): - Add missing modifiers parameter (0) to RegisterKeyboardShortcut calls - Fixes cmdorctrl+r, cmdorctrl+shift+r, and F5 reload shortcuts Fix workspace_diagnostics.go (1 error): - Change container != 0 to container != nil (gtk.Widgetter is interface) - Change format from %#x to %p for pointer printing Fix workspace_geometry_validator.go (2 errors): - Change container == 0 to container == nil (gtk.Widgetter is interface) - Fix WidgetGetAllocation call to unpack 4 return values (x, y, width, height) Total: 6 quick-win errors fixed
- commit
- 56de592475fb018939ec1ca7e76fa404edcbc7e3
- author
- bamen · · 2025-10-08 20:34 UTC
- committer
- bamen · · 2025-10-08 16:39 UTC
- parent
- 173610c
- signature
- unsigned
3 files · +11 -11
M internal/app/browser/shortcuts.go +3 -3
| @@ -67,7 +67,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||
| 67 | 67 | // by WindowShortcutHandler at the window level to prevent duplicates | |
| 68 | 68 | ||
| 69 | 69 | // Page refresh shortcuts | |
| 70 | - | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+r", func() { | |
| 70 | + | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+r", 0, func() { | |
| 71 | 71 | if !s.isActivePane() { | |
| 72 | 72 | return | |
| 73 | 73 | } | |
| @@ -75,7 +75,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||
| 75 | 75 | _ = s.webView.Reload() | |
| 76 | 76 | }) | |
| 77 | 77 | ||
| 78 | - | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+shift+r", func() { | |
| 78 | + | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+shift+r", 0, func() { | |
| 79 | 79 | if !s.isActivePane() { | |
| 80 | 80 | return | |
| 81 | 81 | } | |
| @@ -83,7 +83,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||
| 83 | 83 | _ = s.webView.ReloadBypassCache() | |
| 84 | 84 | }) | |
| 85 | 85 | ||
| 86 | - | _ = s.webView.RegisterKeyboardShortcut("F5", func() { | |
| 86 | + | _ = s.webView.RegisterKeyboardShortcut("F5", 0, func() { | |
| 87 | 87 | if !s.isActivePane() { | |
| 88 | 88 | return | |
| 89 | 89 | } | |
| @@ -67,7 +67,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||||
| 67 | // by WindowShortcutHandler at the window level to prevent duplicates | 67 | // by WindowShortcutHandler at the window level to prevent duplicates | ||
| 68 | 68 | ||||
| 69 | // Page refresh shortcuts | 69 | // Page refresh shortcuts | ||
| 70 | - | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+r", func() { | 70 | + | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+r", 0, func() { |
| 71 | if !s.isActivePane() { | 71 | if !s.isActivePane() { | ||
| 72 | return | 72 | return | ||
| 73 | } | 73 | } | ||
| @@ -75,7 +75,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||||
| 75 | _ = s.webView.Reload() | 75 | _ = s.webView.Reload() | ||
| 76 | }) | 76 | }) | ||
| 77 | 77 | ||||
| 78 | - | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+shift+r", func() { | 78 | + | _ = s.webView.RegisterKeyboardShortcut("cmdorctrl+shift+r", 0, func() { |
| 79 | if !s.isActivePane() { | 79 | if !s.isActivePane() { | ||
| 80 | return | 80 | return | ||
| 81 | } | 81 | } | ||
| @@ -83,7 +83,7 @@ func (s *ShortcutHandler) RegisterShortcuts() { | |||||
| 83 | _ = s.webView.ReloadBypassCache() | 83 | _ = s.webView.ReloadBypassCache() | ||
| 84 | }) | 84 | }) | ||
| 85 | 85 | ||||
| 86 | - | _ = s.webView.RegisterKeyboardShortcut("F5", func() { | 86 | + | _ = s.webView.RegisterKeyboardShortcut("F5", 0, func() { |
| 87 | if !s.isActivePane() { | 87 | if !s.isActivePane() { | ||
| 88 | return | 88 | return | ||
| 89 | } | 89 | } | ||
M internal/app/browser/workspace_diagnostics.go +2 -2
| @@ -134,8 +134,8 @@ func describePaneNode(node *paneNode) string { | |||
| 134 | 134 | parts = append(parts, fmt.Sprintf("split orientation=%d", node.orientation)) | |
| 135 | 135 | } | |
| 136 | 136 | ||
| 137 | - | if node.container != 0 { | |
| 138 | - | parts = append(parts, fmt.Sprintf("widget=%#x", node.container)) | |
| 137 | + | if node.container != nil { | |
| 138 | + | parts = append(parts, fmt.Sprintf("widget=%p", node.container)) | |
| 139 | 139 | } | |
| 140 | 140 | ||
| 141 | 141 | if node.parent != nil { | |
| @@ -134,8 +134,8 @@ func describePaneNode(node *paneNode) string { | |||||
| 134 | parts = append(parts, fmt.Sprintf("split orientation=%d", node.orientation)) | 134 | parts = append(parts, fmt.Sprintf("split orientation=%d", node.orientation)) | ||
| 135 | } | 135 | } | ||
| 136 | 136 | ||||
| 137 | - | if node.container != 0 { | 137 | + | if node.container != nil { |
| 138 | - | parts = append(parts, fmt.Sprintf("widget=%#x", node.container)) | 138 | + | parts = append(parts, fmt.Sprintf("widget=%p", node.container)) |
| 139 | } | 139 | } | ||
| 140 | 140 | ||||
| 141 | if node.parent != nil { | 141 | if node.parent != nil { | ||
M internal/app/browser/workspace_geometry_validator.go +6 -6
| @@ -50,7 +50,7 @@ func (gv *GeometryValidator) SetDebugMode(debug bool) { | |||
| 50 | 50 | func (gv *GeometryValidator) GetPaneGeometry(node *paneNode) PaneGeometry { | |
| 51 | 51 | geometry := PaneGeometry{IsValid: false} | |
| 52 | 52 | ||
| 53 | - | if node == nil || node.container == 0 { | |
| 53 | + | if node == nil || node.container == nil { | |
| 54 | 54 | if gv.debugMode { | |
| 55 | 55 | log.Printf("[geometry] Invalid node or missing container") | |
| 56 | 56 | } | |
| @@ -58,12 +58,12 @@ func (gv *GeometryValidator) GetPaneGeometry(node *paneNode) PaneGeometry { | |||
| 58 | 58 | } | |
| 59 | 59 | ||
| 60 | 60 | // Get widget allocation directly - GTK operations are always on main thread | |
| 61 | - | allocation := webkit.WidgetGetAllocation(node.container) | |
| 61 | + | x, y, width, height := webkit.WidgetGetAllocation(node.container) | |
| 62 | 62 | ||
| 63 | - | geometry.X = allocation.X | |
| 64 | - | geometry.Y = allocation.Y | |
| 65 | - | geometry.Width = allocation.Width | |
| 66 | - | geometry.Height = allocation.Height | |
| 63 | + | geometry.X = x | |
| 64 | + | geometry.Y = y | |
| 65 | + | geometry.Width = width | |
| 66 | + | geometry.Height = height | |
| 67 | 67 | geometry.IsValid = true | |
| 68 | 68 | ||
| 69 | 69 | if gv.debugMode { | |
| @@ -50,7 +50,7 @@ func (gv *GeometryValidator) SetDebugMode(debug bool) { | |||||
| 50 | func (gv *GeometryValidator) GetPaneGeometry(node *paneNode) PaneGeometry { | 50 | func (gv *GeometryValidator) GetPaneGeometry(node *paneNode) PaneGeometry { | ||
| 51 | geometry := PaneGeometry{IsValid: false} | 51 | geometry := PaneGeometry{IsValid: false} | ||
| 52 | 52 | ||||
| 53 | - | if node == nil || node.container == 0 { | 53 | + | if node == nil || node.container == nil { |
| 54 | if gv.debugMode { | 54 | if gv.debugMode { | ||
| 55 | log.Printf("[geometry] Invalid node or missing container") | 55 | log.Printf("[geometry] Invalid node or missing container") | ||
| 56 | } | 56 | } | ||
| @@ -58,12 +58,12 @@ func (gv *GeometryValidator) GetPaneGeometry(node *paneNode) PaneGeometry { | |||||
| 58 | } | 58 | } | ||
| 59 | 59 | ||||
| 60 | // Get widget allocation directly - GTK operations are always on main thread | 60 | // Get widget allocation directly - GTK operations are always on main thread | ||
| 61 | - | allocation := webkit.WidgetGetAllocation(node.container) | 61 | + | x, y, width, height := webkit.WidgetGetAllocation(node.container) |
| 62 | 62 | ||||
| 63 | - | geometry.X = allocation.X | 63 | + | geometry.X = x |
| 64 | - | geometry.Y = allocation.Y | 64 | + | geometry.Y = y |
| 65 | - | geometry.Width = allocation.Width | 65 | + | geometry.Width = width |
| 66 | - | geometry.Height = allocation.Height | 66 | + | geometry.Height = height |
| 67 | geometry.IsValid = true | 67 | geometry.IsValid = true | ||
| 68 | 68 | ||||
| 69 | if gv.debugMode { | 69 | if gv.debugMode { | ||