@bobfrankston/msger 0.1.137 → 0.1.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ # Pi Rendering Fix Applied
2
+
3
+ ## Date
4
+ 2025-11-17
5
+
6
+ ## Changes Made
7
+ Applied test16 successful rendering approach to msger main.rs:
8
+
9
+ ### 1. Disable HW Acceleration on ARM (line 500-501)
10
+ ```rust
11
+ #[cfg(all(target_os = "linux", any(target_arch = "arm", target_arch = "aarch64")))]
12
+ std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
13
+ ```
14
+
15
+ ### 2. Set Fill Properties on WebKit Widget (lines 627-651, both URL and HTML paths)
16
+ ```rust
17
+ #[cfg(target_os = "linux")]
18
+ let webview = {
19
+ use gtk::prelude::*;
20
+ let wv = builder.build_gtk(vbox).expect("Failed to create webview");
21
+
22
+ // Set fill properties on WebKit widget for proper sizing on Pi
23
+ if let Some(children) = vbox.children().first() {
24
+ if let Ok(webkit_widget) = children.clone().downcast::<gtk::Widget>() {
25
+ webkit_widget.set_hexpand(true);
26
+ webkit_widget.set_vexpand(true);
27
+ webkit_widget.set_halign(gtk::Align::Fill);
28
+ webkit_widget.set_valign(gtk::Align::Fill);
29
+ }
30
+ }
31
+
32
+ vbox.show_all();
33
+ wv
34
+ };
35
+ ```
36
+
37
+ ## Expected Result
38
+ - Clean rendering on first display on Raspberry Pi
39
+ - No manual resize required
40
+ - Works for both -html and -url modes
41
+
42
+ ## Update 2025-11-17 (v0.1.139)
43
+ First attempt (fill properties only) didn't work - still needed manual window move to trigger render.
44
+
45
+ Added synthetic resize trigger:
46
+ ```rust
47
+ #[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
48
+ {
49
+ let current_size = window.inner_size();
50
+ window.set_inner_size(tao::dpi::LogicalSize::new(
51
+ current_size.width as f64 + 1.0,
52
+ current_size.height as f64
53
+ ));
54
+ window.set_inner_size(tao::dpi::LogicalSize::new(
55
+ current_size.width as f64,
56
+ current_size.height as f64
57
+ ));
58
+ }
59
+ ```
60
+
61
+ This programmatically nudges window size +1px then back, forcing configure event.
62
+
63
+ ## Testing Required
64
+ 1. Build for Pi ARM64
65
+ 2. Test: `msger -html '<h1>Test</h1>'`
66
+ 3. Test: `msger -url 'https://example.com'`
67
+ 4. Verify no regression on x86/WSL
68
+
69
+ ## Based On
70
+ test16-html-param.rs which demonstrated clean first-time rendering on Pi
@@ -182,3 +182,81 @@ All automatically checked (warnings shown if missing):
182
182
  - Last build: 2025-11-14 00:26:20 UTC
183
183
  - Versions tested: 0.1.116, 0.1.117, 0.1.118
184
184
  - Status: **Issue persists - no fix found yet**
185
+
186
+ ## WebView Framework Alternatives (2025-11-17)
187
+
188
+ ### Current Issue
189
+ GTK rendering with wry/webkit2gtk consistently garbled on Linux (Pi, WSL). Brief valid header shows, then screen corrupts.
190
+
191
+ ### Attempted Fix (Failed)
192
+ - Tried `vbox.show_all()` / `vbox.show()` before `build_gtk()`
193
+ - Requires `use gtk::prelude::*` import
194
+ - Compilation issues - gtk crate not directly available in wry context
195
+ - Simple GTK method calls won't work without proper trait imports/dependencies
196
+
197
+ ### WebView Alternatives (Keep WebView Capability)
198
+
199
+ **1. Tauri Framework**
200
+ - Built on wry but handles GTK setup better
201
+ - More mature, may have GTK fixes built-in
202
+ - Still uses webkit2gtk on Linux
203
+ - Worth trying - abstracts GTK complexity
204
+
205
+ **2. Native OS Dialogs (Fallback)**
206
+ - `native-dialog` crate - OS-native dialogs
207
+ - No WebView capability - simple text/buttons only
208
+ - Not suitable for HTML/URL content requirement
209
+
210
+ **3. Electron (Heavy)**
211
+ - Bundles Chromium - avoids system WebView
212
+ - Would need full rewrite from Rust to Node.js
213
+ - Most reliable but resource-heavy
214
+
215
+ **4. CEF (Chromium Embedded Framework)**
216
+ - `rust-cef` bindings
217
+ - Bundles Chromium like Electron
218
+ - Complex integration, large binaries
219
+
220
+ **5. Qt WebEngine**
221
+ - Different rendering engine (Chromium-based)
222
+ - Requires Qt framework
223
+ - Cross-platform but large dependency
224
+
225
+ **6. webkit2gtk Direct Integration**
226
+ - Bypass wry, use webkit2gtk FFI directly
227
+ - More control over GTK initialization
228
+ - Requires deep GTK/webkit knowledge
229
+
230
+ ### Recommendation
231
+ Try Tauri framework first - may have solved GTK rendering issues that raw wry hasn't.
232
+
233
+ ## Key Finding: Resize Fixes Rendering (2025-11-17)
234
+
235
+ **Discovery**: Msger displays garbled initially, but becomes readable after resizing past initial window dimensions.
236
+
237
+ **Implications**:
238
+ - WebKit widget renders correctly
239
+ - Initial render/compositing is corrupted
240
+ - Resize triggers proper redraw via configure-event
241
+ - Not a WebKit bug - likely GTK size allocation timing issue
242
+
243
+ **Tests Performed**:
244
+ - test13: Yellow WebKit background with hexpand/halign fill - horizontal resize works
245
+ - test14: Configure event logging - vertical resize works
246
+ - Both tests render cleanly on resize (no artifacts)
247
+
248
+ **Root Cause Hypothesis**:
249
+ - WebKit widget size negotiation happens before GTK container finalized
250
+ - Initial render uses wrong dimensions or uninitialized buffer
251
+ - Configure event forces correct size allocation and clean redraw
252
+
253
+ **Potential Fixes**:
254
+ 1. Force configure event after webview creation (simulate resize)
255
+ 2. Set explicit size on vbox before build_gtk()
256
+ 3. Call gtk size allocation functions manually
257
+ 4. Delay webview creation until after vbox realized
258
+
259
+ **Why disable HW acceleration helps in tests**:
260
+ - Software rendering more forgiving of size mismatches
261
+ - Compositor artifacts avoided
262
+ - Not ARM-specific - timing issue affects all platforms
package/docs/TODO.md CHANGED
@@ -562,3 +562,25 @@ None currently known!
562
562
  - MSGER-API-SUMMARY.md - API reference
563
563
  - msgerdefs/README.md - TypeScript package docs
564
564
  - Update msgerdefs TypeScript definitions
565
+
566
+ ### GTK/Linux Rendering Issue (Pi, WSL)
567
+ **Status:** 🔍 INVESTIGATING - See [PI-RENDERING-NOTES.md](PI-RENDERING-NOTES.md) for details
568
+
569
+ **Problem:**
570
+ - GTK window shows garbled rendering on Linux (Pi ARM64, WSL x64)
571
+ - Brief valid header appears, then screen corrupts
572
+ - Affects all webkit2gtk-based platforms
573
+
574
+ **Investigation:**
575
+ - Attempted `vbox.show_all()` / `vbox.show()` before `build_gtk()` - failed (requires gtk::prelude import)
576
+ - WebView framework alternatives documented in PI-RENDERING-NOTES.md
577
+ - Consider trying Tauri framework (built on wry with better GTK handling)
578
+
579
+ **Current Workaround:**
580
+ - Windows build works perfectly
581
+ - Linux builds compile but rendering broken
582
+
583
+ **Next Steps:**
584
+ - Research Tauri framework as wry replacement
585
+ - Check wry GitHub issues for similar GTK rendering bugs
586
+ - Consider webkit2gtk direct integration for more control
Binary file
@@ -402,12 +402,11 @@ fn main() {
402
402
  .with_resizable(true)
403
403
  .with_always_on_top(options.always_on_top);
404
404
 
405
- // On Linux, create window invisible to avoid garbled rendering on webkit2gtk
406
- // We'll show it after webview is created
407
- #[cfg(target_os = "linux")]
408
- {
409
- window_builder = window_builder.with_visible(false);
410
- }
405
+ // On Linux, show window immediately (invisible approach didn't fix rendering)
406
+ // #[cfg(target_os = "linux")]
407
+ // {
408
+ // window_builder = window_builder.with_visible(false);
409
+ // }
411
410
 
412
411
  // Set icon if loaded successfully
413
412
  if let Some(icon) = icon {
@@ -497,6 +496,7 @@ fn main() {
497
496
  #[cfg(target_os = "linux")]
498
497
  let vbox = window.default_vbox().expect("Failed to get GTK vbox");
499
498
 
499
+
500
500
  // webview is only used on Windows for About menu functionality
501
501
  #[cfg_attr(not(windows), allow(unused_variables))]
502
502
  let webview = if let Some(ref url) = options.url {
@@ -628,15 +628,6 @@ fn main() {
628
628
  #[cfg(not(target_os = "linux"))]
629
629
  let webview = builder.build(window.as_ref()).expect("Failed to create webview");
630
630
 
631
- // Fix for garbled window on Linux/GTK: Show window after webview creation
632
- // Window was created invisible, now show it after webkit2gtk is ready
633
- #[cfg(target_os = "linux")]
634
- {
635
- // Give webkit2gtk more time to initialize - Pi needs longer delay
636
- std::thread::sleep(std::time::Duration::from_millis(500));
637
- window.set_visible(true);
638
- }
639
-
640
631
  webview
641
632
  } else {
642
633
  // Use HTML content (msger API already in template.html)
@@ -694,15 +685,6 @@ fn main() {
694
685
  #[cfg(not(target_os = "linux"))]
695
686
  let webview = builder.build(window.as_ref()).expect("Failed to create webview");
696
687
 
697
- // Fix for garbled window on Linux/GTK: Show window after webview creation
698
- // Window was created invisible, now show it after webkit2gtk is ready
699
- #[cfg(target_os = "linux")]
700
- {
701
- // Give webkit2gtk more time to initialize - Pi needs longer delay
702
- std::thread::sleep(std::time::Duration::from_millis(500));
703
- window.set_visible(true);
704
- }
705
-
706
688
  webview
707
689
  };
708
690
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/msger",
3
- "version": "0.1.137",
3
+ "version": "0.1.139",
4
4
  "description": "Fast, lightweight, cross-platform message box - Rust-powered alternative to msgview",
5
5
  "type": "module",
6
6
  "main": "./index.js",