Skip to content

Commit

Permalink
Persist state of maximized with a global variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofdusk committed Jul 16, 2019
1 parent 27ba0ee commit 40bc982
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 10 additions & 7 deletions source/NVDAObjects/UIA/winConsoleUIA.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import config
import ctypes
import globalVars
import NVDAHelper
import speech
import time
Expand Down Expand Up @@ -238,9 +239,6 @@ class WinConsoleUIA(Terminal):
_hasNewLines = False
#: the caret in consoles can take a while to move on Windows 10 1903 and later.
_caretMovementTimeoutMultiplier = 1.5
#: Stores whether this console has ever been maximized
# (maximization breaks GetVisibleRanges).
_maximized = False

def _reportNewText(self, line):
# Additional typed character filtering beyond that in LiveText
Expand Down Expand Up @@ -294,10 +292,15 @@ def script_flush_queuedChars(self, gesture):
speech.curWordChars = []

def _get_maximized(self):
res = self.parent.UIAWindowPattern.CurrentWindowVisualState == UIAHandler.WindowVisualState_Maximized
if res:
self._maximized = True
return self._maximized or res
res = self.UIAElement.getRuntimeId() in globalVars.maximizedUIAConsoles
if (
self.parent.UIAWindowPattern.CurrentWindowVisualState
== UIAHandler.WindowVisualState_Maximized
and not res
):
globalVars.maximizedUIAConsoles.append(self.UIAElement.getRuntimeId())
return True
return res

def _getTextLines(self):
# Filter out extraneous empty lines from UIA
Expand Down
2 changes: 2 additions & 0 deletions source/globalVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@type navigatorObject: L{NVDAObjects.NVDAObject}
@var navigatorTracksFocus: if true, the navigator object will follow the focus as it changes
@type navigatorTracksFocus: boolean
@var maximizedUIAConsoles: stores state for maximized consoles, see #9899
"""

startTime=0
Expand All @@ -38,3 +39,4 @@
settingsRing = None
speechDictionaryProcessing=True
exitCode=0
maximizedUIAConsoles = []

0 comments on commit 40bc982

Please sign in to comment.