Re: [gtk-list] Re: Window manager window placement and X modifiers/states



Derek Simkowiak <dereks@kd-dev.com> writes: 
> 	Is it inappropriate or wrong for an application to request a
> particular size/position using the set_u*() functions?
> 

According to the original X design, these should only be used if the
user has specificallly requested that size/position.

In GTK+, gtk_widget_set_usize() on a non-toplevel does not map the X
concept of usize, so it is not really bad in the same way. But
set_usize() on a toplevel is pretty much always wrong; it means your
geometry management is broken. You almost certainly want
gtk_window_set_default_size() instead.

gtk_widget_set_uposition() breaks the window manager's placement
policy, and is almost certainly a bad idea.

However, often people who are wanting to do this have kiosk-type
applications where the user isn't really using the window manager. In
this case it may be OK. But for normal desktop apps it is wrong.

> 	Let's say my app looks best when it's at 600x400.  Is there some
> other function/resource I should use?
> 

gtk_window_set_default_size(). However, you may want to check that the
display is at least that large. :-)

The other danger is that 600x400 is too small with some translations,
themes, or theme-specified fonts. I'm not sure if set_default_size()
will shrink beyond the size request though, in which case it would
come out OK.

In general hardcoded geometry is dangerous - consider that in the
future GTK themes will support geometry changes (wider scrollbars for
the NeXT theme, that sort of thing).

Havoc



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