Re: Automatic focus handling? How do I turn it off?
- From: Owen Taylor <otaylor redhat com>
- To: Paul Davis <pbd op net>
- Cc: Christopher Blizzard <blizzard redhat com>, Ken Simpson <kens ActiveState com>, Havoc Pennington <hp redhat com>, gtk-list gnome org, David Ascher <DavidA ActiveState com>, Mark Hammond <markh ActiveState com>
- Subject: Re: Automatic focus handling? How do I turn it off?
- Date: 12 Jun 2001 23:53:44 -0400
Paul Davis <pbd op net> writes:
> >>>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.
>
> not true in GTK+ 1.2. you have to stop the signal emission as well.
>
> in GTK+ 1.2, the default handler is run regardless of the return
> status of other connected handlers. the docs for GTK+ 1.2 do not make
> this particularly clear. i believe that in GTK+ 1.3/2.0, this is no
> longer true, and things work the way the docs tend to suggest.
In this case, what was being discussed was the return value of
the default handler, so stopping emission isn't necessary -
if someone connects another signal handler using
gtk_signal_connect_after() they mean to override the return
value.
> its the default handler for key press events in a GtkWindow that
> controls the movement of focus between widgets in that window. the
> handler is executed unless you block the emission in the widget that
> currently has focus (i.e. the one that the window directs the events
> to).
This isn't quite right.
In GTK+-1.2 - for every time a signal is run, up to three things
may happen:
1) signal handlers run
2) the default handler runs
3) Signal handlers connected with gtk_signal_connect_after run.
The return value from the signal is the return value from the
last of these; so if 1) returns TRUE meaning "handled",
2) will still be run and override this unless
gtk_signal_emit_stop_by_name() is called.
In GTK+-2 a TRUE return immediately stops emission.
However - this all only applies to a SINGLE signal emission -
even in 1.2, if the result of sending the widget to
the focus widget is TRUE, no further handling will be done.
http://people.redhat.com/otaylor/tmp/key-handling.eps
is a diagram of key handling in GTK+-1.2 which may help
(or may further confuse)
> as i've mentioned, i find it easier to do all this stuff using a key
> snooper, which allows you to completely bypass all of GTK+'s builtin
key handling is quite complicated enough without getting
key snoopers involved!
The idea of key snoopers was to handle hotkeys that would work
in any window - like the hotkey to invoke the GLE widget tree
debugger.
If you have a particular GtkWindow, a connection to "key_press_event"
on the toplevel already allows you to override all key handling
behavior.
Regards,
Owen
[
Actually the situation with Komodo is rather more complicated
again - having GTK+ widgets inside mozilla is basically two
inter-toolkit widget embeddings.
GtkWindow
Mozilla content area
GtkMozBox holding GTK+ widgets
(GtkMozBox derives from GtkWindow!)
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]