[gtk-list] re: Errors in GTK Tutorial?



>        Have I completely misunderstood GTK+'s signals & events or is the
> tutorial simply bugridden?
>

Peter:

The thing that's confusing you is your assumption that all callbacks are
prototyped equal.  Whenever you want to handle a particular type of event
("clicked", "destroy-event", etc.) you have to look-up the prototype for
that event (as you point out, there are many different ones), implement your
callbacks using that prototype, and call gtk_signal_connect with the
function address.  Even though you cast your function prototype using the
GTK_SIGNAL_FUNC() macro, GTK "knows" which callback prototype goes with
which event, so your callbacks will always be called with the correct set of
parameters, stack cleanup, and-so-on.  Although this mechanism makes it more
difficult to implement language bindings to GTK (I know, I'm working on
one!), it's efficient - each callback is called with just the right subset
of information.

Cheerio,
Tim Shead



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