- agor_resize.c: C library with GTK signal handlers for resize - native-resize.ts: Bun FFI wrapper for libagor-resize.so - resize-test.html: minimal stub for isolating resize behavior - index.ts: native resize disabled pending stability testing - RESIZE_TEST env var for loading stub page via Vite
82 lines
3.1 KiB
HTML
82 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<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; }
|
|
</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>
|
|
<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);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|