Re: Units and resolution independence for gtk+



(resending, this time with the right address for the list)

On Fri, 2008-08-08 at 13:47 -0400, Behdad Esfahbod wrote:
> I suggest we do a function.  Later on the function can be defined as a
> nop macro if needed (and a function version kept for ABI compat).
> 
> So, gtk_size_em(1.0).  Also define:
> 
> #define GTK_ONE_EM (gtk_size_em (1.0))
> 
> Something like that.

Sounds good, I'll do that change.

> I'll read the proposal and patch in more detail and comment this
> weekend.  I want to make sure we do this consistently wit hPango.  I
> also want to do a typedef for Pango units.

I'll upload an updated patch to

 http://bugzilla.gnome.org/show_bug.cgi?id=546711

later tonight.

Btw, there's another fundamental change that might be worth discussing
on the list; in order to be multihead safe we need the pixel conversion
function to look like this

 gint gtk_size_to_pixel (GdkScreen *screen, gint x, gint y, GtkSize size);

This is because a GdkScreen can have multiple monitors. And each monitor
can have different physical DPI. There's also a convenience function

 gint gtk_widget_size_to_pixel (GtkWidget *w, GtkSize size);

that uses the center position of @w's top-level to pass into
gtk_size_to_pixel().

While doing this work I identified a few design flaws (wrt. being
multihead safe) in GTK+; for example, a GtkTreeViewColumn really needs
to know what GtkTreeView it's attached to. I think all this is fixable;
simply deprecate gtk_tree_view_column_new() and have e.g.

 gtk_tree_view_create_column();

Or something.

Anyway, one goal of involving GdkScreen, positions etc in the
size_to_pixel mechanism is that we can have the application
automagically change units when you drag a window from one monitor to
another. Of course this goal requires a lot more work on GdkScreen and
in the desktop integration bits (e.g. the current gtk-xft-dpi property
on GtkSettings becomes meaningless). But first things first.

     David





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