Re: passing on signals



Thanks for the clarification, Sven. 

I suppose the additional parameter after event will make the call
blocking so that the return value of the signal handler can be returned
there, and if there is no additional parameter (or set to NULL) the
function will just toss the signal on to the queue to be processed by
the event loop and be non-blocking. Just a hypothesis...

On Thu, 2003-10-02 at 14:04, Sven Neumann wrote:
> Hi,
> 
> edscott wilson garcia <edscott imp mx> writes:
> 
> >   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);
> 
> Both lines are wrong. The user_data that is passed to a signal
> callback is not set on signal emission but it's the data set when the
> signal was connected. The correct code would be:
> 
>  gtk_signal_emit_by_name (GTK_OBJECT (entry), "key_press_event", event);
> 
> Actually this is deprecated API, so you would better use the following
> instead:
> 
>  g_signal_emit_by_name (entry, "key_press_event", event);
> 
> This code assumes that event is a pointer to a GdkEventKey structure.
> 
> 
> Sven
> 




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