Re: passing on signals



On Tue, 2003-09-30 at 20:09, edscott wilson garcia wrote:
> Hi,
> 
>   Does anybody know the correct way to pass on keypressed signals
> received by one widget to another? Either of the following two lines
> causes gtk to segfault when signal received by GtkCombo is passed to
> GtkEntry:
> 
> gtk_signal_emit_by_name (GTK_OBJECT (entry),
> "key_press_event",event,data,NULL);
> 
> gtk_signal_emit_by_name (GTK_OBJECT (entry),
> "key_press_event",event,data);


If anyone is interested, I figured this one out:
gtk_signal_emit_by_name() is blocking, i.e. it does not return until the
signal has been duly received and processed by the target widget's
signal handler. And the value of "data" is overwritten by the return of
the signal handler (in this case it returns a guint).

This means that you must save whatever you have in "data" to restore it
after the function returns. But the fact that gtk_signal_emit_by_name()
is blocking means that you have to get into the thread business if you
want to make things work as with signal queue. So you are much better
off calling the signal handler of the signalled widget directly. Oh
well...

Edscott

> 
> 
> TIA,
> 
> Edscott Wilson Garcia
> 
> 
> 
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 




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