Re: Units and resolution independence for gtk+



On Fri, 2008-08-08 at 12:22 +0200, BJörn Lindqvist wrote:
> > A new macro GTK_UNIT_EM (and it's companion GTK_UNIT_ONE_TWELFTH_EM) is
> > introduced. This allows application to do e.g.
> >
> >  hbox = gtk_hbox_new (FALSE, GDK_UNIT_EM (1));
> >
> > instead of
> >
> >  hbox = gtk_hbox_new (FALSE, 12);
> 
> Why use macros instead of functions for all this? Won't that just make
> binding authors lives harder?

The thinking is that if the feature becomes default then the macro will
be resolved to a GtkSize with high bits set at compile time. For 2.x,
the thinking is that it will resolve to a function call and the
conversion happens at run time, e.g.

 o if RI is enabled, GTK_SIZE_EM(size) will resolve to a GtkSize with
   some high bit sets: (size | (1<<30))

 o if RI is not enabled, GTK_SIZE_EM(size) will resolve to the pixel
   size: size*12

Right now it just looks like this

 #define GTK_SIZE_EM(em) gtk_size_em(em)

with

 GtkSize gtk_size_em (double em);

Is this approach a problem for binding authors?

     David




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