Skip to content

Commit 95b6ced

Browse files
Merge 3f138b8 into c595463
2 parents c595463 + 3f138b8 commit 95b6ced

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

source/JABHandler.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
import config
4444
from utils.security import isRunningOnSecureDesktop
4545

46+
#: Verification of the architecture of the running system
47+
is_64Bit = os.environ["PROCESSOR_ARCHITECTURE"].endswith("64")
48+
4649
#: The path to the user's .accessibility.properties file, used
4750
#: to enable JAB.
4851
A11Y_PROPS_PATH = os.path.expanduser(r"~\.accessibility.properties")
@@ -53,7 +56,6 @@
5356
)
5457

5558
#Some utility functions to help with function defines
56-
5759
def _errcheck(res, func, args):
5860
if not res:
5961
raise RuntimeError("Result %s" % res)
@@ -81,7 +83,8 @@ def _fixBridgeFunc(restype,name,*argtypes,**kwargs):
8183
jboolean=c_bool
8284

8385

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):
8588
pass
8689
AccessibleTable=JOBJECT64
8790

@@ -791,7 +794,8 @@ def event_enterJavaWindow(hwnd):
791794
def enterJavaWindow_helper(hwnd):
792795
vmID=c_long()
793796
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
795799
while time.time()<timeout and not eventHandler.isPendingEvents("gainFocus"):
796800
try:
797801
bridgeDll.getAccessibleContextWithFocus(hwnd,byref(vmID),byref(accContext))
@@ -836,10 +840,12 @@ def enableBridge():
836840

837841

838842
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"
840847
try:
841-
bridgeDll = cdll.LoadLibrary(
842-
os.path.join(NVDAHelper.versionedLibPath, "windowsaccessbridge-32.dll"))
848+
bridgeDll = cdll.LoadLibrary(os.path.join(NVDAHelper.versionedLibPath, correctDll))
843849
except WindowsError:
844850
raise NotImplementedError("dll not available")
845851
_fixBridgeFuncs()

user_docs/en/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* NVDA will announce correctly the autocomplete suggestions in Eclipse and other Eclipse-based environments on Windows 11. (#16416, @thgcode)
2424
* Improved reliability of automatic text readout, particularly in terminal applications. (#15850, #16027, @Danstiv)
2525
* NVDA will correctly announce selection changes when editing a cell's text in Microsoft Excel. (#15843)
26+
* Java Access Bridge support works as expected on 32-bit systems, as it did in version 2019.2.1 and earlier. (#10842, @FelipeZanabria)
2627
* Windows 11 fixes:
2728
* NVDA will no longer appear to get stuck when closing the clipboard history and emoji panel. (#16346, #16347, @josephsl)
2829
* NVDA will announce visible candidates again when opening the Windows 11 IME interface. (#14023, @josephsl)

0 commit comments

Comments
 (0)