# Pi Rendering Fix Applied

## Date
2025-11-17

## Changes Made
Applied test16 successful rendering approach to msger main.rs:

### 1. Disable HW Acceleration on ARM (line 500-501)
```rust
#[cfg(all(target_os = "linux", any(target_arch = "arm", target_arch = "aarch64")))]
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
```

### 2. Set Fill Properties on WebKit Widget (lines 627-651, both URL and HTML paths)
```rust
#[cfg(target_os = "linux")]
let webview = {
    use gtk::prelude::*;
    let wv = builder.build_gtk(vbox).expect("Failed to create webview");

    // Set fill properties on WebKit widget for proper sizing on Pi
    if let Some(children) = vbox.children().first() {
        if let Ok(webkit_widget) = children.clone().downcast::<gtk::Widget>() {
            webkit_widget.set_hexpand(true);
            webkit_widget.set_vexpand(true);
            webkit_widget.set_halign(gtk::Align::Fill);
            webkit_widget.set_valign(gtk::Align::Fill);
        }
    }

    vbox.show_all();
    wv
};
```

## Expected Result
- Clean rendering on first display on Raspberry Pi
- No manual resize required
- Works for both -html and -url modes

## Update 2025-11-17 (v0.1.139)
First attempt (fill properties only) didn't work - still needed manual window move to trigger render.

Added synthetic resize trigger:
```rust
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
{
    let current_size = window.inner_size();
    window.set_inner_size(tao::dpi::LogicalSize::new(
        current_size.width as f64 + 1.0,
        current_size.height as f64
    ));
    window.set_inner_size(tao::dpi::LogicalSize::new(
        current_size.width as f64,
        current_size.height as f64
    ));
}
```

This programmatically nudges window size +1px then back, forcing configure event.

## Testing Required
1. Build for Pi ARM64
2. Test: `msger -html '<h1>Test</h1>'`
3. Test: `msger -url 'https://example.com'`
4. Verify no regression on x86/WSL

## Based On
test16-html-param.rs which demonstrated clean first-time rendering on Pi
