Skip to content

Fix screenCurtain/Fullscreen conflict#20342

Open
Boumtchack wants to merge 1 commit into
nvaccess:betafrom
France-Travail:fix/screenCurtainConflict
Open

Fix screenCurtain/Fullscreen conflict#20342
Boumtchack wants to merge 1 commit into
nvaccess:betafrom
France-Travail:fix/screenCurtainConflict

Conversation

@Boumtchack

Copy link
Copy Markdown
Contributor

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:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@Boumtchack Boumtchack marked this pull request as ready for review June 15, 2026 15:17
@Boumtchack Boumtchack requested a review from a team as a code owner June 15, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@SaschaCowley SaschaCowley added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Jun 16, 2026
"""
if not (screenCurtain.screenCurtain and screenCurtain.screenCurtain.enabled):
return False
from NVDAState import _TrackNVDAInitialization

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this import be moved out?

log.debug("Full-screen Magnifier gain focus event")
nextHandler()

def _isBlockedByScreenCurtain(self) -> bool:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't these functions need to be more generic than just the full screen magnifier?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants