Re: Redirecting keyboard events



On Wed, 2004-11-24 at 14:25 -0300, Andre Moreira Magalhaes wrote:
> Hi all,
> 
> I have a problem using GTK (version 2.2.1) and would like to know if anyone can
> help me here. The problem is described bellow:
> 
> - I have a application written in VisualAge and ported to GTK+. The problem is
> that the application written in VisualAge has some kind of keyboard buffer (i
> don't know if this is the exactly name). What is the "keyboard buffer"?? 
> The user start a command and then immediately press Enter. After processing
> some data the command will show a MessageBox. In the VisualAge version when the
> messagebox appear the keyevent is sent to that window, making the window close
> (desired behavior). In the GTK version the user needs to wait until the window
> appear to press Enter. 

I have no idea what VisualAge is in this context (I think "IBM's
compiler suite" when I hear that).

X has some features to enable typeahead like this ... something called
"synchronous grabs". Because it's a feature not found in most platforms,
very few modern toolkits support it. GTK+ doesn't, Qt doesn't. Swing
doesn't. Motif may have supported it, I'm not sure.

> Do you know how can i fix this??? This happens in other cases but this is the
> most common.

Make your app faster, basically. There's no reason you shouldn't be able
to get a dialog up in a small fraction of a second ... maybe you need to
put it up before doing the processing?

You could use XGrabKeyboard() directly to get a synchronous grab, but I
really wouldn't recommend it. For one thing, that will grab the keyboard
globally for the entire display.

You could catch Enter on the main toplevel and forward it to the dialog
after you show it, but that sounds like a lot of work for small gain.
And getting your users used to a behavior that isn't consistent
throughout your app (and with other apps) isn't a good idea.

							Owen

Attachment: signature.asc
Description: This is a digitally signed message part



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