The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): add focus to ZOOM_REASSERT_WINDOW_EVENTS for high-DPI displays
QLYF253d4aa99652
diff --git a/apps/desktop/electron/zoom.test.ts b/apps/desktop/electron/zoom.test.tsindex c288018979c..a6affd0c5e5 100644--- a/apps/desktop/electron/zoom.test.ts+++ b/apps/desktop/electron/zoom.test.ts@@ -73,7 +73,7 @@ test('extreme percentages clamp to the level bounds', () => {assert.equal(percentToZoomLevel(1_000_000), 9)})-test('installZoomReassertOnWindowEvents wires show, restore, resize, and cross-display moves on macOS and Windows', () => {+test('installZoomReassertOnWindowEvents wires show, restore, focus, resize, and cross-display moves on macOS and Windows', () => {const handlers = new Map()const win = {@@ -95,9 +95,34 @@ test('installZoomReassertOnWindowEvents wires show, restore, resize, and cross-dassert.deepEqual([...handlers.keys()], zoomReassertWindowEvents('win32'))handlers.get('show')()handlers.get('restore')()+ handlers.get('focus')()handlers.get('resized')()handlers.get('moved')()- assert.equal(calls, 4)+ assert.equal(calls, 5)+})++test('focus event reasserts zoom immediately without debounce (Windows high-DPI alt-tab, #50837)', () => {+ const handlers = new Map()++ const win = {+ isDestroyed: () => false,+ on(event, listener) {+ handlers.set(event, listener)+ }+ }++ let calls = 0+ installZoomReassertOnWindowEvents(+ win,+ () => {+ calls += 1+ },+ 'win32'+ )++ // focus should trigger immediate reassert — no timer involved+ handlers.get('focus')()+ assert.equal(calls, 1)})test('installZoomReassertOnWindowEvents debounces Linux resize and move events at the trailing edge', () => {diff --git a/apps/desktop/electron/zoom.ts b/apps/desktop/electron/zoom.tsindex 9dfdbbc5277..e0e392be1ba 100644--- a/apps/desktop/electron/zoom.ts+++ b/apps/desktop/electron/zoom.ts@@ -58,14 +58,15 @@ export function applyZoomLevel(webContents, level) {}// Chromium can drop webContents zoom when a BrowserWindow is resized, minimized-// and restored, or crosses onto a monitor with different display scaling. macOS-// and Windows provide trailing `resized`/`moved` events; Linux only provides the-// noisy `resize`/`move` pair, so debounce those fallbacks before re-applying the-// persisted level.+// and restored, crosses onto a monitor with different display scaling, or loses+// and regains focus (alt-tab on Windows high-DPI displays triggers a DPI+// re-evaluation). macOS and Windows provide trailing `resized`/`moved` events;+// Linux only provides the noisy `resize`/`move` pair, so debounce those+// fallbacks before re-applying the persisted level.export const ZOOM_RESIZE_REASSERT_DELAY_MS = 100export function zoomReassertWindowEvents(platform = process.platform) {- return platform === 'linux' ? ['show', 'restore', 'resize', 'move'] : ['show', 'restore', 'resized', 'moved']+ return platform === 'linux' ? ['show', 'restore', 'focus', 'resize', 'move'] : ['show', 'restore', 'focus', 'resized', 'moved']}export function installZoomReassertOnWindowEvents(win, reassert, platform = process.platform) {