diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 1c3904b..f6e8ff3 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -738,6 +738,10 @@ function App() { return; } lastRatio = currentRatio; + if (minimisedSeen || hiddenSeen) { + scheduleActivationFix(); + return; + } void fixWindowScaleIfNeeded('ratio-change'); }; @@ -764,6 +768,7 @@ function App() { if (activationTimer !== null) { window.clearTimeout(activationTimer); } + const delayMs = (minimisedSeen || hiddenSeen) ? 260 : 80; activationTimer = window.setTimeout(async () => { activationTimer = null; if (cancelled) return; @@ -774,7 +779,7 @@ function App() { minimisedSeen = false; hiddenSeen = false; void fixWindowScaleIfNeeded(reason); - }, 80); + }, delayMs); }; const handleWindowFocus = () => { diff --git a/frontend/src/utils/windowStateUi.test.ts b/frontend/src/utils/windowStateUi.test.ts index 26acde9..a141602 100644 --- a/frontend/src/utils/windowStateUi.test.ts +++ b/frontend/src/utils/windowStateUi.test.ts @@ -20,7 +20,7 @@ describe('windowStateUi', () => { it('applies the Windows scale fix when a minimized taskbar window is restored with viewport drift', () => { expect(shouldApplyWindowsScaleFix('restore', true)).toBe(true); expect(shouldApplyWindowsScaleFix('restore', false)).toBe(false); - expect(shouldToggleMaximisedWindowForScaleFix('restore', true)).toBe(true); + expect(shouldToggleMaximisedWindowForScaleFix('restore', true)).toBe(false); }); it('debounces resize-triggered Windows scale checks until window transitions settle', () => { diff --git a/frontend/src/utils/windowStateUi.ts b/frontend/src/utils/windowStateUi.ts index b0b68a2..a799010 100644 --- a/frontend/src/utils/windowStateUi.ts +++ b/frontend/src/utils/windowStateUi.ts @@ -8,7 +8,10 @@ export const shouldApplyWindowsScaleFix = ( hasViewportScaleDrift: boolean, ): boolean => (reason === 'ratio-change' || reason === 'restore') && hasViewportScaleDrift; -export const shouldToggleMaximisedWindowForScaleFix = shouldApplyWindowsScaleFix; +export const shouldToggleMaximisedWindowForScaleFix = ( + reason: WindowScaleFixReason, + hasViewportScaleDrift: boolean, +): boolean => reason === 'ratio-change' && hasViewportScaleDrift; export const resolveWindowsScaleCheckDelayMs = (trigger: WindowsScaleCheckTrigger): number => trigger === 'resize' ? 240 : 0;