Skip to content

Commit

Permalink
TerminalWithKeyboardSupport -> TerminalWithoutTypedCharDetection.
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofdusk committed Jul 16, 2019
1 parent 98b6931 commit f59dd6a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions source/NVDAObjects/IAccessible/winConsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class WinConsole(LegacyWinConsole, IAccessible):

def findExtraOverlayClasses(obj, clsList):
if isWin10(1607) and config.conf['terminals']['keyboardSupportInLegacy']:
from NVDAObjects.behaviors import TerminalWithKeyboardSupport
clsList.append(TerminalWithKeyboardSupport)
from NVDAObjects.behaviors import TerminalWithoutTypedCharDetection
clsList.append(TerminalWithoutTypedCharDetection)
clsList.append(WinConsole)
4 changes: 2 additions & 2 deletions source/NVDAObjects/UIA/winConsoleUIA.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from winVersion import isWin10
from . import UIATextInfo
from ..behaviors import TerminalWithKeyboardSupport
from ..behaviors import TerminalWithoutTypedCharDetection
from ..window import Window


Expand Down Expand Up @@ -219,7 +219,7 @@ def _get_focusRedirect(self):
return None


class WinConsoleUIA(TerminalWithKeyboardSupport):
class WinConsoleUIA(TerminalWithoutTypedCharDetection):
#: Disable the name as it won't be localized
name = ""
#: Only process text changes every 30 ms, in case the console is getting
Expand Down
12 changes: 6 additions & 6 deletions source/NVDAObjects/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def event_loseFocus(self):
self.stopMonitoring()


class TerminalWithKeyboardSupport(Terminal):
class TerminalWithoutTypedCharDetection(Terminal):
"""A Terminal object that also provides typed character support for
console applications on Windows 10 1607 and later."""
#: Whether this object reliably sends textChange events.
Expand Down Expand Up @@ -395,7 +395,7 @@ def _reportNewText(self, line):
# This will need to be changed once #8110 is merged.
speech.curWordChars = []
self._queuedChars = []
super(TerminalWithKeyboardSupport, self)._reportNewText(line)
super(TerminalWithoutTypedCharDetection, self)._reportNewText(line)

def event_typedCharacter(self, ch):
if ch == '\t':
Expand All @@ -415,11 +415,11 @@ def event_typedCharacter(self, ch):
):
self._queuedChars.append(ch)
else:
super(TerminalWithKeyboardSupport, self).event_typedCharacter(ch)
super(TerminalWithoutTypedCharDetection, self).event_typedCharacter(ch)

def event_textChange(self):
self._dispatchQueue()
super(TerminalWithKeyboardSupport, self).event_textChange()
super(TerminalWithoutTypedCharDetection, self).event_textChange()

@script(gestures=[
"kb:enter",
Expand All @@ -444,13 +444,13 @@ def _calculateNewText(self, newLines, oldLines):
self._findNonBlankIndices(newLines)
!= self._findNonBlankIndices(oldLines)
)
return super(TerminalWithKeyboardSupport, self)._calculateNewText(newLines, oldLines)
return super(TerminalWithoutTypedCharDetection, self)._calculateNewText(newLines, oldLines)

def _dispatchQueue(self):
"""Sends queued typedCharacter events through to NVDA."""
while self._queuedChars:
ch = self._queuedChars.pop(0)
super(TerminalWithKeyboardSupport, self).event_typedCharacter(ch)
super(TerminalWithoutTypedCharDetection, self).event_typedCharacter(ch)

def _findNonBlankIndices(self, lines):
"""
Expand Down
4 changes: 2 additions & 2 deletions source/NVDAObjects/window/winConsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import winConsoleHandler
from . import Window
from ..behaviors import Terminal, EditableTextWithoutAutoSelectDetection, TerminalWithKeyboardSupport
from ..behaviors import Terminal, EditableTextWithoutAutoSelectDetection, TerminalWithoutTypedCharDetection
import api
import core

Expand All @@ -21,7 +21,7 @@ class WinConsole(Terminal, EditableTextWithoutAutoSelectDetection, Window):
def initOverlayClass(self):
# Legacy consoles take quite a while to send textChange events.
# This significantly impacts typing performance, so don't queue chars.
if isinstance(self, TerminalWithKeyboardSupport):
if isinstance(self, TerminalWithoutTypedCharDetection):
self._supportsTextChange = False

def _get_TextInfo(self):
Expand Down
4 changes: 2 additions & 2 deletions source/appModules/putty.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""

import oleacc
from NVDAObjects.behaviors import TerminalWithKeyboardSupport
from NVDAObjects.behaviors import TerminalWithoutTypedCharDetection
from NVDAObjects.window import DisplayModelEditableText, DisplayModelLiveText
import appModuleHandler
from NVDAObjects.IAccessible import IAccessible
Expand All @@ -23,4 +23,4 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList):
clsList.remove(DisplayModelEditableText)
except ValueError:
pass
clsList[0:0] = (TerminalWithKeyboardSupport, DisplayModelLiveText)
clsList[0:0] = (TerminalWithoutTypedCharDetection, DisplayModelLiveText)
4 changes: 2 additions & 2 deletions source/keyboardHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def internal_keyDownEvent(vkCode,scanCode,extended,injected):
# #6017: handle typed characters in Win10 RS2 and above where we can't detect typed characters in-process
# This code must be in the 'finally' block as code above returns in several places yet we still want to execute this particular code.
focus=api.getFocusObject()
from NVDAObjects.behaviors import TerminalWithKeyboardSupport
from NVDAObjects.behaviors import TerminalWithoutTypedCharDetection
if (
# This is only possible in Windows 10 1607 and above
winVersion.isWin10(1607)
Expand All @@ -212,7 +212,7 @@ def internal_keyDownEvent(vkCode,scanCode,extended,injected):
# or the focus is within a UWP app, where WM_CHAR never gets sent
or focus.windowClassName.startswith('Windows.UI.Core')
#Or this is a console with keyboard support, where WM_CHAR messages are doubled
or isinstance(focus, TerminalWithKeyboardSupport)
or isinstance(focus, TerminalWithoutTypedCharDetection)
)
):
keyStates=(ctypes.c_byte*256)()
Expand Down
4 changes: 2 additions & 2 deletions source/winConsoleHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def getConsoleVisibleLines():

@winUser.WINEVENTPROC
def consoleWinEventHook(handle,eventID,window,objectID,childID,threadID,timestamp):
from NVDAObjects.behaviors import TerminalWithKeyboardSupport
from NVDAObjects.behaviors import TerminalWithoutTypedCharDetection
#We don't want to do anything with the event if the event is not for the window this console is in
if window!=consoleObject.windowHandle:
return
Expand All @@ -146,7 +146,7 @@ def consoleWinEventHook(handle,eventID,window,objectID,childID,threadID,timestam
x=winUser.GET_X_LPARAM(objectID)
y=winUser.GET_Y_LPARAM(objectID)
consoleScreenBufferInfo=wincon.GetConsoleScreenBufferInfo(consoleOutputHandle)
if not isinstance(consoleObject, TerminalWithKeyboardSupport) and x<consoleScreenBufferInfo.dwCursorPosition.x and (y==consoleScreenBufferInfo.dwCursorPosition.y or y==consoleScreenBufferInfo.dwCursorPosition.y+1):
if not isinstance(consoleObject, TerminalWithoutTypedCharDetection) and x<consoleScreenBufferInfo.dwCursorPosition.x and (y==consoleScreenBufferInfo.dwCursorPosition.y or y==consoleScreenBufferInfo.dwCursorPosition.y+1):
eventHandler.queueEvent("typedCharacter",consoleObject,ch=unichr(winUser.LOWORD(childID)))

def initialize():
Expand Down

0 comments on commit f59dd6a

Please sign in to comment.