Re: OK, now gtk_signal_emit_by_name() is confusing me!!!



rhfreeman <rhfreeman@micron.com> writes:
> 
> Now, I'm *REALLY* curious. First I have this bit of code, which breaks:
> 
>   gtk_signal_emit_by_name(GTK_OBJECT(w_layout[current].drawing_area),
> "expose_event");
> 

This is Not Allowed and won't work. (You are doing it wrong, because
you have to pass args to the emission, but even if you were doing it
right it's still wrong because you are not allowed to emit
expose_event.)

The rule is that only an object implementation may call
gtk_signal_emit* on signals for that object. If you call them
yourself, behavior is undefined. The exception is for signals with the
GTK_RUN_ACTION flag set, which anyone may emit and are guaranteed to
work fine. Event signals don't have this flag.

In this case, the correct solution is:

 GdkEventExpose event;
 /* fill in the event fields; in particular, send_event should be TRUE */

 gtk_widget_event (widget, &event);

gtk_widget_event() will end up emitting the signal, but will do
necessary setup and shutdown first.

Havoc





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