|
43 | 43 | import config |
44 | 44 | from utils.security import isRunningOnSecureDesktop |
45 | 45 |
|
| 46 | +#: Verification of the architecture of the running system |
| 47 | +is_64Bit = os.environ["PROCESSOR_ARCHITECTURE"].endswith("64") |
| 48 | + |
46 | 49 | #: The path to the user's .accessibility.properties file, used |
47 | 50 | #: to enable JAB. |
48 | 51 | A11Y_PROPS_PATH = os.path.expanduser(r"~\.accessibility.properties") |
|
53 | 56 | ) |
54 | 57 |
|
55 | 58 | #Some utility functions to help with function defines |
56 | | - |
57 | 59 | def _errcheck(res, func, args): |
58 | 60 | if not res: |
59 | 61 | raise RuntimeError("Result %s" % res) |
@@ -81,7 +83,8 @@ def _fixBridgeFunc(restype,name,*argtypes,**kwargs): |
81 | 83 | jboolean=c_bool |
82 | 84 |
|
83 | 85 |
|
84 | | -class JOBJECT64(c_int64): |
| 86 | +# If the machine is 64-bit, use c_int64, otherwise use c_int as a parameter. |
| 87 | +class JOBJECT64(c_int64 if is_64Bit else c_int): |
85 | 88 | pass |
86 | 89 | AccessibleTable=JOBJECT64 |
87 | 90 |
|
@@ -791,7 +794,8 @@ def event_enterJavaWindow(hwnd): |
791 | 794 | def enterJavaWindow_helper(hwnd): |
792 | 795 | vmID=c_long() |
793 | 796 | accContext=JOBJECT64() |
794 | | - timeout=time.time()+0.2 |
| 797 | + # I changed the timeout to 0.5 because when a Java object disappeared NVDA would hang until I moved focus again. |
| 798 | + timeout = time.time() + 0.5 |
795 | 799 | while time.time()<timeout and not eventHandler.isPendingEvents("gainFocus"): |
796 | 800 | try: |
797 | 801 | bridgeDll.getAccessibleContextWithFocus(hwnd,byref(vmID),byref(accContext)) |
@@ -836,10 +840,12 @@ def enableBridge(): |
836 | 840 |
|
837 | 841 |
|
838 | 842 | def initialize(): |
839 | | - global bridgeDll, isRunning |
| 843 | + global bridgeDll, is_64Bit, isRunning |
| 844 | + # If the system is 64-bit, load the dll that we have in the NVDA distribution. |
| 845 | + # Otherwise, it loads the one on the 32-bit system, which does not have the -32 suffix. |
| 846 | + correctDll = "windowsaccessbridge-32.dll" if is_64Bit else "windowsaccessbridge.dll" |
840 | 847 | try: |
841 | | - bridgeDll = cdll.LoadLibrary( |
842 | | - os.path.join(NVDAHelper.versionedLibPath, "windowsaccessbridge-32.dll")) |
| 848 | + bridgeDll = cdll.LoadLibrary(os.path.join(NVDAHelper.versionedLibPath, correctDll)) |
843 | 849 | except WindowsError: |
844 | 850 | raise NotImplementedError("dll not available") |
845 | 851 | _fixBridgeFuncs() |
|
0 commit comments