Re: [gtk-list] Re: Callback Argument Marshalling



On Mon, 10 Aug 1998, Kenneth Albanowski wrote:

> On 9 Aug 1998, Marius Vollmer wrote:
> 
> > Kenneth Albanowski <kjahds@kjahds.com> writes:
> > 
> > > On Thu, 6 Aug 1998 beach@ataman.com wrote:
> > > 
> > > > How does it work with the low-level (GdkEvent) signals? 
> > > 
> > > That's the rub: all passed structure pointers (like GdkEvent) will be
> > > passed as a raw pointer, with type "pointer".  Currently disambiguating
> > > such types requires manual assistance, in some form or another. 
> > 
> > The Gtk type system is able to differentiate between random pointers
> > (GTK_TYPE_POINTER) and pointers to specific structures (say GdkEvent,
> > GTK_TYPE_GDK_EVENT).
> > 
> > Uses of GTK_TYPE_POINTER naturally pose problems for programs that
> > want to dynamically query the types of pointers, like interpreter
> > bindings.  So using GTK_TYPE_POINTER should be avoided whenever
> > possible.  I think most of Gtk+ is free of GTK_TYPE_POINTER.
> 
> Even in signal descriptors? If so, I _really_ need to get working on
> Gtk/Perl for 1.1.x.

it should be noted, that it is extremely easy to retrive the
base type for such things, i.e. getting back GTK_TYPE_BOXED from
GTK_TYPE_GDK_EVENT. the GTK_FUNDAMENTAL_TYPE() macro does this,
you get:

GTK_FUNDAMENTAL_TYPE (GTK_TYPE_WIDGET) == GTK_TYPE_OBJECT
GTK_FUNDAMENTAL_TYPE (GTK_TYPE_ACCEL_FLAGS) == GTK_TYPE_FLAGS
GTK_FUNDAMENTAL_TYPE (GTK_TYPE_PACK_TYPE) == GTK_TYPE_ENUM

and so on.
so, finally your code only needs to handle the basis types as defined
in the GtkFundamentalType enum, and we can still supply the full
fledged type information for e.g. signals or object arguments.

> 
> -- 
> Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
> 

---
ciaoTJ



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