fix(electrobun): wrap WebView in GtkScrolledWindow for resize-in

Codex review #2 found: set_size_request only controls minimum, not
natural/preferred size. WebView still reports content size as natural,
causing rubber-band effect during shrink.

Fix: reparent WebKitWebView into GtkScrolledWindow via FFI with
propagate-natural-width/height=FALSE and min-content=1x1. This
decouples WebView content size from window size negotiation.

Also reverted to native begin_resize_drag (WM handles everything).
This commit is contained in:
Hibryda 2026-03-25 13:38:29 +01:00
parent d1583f8ce4
commit 300bd30ca3
2 changed files with 132 additions and 2 deletions

View file

@ -233,10 +233,15 @@ mainWindow = new BrowserWindow({
},
});
// Ensure GTK window is resizable (titleBarStyle:"hidden" may clear the flag)
// Ensure GTK window is resizable and wrap WebView for proper resize-in
{
const { ensureResizable } = require("./gtk-window.ts");
const { ensureResizable, wrapWebViewInScrolledWindow } = require("./gtk-window.ts");
ensureResizable((mainWindow as any).ptr);
// Wrap WebView in GtkScrolledWindow to decouple natural size from window size
// (prevents rubber-band effect when shrinking)
setTimeout(() => {
wrapWebViewInScrolledWindow((mainWindow as any).ptr);
}, 2000); // Delay to ensure WebView is fully initialized
}
// Prevent GTK's false Ctrl+click detection from closing the window on initial load.