Re: Question about signals and functions parameters



You define the callback function in your program and GTK calls it when the event happens.
GTK then sets all actual parameters of the call. There are no default parameters.
The data types of the actual parameters passed by GTK are exactly those that are defined for the callback function.

The last parameter in signal connect is for the user. Typically it is the address of some data structure that is needed for the application to be able to handle the event. It is 'remembered' by GTK and passed as an actual parameter when GTK calls the callback function. If the event handling does not need userdata, just put NULL as the last parameter of signal connect.
 

--- On Sat, 30/1/10, Teste123 Teste123 <asb1231 gmail com> wrote:

From: Teste123 Teste123 <asb1231 gmail com>
Subject: Question about signals and functions parameters
To: gtk-list gnome org
Date: Saturday, 30 January, 2010, 9:40 AM

Hi all,

When use a g_signal_connect to connect some signal to some function, the 'default' parameters of these functions are configured by the signal?

example:
g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(end),NULL);

the 'default' parameters of function "end" receives are a GtkWidget * and a gpointer. But where it's defined?

If using the key_press_event the default parameters that the function will receive are a GtkWidget * and a GdkEventKey *

The 'default' parameters have changed when the signal change.

How this works? Is it how I'm thinking?

Thanks

-----Inline Attachment Follows-----

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list


Get your new Email address!
Grab the Email name you've always wanted before someone else does!

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