fix(electrobun): update stub HTML + 800x600 test window size
This commit is contained in:
parent
7971ffe859
commit
f97eaa1c36
2 changed files with 26 additions and 74 deletions
|
|
@ -226,10 +226,12 @@ connectToDaemon();
|
||||||
|
|
||||||
const url = await getMainViewUrl();
|
const url = await getMainViewUrl();
|
||||||
|
|
||||||
const savedX = Number(settingsDb.getSetting("win_x") ?? 100);
|
// Use 800x600 for resize testing; normal mode uses saved values
|
||||||
const savedY = Number(settingsDb.getSetting("win_y") ?? 100);
|
const RESIZE_TEST_ACTIVE = true; // HARDCODED — revert after testing
|
||||||
const savedWidth = Number(settingsDb.getSetting("win_width") ?? 1400);
|
const savedX = RESIZE_TEST_ACTIVE ? 200 : Number(settingsDb.getSetting("win_x") ?? 100);
|
||||||
const savedHeight = Number(settingsDb.getSetting("win_height") ?? 900);
|
const savedY = RESIZE_TEST_ACTIVE ? 200 : Number(settingsDb.getSetting("win_y") ?? 100);
|
||||||
|
const savedWidth = RESIZE_TEST_ACTIVE ? 800 : Number(settingsDb.getSetting("win_width") ?? 1400);
|
||||||
|
const savedHeight = RESIZE_TEST_ACTIVE ? 600 : Number(settingsDb.getSetting("win_height") ?? 900);
|
||||||
|
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
title: "Agent Orchestrator",
|
title: "Agent Orchestrator",
|
||||||
|
|
|
||||||
|
|
@ -1,82 +1,32 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
<style>
|
<style>
|
||||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
body { background: #1e1e2e; color: #cdd6f4; font-family: monospace; overflow: hidden; }
|
body { background: #1e1e2e; color: #cdd6f4; font-family: monospace; font-size: 14px; }
|
||||||
.rz { position: fixed; z-index: 9999; background: rgba(255,0,0,0.2); }
|
h2 { padding: 20px 40px 10px; }
|
||||||
.rz-n { top: 0; left: 12px; right: 12px; height: 8px; cursor: n-resize; }
|
p { padding: 0 40px 10px; color: #a6adc8; }
|
||||||
.rz-s { bottom: 0; left: 12px; right: 12px; height: 8px; cursor: s-resize; }
|
#log { padding: 10px 40px; color: #a6e3a1; white-space: pre-wrap; max-height: 80vh; overflow-y: auto; }
|
||||||
.rz-e { right: 0; top: 12px; bottom: 12px; width: 8px; cursor: e-resize; }
|
|
||||||
.rz-w { left: 0; top: 12px; bottom: 12px; width: 8px; cursor: w-resize; }
|
|
||||||
.rz-ne { top: 0; right: 0; width: 12px; height: 12px; cursor: ne-resize; }
|
|
||||||
.rz-nw { top: 0; left: 0; width: 12px; height: 12px; cursor: nw-resize; }
|
|
||||||
.rz-se { bottom: 0; right: 0; width: 12px; height: 12px; cursor: se-resize; }
|
|
||||||
.rz-sw { bottom: 0; left: 0; width: 12px; height: 12px; cursor: sw-resize; }
|
|
||||||
#log { padding: 40px; font-size: 13px; color: #a6e3a1; white-space: pre-wrap; }
|
|
||||||
h2 { padding: 20px 40px 0; }
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="rz rz-n"></div><div class="rz rz-s"></div>
|
<h2>Resize Test - Native C Library</h2>
|
||||||
<div class="rz rz-e"></div><div class="rz rz-w"></div>
|
<p>The C library (libagor-resize.so) connects button-press-event directly on the GtkWindow.</p>
|
||||||
<div class="rz rz-ne"></div><div class="rz rz-nw"></div>
|
<p>It does edge hit-test internally (8px border) and calls gtk_window_begin_resize_drag.</p>
|
||||||
<div class="rz rz-se"></div><div class="rz rz-sw"></div>
|
<p><b>Move your mouse to the window edges. Click and drag to resize.</b></p>
|
||||||
|
<p>No RPC needed. Check the terminal for [agor-resize] logs.</p>
|
||||||
<h2>Resize Stub — Electrobun + libagor-resize.so</h2>
|
<p>Window size: <span id="size"></span></p>
|
||||||
<div id="log">Waiting for RPC...\n</div>
|
<div id="log"></div>
|
||||||
<script>
|
<script>
|
||||||
const log = document.getElementById('log');
|
const sizeEl = document.getElementById('size');
|
||||||
function L(msg) { log.textContent += msg + '\n'; log.scrollTop = log.scrollHeight; }
|
const logEl = document.getElementById('log');
|
||||||
|
function L(msg) { logEl.textContent += msg + '\n'; }
|
||||||
const EDGES = {
|
function updateSize() { sizeEl.textContent = window.innerWidth + 'x' + window.innerHeight; }
|
||||||
'rz-n': 'n', 'rz-s': 's', 'rz-e': 'e', 'rz-w': 'w',
|
updateSize();
|
||||||
'rz-ne': 'ne', 'rz-nw': 'nw', 'rz-se': 'se', 'rz-sw': 'sw',
|
window.addEventListener('resize', () => { updateSize(); L('RESIZE: ' + window.innerWidth + 'x' + window.innerHeight); });
|
||||||
};
|
L('Page loaded. Native C library handles resize - watch terminal for [agor-resize] logs.');
|
||||||
|
L('Click near any edge (within 8px of window border) to trigger native resize.');
|
||||||
// Wait for Electrobun RPC to be available
|
|
||||||
function waitForRpc() {
|
|
||||||
// Try multiple possible global names
|
|
||||||
const eb = window.electrobun || window.Electrobun || window.__electrobun;
|
|
||||||
if (eb && eb.rpc) {
|
|
||||||
L('RPC available! (' + Object.keys(eb.rpc).join(', ') + ')');
|
|
||||||
window._rpc = eb.rpc;
|
|
||||||
setupHandles();
|
|
||||||
} else {
|
|
||||||
L('Waiting for electrobun.rpc... (globals: ' +
|
|
||||||
['electrobun','Electrobun','__electrobun'].filter(k => k in window).join(',') + ')');
|
|
||||||
setTimeout(waitForRpc, 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setupHandles() {
|
|
||||||
document.querySelectorAll('.rz').forEach(el => {
|
|
||||||
el.addEventListener('mousedown', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
const cls = [...el.classList].find(c => c.startsWith('rz-'));
|
|
||||||
const edge = EDGES[cls];
|
|
||||||
if (!edge) return;
|
|
||||||
L('mousedown edge=' + edge + ' screen=' + e.screenX + ',' + e.screenY);
|
|
||||||
|
|
||||||
// Call native resize via RPC
|
|
||||||
try {
|
|
||||||
window._rpc.request['window.beginResize']({ edge })
|
|
||||||
.then(r => L('RPC result: ' + JSON.stringify(r)))
|
|
||||||
.catch(err => L('RPC error: ' + err));
|
|
||||||
} catch (err) {
|
|
||||||
L('RPC call error: ' + err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
L('Handles wired. Click any red edge to resize.');
|
|
||||||
}
|
|
||||||
|
|
||||||
waitForRpc();
|
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
|
||||||
L('RESIZE event: ' + window.innerWidth + 'x' + window.innerHeight);
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue