Re: [gtk-list] Sending arbitrary events to widgets
- From: Havoc Pennington <rhp zirx pair com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Sending arbitrary events to widgets
- Date: Sun, 18 Apr 1999 03:13:18 -0400 (EDT)
On Sun, 18 Apr 1999, Adam Fritzler wrote:
>
> Is it possible to send an event (like a key press/click) to a widget using
> only gtk routines? (ie, the event never actually happens, but the widget
> thinks it did and acts normally)
>
gtk_widget_event() should more or less work; you are going to have to
synthesize a sane GdkEvent though (just make sure all the fields are
filled with non-garbage). It won't be *exactly* like a normal event; some
processing is in the main loop, grep for gtk_widget_event in gtkmain.c to
see when Gtk actually calls it and in what contexts. For example,
propagation of events from children to parents is done in gtkmain.c.
> gtk_signal_emit*() seem to be going in the wrong direction (aparently they
> emit a signal _from_ a widget instead of the desired _to_ a widget).
>
gtk_widget_event() is going to call gtk_signal_emit() for the widget's
"event" signal; it will also call it for the specific event type signal
(such as "button_press_event") and it will handle some destroy/refcount
issues. Check it out in gtkwidget.c to get a sense of things.
Signals are both "from" and "to" in a sense; emitting a signal will
generally run any user-installed handlers as well as the default handlers
defined by the GtkObject itself.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]