Module keyboardHandler
[hide private]

Module keyboardHandler

source code

Keyboard support

Classes [hide private]
  KeyboardInputGesture
A key pressed on the traditional system keyboard.
Functions [hide private]
 
passNextKeyThrough() source code
 
isNVDAModifierKey(vkCode, extended) source code
 
getNVDAModifierKeys() source code
 
internal_keyDownEvent(vkCode, scanCode, extended, injected)
Event called by winInputHook when it receives a keyDown.
source code
 
internal_keyUpEvent(vkCode, scanCode, extended, injected)
Event called by winInputHook when it receives a keyUp.
source code
 
initialize()
Initialises keyboard support.
source code
 
terminate() source code
 
getInputHkl()
Obtain the hkl currently being used for input.
source code
 
canModifiersPerformAction(modifiers)
Determine whether given generalized modifiers can perform an action if pressed alone.
source code
 
injectRawKeyboardInput(isPress, code, isExtended)
Inject raw input from a system keyboard that is not handled natively by Windows.
source code
Variables [hide private]
  ignoreInjected = False
  VK_WIN = "windows"
  VK_NVDA = "NVDA"
  trappedKeys = set()
Keys which have been trapped by NVDA and should not be passed to the OS.
  passKeyThroughCount = -1
Tracks the number of keys passed through by request of the user.
  lastPassThroughKeyDown = None
The last key down passed through by request of the user.
  lastNVDAModifier = None
The last NVDA modifier key that was pressed with no subsequent key presses.
  lastNVDAModifierReleaseTime = None
When the last NVDA modifier key was released.
  bypassNVDAModifier = False
Indicates that the NVDA modifier's special functionality should be bypassed until a key is next released.
  currentModifiers = set()
The modifiers currently being pressed.
int keyCounter = 0
A counter which is incremented each time a key is pressed.
  stickyNVDAModifier = None
The current sticky NVDa modifier key.
  stickyNVDAModifierLocked = False
Whether the sticky NVDA modifier is locked.
  SUPPORTED_NVDA_MODIFIER_KEYS = "capslock", "numpadinsert", "in...
Function Details [hide private]

getInputHkl()

source code 

Obtain the hkl currently being used for input. This retrieves the hkl from the thread of the focused window.

canModifiersPerformAction(modifiers)

source code 

Determine whether given generalized modifiers can perform an action if pressed alone. For example, alt activates the menu bar if it isn't modifying another key.

injectRawKeyboardInput(isPress, code, isExtended)

source code 

Inject raw input from a system keyboard that is not handled natively by Windows. For example, this might be used for input from a QWERTY keyboard on a braille display. NVDA will treat the key as if it had been pressed on a normal system keyboard. If it is not handled by NVDA, it will be sent to the operating system.

Parameters:
  • isPress (bool) - Whether the key is being pressed.
  • code (int) - The scan code (PC set 1) of the key.
  • isExtended (bool) - Whether this is an extended key.

Variables Details [hide private]

passKeyThroughCount

Tracks the number of keys passed through by request of the user. If -1, pass through is disabled. If 0 or higher then key downs and key ups will be passed straight through.

Value:
-1

keyCounter

A counter which is incremented each time a key is pressed. Note that this may be removed in future, so reliance on it should generally be avoided.

Type:
int
Value:
0

SUPPORTED_NVDA_MODIFIER_KEYS

Value:
"capslock", "numpadinsert", "insert"