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 savedX = Number(settingsDb.getSetting("win_x") ?? 100);
|
||||
const savedY = Number(settingsDb.getSetting("win_y") ?? 100);
|
||||
const savedWidth = Number(settingsDb.getSetting("win_width") ?? 1400);
|
||||
const savedHeight = Number(settingsDb.getSetting("win_height") ?? 900);
|
||||
// Use 800x600 for resize testing; normal mode uses saved values
|
||||
const RESIZE_TEST_ACTIVE = true; // HARDCODED — revert after testing
|
||||
const savedX = RESIZE_TEST_ACTIVE ? 200 : Number(settingsDb.getSetting("win_x") ?? 100);
|
||||
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({
|
||||
title: "Agent Orchestrator",
|
||||
|
|
|
|||
|
|
@ -1,82 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { background: #1e1e2e; color: #cdd6f4; font-family: monospace; overflow: hidden; }
|
||||
.rz { position: fixed; z-index: 9999; background: rgba(255,0,0,0.2); }
|
||||
.rz-n { top: 0; left: 12px; right: 12px; height: 8px; cursor: n-resize; }
|
||||
.rz-s { bottom: 0; left: 12px; right: 12px; height: 8px; cursor: s-resize; }
|
||||
.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; }
|
||||
body { background: #1e1e2e; color: #cdd6f4; font-family: monospace; font-size: 14px; }
|
||||
h2 { padding: 20px 40px 10px; }
|
||||
p { padding: 0 40px 10px; color: #a6adc8; }
|
||||
#log { padding: 10px 40px; color: #a6e3a1; white-space: pre-wrap; max-height: 80vh; overflow-y: auto; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="rz rz-n"></div><div class="rz rz-s"></div>
|
||||
<div class="rz rz-e"></div><div class="rz rz-w"></div>
|
||||
<div class="rz rz-ne"></div><div class="rz rz-nw"></div>
|
||||
<div class="rz rz-se"></div><div class="rz rz-sw"></div>
|
||||
|
||||
<h2>Resize Stub — Electrobun + libagor-resize.so</h2>
|
||||
<div id="log">Waiting for RPC...\n</div>
|
||||
<h2>Resize Test - Native C Library</h2>
|
||||
<p>The C library (libagor-resize.so) connects button-press-event directly on the GtkWindow.</p>
|
||||
<p>It does edge hit-test internally (8px border) and calls gtk_window_begin_resize_drag.</p>
|
||||
<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>
|
||||
<p>Window size: <span id="size"></span></p>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
const log = document.getElementById('log');
|
||||
function L(msg) { log.textContent += msg + '\n'; log.scrollTop = log.scrollHeight; }
|
||||
|
||||
const EDGES = {
|
||||
'rz-n': 'n', 'rz-s': 's', 'rz-e': 'e', 'rz-w': 'w',
|
||||
'rz-ne': 'ne', 'rz-nw': 'nw', 'rz-se': 'se', 'rz-sw': 'sw',
|
||||
};
|
||||
|
||||
// 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);
|
||||
});
|
||||
const sizeEl = document.getElementById('size');
|
||||
const logEl = document.getElementById('log');
|
||||
function L(msg) { logEl.textContent += msg + '\n'; }
|
||||
function updateSize() { sizeEl.textContent = window.innerWidth + 'x' + window.innerHeight; }
|
||||
updateSize();
|
||||
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.');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue