Skip to content

Commit 8b5645a

Browse files
authored
Merge 1587b61 into 2a13056
2 parents 2a13056 + 1587b61 commit 8b5645a

3 files changed

Lines changed: 26 additions & 5 deletions

File tree

source/JABHandler.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# -*- coding: UTF-8 -*-
2-
#javaAccessBridgeHandler.py
3-
#A part of NonVisual Desktop Access (NVDA)
4-
#Copyright (C) 2007-2018 NV Access Limited, Peter Vágner, Renaud Paquay, Babbage B.V.
5-
#This file is covered by the GNU General Public License.
6-
#See the file COPYING for more details.
2+
# A part of NonVisual Desktop Access (NVDA)
3+
# Copyright (C) 2007-2019 NV Access Limited, Peter Vágner, Renaud Paquay, Babbage B.V.
4+
# This file is covered by the GNU General Public License.
5+
# See the file COPYING for more details.
76

87
import queue
98
from ctypes import *
@@ -258,6 +257,15 @@ class AccessibleKeyBindings(Structure):
258257
_fixBridgeFunc(BOOL,'getAccessibleTextItems',c_long,JOBJECT64,POINTER(AccessibleTextItemsInfo),jint,errcheck=True)
259258
_fixBridgeFunc(BOOL,'getAccessibleTextSelectionInfo',c_long,JOBJECT64,POINTER(AccessibleTextSelectionInfo),errcheck=True)
260259
_fixBridgeFunc(BOOL,'getAccessibleTextAttributes',c_long,JOBJECT64,jint,POINTER(AccessibleTextAttributesInfo),errcheck=True)
260+
_fixBridgeFunc(
261+
BOOL,
262+
'getAccessibleTextRect',
263+
c_long,
264+
JOBJECT64,
265+
POINTER(AccessibleTextRectInfo),
266+
jint,
267+
errcheck=True
268+
)
261269
_fixBridgeFunc(BOOL,'getAccessibleTextLineBounds',c_long,JOBJECT64,jint,POINTER(jint),POINTER(jint),errcheck=True)
262270
_fixBridgeFunc(BOOL,'getAccessibleTextRange',c_long,JOBJECT64,jint,jint,POINTER(c_char),c_short,errcheck=True)
263271
_fixBridgeFunc(BOOL,'getCurrentAccessibleValueFromContext',c_long,JOBJECT64,POINTER(c_wchar),c_short,errcheck=True)
@@ -494,6 +502,11 @@ def getTextAttributesInRange(self, startIndex, endIndex):
494502
bridgeDll.getTextAttributesInRange(self.vmID, self.accContext, startIndex, endIndex, byref(attributes), byref(length))
495503
return attributes, length.value
496504

505+
def getAccessibleTextRect(self, index):
506+
rect = AccessibleTextRectInfo()
507+
bridgeDll.getAccessibleTextRect(self.vmID, self.accContext, byref(rect), index)
508+
return rect
509+
497510
def getAccessibleRelationSet(self):
498511
relations = AccessibleRelationSetInfo()
499512
bridgeDll.getAccessibleRelationSet(self.vmID, self.accContext, byref(relations))

source/NVDAObjects/JAB/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ def _getOffsetFromPoint(self,x,y):
9797
offset=max(min(info.indexAtPoint,info.charCount-1),0)
9898
return offset
9999

100+
def _getBoundingRectFromOffset(self,offset):
101+
rect = self.obj.jabContext.getAccessibleTextRect(offset)
102+
try:
103+
return RectLTWH(rect.x, rect.y, rect.width, rect.height).toLTRB()
104+
except ValueError:
105+
raise LookupError
106+
100107
def _getCaretOffset(self):
101108
textInfo=self.obj.jabContext.getAccessibleTextInfo(self.obj._JABAccContextInfo.x,self.obj._JABAccContextInfo.y)
102109
offset=textInfo.caretIndex

source/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ def handlePowerStatusChange(self):
428428
log.debug("initializing Java Access Bridge support")
429429
try:
430430
JABHandler.initialize()
431+
log.info("Java Access Bridge support initialized")
431432
except NotImplementedError:
432433
log.warning("Java Access Bridge not available")
433434
except:

0 commit comments

Comments
 (0)