nvda
8b2f5ae2 - Fix screenCurtain/Fullscreen conflict (#20342)

Commit
1 day ago
Fix screenCurtain/Fullscreen conflict (#20342) Fixes #20289 Summary of the issue: Two bugs occur when both the fullscreen magnifier and screen curtain are enabled and NVDA is restarted: (Privacy/critical) The magnifier's initialization calls MagUninitialize() on the screen curtain's active API session, briefly exposing the screen. After restart, disabling the screen curtain then enabling the magnifier fails on the first attempt due to stale Windows API state left by the screen curtain's MagSetFullscreenColorEffect(TRANSFORM_BLACK) call. Description of user facing changes: On restart, the screen curtain remains active during magnifier initialization, the screen is no longer exposed. Enabling the screen curtain while the magnifier is active stops the magnifier (with a spoken message) and re-enables it automatically when the screen curtain is disabled. Trying to enable the magnifier while the screen curtain is active speaks an error message. Description of developer facing changes: Magnifier (base class) gains _isBlockedByScreenCurtain(), onScreenCurtainEnabled(), and onScreenCurtainDisabled(), replacing the former inline screen curtain check in _startMagnifier(). FullScreenMagnifier gains _clearStaleApiState() and a guard if not self._isActive: return after super()._startMagnifier() to prevent API initialization when the base class blocked the start. screenCurtain already called onScreenCurtainEnabled/Disabled — no change needed there. Description of development approach: Bug 1 is fixed by checking the screen curtain in Magnifier._startMagnifier() via _isBlockedByScreenCurtain() and returning without setting _isActive = True. The FullScreenMagnifier override detects this and skips _initializeNativeMagnification(), so the screen curtain's API session is never touched. Bug 2 is a Windows API quirk: after MagSetFullscreenColorEffect(TRANSFORM_BLACK) + MagUninitialize(), the next MagSetFullscreenTransform silently fails. _clearStaleApiState() runs a dummy MagInitialize / MagSetFullscreenColorEffect(NORMAL) / MagUninitialize cycle before every real MagInitialize to clear this state. Screen curtain interaction logic lives in the base Magnifier class so all future magnifier types inherit it. _clearStaleApiState() stays in FullScreenMagnifier as it is specific to the Windows Magnification API.
Author
Parents
Loading