Re: Automatic focus handling? How do I turn it off?

Havoc Pennington <hp redhat com> writes:

> Ken Simpson <kens ActiveState com> writes: 
> > Is this the code which performs automatic focus changing in response to
> > keypresses? It certainly seems to fit the symptoms :)
> > Hmm.. But there doesn't appear any way of "turning it off".
> > 
> Yep, that's the code. Writing other widget sets is not what GTK is
> made for, so we don't have an easy way to change this. ;-) That's why
> Chris was working on Xlib Mozilla for a while I imagine.
> However you can do a hack to GtkWindow - connect to key_press_event,
> when you see one of these keys call gtk_signal_emit_stop_by_name to
> kill the event. Or subclass GtkWindow and override the default signal
> handler and do something a bit differently there. Should be able to
> get it working. You could possibly also override set_focus or
> grab_focus and do some sort of hack.
> You may well have weird interactions with GtkMozEmbed and apps like
> Galeon...

You shouldn't need anything this complicated, or this likely
to break stuff.

Widgets are sent key presses before GTK+ checks for focus keys. If the
widget handles the key press in its event handler and returns TRUE,
then GTK+ will not check for tab/arrows.

For instance, this is how GtkText prevents a tab key from tabbing out
of the GtkText widget.


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