[BRLTTY] using BrlAPI and speech API in one program

Samuel Thibault samuel.thibault at ens-lyon.org
Sun Aug 22 08:40:18 EDT 2010


Samuel Thibault, le Sun 22 Aug 2010 12:56:51 +0200, a écrit :
> marquats at studi.informatik.uni-stuttgart.de, le Sun 22 Aug 2010 11:40:13 +0200, a écrit :
> > >> I can click on the cells, but the input is not delivered to the
> > >> program (client).  The method brlapi_readKey (1, &key) does not
> > >> return when I click.
> > 
> > >Did you use brlapi_acceptKeys() to enable getting them?
> > 
> > Now I tried to solve it by calling brlapi_acceptKeys()
> > or brlapi_acceptAllKeys(), but it made no difference.
> 
> Mmm, that's odd. I guess you made sure that your windows has the focus
> when you are pressing the cells?

Grembl, it looks like it's the brltty window box which steals the focus
on click.  I have no idea how to disable that.  You can work around this
by stealing braille control completely by replacing your enterTtyMode
call with

brlapi_enterTtyModeWithPath(NULL, 0, NULL);

Of course, in production environment you should get back to
a simple enterTtyMode call, to let brltty get back control when your
application is not focused.

> > >> 1. changing to multibyte coding in the project settings:
> > >> Configuration Properties / General / Character set: Multi-Byte
> > >>
> > >> 2. #undef UNICODE at the beginning of the program
> > >> BTW, the constand UNICODE was defined to have the value 1
> > 
> > >Mmm, it's odd. Did you include brlapi.h before or after windows.h?
> > 
> > I didn't include windows.h at all.
> > It is a simple Win32 console application and does not need it.
> 
> I'm realizing that brlapi.h actually includes windows.h itself at the
> head, so it shouldn't matter.
> 
> I'll have to check why unicode wasn't working.

It works for me on cygwin, when using proper unicode strings, i.e.

#define UNICODE 1 /* done by your IDE */
#include <brlapi.h>

int main(void) {
	/* Init stuf */
	...

	brlapi_writeText(1, L"foobar");

	return 0;
}

I don't know how the microsoft compiler behaves regarding strings
when it is in unicode mode.  I'd have thought that since the windows
headers automatically take the wide versions of functions, the microsoft
compiler would automatically make strings wide, or tell the user to
explicitly use wide strings, but from what you say the former doesn't
seem to happen, and apparently you are not aware of having to do the
latter.

Just to make sure my understanding is correct, could you try to set back
your IDE to unicode mode (so that UNICODE gets defined to 1), and use
explicit strings like the code snippet above does?

Samuel


More information about the BRLTTY mailing list