Re: [g-a-devel] [PATCH] gnopernicus letting BRLTTY translate dots



Nice work Samuel!

I just got off the phone with the BAUM engineers, who told me they'll look at the patch shortly (their day is about over now in Romania...).


Peter Korn
Sun Accessibility team

Samuel Thibault wrote:
Hi,

Mario Lang wrote a gnopernicus braille driver using BRLTTY's BrlAPI
some time ago. This brings the possibility to use its big lot of
braille drivers and smoothly switch between linux consoles. But
gnopernicus doesn't have many translation tables, while BRLTTY have
plenty of them, including very special ones (VisioBraille table for
instance). Moreover, BRLTTY users will most probably prefer just keeping
the same braille style & cursor settings without having to reconfigure
it.

Here is a patch which makes gnopernicus let BRLTTY translate text into
dots: if the "None" translation table is selected (ie no translation
table is loaded), xml's plain text is recorded as such, while xml's
raw dots are still stored the usual way. The BRLTTY driver then gives
both to BRLTTY, which mixes them up appropriately.

Since braille style & cursor settings will be handled by BRLTTY,
selecting the "None" translation will also disable corresponding braille
settings buttons, for not confusing the user.

Regards,
Samuel, for S&S


------------------------------------------------------------------------

diff -urp gnopernicus-0.9.1/braille/libbrl/alvabrl.c gnopernicus-brltty-0.9.1/braille/libbrl/alvabrl.c
--- gnopernicus-0.9.1/braille/libbrl/alvabrl.c	2004-04-08 10:41:23.000000000 +0200
+++ gnopernicus-brltty-0.9.1/braille/libbrl/alvabrl.c	2004-08-01 23:34:59.000000000 +0200
@@ -492,7 +492,7 @@ short alva_brl_input_parser (int NewVal)
 }
/* ... */
-int alva_brl_send_dots (unsigned char *dots, short count, short blocking)
+int alva_brl_send_dots (unsigned char *dots, unsigned char *text, short cursorPosition, short count, short blocking)
 {
int rv = 0;
diff -urp gnopernicus-0.9.1/braille/libbrl/baumbrl.c gnopernicus-brltty-0.9.1/braille/libbrl/baumbrl.c
--- gnopernicus-0.9.1/braille/libbrl/baumbrl.c	2003-08-05 18:15:47.000000000 +0200
+++ gnopernicus-brltty-0.9.1/braille/libbrl/baumbrl.c	2004-08-01 23:35:19.000000000 +0200
@@ -1129,7 +1129,7 @@ short baum_brl_input_parser (int NewVal)
 }
/* ... */
-int baum_brl_send_dots (unsigned char *Dots, short Count, short Blocking)
+int baum_brl_send_dots (unsigned char *Dots, unsigned char *Text, short CursorPosition, short Count, short Blocking)
 {
 	int rv = 0;
 	int i, realcnt = 0;
diff -urp gnopernicus-0.9.1/braille/libbrl/braille.c gnopernicus-brltty-0.9.1/braille/libbrl/braille.c
--- gnopernicus-0.9.1/braille/libbrl/braille.c	2004-04-08 10:41:23.000000000 +0200
+++ gnopernicus-brltty-0.9.1/braille/libbrl/braille.c	2004-08-01 23:51:30.000000000 +0200
@@ -69,6 +69,8 @@ BRLDEV_INFO   SupportedDevices[] = {
static BRL_DEVICE* CurrentDevice = NULL;
 static unsigned char* Dots = NULL;
+static unsigned char* Text = NULL;
+static short cursorPosition = 0;
/* static short CursorShape = 0x0C; dot 7/8 */
 /* static short CursorMask = 0x0C;       dot 7/8 */
@@ -266,11 +268,12 @@ int brl_open_device (char *DeviceName, i
 			/* memset (Text, ' ', CurrentDevice->CellCount * sizeof (char)); */
 			/* Attrs = calloc (CurrentDevice->CellCount, sizeof (unsigned long)); */
 			Dots = calloc (CurrentDevice->CellCount, sizeof (unsigned char));
+			Text = calloc (CurrentDevice->CellCount, sizeof (unsigned char));
/* assert (Text && Attrs && Dots); */ /* clear all cells */
-    			CurrentDevice->send_dots(Dots, CurrentDevice->CellCount, 1);	/* blocking send ;-) */
+    			CurrentDevice->send_dots(Dots, Text, 0, CurrentDevice->CellCount, 1);	/* blocking send ;-) */
 		}
 		else
 		{
@@ -400,10 +403,16 @@ void brl_clear_all()
 {
-	if ( CurrentDevice &&
-	 	  Dots )
-	{				
-		memset (&Dots[0], 0, CurrentDevice->CellCount);
+	if ( CurrentDevice )
+	{
+		if ( Dots )
+		{				
+			memset (&Dots[0], 0, CurrentDevice->CellCount);
+		}
+		if ( Text )
+		{				
+			memset (&Text[0], ' ', CurrentDevice->CellCount);
+		}
 	}
 	
 }
@@ -415,16 +424,22 @@ void brl_clear_display (short Display)
 	/* set to 0 all the cells coresponding to the display */
 	if (	Display < (CurrentDevice->DisplayCount) &&
 			Display >= 0  &&
-			CurrentDevice &&
-			Dots)
+			CurrentDevice)
 	{		
 		brd = &(CurrentDevice->Displays[Display]);
-		memset (&Dots[brd->StartCell], 0, brd->Width);
+		if ( Dots )
+		{
+			memset (&Dots[brd->StartCell], 0, brd->Width);
+		}
+		if ( Text )
+		{
+			memset (&Text[brd->StartCell], 0, brd->Width);
+		}
 	}
 	
 }
-void brl_set_dots (short Display, short StartCell, unsigned char *newDots, short CellCount, short Offset, short CursorPosition)
+void brl_set_dots (short Display, short StartCell, unsigned char *newDots, unsigned char *newText, short CellCount, short Offset, short CursorPosition)
 {
BRL_DISPLAY *brd; @@ -434,9 +449,7 @@ void brl_set_dots (short Display, short if ( Display >= 0 &&
 			Display < (CurrentDevice->DisplayCount) &&			
 			CurrentDevice &&
-		 	CurrentDevice->send_dots &&
-			Dots &&
-			newDots)
+		 	CurrentDevice->send_dots)
 	{
 			
 		brd = &(CurrentDevice->Displays[Display]);
@@ -467,7 +480,16 @@ void brl_set_dots (short Display, short /* clamp cell count to actual display width */ /* fprintf(stderr, "BRL: set dots: cell_cnt:%d, st:%d, off:%d\n", CellCount, StartCell, Offset); */
-        memcpy (&Dots[brd->StartCell + StartCell], &newDots[Offset], CellCount - Offset);
+				if (Dots && newDots)
+        	memcpy (&Dots[brd->StartCell + StartCell], &newDots[Offset], CellCount - Offset);
+				if (Text && newText)
+        	memcpy (&Text[brd->StartCell + StartCell], &newText[Offset], CellCount - Offset);
+
+				/* if cursor is visible, tell its position */
+				if (CursorPosition >= Offset && CursorPosition <= Offset + brd->Width)
+					cursorPosition = CursorPosition - Offset + 1;
+				else
+					cursorPosition = 0;
/* !!! TBI !!! fire a callback here */
 			}
@@ -482,7 +504,7 @@ void brl_update_dots (short Blocking)
 	if (CurrentDevice && Dots)
 	{
 		/* send all dots at once */
-		CurrentDevice->send_dots(Dots, CurrentDevice->CellCount, Blocking);
+		CurrentDevice->send_dots(Dots, Text, cursorPosition, CurrentDevice->CellCount, Blocking);
 	}
}
diff -urp gnopernicus-0.9.1/braille/libbrl/braille.h gnopernicus-brltty-0.9.1/braille/libbrl/braille.h
--- gnopernicus-0.9.1/braille/libbrl/braille.h	2003-02-07 17:12:10.000000000 +0100
+++ gnopernicus-brltty-0.9.1/braille/libbrl/braille.h	2004-08-01 23:34:03.000000000 +0200
@@ -65,7 +65,7 @@ typedef struct
 }  BRL_DISPLAY;
typedef void (*BRL_DEV_CLOSE_DEVICE_PROC) ();
-typedef int (*BRL_DEV_SEND_DOTS_PROC) (unsigned char *Dots, short Length, short Blocking);
+typedef int (*BRL_DEV_SEND_DOTS_PROC) (unsigned char *Dots, unsigned char *Text, short cursorPosition, short Length, short Blocking);
typedef enum {bit_bits, bit_make_break_codes, bit_make_codes} BRL_INPUT_TYPE ; @@ -138,7 +138,7 @@ void brl_close_device (); void brl_clear_all();
 void  brl_clear_display (short Display);
-void  brl_set_dots (short Display, short StartCell, unsigned char *newDots, short CellCount, short Offset, short CursorPosition);
+void  brl_set_dots (short Display, short StartCell, unsigned char *newDots, unsigned char *newText, short CellCount, short Offset, short CursorPosition);
 void  brl_update_dots (short Blocking);
 short brl_get_disp_id (char* Role, short No);
diff -urp gnopernicus-0.9.1/braille/libbrl/brlxml.c gnopernicus-brltty-0.9.1/braille/libbrl/brlxml.c
--- gnopernicus-0.9.1/braille/libbrl/brlxml.c	2003-07-04 16:31:43.000000000 +0200
+++ gnopernicus-brltty-0.9.1/braille/libbrl/brlxml.c	2004-08-02 12:20:53.000000000 +0200
@@ -86,6 +86,9 @@ guint8* ttc_get_translation_table (const
 	gchar*	dir_fn 	= NULL;
 	FILE* 	fp	= NULL;
 	
+	if (!strcmp(language,"none"))
+		return NULL;
+
 	/* search the key in the table first */
 	value = (guint8*) g_hash_table_lookup (TranslationTableCache, language);
 		
@@ -172,6 +175,7 @@ BRL_DISP* brl_disp_new ()
 	
 	brl_disp = g_malloc0(sizeof(BRL_DISP));
 	brl_disp->Dots = g_byte_array_new();
+	brl_disp->Text = g_byte_array_new();
 	brl_disp->CursorPosition = -1;	/* no cursor */
 	brl_disp->CursorStyle = CS_UNDERLINE;
 	brl_disp->CursorMask = 0xC0;
@@ -190,6 +194,7 @@ void	brl_disp_free (BRL_DISP *brl_disp)
 	/* g_free (brl_disp->TranslationTable);	 */
 	g_free (brl_disp->Role);
 	g_byte_array_free (brl_disp->Dots, TRUE);
+	g_byte_array_free (brl_disp->Text, TRUE);
 	g_free (brl_disp);
 }
@@ -228,6 +233,8 @@ BRL_DISP* brl_disp_copy (BRL_DISP *brl_d
 	/* copy the dots array */
 	bd->Dots = g_byte_array_new();
 	g_byte_array_append (bd->Dots, brl_disp->Dots->data, brl_disp->Dots->len);
+	bd->Text = g_byte_array_new();
+	g_byte_array_append (bd->Text, brl_disp->Text->data, brl_disp->Text->len);
 	
 	return bd;
 }
@@ -324,9 +331,22 @@ void brl_disp_load_translation_table (BR
void brl_disp_add_dots (BRL_DISP *brl_disp, guint8* dots, int len)
 {
-
+	guint8 *text;
 /*	fprintf(stderr, "BRL: add dots: ID %08x, len %d\n", brl_disp, len); */
 	g_byte_array_append (brl_disp->Dots, dots, len);
+	text = g_alloca(len);
+	memset(text,' ',len);
+	g_byte_array_append (brl_disp->Text, text, len);
+}
+
+void brl_disp_add_text (BRL_DISP *brl_disp, guint8* text, int len)
+{
+	guint8 *dots;
+/*	fprintf(stderr, "BRL: add text: ID %08x, len %d\n", brl_disp, len); */
+	dots = g_alloca(len);
+	memset(dots,0,len);
+	g_byte_array_append (brl_disp->Dots, dots, len);
+	g_byte_array_append (brl_disp->Text, text, len);
 }
/* __ BRL_OUT METHODS _________________________________________________________ */
@@ -457,7 +477,8 @@ void brl_out_to_driver (BRL_OUT *brl_out
 			
 			/* fprintf (stderr, "CP:%d, M:%02X, P:%02X\n", brl_disp->CursorPosition, brl_disp->CursorMask, brl_disp->CursorPattern); */
 			
-			if (brl_disp->CursorPosition >= 0 &&
+			if (brl_disp->TranslationTable &&
+				brl_disp->CursorPosition >= 0 &&
 				brl_disp->CursorPosition < 1024			/* to avoid ill values eating too much mem ... */
 			)	
 			{
@@ -480,7 +501,7 @@ void brl_out_to_driver (BRL_OUT *brl_out
  			/* fprintf(stderr, "BRL: set dots: did %d, start %d, len %d, off %d\n",
 							did, brl_disp->Start, brl_disp->Dots->len, brl_disp->Offset); */
 			
-			brl_set_dots (did, brl_disp->Start, &brl_disp->Dots->data[0], brl_disp->Dots->len, brl_disp->Offset, brl_disp->CursorPosition);
+			brl_set_dots (did, brl_disp->Start, &brl_disp->Dots->data[0], &brl_disp->Text->data[0], brl_disp->Dots->len, brl_disp->Offset, brl_disp->CursorPosition);
 		
 		}
 		
@@ -508,7 +529,7 @@ void brl_startElement (void *ctx, const gchar* attr_val;
 	gchar* tattr_val;
 		
-/*	fprintf (stderr, "BRL: startElement: %s\n", name); */
+	/* fprintf (stderr, "BRL: startElement: %s\n", name); */
 	
 	switch (brl_curr_state)
 	{
@@ -835,7 +856,7 @@ void brl_characters (void *ctx, const xm
 	gchar*		tch;
 	gchar**	tokens;
 	guint8		tdots;
-	guint8*	dotbuff;
+	guint8*	buff;
 		
 	tch = g_strndup((gchar*)ch, len);
 	tch = g_strstrip(tch);
@@ -867,7 +888,7 @@ void brl_characters (void *ctx, const xm
 			str_utf = g_strndup (ch, len);
 			str_len = g_utf8_strlen (str_utf, -1);
 			/* convert text to braille dots			 */
-			dotbuff = malloc (str_len);			
+			buff = malloc (str_len);			
 			str_crt = str_utf;					
 			
 			for (i = 0; i < str_len; ++i)
@@ -879,36 +900,41 @@ void brl_characters (void *ctx, const xm
 					if (TT_SIZE > g_utf8_get_char (str_crt))
 					{
 					    /* use the translation table */
-					    dotbuff[i] = tbrl_disp->TranslationTable[g_utf8_get_char (str_crt)];
+					    buff[i] = tbrl_disp->TranslationTable[g_utf8_get_char (str_crt)];
 					}
 					else
 					{
/* use the last simbol from translation table, when the character code is grant then the number of simbols in translation table*/
-					    dotbuff[i] = tbrl_disp->TranslationTable[TT_SIZE - 1];
+					    buff[i] = tbrl_disp->TranslationTable[TT_SIZE - 1];
 					}
+					/* consider 6/8 dot Braille style */
+					if (tbrl_out->BrailleStyle == BS_6_DOTS)
+					{
+						buff[i] &= 0x3F;	/* clear dot 78 */
+					}
+					/* merge the Braille attributes				 */
+					buff[i] |= tbrl_disp->Attribute;
 				}
 				else
 				{
-					/* no table, no dots */
-					dotbuff[i] = 0;
-				}
-				
-				/* consider 6/8 dot Braille style */
-				if (tbrl_out->BrailleStyle == BS_6_DOTS)
-				{
-					dotbuff[i] &= 0x3F;	/* clear dot 78 */
+					/* no table, no translation, just give low UTF8 */
+					if (TT_SIZE > g_utf8_get_char (str_crt))
+						buff[i] = g_utf8_get_char (str_crt);
+					else
+						buff[i] = '?';
 				}
 				
-				/* merge the Braille attributes				 */
-				dotbuff[i] |= tbrl_disp->Attribute;
 				str_crt = g_utf8_find_next_char (str_crt, NULL);
 			}
 							
-			brl_disp_add_dots (tbrl_disp, dotbuff, str_len );
+			if (tbrl_disp->TranslationTable)
+				brl_disp_add_dots (tbrl_disp, buff, str_len );
+			else
+				brl_disp_add_text (tbrl_disp, buff, str_len );
 			
-			free (dotbuff);
+			free (buff);
 			free (str_utf);	
 		break;
 		}
diff -urp gnopernicus-0.9.1/braille/libbrl/brlxml.h gnopernicus-brltty-0.9.1/braille/libbrl/brlxml.h
--- gnopernicus-0.9.1/braille/libbrl/brlxml.h	2003-02-07 17:12:10.000000000 +0100
+++ gnopernicus-brltty-0.9.1/braille/libbrl/brlxml.h	2004-08-01 22:56:41.000000000 +0200
@@ -62,6 +62,7 @@ typedef struct
 	/* gchar*						Language;				 i.e. "us", "german", etc. */
 	guint8*						  TranslationTable;
 	GByteArray*				  Dots;
+	GByteArray*		  		Text;
 } BRL_DISP;
#define TT_SIZE 256
@@ -80,6 +81,7 @@ BRL_DISP* brl_disp_copy (BRL_DISP *brl_d
 void brl_disp_free (BRL_DISP *brl_disp);
 /* ... */
 void brl_disp_add_dots (BRL_DISP *brl_disp, guint8* dots, int len);	
+void brl_disp_add_text (BRL_DISP *brl_disp, guint8* text, int len);	
BRL_OUT* brl_out_new ();
 void brl_out_free (BRL_OUT *brl_out);
diff -urp gnopernicus-0.9.1/braille/libbrl/handybrl.c gnopernicus-brltty-0.9.1/braille/libbrl/handybrl.c
--- gnopernicus-0.9.1/braille/libbrl/handybrl.c	2004-01-09 14:43:26.000000000 +0100
+++ gnopernicus-brltty-0.9.1/braille/libbrl/handybrl.c	2004-08-01 23:35:33.000000000 +0200
@@ -650,7 +650,7 @@ short handy_brl_input_parser (int NewVal
/* sends line to braille device */
-int handy_brl_send_dots (unsigned char *dots, short count, short blocking)
+int handy_brl_send_dots (unsigned char *dots, unsigned char *text, short cursorPosition, short count, short blocking)
 {
 	int rv = 0;
 	unsigned char sendbuffer[MAX_BUFFER];
diff -urp gnopernicus-0.9.1/braille/libbrl/ttybrl.c gnopernicus-brltty-0.9.1/braille/libbrl/ttybrl.c
--- gnopernicus-0.9.1/braille/libbrl/ttybrl.c	2004-01-30 16:00:09.000000000 +0100
+++ gnopernicus-brltty-0.9.1/braille/libbrl/ttybrl.c	2004-08-01 23:57:30.000000000 +0200
@@ -34,7 +34,7 @@
 #include <glib.h>
#include <brltty/brldefs.h>
-#include <brltty/brlapi.h>
+#include <brltty/api.h>
#include "braille.h" @@ -61,12 +61,17 @@ static BRLTTY_DEVICE_DATA dd;
  */
 int
brltty_brl_send_dots (unsigned char *dots, + unsigned char *text, + short cursorPosition, short count, short blocking)
 {
int i, len = dd.x * dd.y;
-    unsigned char 	sendbuff[256];
+    unsigned char 	dotsbuff[256];
+    unsigned char	textbuff[256];
+
+    brlapi_writeStruct ws = BRLAPI_WRITESTRUCT_INITIALIZER;
if (count > len) @@ -80,30 +85,36 @@ brltty_brl_send_dots (unsigned char *do
 	unsigned char val = 0;
 	
if (dots[i] & 0x01 ) - val = val|B1;
+	    val = val|BRL_DOT1;
if (dots[i] & 0x02 ) - val = val|B2;
+	    val = val|BRL_DOT2;
if (dots[i] & 0x04 ) - val = val|B3;
+	    val = val|BRL_DOT3;
if (dots[i] & 0x08 ) - val = val|B4;
+	    val = val|BRL_DOT4;
if (dots[i] & 0x10 ) - val = val|B5;
+	    val = val|BRL_DOT5;
if (dots[i] & 0x20 ) - val = val|B6;
+	    val = val|BRL_DOT6;
if (dots[i] & 0x40 ) - val = val|B7;
+	    val = val|BRL_DOT7;
if (dots[i] & 0x80 ) - val = val|B8;
+	    val = val|BRL_DOT8;
 	
-	sendbuff[i] = val;
+	dotsbuff[i] = val;
+	textbuff[i] = text[i];
     }
if (count < len) {
-	memset (&sendbuff[count], 0, len-count);
+	memset (&dotsbuff[count], 0, len-count);
+	memset (&textbuff[count], 0, len-count);
     }
- if (brlapi_writeBrlDots(sendbuff) == 0) + ws.text = textbuff;
+    ws.attrOr = dotsbuff;
+    ws.cursor = cursorPosition;
+
+ if (brlapi_write(&ws) == 0) return 1; else return 0; @@ -124,40 +135,42 @@ brltty_brl_glib_cb (GIOChannel *source, BRAILLE_EVENT_CODE bec;
     BRAILLE_EVENT_DATA 	bed;
- while (brlapi_readCommand (0, &keypress) == 1) + while (brlapi_readKey (0, &keypress) == 1) {
 	/* TODO: Find a better way to map brltty commands to gnopernicus keys. */
- switch (keypress & ~VAL_TOGGLE_MASK) + switch (keypress & ~BRL_FLG_TOGGLE_MASK) {
-	    case CMD_LNUP:
+	    case BRL_CMD_LNUP:
     		sprintf(&dd.key_codes[0], "DK00");
     		bec = bec_key_codes;
     		bed.KeyCodes = dd.key_codes;						
     		ClientCallback (bec, &bed);
     		break;
- case CMD_HOME:
+	    case BRL_CMD_HOME:
     		sprintf(&dd.key_codes[0], "DK01");
     		bec = bec_key_codes;
     		bed.KeyCodes = dd.key_codes;						
     		ClientCallback (bec, &bed);
     		break;
- case CMD_LNDN:
+	    case BRL_CMD_LNDN:
     		sprintf(&dd.key_codes[0], "DK02");
     		bec = bec_key_codes;
     		bed.KeyCodes = dd.key_codes;						
     		ClientCallback (bec, &bed);
     		break;
- case CMD_FWINLT:
+	    case BRL_CMD_FWINLT:
+	    case BRL_CMD_FWINLTSKIP:
     		sprintf(&dd.key_codes[0], "DK03");
     		bec = bec_key_codes;
     		bed.KeyCodes = dd.key_codes;						
     		ClientCallback (bec, &bed);
     		break;
- case CMD_FWINRT:
+	    case BRL_CMD_FWINRT:
+	    case BRL_CMD_FWINRTSKIP:
     		sprintf(&dd.key_codes[0], "DK05");
         	bec = bec_key_codes;
     		bed.KeyCodes = dd.key_codes;						
@@ -167,12 +180,12 @@ brltty_brl_glib_cb (GIOChannel *source, /* TBD: Default action (DK01DK02) and repeat last */ default: {
-    		int key = keypress & VAL_BLK_MASK;
-    		int arg = keypress & VAL_ARG_MASK;
+    		int key = keypress & BRL_MSK_BLK;
+    		int arg = keypress & BRL_MSK_ARG;
switch (key) {
-    		    case CR_ROUTE:
+    		    case BRL_BLK_ROUTE:
 			sprintf(&dd.sensor_codes[0], "HMS%02d", arg);
 			bec = bec_sensor;
 			bed.Sensor.SensorCodes = dd.sensor_codes;
@@ -192,29 +205,29 @@ brltty_brl_glib_cb (GIOChannel *source, static void
 ignoreBlock (int block)
 {
-    brlapi_ignoreKeys(block, block|VAL_ARG_MASK);
+    brlapi_ignoreKeyRange(block, block|BRL_MSK_ARG);
 }
static void
 ignoreInput (int block)
 {
     static const int flags[] = {
-                0 |         0 |        0 |           0,
-                0 |         0 |        0 | VPC_CONTROL,
-                0 |         0 | VPC_META |           0,
-                0 |         0 | VPC_META | VPC_CONTROL,
-                0 | VPC_UPPER |        0 |           0,
-                0 | VPC_UPPER |        0 | VPC_CONTROL,
-                0 | VPC_UPPER | VPC_META |           0,
-                0 | VPC_UPPER | VPC_META | VPC_CONTROL,
-        VPC_SHIFT |         0 |        0 |           0,
-        VPC_SHIFT |         0 |        0 | VPC_CONTROL,
-        VPC_SHIFT |         0 | VPC_META |           0,
-        VPC_SHIFT |         0 | VPC_META | VPC_CONTROL,
-        VPC_SHIFT | VPC_UPPER |        0 |           0,
-        VPC_SHIFT | VPC_UPPER |        0 | VPC_CONTROL,
-        VPC_SHIFT | VPC_UPPER | VPC_META |           0,
-        VPC_SHIFT | VPC_UPPER | VPC_META | VPC_CONTROL
+                         0 |                  0 |                 0 |                    0,
+                         0 |                  0 |                 0 | BRL_FLG_CHAR_CONTROL,
+                         0 |                  0 | BRL_FLG_CHAR_META |                    0,
+                         0 |                  0 | BRL_FLG_CHAR_META | BRL_FLG_CHAR_CONTROL,
+                         0 | BRL_FLG_CHAR_UPPER |                 0 |                    0,
+                         0 | BRL_FLG_CHAR_UPPER |                 0 | BRL_FLG_CHAR_CONTROL,
+                         0 | BRL_FLG_CHAR_UPPER | BRL_FLG_CHAR_META |                    0,
+                         0 | BRL_FLG_CHAR_UPPER | BRL_FLG_CHAR_META | BRL_FLG_CHAR_CONTROL,
+        BRL_FLG_CHAR_SHIFT |                  0 |                 0 |                    0,
+        BRL_FLG_CHAR_SHIFT |                  0 |                 0 | BRL_FLG_CHAR_CONTROL,
+        BRL_FLG_CHAR_SHIFT |                  0 | BRL_FLG_CHAR_META |                    0,
+        BRL_FLG_CHAR_SHIFT |                  0 | BRL_FLG_CHAR_META | BRL_FLG_CHAR_CONTROL,
+        BRL_FLG_CHAR_SHIFT | BRL_FLG_CHAR_UPPER |                 0 |                    0,
+        BRL_FLG_CHAR_SHIFT | BRL_FLG_CHAR_UPPER |                 0 | BRL_FLG_CHAR_CONTROL,
+        BRL_FLG_CHAR_SHIFT | BRL_FLG_CHAR_UPPER | BRL_FLG_CHAR_META |                    0,
+        BRL_FLG_CHAR_SHIFT | BRL_FLG_CHAR_UPPER | BRL_FLG_CHAR_META | BRL_FLG_CHAR_CONTROL
     };
     const int *flag = flags + (sizeof(flags) / sizeof(*flag));
     do {
@@ -267,11 +280,11 @@ brltty_brl_open_device (char* 			DeviceN
      variable
      CONTROLVT="$(grep "using VT number" "/var/log/XFree86.$(echo "$DISPLAY" | sed -e "s/^.*::*\([0-9]*\).*$/\1/").log" | sed -e "s/^.*using VT number \([0-9]*\).*$/\1/")"
     */
-    brlapi_getTty (0, BRLCOMMANDS, NULL);
+    brlapi_getTty (0, BRLCOMMANDS);
- ignoreInput(VAL_PASSCHAR);
-    ignoreInput(VAL_PASSDOTS);
-    ignoreBlock(VAL_PASSKEY);
+    ignoreInput(BRL_BLK_PASSCHAR);
+    ignoreInput(BRL_BLK_PASSDOTS);
+    ignoreBlock(BRL_BLK_PASSKEY);
return 1;
 }
diff -urp gnopernicus-0.9.1/configure.in gnopernicus-brltty-0.9.1/configure.in
--- gnopernicus-0.9.1/configure.in	2004-04-30 07:05:16.000000000 +0200
+++ gnopernicus-brltty-0.9.1/configure.in	2004-08-01 23:49:36.000000000 +0200
@@ -186,7 +186,7 @@ AC_SUBST(TTYNAME_0)
 AC_SUBST(TTYNAME_1)
dnl **********************************************************************
-dnl Check for BRLTTY support - brlapi.h
+dnl Check for BRLTTY support - api.h
 dnl **********************************************************************
 AC_ARG_ENABLE(brltty,
 	    [AC_HELP_STRING([--enable-brltty],
@@ -204,7 +204,7 @@ case "$enableval" in
 #	LIBADD="-lbrlapi"
 #	CFLAGS="-I/usr/include"
 	AC_TRY_RUN([ /* is brltty available? */
-	#include <brltty/brlapi.h>
+	#include <brltty/api.h>
 	#include <brltty/brldefs.h>
 	int main()
 	{
diff -urp gnopernicus-0.9.1/gnopi/brlui.c gnopernicus-brltty-0.9.1/gnopi/brlui.c
--- gnopernicus-0.9.1/gnopi/brlui.c	2004-04-27 11:12:32.000000000 +0200
+++ gnopernicus-brltty-0.9.1/gnopi/brlui.c	2004-08-02 03:20:52.000000000 +0200
@@ -80,6 +80,7 @@ const struct
     {N_("German"),		"de"},
     {N_("Spanish"),		"es"},
     {N_("Swedish"),		"sv"},
+    {N_("None"),		"none"},
     {NULL,		NULL}
 };
@@ -101,6 +102,8 @@ const gchar *status_cell_value [] = /* Window */
 GtkWidget		*w_braille_settings = NULL;
+static GtkWidget *bt_braille_style;
+static GtkWidget	*bt_cursor_settings;
/**
  * Braille device widgets 					
@@ -289,14 +292,21 @@ brlui_load_braille_settings (GtkWidget *
     if (!w_braille_settings)
     {
 	GladeXML *xml;	
+	gboolean sensitivity;
+
 	xml = gn_load_interface ("Braille_Settings/braille_settings.glade2", NULL);
 	sru_return_val_if_fail (xml, FALSE);
 	brlui_set_handlers_braille_settings (xml, braille_setting);
+	bt_braille_style = glade_xml_get_widget(xml, "bt_braille_style_");
+	bt_cursor_settings = glade_xml_get_widget(xml, "bt_cursor_settings");
 	g_object_unref (G_OBJECT (xml));
 	gtk_window_set_transient_for (GTK_WINDOW (w_braille_settings),
 	    			      GTK_WINDOW (parent_window));
gtk_window_set_destroy_with_parent ( GTK_WINDOW (w_braille_settings), TRUE);
+	sensitivity = strcmp (braille_setting->translation_table, "none");
+	gtk_widget_set_sensitive (GTK_WIDGET (bt_braille_style), sensitivity);
+	gtk_widget_set_sensitive (GTK_WIDGET (bt_cursor_settings), sensitivity);
     }
     else
 	gtk_widget_show (w_braille_settings);
@@ -512,6 +522,7 @@ brlui_translation_table_changeing (Brail
     GtkTreeIter      iter;
     gint 	     l_iter;
     gchar 	    *key;
+    gboolean	     sensitivity;
sru_return_if_fail (braille_setting); @@ -534,6 +545,10 @@ brlui_translation_table_changeing (Brail
 	    g_free (braille_setting->translation_table);
 	    braille_setting->translation_table = g_strdup (trans_table_list [ l_iter ].file_name);
 	    brlconf_translation_table_set (braille_setting->translation_table);
+
+	    sensitivity = strcmp (braille_setting->translation_table, "none");
+    	    gtk_widget_set_sensitive (GTK_WIDGET (bt_braille_style), sensitivity);
+    	    gtk_widget_set_sensitive (GTK_WIDGET (bt_cursor_settings), sensitivity);
 	}
     }
     g_free (key);


------------------------------------------------------------------------

_______________________________________________
Gnome-accessibility-devel mailing list
Gnome-accessibility-devel gnome org
http://mail.gnome.org/mailman/listinfo/gnome-accessibility-devel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]