chore(cef): prepare touchpad branch for review
- commit
- 21a8658c478c2e166bd132959215a523e0436c62
- author
- brice · · 2026-06-08 21:02 UTC
- parent
- 8453767
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
5 files · +18 -14
M docs/config/index.md +2 -0
| @@ -203,6 +203,8 @@ border = "#363636" | |||
| 203 | 203 | | `engine.cef.input.touchpad_navigation_min_delta` | float | `200.0` | > 0 | Minimum accumulated horizontal swipe delta required for navigation | | |
| 204 | 204 | | `engine.cef.input.touchpad_navigation_max_vertical_ratio` | float | `0.5` | > 0 | Maximum vertical-to-horizontal delta ratio allowed for navigation swipes | | |
| 205 | 205 | | `default_ui_scale` | float | `1.0` | > 0 | GTK widget UI scale (1.0=100%, 2.0=200%) | | |
| 206 | + | ||
| 207 | + | `engine.cef.input.touchpad_navigation_min_delta` uses raw GTK touchpad surface units for back/forward gestures. The default `200.0` matches WebKit-style commit distance to reduce accidental navigation; raise or lower it in `config.toml` to tune gesture sensitivity. | |
| 206 | 208 | | `default_webpage_zoom` | float | `1.2` | > 0 | Default page zoom (1.0=100%, 1.2=120%) | | |
| 207 | 209 | ||
| 208 | 210 | ## Workspace Configuration | |
| @@ -203,6 +203,8 @@ border = "#363636" | |||||
| 203 | | `engine.cef.input.touchpad_navigation_min_delta` | float | `200.0` | > 0 | Minimum accumulated horizontal swipe delta required for navigation | | 203 | | `engine.cef.input.touchpad_navigation_min_delta` | float | `200.0` | > 0 | Minimum accumulated horizontal swipe delta required for navigation | | ||
| 204 | | `engine.cef.input.touchpad_navigation_max_vertical_ratio` | float | `0.5` | > 0 | Maximum vertical-to-horizontal delta ratio allowed for navigation swipes | | 204 | | `engine.cef.input.touchpad_navigation_max_vertical_ratio` | float | `0.5` | > 0 | Maximum vertical-to-horizontal delta ratio allowed for navigation swipes | | ||
| 205 | | `default_ui_scale` | float | `1.0` | > 0 | GTK widget UI scale (1.0=100%, 2.0=200%) | | 205 | | `default_ui_scale` | float | `1.0` | > 0 | GTK widget UI scale (1.0=100%, 2.0=200%) | | ||
| 206 | + | ||||
| 207 | + | `engine.cef.input.touchpad_navigation_min_delta` uses raw GTK touchpad surface units for back/forward gestures. The default `200.0` matches WebKit-style commit distance to reduce accidental navigation; raise or lower it in `config.toml` to tune gesture sensitivity. | |||
| 206 | | `default_webpage_zoom` | float | `1.2` | > 0 | Default page zoom (1.0=100%, 1.2=120%) | | 208 | | `default_webpage_zoom` | float | `1.2` | > 0 | Default page zoom (1.0=100%, 1.2=120%) | | ||
| 207 | 209 | ||||
| 208 | ## Workspace Configuration | 210 | ## Workspace Configuration | ||
M docs/reference/configuration.md +2 -0
| @@ -73,6 +73,8 @@ | |||
| 73 | 73 | | `engine.cef.input.touchpad_navigation_min_delta` | float | `200.0` | > 0 | | |
| 74 | 74 | | `engine.cef.input.touchpad_navigation_max_vertical_ratio` | float | `0.5` | > 0 | | |
| 75 | 75 | | `default_ui_scale` | float | `1.0` | > 0 | | |
| 76 | + | ||
| 77 | + | `engine.cef.input.touchpad_navigation_min_delta` is measured in raw GTK touchpad surface units. The default `200.0` matches WebKit-style commit distance to reduce accidental back/forward navigation and can be overridden in `config.toml`. | |
| 76 | 78 | | `default_webpage_zoom` | float | `1.2` | > 0 | | |
| 77 | 79 | | `workspace.new_pane_url` | string | `about:blank` | | | |
| 78 | 80 | | `workspace.switch_to_tab_on_move` | bool | `true` | | | |
| @@ -73,6 +73,8 @@ | |||||
| 73 | | `engine.cef.input.touchpad_navigation_min_delta` | float | `200.0` | > 0 | | 73 | | `engine.cef.input.touchpad_navigation_min_delta` | float | `200.0` | > 0 | | ||
| 74 | | `engine.cef.input.touchpad_navigation_max_vertical_ratio` | float | `0.5` | > 0 | | 74 | | `engine.cef.input.touchpad_navigation_max_vertical_ratio` | float | `0.5` | > 0 | | ||
| 75 | | `default_ui_scale` | float | `1.0` | > 0 | | 75 | | `default_ui_scale` | float | `1.0` | > 0 | | ||
| 76 | + | ||||
| 77 | + | `engine.cef.input.touchpad_navigation_min_delta` is measured in raw GTK touchpad surface units. The default `200.0` matches WebKit-style commit distance to reduce accidental back/forward navigation and can be overridden in `config.toml`. | |||
| 76 | | `default_webpage_zoom` | float | `1.2` | > 0 | | 78 | | `default_webpage_zoom` | float | `1.2` | > 0 | | ||
| 77 | | `workspace.new_pane_url` | string | `about:blank` | | | 79 | | `workspace.new_pane_url` | string | `about:blank` | | | ||
| 78 | | `workspace.switch_to_tab_on_move` | bool | `true` | | | 80 | | `workspace.switch_to_tab_on_move` | bool | `true` | | | ||
M go.mod +1 -3
| @@ -7,7 +7,7 @@ require ( | |||
| 7 | 7 | github.com/andybalholm/brotli v1.2.1 | |
| 8 | 8 | github.com/bnema/purego v0.11.0-bnema.3 | |
| 9 | 9 | github.com/bnema/purego-cef v0.13.2 | |
| 10 | - | github.com/bnema/purego-cef2gtk v0.7.0 | |
| 10 | + | github.com/bnema/purego-cef2gtk v0.7.1-0.20260608204515-03f646765b43 | |
| 11 | 11 | github.com/bnema/purego-pipewire v0.1.4 | |
| 12 | 12 | github.com/bnema/purego-sqlite v0.1.3 | |
| 13 | 13 | github.com/bnema/puregotk v0.6.0 | |
| @@ -83,5 +83,3 @@ require ( | |||
| 83 | 83 | ) | |
| 84 | 84 | ||
| 85 | 85 | tool github.com/a-h/templ/cmd/templ | |
| 86 | - | ||
| 87 | - | replace github.com/bnema/purego-cef2gtk => ../purego-cef2gtk | |
| @@ -7,7 +7,7 @@ require ( | |||||
| 7 | github.com/andybalholm/brotli v1.2.1 | 7 | github.com/andybalholm/brotli v1.2.1 | ||
| 8 | github.com/bnema/purego v0.11.0-bnema.3 | 8 | github.com/bnema/purego v0.11.0-bnema.3 | ||
| 9 | github.com/bnema/purego-cef v0.13.2 | 9 | github.com/bnema/purego-cef v0.13.2 | ||
| 10 | - | github.com/bnema/purego-cef2gtk v0.7.0 | 10 | + | github.com/bnema/purego-cef2gtk v0.7.1-0.20260608204515-03f646765b43 |
| 11 | github.com/bnema/purego-pipewire v0.1.4 | 11 | github.com/bnema/purego-pipewire v0.1.4 | ||
| 12 | github.com/bnema/purego-sqlite v0.1.3 | 12 | github.com/bnema/purego-sqlite v0.1.3 | ||
| 13 | github.com/bnema/puregotk v0.6.0 | 13 | github.com/bnema/puregotk v0.6.0 | ||
| @@ -83,5 +83,3 @@ require ( | |||||
| 83 | ) | 83 | ) | ||
| 84 | 84 | ||||
| 85 | tool github.com/a-h/templ/cmd/templ | 85 | tool github.com/a-h/templ/cmd/templ | ||
| 86 | - | ||||
| 87 | - | replace github.com/bnema/purego-cef2gtk => ../purego-cef2gtk | |||
M go.sum +2 -2 generated file: collapsed
M internal/infrastructure/cef/webview.go +11 -9
| @@ -1523,7 +1523,7 @@ func (wv *WebView) handleScrollInputDiagnostic(event cef2gtk.ScrollEvent) cef2gt | |||
| 1523 | 1523 | wv.inputDiagLastLog = now | |
| 1524 | 1524 | wv.inputDiagMu.Unlock() | |
| 1525 | 1525 | ||
| 1526 | - | logging.FromContext(wv.ctx).Debug(). | |
| 1526 | + | logging.FromContext(wv.ctx).Trace(). | |
| 1527 | 1527 | Uint64("webview_id", uint64(wv.id)). | |
| 1528 | 1528 | Int("events", count). | |
| 1529 | 1529 | Str("phase", fmt.Sprint(event.Phase)). | |
| @@ -1544,20 +1544,22 @@ func (wv *WebView) handleScrollInputDiagnostic(event cef2gtk.ScrollEvent) cef2gt | |||
| 1544 | 1544 | } | |
| 1545 | 1545 | ||
| 1546 | 1546 | func (wv *WebView) handleNavigationSwipeAction(action cef2gtk.NavigationSwipeAction) { | |
| 1547 | - | logging.FromContext(wv.ctx).Debug(). | |
| 1548 | - | Uint64("webview_id", uint64(wv.id)). | |
| 1549 | - | Str("action", fmt.Sprint(action)). | |
| 1550 | - | Bool("can_go_back", wv.CanGoBack()). | |
| 1551 | - | Bool("can_go_forward", wv.CanGoForward()). | |
| 1552 | - | Msg("cef: touchpad navigation swipe recognized") | |
| 1547 | + | if wv.ctx != nil { | |
| 1548 | + | logging.FromContext(wv.ctx).Debug(). | |
| 1549 | + | Uint64("webview_id", uint64(wv.id)). | |
| 1550 | + | Str("action", fmt.Sprint(action)). | |
| 1551 | + | Bool("can_go_back", wv.CanGoBack()). | |
| 1552 | + | Bool("can_go_forward", wv.CanGoForward()). | |
| 1553 | + | Msg("cef: touchpad navigation swipe recognized") | |
| 1554 | + | } | |
| 1553 | 1555 | ||
| 1554 | 1556 | switch action { | |
| 1555 | 1557 | case cef2gtk.NavigationSwipeBack: | |
| 1556 | - | if err := wv.GoBack(wv.ctx); err != nil { | |
| 1558 | + | if err := wv.GoBack(wv.ctx); err != nil && wv.ctx != nil { | |
| 1557 | 1559 | logging.FromContext(wv.ctx).Warn().Err(err).Msg("touchpad back navigation failed") | |
| 1558 | 1560 | } | |
| 1559 | 1561 | case cef2gtk.NavigationSwipeForward: | |
| 1560 | - | if err := wv.GoForward(wv.ctx); err != nil { | |
| 1562 | + | if err := wv.GoForward(wv.ctx); err != nil && wv.ctx != nil { | |
| 1561 | 1563 | logging.FromContext(wv.ctx).Warn().Err(err).Msg("touchpad forward navigation failed") | |
| 1562 | 1564 | } | |
| 1563 | 1565 | } | |
| @@ -1523,7 +1523,7 @@ func (wv *WebView) handleScrollInputDiagnostic(event cef2gtk.ScrollEvent) cef2gt | |||||
| 1523 | wv.inputDiagLastLog = now | 1523 | wv.inputDiagLastLog = now | ||
| 1524 | wv.inputDiagMu.Unlock() | 1524 | wv.inputDiagMu.Unlock() | ||
| 1525 | 1525 | ||||
| 1526 | - | logging.FromContext(wv.ctx).Debug(). | 1526 | + | logging.FromContext(wv.ctx).Trace(). |
| 1527 | Uint64("webview_id", uint64(wv.id)). | 1527 | Uint64("webview_id", uint64(wv.id)). | ||
| 1528 | Int("events", count). | 1528 | Int("events", count). | ||
| 1529 | Str("phase", fmt.Sprint(event.Phase)). | 1529 | Str("phase", fmt.Sprint(event.Phase)). | ||
| @@ -1544,20 +1544,22 @@ func (wv *WebView) handleScrollInputDiagnostic(event cef2gtk.ScrollEvent) cef2gt | |||||
| 1544 | } | 1544 | } | ||
| 1545 | 1545 | ||||
| 1546 | func (wv *WebView) handleNavigationSwipeAction(action cef2gtk.NavigationSwipeAction) { | 1546 | func (wv *WebView) handleNavigationSwipeAction(action cef2gtk.NavigationSwipeAction) { | ||
| 1547 | - | logging.FromContext(wv.ctx).Debug(). | 1547 | + | if wv.ctx != nil { |
| 1548 | - | Uint64("webview_id", uint64(wv.id)). | 1548 | + | logging.FromContext(wv.ctx).Debug(). |
| 1549 | - | Str("action", fmt.Sprint(action)). | 1549 | + | Uint64("webview_id", uint64(wv.id)). |
| 1550 | - | Bool("can_go_back", wv.CanGoBack()). | 1550 | + | Str("action", fmt.Sprint(action)). |
| 1551 | - | Bool("can_go_forward", wv.CanGoForward()). | 1551 | + | Bool("can_go_back", wv.CanGoBack()). |
| 1552 | - | Msg("cef: touchpad navigation swipe recognized") | 1552 | + | Bool("can_go_forward", wv.CanGoForward()). |
| 1553 | + | Msg("cef: touchpad navigation swipe recognized") | |||
| 1554 | + | } | |||
| 1553 | 1555 | ||||
| 1554 | switch action { | 1556 | switch action { | ||
| 1555 | case cef2gtk.NavigationSwipeBack: | 1557 | case cef2gtk.NavigationSwipeBack: | ||
| 1556 | - | if err := wv.GoBack(wv.ctx); err != nil { | 1558 | + | if err := wv.GoBack(wv.ctx); err != nil && wv.ctx != nil { |
| 1557 | logging.FromContext(wv.ctx).Warn().Err(err).Msg("touchpad back navigation failed") | 1559 | logging.FromContext(wv.ctx).Warn().Err(err).Msg("touchpad back navigation failed") | ||
| 1558 | } | 1560 | } | ||
| 1559 | case cef2gtk.NavigationSwipeForward: | 1561 | case cef2gtk.NavigationSwipeForward: | ||
| 1560 | - | if err := wv.GoForward(wv.ctx); err != nil { | 1562 | + | if err := wv.GoForward(wv.ctx); err != nil && wv.ctx != nil { |
| 1561 | logging.FromContext(wv.ctx).Warn().Err(err).Msg("touchpad forward navigation failed") | 1563 | logging.FromContext(wv.ctx).Warn().Err(err).Msg("touchpad forward navigation failed") | ||
| 1562 | } | 1564 | } | ||
| 1563 | } | 1565 | } | ||