Fix screenCurtain/Fullscreen conflict#20342
Open
Boumtchack wants to merge 1 commit into
Open
Conversation
seanbudd
reviewed
Jun 16, 2026
| """ | ||
| if not (screenCurtain.screenCurtain and screenCurtain.screenCurtain.enabled): | ||
| return False | ||
| from NVDAState import _TrackNVDAInitialization |
| log.debug("Full-screen Magnifier gain focus event") | ||
| nextHandler() | ||
|
|
||
| def _isBlockedByScreenCurtain(self) -> bool: |
Member
There was a problem hiding this comment.
won't these functions need to be more generic than just the full screen magnifier?
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:
FullScreenMagnifier gains onScreenCurtainEnabled(), onScreenCurtainDisabled(), _isBlockedByScreenCurtain(), and _clearStaleApiState().
screenCurtain now calls the two onScreenCurtain methods, guarded by _MAGNIFIED_VIEW == MagnifiedView.FULLSCREEN.
All screen curtain logic removed from the base Magnifier class into fullscreen
Description of development approach:
Bug 1 is fixed by checking the screen curtain at the start of _startMagnifier() and returning immediately without touching the API if it is active.
Bug 2 : 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.
All screen curtain handling is confined to FullScreenMagnifier since it is the only magnifier type that drives the Windows Magnification API.
Testing strategy:
manual/unit
Known issues with pull request:
Code Review Checklist: