Re: Signals, events and handlers (was: Errors in GTK Tutorial?)




Mario Motta <mmotta@guest.net> writes:

> Hi all,
> is at last well known that event signal handlers should be declared and return
> an int value that has the meaning to upward propagate the event signal when the
> handler retun a false value or to stop further propagation if it returns other
> than false.
> I would like to be confirmed that this does not apply to signals, signal
> handlers return type is and remain void.

There is no unique type for signal handlers.

Event signals have the prototype:

 gboolean (*handler) (GtkWidget *widget, GdkEvent *event, gpointer data);

Other signal handlers have, variously prototypes:

 void (*handler) (GtkWidget *widget, gpointer data);
 void (*handler) (GtkWidget *widget, GtkAllocation *allocation, gpointer data);
 gboolean (* handler) (GtkWidget	  *widget,
		       GdkDragContext     *context,
                       gint                x,
                       gint                y,
                       guint               time);

Etc.

So, you have to know what the correct prototype is for
the signal you want to connect to.

The form:

 void (*handler) (GtkWidget *widget, gpointer data);

is very common... but it is certainly not the only one.

                                        Owen



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