detached ba33fa2

fix(context-menu): use puregotk pointer type checks

commit
ba33fa252c15cec703c58a955e024eb1999718cc
author
brice · · 2026-04-14 18:04 UTC
parent
0a87b78
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +5 -6
M go.mod +1 -1
@@ -7,7 +7,7 @@ require (
77 github.com/bnema/purego-ffmpeg v0.3.0
88 github.com/bnema/purego-pipewire v0.1.1
99 github.com/bnema/purego-sqlite v0.1.1
10- github.com/bnema/puregotk v0.3.0
10+ github.com/bnema/puregotk v0.4.0
1111 github.com/bnema/puregotk-webkit v0.0.16
1212 github.com/charmbracelet/bubbles v1.0.0
1313 github.com/charmbracelet/bubbletea v1.3.10
@@ -7,7 +7,7 @@ require (
7 github.com/bnema/purego-ffmpeg v0.3.07 github.com/bnema/purego-ffmpeg v0.3.0
8 github.com/bnema/purego-pipewire v0.1.18 github.com/bnema/purego-pipewire v0.1.1
9 github.com/bnema/purego-sqlite v0.1.19 github.com/bnema/purego-sqlite v0.1.1
10- github.com/bnema/puregotk v0.3.010+ github.com/bnema/puregotk v0.4.0
11 github.com/bnema/puregotk-webkit v0.0.1611 github.com/bnema/puregotk-webkit v0.0.16
12 github.com/charmbracelet/bubbles v1.0.012 github.com/charmbracelet/bubbles v1.0.0
13 github.com/charmbracelet/bubbletea v1.3.1013 github.com/charmbracelet/bubbletea v1.3.10
M go.sum +2 -2 generated file: collapsed
M internal/infrastructure/gtkmenu/renderer.go +1 -2
@@ -5,7 +5,6 @@ import (
55 "github.com/bnema/puregotk/v4/gdk"
66 "github.com/bnema/puregotk/v4/gobject"
77 "github.com/bnema/puregotk/v4/gtk"
8- "unsafe"
98 )
109
1110 type renderItem struct {
@@ -200,7 +199,7 @@ func overlayFromWidget(widget *gtk.Widget) *gtk.Overlay {
200199 if widget == nil || widget.GoPointer() == 0 {
201200 return nil
202201 }
203- if !gobject.TypeCheckInstanceIsA((*gobject.TypeInstance)(unsafe.Pointer(widget.GoPointer())), gtk.OverlayGLibType()) {
202+ if !gobject.TypeCheckInstanceIsAPtr(widget.GoPointer(), gtk.OverlayGLibType()) {
204203 return nil
205204 }
206205 return gtk.OverlayNewFromInternalPtr(widget.GoPointer())
@@ -5,7 +5,6 @@ import (
5 "github.com/bnema/puregotk/v4/gdk"5 "github.com/bnema/puregotk/v4/gdk"
6 "github.com/bnema/puregotk/v4/gobject"6 "github.com/bnema/puregotk/v4/gobject"
7 "github.com/bnema/puregotk/v4/gtk"7 "github.com/bnema/puregotk/v4/gtk"
8- "unsafe"
9 )8 )
10 9
11 type renderItem struct {10 type renderItem struct {
@@ -200,7 +199,7 @@ func overlayFromWidget(widget *gtk.Widget) *gtk.Overlay {
200 if widget == nil || widget.GoPointer() == 0 {199 if widget == nil || widget.GoPointer() == 0 {
201 return nil200 return nil
202 }201 }
203- if !gobject.TypeCheckInstanceIsA((*gobject.TypeInstance)(unsafe.Pointer(widget.GoPointer())), gtk.OverlayGLibType()) {202+ if !gobject.TypeCheckInstanceIsAPtr(widget.GoPointer(), gtk.OverlayGLibType()) {
204 return nil203 return nil
205 }204 }
206 return gtk.OverlayNewFromInternalPtr(widget.GoPointer())205 return gtk.OverlayNewFromInternalPtr(widget.GoPointer())
M internal/infrastructure/webkit/context_menu_test.go +1 -1
@@ -232,7 +232,7 @@ func TestResolveImageData(t *testing.T) {
232232 })
233233
234234 t.Run("rejects spoofed image headers when sniffed bytes are not an image", func(t *testing.T) {
235- srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
235+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
236236 w.Header().Set("Content-Type", "image/png")
237237 w.Write([]byte("<html><body>not really an image</body></html>"))
238238 }))
@@ -232,7 +232,7 @@ func TestResolveImageData(t *testing.T) {
232 })232 })
233 233
234 t.Run("rejects spoofed image headers when sniffed bytes are not an image", func(t *testing.T) {234 t.Run("rejects spoofed image headers when sniffed bytes are not an image", func(t *testing.T) {
235- srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {235+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
236 w.Header().Set("Content-Type", "image/png")236 w.Header().Set("Content-Type", "image/png")
237 w.Write([]byte("<html><body>not really an image</body></html>"))237 w.Write([]byte("<html><body>not really an image</body></html>"))
238 }))238 }))

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