v0.11.0 dc50343

window_handler_cgo.go RawHistoryFolder

1//go:build webkit_cgo
2
3package webkit
4
5/*
6#cgo pkg-config: gtk4 webkitgtk-6.0
7#include <gtk/gtk.h>
8#include <gdk/gdk.h>
9#include <webkit/webkit.h>
10
11// Declarations for Go callbacks
12extern GtkWidget* goHandleCreateWebView(unsigned long id, char* uri);
13
14// Handle create signal for popup windows - essential for window.open() support
15static GtkWidget* on_create_web_view(WebKitWebView *web_view,
16                                     WebKitNavigationAction *navigation_action,
17                                     gpointer user_data) {
18    WebKitURIRequest *request = webkit_navigation_action_get_request(navigation_action);
19    const char* uri = webkit_uri_request_get_uri(request);
20
21    printf("[webkit-create] Create signal for URI: %s\n", uri ? uri : "NULL");
22
23    unsigned long parent_view_id = (unsigned long)user_data;
24
25    // Let Go handler create WebView and return it like Epiphany does
26    GtkWidget* new_webview = goHandleCreateWebView(parent_view_id, (char*)uri);
27
28    if (new_webview) {
29        printf("[webkit-create] Go handler provided WebView - using workspace pane\n");
30        return new_webview;
31    } else {
32        printf("[webkit-create] Go handler declined - allowing native popup window\n");
33        return NULL; // Let WebKit create native popup window
34    }
35}
36
37static void connect_create_signal(WebKitWebView* web_view, unsigned long id) {
38    if (!web_view) return;
39    g_signal_connect_data(G_OBJECT(web_view), "create", G_CALLBACK(on_create_web_view), (gpointer)id, NULL, 0);
40    printf("[webkit-debug] create-web-view callback ENABLED with WebKit-created WebViews\n");
41}
42*/
43import "C"
44import (
45	"log"
46	"unsafe"
47)
48
49//export goHandleCreateWebView
50func goHandleCreateWebView(parentID C.ulong, curi *C.char) *C.GtkWidget {
51	uri := ""
52	if curi != nil {
53		uri = C.GoString(curi)
54	}
55
56	log.Printf("[webkit] Create signal bypassed: URI=%s (handled by JavaScript bypass)", uri)
57
58	// Always return NULL - window.open is now handled entirely by JavaScript bypass
59	// This prevents duplicate pane creation from WebKit's create signal
60	return nil
61}
62
63// ConnectCreateSignal connects the create signal to a WebView
64func ConnectCreateSignal(view *WebView) {
65	if view == nil || view.native == nil || view.native.view == nil {
66		log.Printf("[webkit] ConnectCreateSignal: invalid WebView")
67		return
68	}
69
70	webkitView := (*C.WebKitWebView)(unsafe.Pointer(view.native.view))
71	C.connect_create_signal(webkitView, C.ulong(view.id))
72}

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