fix(electrobun): JS-based window resize replaces GTK begin_resize_drag
GTK begin_resize_drag loses grip when cursor moves inward past the 6px handle zone. Replaced with document-level mousemove/mouseup listeners that compute delta from initial frame and call setPosition+setSize. - clearMinSize RPC clears WebView min-size before resize starts - Cursor locks to resize direction during drag (body.style.cursor) - user-select disabled during drag to prevent text selection - Frame captured async before resize starts (no race condition)
This commit is contained in:
parent
290ae8ef86
commit
e6635e436c
2 changed files with 63 additions and 11 deletions
|
|
@ -142,13 +142,18 @@ const rpc = BrowserView.defineRPC<PtyRPCSchema>({
|
|||
"window.setPosition": ({ x, y }: { x: number; y: number }) => { try { mainWindow.setPosition(x, y); return { ok: true }; } catch { return { ok: false }; } },
|
||||
"window.setFrame": ({ x, y, width, height }: { x: number; y: number; width: number; height: number }) => {
|
||||
try {
|
||||
// Use separate setPosition + setSize — setFrame's C implementation
|
||||
// may not resize on GTK with titleBarStyle:"hidden"
|
||||
mainWindow.setPosition(x, y);
|
||||
mainWindow.setSize(width, height);
|
||||
return { ok: true };
|
||||
} catch (err) { console.error("[window.setFrame]", err); return { ok: false }; }
|
||||
},
|
||||
"window.clearMinSize": () => {
|
||||
try {
|
||||
const { ensureResizable } = require("./gtk-window.ts");
|
||||
ensureResizable((mainWindow as any).ptr);
|
||||
return { ok: true };
|
||||
} catch (err) { console.error("[window.clearMinSize]", err); return { ok: false }; }
|
||||
},
|
||||
},
|
||||
messages: {},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue