Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 't5181' into next
Incubates #5181, #4576.
  • Loading branch information
jcsteh committed Jun 29, 2015
2 parents b720d04 + 355b91f commit 3f71be7
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
9 changes: 8 additions & 1 deletion source/brailleDisplayDrivers/papenmeier.py
Expand Up @@ -15,6 +15,7 @@
import inputCore
import brailleInput
import struct
import keyboardHandler

try:
import ftdi2
Expand Down Expand Up @@ -528,7 +529,13 @@ def __init__(self, keys, driver):
self.id=brl_join_keys(brl_decode_key_names_repeat(driver))
return

if driver._baud != 1 and keys[0] == 'L' and not ((ord(keys[3])-48) >>3):
if driver._baud != 1 and keys[0] == 'L':
if ((ord(keys[3]) -48) >>3):
scancode=ord(keys[5])-48 << 4| ord(keys[6])-48
press = not ord(keys[4]) & 1
ext = bool(ord(keys[4]) & 2)
keyboardHandler.injectRawKeyboardInput(press,scancode,ext)
return
#get dots
z = ord('0')
b = ord(keys[4])-z
Expand Down
37 changes: 36 additions & 1 deletion source/keyboardHandler.py
Expand Up @@ -3,7 +3,7 @@
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2006-2013 NV Access Limited, Peter Vágner, Aleksey Sadovoy
#Copyright (C) 2006-2015 NV Access Limited, Peter Vágner, Aleksey Sadovoy

"""Keyboard support"""

Expand Down Expand Up @@ -543,3 +543,38 @@ def getDisplayTextForIdentifier(cls, identifier):
return dispSource, "+".join(names)

inputCore.registerGestureSource("kb", KeyboardInputGesture)

def injectRawKeyboardInput(isPress, code, isExtended):
"""Injet 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.
@param isPress: Whether the key is being pressed.
@type isPress: bool
@param code: The scan code (PC set 1) of the key.
@type code: int
@param isExtended: Whether this is an extended key.
@type isExtended: bool
"""
mapScan = code
if isExtended:
# Change what we pass to MapVirtualKeyEx, but don't change what NVDA gets.
mapScan |= 0xE000
vkCode = winUser.user32.MapVirtualKeyExW(mapScan, winUser.MAPVK_VSC_TO_VK_EX, getInputHkl())
if isPress:
shouldSend = internal_keyDownEvent(vkCode, code, isExtended, False)
else:
shouldSend = internal_keyUpEvent(vkCode, code, isExtended, False)
if shouldSend:
flags = 0
if not isPress:
flags |= 2
if isExtended:
flags |= 1
global ignoreInjected
ignoreInjected = True
try:
winUser.keybd_event(vkCode, code, flags, None)
wx.Yield()
finally:
ignoreInjected = False
3 changes: 2 additions & 1 deletion source/winUser.py
Expand Up @@ -123,7 +123,8 @@ class GUITHREADINFO(Structure):
#Clipboard formats
CF_TEXT=1
#mapVirtualKey constants
MAPVK_VK_TO_CHAR=2
MAPVK_VK_TO_CHAR=2
MAPVK_VSC_TO_VK_EX=3
#Virtual key codes
VK_LBUTTON=1
VK_RBUTTON=2
Expand Down
3 changes: 1 addition & 2 deletions user_docs/en/userGuide.t2t
Expand Up @@ -1758,8 +1758,7 @@ The following Braille displays are supported:
If BrxCom is installed, NVDA will use BrxCom.
BrxCom is a tool that allows you to use the Braille input independently from a screen reader.
A new version of BrxCom which works with NVDA will be released by Papenmeier soon.
Braille input is possible with the Trio, BRAILLEX Live 20 and Braillex Live devices without BrxCom.
Braille input is also possible with the Live Plus model, but with BrxCom only.
Braille input is possible with the Trio and BRAILLEX Live models.

Most devices have an Easy Access Bar (EAB) that allows intuitive and fast operation.
The EAB can be moved in four directions where generally each direction has two switches.
Expand Down

0 comments on commit 3f71be7

Please sign in to comment.