detached 5041353

click_diagnostics.go RawHistoryFolder

1package cef
2
3import (
4	"fmt"
5
6	"github.com/bnema/dumber/internal/logging"
7	cef2gtk "github.com/bnema/purego-cef2gtk"
8	"github.com/rs/zerolog"
9)
10
11func clickDiagnosticPhaseName(phase cef2gtk.ClickDiagnosticPhase) string {
12	switch phase {
13	case cef2gtk.ClickDiagnosticPressed:
14		return "pressed"
15	case cef2gtk.ClickDiagnosticReleased:
16		return "released"
17	case cef2gtk.ClickDiagnosticCancelled:
18		return "canceled"
19	case cef2gtk.ClickDiagnosticForwarded:
20		return "forwarded"
21	case cef2gtk.ClickDiagnosticConsumed:
22		return "consumed"
23	case cef2gtk.ClickDiagnosticDropped:
24		return "dropped"
25	default:
26		return fmt.Sprintf("unknown(%d)", phase)
27	}
28}
29
30func clickDropReasonName(reason cef2gtk.ClickDropReason) string {
31	switch reason {
32	case cef2gtk.ClickDropReasonNone:
33		return "none"
34	case cef2gtk.ClickDropReasonMissingHost:
35		return "missing_host"
36	case cef2gtk.ClickDropReasonDetached:
37		return "detached"
38	case cef2gtk.ClickDropReasonMissingInputState:
39		return "missing_input_state"
40	default:
41		return fmt.Sprintf("unknown(%d)", reason)
42	}
43}
44
45func clickButtonName(button uint) string {
46	switch button {
47	case 1:
48		return "primary"
49	case 2:
50		return "middle"
51	case 3:
52		return "secondary"
53	default:
54		return "other"
55	}
56}
57
58func (wv *WebView) logClickDiagnostic(event cef2gtk.ClickDiagnosticEvent) {
59	if wv == nil || wv.ctx == nil {
60		return
61	}
62	wv.mu.RLock()
63	browserID := int32(0)
64	if wv.browser != nil {
65		browserID = wv.browser.GetIdentifier()
66	}
67	inputAttached := wv.inputAttached
68	visibilityKnown := wv.effectiveVisibilityKnown
69	visible := wv.effectiveVisible
70	bridge := wv.viewBridge
71	bridgePresent := bridge != nil
72	wv.mu.RUnlock()
73	bridgeFocused := bridgePresent && bridge.HasFocus()
74
75	logger := logging.FromContext(wv.ctx)
76	var logEvent *zerolog.Event
77	if event.Phase == cef2gtk.ClickDiagnosticDropped || event.Phase == cef2gtk.ClickDiagnosticCancelled {
78		logEvent = logger.Warn()
79	} else {
80		logEvent = logger.Debug()
81	}
82	logEvent.
83		Uint64("webview_id", uint64(wv.id)).
84		Int32("browser_id", browserID).
85		Str("phase", clickDiagnosticPhaseName(event.Phase)).
86		Uint("button", event.Button).
87		Str("button_type", clickButtonName(event.Button)).
88		Int("click_count", event.ClickCount).
89		Str("drop_reason", clickDropReasonName(event.DropReason)).
90		Bool("input_attached", inputAttached).
91		Bool("effective_visibility_known", visibilityKnown).
92		Bool("effective_visible", visible).
93		Bool("destroyed", wv.destroyed.Load()).
94		Bool("bridge_present", bridgePresent).
95		Bool("bridge_focused", bridgeFocused).
96		Msg("cef: click routing diagnostic")
97}

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