Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions source/virtualBuffers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
VBufRemote_nodeHandle_t = ctypes.c_ulonglong


def _normalizeIdentifier(docHandle: int | None, ID: int | None) -> tuple[int, int]:
return docHandle if docHandle is not None else 0, ID if ID is not None else 0


class VBufStorage_findMatch_word(str):
pass

Expand Down Expand Up @@ -223,7 +227,7 @@ def _getNVDAObjectFromOffset(self, offset):
return self.obj.getNVDAObjectFromIdentifier(docHandle, ID)

def _getOffsetsFromNVDAObjectInBuffer(self, obj):
docHandle, ID = self.obj.getIdentifierFromNVDAObject(obj)
docHandle, ID = _normalizeIdentifier(*self.obj.getIdentifierFromNVDAObject(obj))
return self._getOffsetsFromFieldIdentifier(docHandle, ID)

def _getOffsetsFromNVDAObject(self, obj):
Expand Down Expand Up @@ -520,7 +524,9 @@ def __init__(self, rootNVDAObject, backendName=None):
self.backendName = backendName
self.VBufHandle = None
self.isLoading = False
self.rootDocHandle, self.rootID = self.getIdentifierFromNVDAObject(self.rootNVDAObject)
self.rootDocHandle, self.rootID = _normalizeIdentifier(
*self.getIdentifierFromNVDAObject(self.rootNVDAObject),
)
self.rootIdentifiers[self.rootDocHandle, self.rootID] = self

def prepare(self):
Expand Down Expand Up @@ -629,7 +635,7 @@ def unloadBuffer(self):
self.VBufHandle = None

def isNVDAObjectPartOfLayoutTable(self, obj):
docHandle, ID = self.getIdentifierFromNVDAObject(obj)
docHandle, ID = _normalizeIdentifier(*self.getIdentifierFromNVDAObject(obj))
ID = str(ID)
info = self.makeTextInfo(obj)
info.collapse()
Expand Down Expand Up @@ -869,7 +875,7 @@ def _handleUpdate(self):
braille.handler.handleUpdate(self)

def getControlFieldForNVDAObject(self, obj):
docHandle, objId = self.getIdentifierFromNVDAObject(obj)
docHandle, objId = _normalizeIdentifier(*self.getIdentifierFromNVDAObject(obj))
objId = str(objId)
info = self.makeTextInfo(obj)
info.collapse()
Expand All @@ -888,7 +894,7 @@ def _isNVDAObjectInApplication_noWalk(self, obj):
return inApp
# If the object is in the buffer, it's definitely not in an application.
try:
docHandle, objId = self.getIdentifierFromNVDAObject(obj)
docHandle, objId = _normalizeIdentifier(*self.getIdentifierFromNVDAObject(obj))
except: # noqa: E722
log.debugWarning(
"getIdentifierFromNVDAObject failed. Object probably died while walking ancestors.",
Expand All @@ -901,8 +907,8 @@ def _isNVDAObjectInApplication_noWalk(self, obj):
try:
NVDAHelper.localLib.VBuf_getControlFieldNodeWithIdentifier(
self.VBufHandle,
docHandle if docHandle is not None else 0,
objId if objId is not None else 0,
docHandle,
objId,
ctypes.byref(node),
)
except WindowsError:
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ The setting is disabled by default. (#20013, @LeonarddeR)
* Fixed an error that could occur when NVDA checked whether a language is supported for a synthesizer with invalid languages. (#20080, @nvdaes)
* NVDA will attempt to recover more quickly from freezes in some applications, especially those written in Java. (#14396, @thgcode)
* In Firefox browse mode, the accessible name of form controls (such as checkboxes and radio buttons) is now correctly announced when the control has an `aria-label` and an associated `<label>` element that contains only `aria-hidden` content. (#19409, @bramd)
* In Foxit PDF Editor, NVDA can once again browse PDF documents. (#20440, @cary-rowen)
* The "Toggles on and off if the screen layout is preserved while rendering the document content" item in the "Browse mode" category of the Input Gestures dialog now behaves correctly. (#18378)
* In Microsoft Word with UIA enabled, page changes are now correctly announced when navigating table rows that span multiple pages. (#19386, @akj)
* Fixed excessive resource usage and highlight flickering when using Visual Highlight. (#17434, @hwf1324)
Expand Down
Loading