[BRLTTY] Fix BrlAPI refresh on xbrlapi setfocus notification

Samuel Thibault samuel.thibault at ens-lyon.org
Sat Oct 8 20:29:19 EDT 2016


Braille rendering was not flushed when xbrlapi notifies brltty of the
focus change. Also, we need to make sure to flush rendering when the
displayed connection changes, so far we were just lucky that the cursor
position was different and thus triggered a flush.

Samuel
-------------- next part --------------
diff --git a/Programs/brlapi_server.c b/Programs/brlapi_server.c
index 3fadda2..bcc530f 100644
--- a/Programs/brlapi_server.c
+++ b/Programs/brlapi_server.c
@@ -924,6 +924,7 @@ static int handleSetFocus(Connection *c, brlapi_packetType_t type, brlapi_packet
   CHECKEXC(c->tty,BRLAPI_ERROR_ILLEGAL_INSTRUCTION,"not allowed out of tty mode");
   c->tty->focus = ntohl(ints[0]);
   logMessage(LOG_CATEGORY(SERVER_EVENTS), "focus on window %#010x from fd%"PRIfd,c->tty->focus,c->fd);
+  asyncSignalEvent(flushEvent, NULL);
   return 0;
 }
 
@@ -2830,6 +2853,7 @@ out:
  */
 int api_flush(BrailleDisplay *brl) {
   Connection *c;
+  static Connection *displayed_last;
   int ok = 1;
   int drain = 0;
   int update = 0;
@@ -2863,7 +2887,7 @@ int api_flush(BrailleDisplay *brl) {
       }
     }
 
-    if (c->brlbufstate==TODISPLAY || update) {
+    if (c != displayed_last || c->brlbufstate==TODISPLAY || update) {
       unsigned char *oldbuf = disp->buffer, buf[displaySize];
       disp->buffer = buf;
       getDots(&c->brailleWindow, buf);
@@ -2871,6 +2895,7 @@ int api_flush(BrailleDisplay *brl) {
       ok = trueBraille->writeWindow(brl, c->brailleWindow.text);
       drain = 1;
       disp->buffer = oldbuf;
+      displayed_last = c;
     }
     unlockMutex(&apiDriverMutex);
     unlockMutex(&c->brailleWindowMutex);


More information about the BRLTTY mailing list