Fix screenCurtain/Fullscreen conflict#20342
Merged
seanbudd merged 9 commits intoJun 30, 2026
Merged
Conversation
seanbudd
reviewed
Jun 16, 2026
seanbudd
reviewed
Jun 23, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…-Travail/nvda into fix/screenCurtainConflict
Member
|
Thanks @Boumtchack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
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.
Testing strategy:
manual/unit
Known issues with pull request:
Code Review Checklist: