[BRLTTY] BRLTTY and AT-SPI

Samuel Thibault samuel.thibault at ens-lyon.org
Fri Aug 28 20:09:41 EDT 2015


Aura Kelloniemi, le Fri 28 Aug 2015 23:55:53 +0300, a écrit :
> - BRLTTY does not correctly detect the terminal size (it tries to guess it by
>   examining line lengths, but this fails). Because of this the cursor is often
>   out of BRLTTY's knowledge.

The attached patch should fix this. Dave, here is a changelog:

“
atspi2: bump the screen width as much as needed when the cursor goes
beyond the text provided by the widget.
”

There is actually no way to know the terminal size, because there is no
such notion in AccessibleText.  Notably, if the application prints 100
characters with no \n, then the line exposed by the terminal widget will
be 160 characters long...

I had raised concerns on

https://mail.gnome.org/archives/gnome-accessibility-devel/2005-June/msg00004.html

that an AccessibleText interface is really not convenient for a
terminal, if it makes sense at all, but the discussion went nowhere, and
I was stuck with just interpreting AccessibleText so as to be efficient
(see the thread discussion), with all the potential bugs you now get.

Samuel
-------------- next part --------------
diff --git a/Drivers/Screen/AtSpi2/screen.c b/Drivers/Screen/AtSpi2/screen.c
index 4305213..28ad51a 100644
--- a/Drivers/Screen/AtSpi2/screen.c
+++ b/Drivers/Screen/AtSpi2/screen.c
@@ -947,7 +947,7 @@ static void
 describe_AtSpi2Screen (ScreenDescription *description) {
   pthread_mutex_lock(&updateMutex);
   if (curPath) {
-    description->cols = curNumCols;
+    description->cols = curPosX>=curNumCols?curPosX+1:curNumCols;
     description->rows = curNumRows?curNumRows:1;
     description->posx = curPosX;
     description->posy = curPosY;
@@ -971,8 +971,13 @@ readCharacters_AtSpi2Screen (const ScreenBox *box, ScreenCharacter *buffer) {
     return 1;
   }
   if (!curNumCols || !curNumRows) return 0;
-  if (!validateScreenBox(box, curNumCols, curNumRows)) return 0;
   pthread_mutex_lock(&updateMutex);
+  short cols = curPosX>=curNumCols?curPosX+1:curNumCols;
+  if (!validateScreenBox(box, cols, curNumRows))
+  {
+    pthread_mutex_unlock(&updateMutex);
+    return 0;
+  }
   for (y=0; y<box->height; y++) {
     if (curRowLengths[box->top+y]) {
       for (x=0; x<box->width; x++) {


More information about the BRLTTY mailing list