Re: invalid unclassed pointer?

Havoc Pennington wrote:

> Mark Leisher <> writes: 
> > Like one pair of functions (basically) to set/get values on an object, this is
> > another area where Xt was designed correctly IMHO.  In Xt, all callbacks have
> > the same 4 parameters.  In GTK terms the prototype would be:
> > 
> >   void (*callback)(GtkWidget *widget, GdkEvent *event,
> >                    gpointer call_data, gpointer client_data);

> There aren't that many variants for commonly-used signals, and you can
> always look it up.
> The advantages of the GTK way are numerous; one of the more important
> is that signals are also introspectable virtual functions.

The single-prototype-callback has a lot of merit, if you look at 
realistic use-scenarios.  My SDPGTK C++ library has to jump through a 
lot of hoops to layer this type of paradigm on top of GTK+ (with the 
ability to get at the "raw" event data, when needed), but it's clearly 
worth it: in an interactive 3D modelling application with over 100 
dialogs and literally thousands of different event-handlers, I only 
count about 30 places in my code where I access the "raw" GTK+ callback 
data at all.
If there was some way to provide an optional single-prototype-callback 
to GTK+, I'm pretty sure library authors everywhere would have a field day.

Tim Shead

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