fix(overlay): Linux X11/XWayland stacking, stale pause state, multi-copy selector (#101)

This commit is contained in:
2026-05-31 20:59:18 -07:00
committed by GitHub
parent b46b8dfa41
commit e1ea464bc9
103 changed files with 6314 additions and 353 deletions
@@ -4,6 +4,7 @@ import {
createEnforceOverlayLayerOrderHandler,
createEnsureOverlayWindowLevelHandler,
createUpdateVisibleOverlayBoundsHandler,
hasLiveOverlayWindowBoundsMismatch,
} from './overlay-window-layout';
test('visible bounds handler writes visible layer geometry', () => {
@@ -32,6 +33,72 @@ test('visible bounds handler runs follow-up callback after applying geometry', (
assert.deepEqual(calls, ['set-bounds', 'after-bounds']);
});
test('visible bounds handler skips unchanged geometry', () => {
const calls: string[] = [];
const geometry = { x: 0, y: 0, width: 100, height: 50 };
const handleVisible = createUpdateVisibleOverlayBoundsHandler({
getCurrentOverlayWindowBounds: () => ({ ...geometry }),
setOverlayWindowBounds: () => calls.push('set-bounds'),
afterSetOverlayWindowBounds: () => calls.push('after-bounds'),
});
handleVisible(geometry);
assert.deepEqual(calls, []);
});
test('visible bounds handler can refresh unchanged geometry for mode reconciliation', () => {
const calls: string[] = [];
const geometry = { x: 0, y: 0, width: 100, height: 50 };
const handleVisible = createUpdateVisibleOverlayBoundsHandler({
getCurrentOverlayWindowBounds: () => ({ ...geometry }),
shouldRefreshUnchangedGeometry: (nextGeometry) => {
assert.deepEqual(nextGeometry, geometry);
calls.push('refresh-check');
return true;
},
setOverlayWindowBounds: () => calls.push('set-bounds'),
afterSetOverlayWindowBounds: () => calls.push('after-bounds'),
});
handleVisible(geometry);
assert.deepEqual(calls, ['refresh-check', 'set-bounds', 'after-bounds']);
});
test('live overlay bounds mismatch forces refresh after window manager restore drift', () => {
const geometry = { x: 100, y: 80, width: 1280, height: 720 };
assert.equal(
hasLiveOverlayWindowBoundsMismatch(
[
{
isDestroyed: () => false,
getBounds: () => ({ x: 96, y: 76, width: 1300, height: 740 }),
},
],
geometry,
),
true,
);
assert.equal(
hasLiveOverlayWindowBoundsMismatch(
[
{
isDestroyed: () => false,
getBounds: () => ({ ...geometry }),
},
{
isDestroyed: () => true,
getBounds: () => ({ x: 0, y: 0, width: 1, height: 1 }),
},
],
geometry,
),
false,
);
});
test('ensure overlay window level handler delegates to core', () => {
const calls: string[] = [];
const ensureLevel = createEnsureOverlayWindowLevelHandler({