v0.3.0 d226234

research.md RawHistoryFolder

Research: WebKitGTK 6.0 Migration

API Migration Research

Decision: WebKitGTK 6.0 with GTK4

Rationale:

  • GTK4 provides native Vulkan renderer support
  • WebKitGTK 6.0 is the only actively maintained version for GTK4
  • Enables hardware-accelerated rendering via modern GPU APIs
  • Better Wayland support and performance

Alternatives considered:

  • Staying on WebKit2GTK 4.0: No Vulkan support, limited to OpenGL
  • Using WebKit2GTK 4.1: Still GTK3, no Vulkan renderer
  • Custom Vulkan implementation: Too complex, maintenance burden

GTK3 to GTK4 Migration Patterns

Key Changes:

  1. Event handling: GdkEvent parameter removed from signals
  2. Widget construction: Direct use of g_object_new() instead of specific constructors
  3. Drawing: No more GtkDrawingArea draw signal, use GtkSnapshot
  4. CSS: GTK4 uses standard CSS, removed custom properties
  5. Layout: New layout managers replace containers

CGO Binding Updates:

  • pkg-config: webkit2gtk-4.0 → webkitgtk-6.0
  • pkg-config: gtk+-3.0 → gtk4
  • Header: gtk/gtk.h remains same
  • Header: webkit2/webkit2.h → webkit/webkit.h

Vulkan Renderer Configuration

Decision: Hardware Acceleration Policy Rationale: Provides user control over GPU vs CPU rendering

Configuration Options:

  1. WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS: Force GPU
  2. WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER: Force CPU
  3. WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND: Auto-detect (default)

New Settings in WebKitGTK 6.0:

  • webkit_settings_set_hardware_acceleration_policy()
  • webkit_settings_set_enable_2d_canvas_acceleration()
  • webkit_settings_set_enable_webgl()
  • webkit_settings_set_draw_compositing_indicators() (debugging)

Deprecated APIs to Replace

WebKit2GTK 4.0 API WebKitGTK 6.0 Replacement
webkit_web_view_new_with_context() g_object_new() with properties
webkit_web_context_set_sandbox_enabled() Always enabled, use add_path_to_sandbox()
WebKitWebContext WebKitNetworkSession for networking
webkit_web_view_run_javascript() Same, but async only
Process swap property Always enabled

Build System Changes

pkg-config flags:

# Old (WebKit2GTK 4.0)
pkg-config --cflags --libs webkit2gtk-4.0 gtk+-3.0 javascriptcoregtk-4.0

# New (WebKitGTK 6.0)
pkg-config --cflags --libs webkitgtk-6.0 gtk4 javascriptcoregtk-6.0

Performance Considerations

GPU Rendering Benefits:

  • Vulkan backend via GTK4's unified GPU renderer
  • Hardware-accelerated 2D canvas
  • Improved WebGL performance
  • Reduced CPU usage for compositing
  • Better multi-threaded rendering

Fallback Strategy:

  • Detect GPU capabilities at runtime
  • Use ON_DEMAND policy for automatic selection
  • Provide config flag for manual override
  • Monitor performance metrics

Global Rendering Configuration

Decision: Add RenderingMode to config Rationale: User control over CPU/GPU rendering with smart defaults

Implementation:

type RenderingMode string

const (
    RenderingModeAuto RenderingMode = "auto"  // Default, detect at runtime
    RenderingModeGPU  RenderingMode = "gpu"   // Force GPU acceleration
    RenderingModeCPU  RenderingMode = "cpu"   // Force software rendering
)

Config Integration:

  • Add to internal/config/config.go
  • Default to "auto" (GPU if available)
  • CLI flag: --rendering-mode=[auto|gpu|cpu]
  • Environment variable: DUMBER_RENDERING_MODE

Summary

The migration to WebKitGTK 6.0 requires:

  1. Complete GTK3 → GTK4 widget/event migration
  2. Update all WebKit API calls to new versions
  3. Implement hardware acceleration configuration
  4. Add global rendering mode configuration
  5. Test Vulkan renderer activation and fallback

All technical questions have been resolved through research.

source
1# Research: WebKitGTK 6.0 Migration
2
3## API Migration Research
4
5### Decision: WebKitGTK 6.0 with GTK4
6**Rationale**: 
7- GTK4 provides native Vulkan renderer support
8- WebKitGTK 6.0 is the only actively maintained version for GTK4
9- Enables hardware-accelerated rendering via modern GPU APIs
10- Better Wayland support and performance
11
12**Alternatives considered**:
13- Staying on WebKit2GTK 4.0: No Vulkan support, limited to OpenGL
14- Using WebKit2GTK 4.1: Still GTK3, no Vulkan renderer
15- Custom Vulkan implementation: Too complex, maintenance burden
16
17### GTK3 to GTK4 Migration Patterns
18
19**Key Changes**:
201. **Event handling**: GdkEvent parameter removed from signals
212. **Widget construction**: Direct use of g_object_new() instead of specific constructors
223. **Drawing**: No more GtkDrawingArea draw signal, use GtkSnapshot
234. **CSS**: GTK4 uses standard CSS, removed custom properties
245. **Layout**: New layout managers replace containers
25
26**CGO Binding Updates**:
27- pkg-config: `webkit2gtk-4.0` → `webkitgtk-6.0`
28- pkg-config: `gtk+-3.0` → `gtk4`
29- Header: `gtk/gtk.h` remains same
30- Header: `webkit2/webkit2.h` → `webkit/webkit.h`
31
32### Vulkan Renderer Configuration
33
34**Decision: Hardware Acceleration Policy**
35**Rationale**: Provides user control over GPU vs CPU rendering
36
37**Configuration Options**:
381. `WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`: Force GPU
392. `WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER`: Force CPU
403. `WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND`: Auto-detect (default)
41
42**New Settings in WebKitGTK 6.0**:
43- `webkit_settings_set_hardware_acceleration_policy()`
44- `webkit_settings_set_enable_2d_canvas_acceleration()`
45- `webkit_settings_set_enable_webgl()`
46- `webkit_settings_set_draw_compositing_indicators()` (debugging)
47
48### Deprecated APIs to Replace
49
50| WebKit2GTK 4.0 API | WebKitGTK 6.0 Replacement |
51|-------------------|---------------------------|
52| `webkit_web_view_new_with_context()` | `g_object_new()` with properties |
53| `webkit_web_context_set_sandbox_enabled()` | Always enabled, use `add_path_to_sandbox()` |
54| `WebKitWebContext` | `WebKitNetworkSession` for networking |
55| `webkit_web_view_run_javascript()` | Same, but async only |
56| Process swap property | Always enabled |
57
58### Build System Changes
59
60**pkg-config flags**:
61```bash
62# Old (WebKit2GTK 4.0)
63pkg-config --cflags --libs webkit2gtk-4.0 gtk+-3.0 javascriptcoregtk-4.0
64
65# New (WebKitGTK 6.0)
66pkg-config --cflags --libs webkitgtk-6.0 gtk4 javascriptcoregtk-6.0
67```
68
69### Performance Considerations
70
71**GPU Rendering Benefits**:
72- Vulkan backend via GTK4's unified GPU renderer
73- Hardware-accelerated 2D canvas
74- Improved WebGL performance
75- Reduced CPU usage for compositing
76- Better multi-threaded rendering
77
78**Fallback Strategy**:
79- Detect GPU capabilities at runtime
80- Use `ON_DEMAND` policy for automatic selection
81- Provide config flag for manual override
82- Monitor performance metrics
83
84### Global Rendering Configuration
85
86**Decision: Add RenderingMode to config**
87**Rationale**: User control over CPU/GPU rendering with smart defaults
88
89**Implementation**:
90```go
91type RenderingMode string
92
93const (
94    RenderingModeAuto RenderingMode = "auto"  // Default, detect at runtime
95    RenderingModeGPU  RenderingMode = "gpu"   // Force GPU acceleration
96    RenderingModeCPU  RenderingMode = "cpu"   // Force software rendering
97)
98```
99
100**Config Integration**:
101- Add to `internal/config/config.go`
102- Default to "auto" (GPU if available)
103- CLI flag: `--rendering-mode=[auto|gpu|cpu]`
104- Environment variable: `DUMBER_RENDERING_MODE`
105
106## Summary
107
108The migration to WebKitGTK 6.0 requires:
1091. Complete GTK3 → GTK4 widget/event migration
1102. Update all WebKit API calls to new versions
1113. Implement hardware acceleration configuration
1124. Add global rendering mode configuration
1135. Test Vulkan renderer activation and fallback
114
115All technical questions have been resolved through research.

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