Synthesize window resize for the frameless win7 skin (a documented stopgap)
The win7 skin is frameless so 7.css can draw the Aero caption, and on GTK that means undecorated, which takes the window manager's resize borders and corner grips with it. All three win7 windows were completely unresizable. electrobun 1.18.1 offers nothing to re-enable, verified against the shipped binary rather than assumed: libNativeWrapper exports startWindowMove/ stopWindowMove with no resize counterpart, imports gtk_window_begin_move_drag but not gtk_window_begin_resize_drag, dragRegions.ts implements moving only, and BrowserWindow has neither setResizable nor min-size options. But the window is still programmatically resizable, so only the input affordance is missing: eight handles overlay the frame and drag it through a new windowGetFrame/windowSetFrame pair on the shared windowControlHandlers factory, which gives all three window kinds resize with no per-window wiring. Three things that would have made this quietly wrong: - dragRegions.ts starts a window MOVE from a mousedown listener on document, never checks defaultPrevented, and is not suppressed by a pointerdown handler either (the compatibility mousedown still fires). Every handle carries app-region-no-drag, which short-circuits its check first. - deltas come from screenX, not clientX: a north/west resize moves the window origin under a stationary pointer, so client coords feed that back into the next delta and the window runs away. - the min-size clamp re-anchors the opposite edge; clamping width alone lets x keep tracking the pointer, walking the window off-screen while it looks frozen. This is a stopgap and the point is that it is removable on sight. The frame math is a dependency-free module so scripts/resize-math-probe.ts asserts all eight edges without a window (verified it catches the unanchored-clamp bug: x jumps to 5100 instead of parking at 460). scripts/check-electrobun-resize.ts scans the installed electrobun for the primitives this is waiting on and prints the removal checklist when they appear; it runs from postinstall so a version bump surfaces it, never fails an install, and is silent otherwise. Both trigger paths were simulated. The component header carries the full checklist; docs cover the platform consequence and the dragRegions traps. Harness diffs exactly 0 in both themes; hover and menu probes still clean. Not yet exercised with a real pointer — that needs a live window. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,31 @@ export function windowControlHandlers(
|
||||
}),
|
||||
|
||||
windowIsMaximized: () => wrap(() => ({ maximized: getWindow()?.isMaximized() ?? false })),
|
||||
|
||||
// ---- STOPGAP: synthesized resize ----
|
||||
// A frameless GTK window has no resize borders, and electrobun exposes no
|
||||
// native resize gesture (it has startWindowMove and nothing else — the
|
||||
// shipped libNativeWrapper does not even link gtk_window_begin_resize_drag).
|
||||
// So the webview drags its own handles and moves the frame itself. Both are
|
||||
// synchronous FFI reads/writes, like isMaximized above, so each drag tick
|
||||
// stays one round trip. DELETE WITH THE REST OF THE HACK — the checklist is
|
||||
// in ui/src/app/skins/7like/window-resize/window-resize.ts.
|
||||
windowGetFrame: () =>
|
||||
wrap(() => getWindow()?.getFrame() ?? { x: 0, y: 0, width: 0, height: 0 }),
|
||||
|
||||
// Params are annotated from the schema rather than inferred: this factory
|
||||
// returns a bare object literal, so it gets none of the contextual typing
|
||||
// the inline handler sets inside defineRPC<AppRPC> enjoy.
|
||||
windowSetFrame: ({
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
}: AppRPC["bun"]["requests"]["windowSetFrame"]["params"]) =>
|
||||
wrap(() => {
|
||||
getWindow()?.setFrame(x, y, width, height);
|
||||
return {};
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,21 @@ export type AppRPC = {
|
||||
params: Record<string, never>;
|
||||
response: Result<{ maximized: boolean }>;
|
||||
};
|
||||
/**
|
||||
* STOPGAP — the two halves of the synthesized resize. A frameless GTK
|
||||
* window has no resize borders and electrobun exposes no native resize
|
||||
* gesture, so the webview drags its own handles and moves the frame
|
||||
* itself. Delete both with the rest of the hack; see the removal
|
||||
* checklist in ui/src/app/skins/7like/window-resize/window-resize.ts.
|
||||
*/
|
||||
windowGetFrame: {
|
||||
params: Record<string, never>;
|
||||
response: Result<{ x: number; y: number; width: number; height: number }>;
|
||||
};
|
||||
windowSetFrame: {
|
||||
params: { x: number; y: number; width: number; height: number };
|
||||
response: Result;
|
||||
};
|
||||
// auto-updater (electrobun Updater)
|
||||
/** Main window: re-run the update check on demand (menu item). */
|
||||
checkForUpdate: {
|
||||
|
||||
Reference in New Issue
Block a user