Skip to content

Commit

Permalink
Add automatic background braille display detection (#7741)
Browse files Browse the repository at this point in the history
* Implement braille display auto detection. This new background mechanism can be activated by choosing the Automatic option from NVDA's braille display settings. See #1271 for an in depth discussion of funcionality.

* brailliantB, use generic implementation for USB serial devices
* Use generic check function for braille display drivers supporting bdDetect
* Make auto detection the default
* Set a timeout for joining the bgThread when auto detection was on
* Poll for bluetooth devices on app switches
* Support bluetooth HID in bdDetect

* Use a separate thread for background scanning.

* Make the bdDetect thread a daemon thread

* Disable auto detection within the unit test framework. If we don't do this, detection will occur and unit tests will fail.

* in braille.handler.handleGainFocus, check whether the focused object has an active tree interceptor. If so, focus the tree interceptor instead

* Revert the use a separate thread for background scanning and make sure recursion does not occur when using an APC

This reverts commit 5b97f39.

* Created Detector._scanQueuedSafe which wraps changing the state of _scanQueued within a lock

* Fix malformed VID and PID for Brailliant, add an extra check

* NO longer filter serial ports for Brailliant

* Updated changes.t2t
  • Loading branch information
LeonarddeR authored and michaelDCurran committed Jul 17, 2018
1 parent d99bb6a commit 846a998
Show file tree
Hide file tree
Showing 22 changed files with 1,094 additions and 676 deletions.
10 changes: 10 additions & 0 deletions source/appModuleHandler.py
Expand Up @@ -33,13 +33,20 @@
import api
import appModules
import watchdog
import extensionPoints

#Dictionary of processID:appModule paires used to hold the currently running modules
runningTable={}
#: The process ID of NVDA itself.
NVDAProcessID=None
_importers=None
_getAppModuleLock=threading.RLock()
#: Notifies when another application is taking foreground.
#: This allows components to react upon application switches.
#: For example, braille triggers bluetooth polling for braille displaysf necessary.
#: Handlers are called with no arguments.
post_appSwitch = extensionPoints.Action()


class processEntry32W(ctypes.Structure):
_fields_ = [
Expand Down Expand Up @@ -237,6 +244,9 @@ def handleAppSwitch(oldMods, newMods):
processed = set()
nextStage = []

if not oldMods or oldMods[-1].appName != newMods[-1].appName:
post_appSwitch.notify()

# Determine all apps that are losing focus and fire appropriate events.
for mod in reversed(oldMods):
if mod in processed:
Expand Down

0 comments on commit 846a998

Please sign in to comment.