Re: -geometry specification for gtk_init




"Adam P. Jenkins" <ajenkins@cs.umass.edu> writes:

> I couldn't find this in the mailing list archive or FAQ, so..
> gtk_init doesn't seem to support the -geometry command line option, or
> anything equivalent.  Is there any equivalent way to specify the
> toplevel geometry at startup, as opposed to compile time?  Even by
> config file, etc., short of implementing it myself?

Without modifying GTK or the application, no.
 
> I ask, because this is the only X toolkit I've seen that didn't
> support -geometry; it's even specified in the X standard as an option
> that all X programs should support.  Was it left out of gtk
> deliberately, or is this just something that needs to be implemented
> still?  If the latter, I can submit a patch to gtk_init to parse this
> option, but I figured I'd ask if there's a reason it's not there
> first.

I doubt there was any great overriding reason, except that it
a little tricky to figure out what it means and do it right.

- GTK applications don't really have a concept of a main
  window. (The first window to be created may well not
  be the main window - think of a splash screen)

- The application has to participate in parsing the geometry.
  Presumably if you start gemvt with a command line of of
  
    --gemvt 80x24

  That should give a terminal with an area of 80x24, not a
  window of 80x24 pixels, or even a window that was (including
  boundaries) 80x24 characters large in some default font.

I think it probably should be done by:

- Having gdk_init() parse the geometry option. (putting it into
  GDK means you can use XParseGeometry() without wrapping it)

- Add a call gdk_get_geometry() that retrieves the results 
  in a form like that returned by XParseGeometry()

- The application then can modify the results (as would gemvt)
  then call a routine gtk_window_set_geometry() on whatever
  it considers to be its main window.

- Then in some manner GtkWindow takes that into account when
  setting its hints. (Probably it uses the size and position
  as the current uposition and usize, and modulates that
  be the equivalents of the X flags

   XValue, YValue, WidthValue, HeightValue, XNegative, or YNegative

  ( You'd have to extend gdk_window_set_hints to accept the
    window gravity option to get it right. )

I've just added the above to the TODO, so (if you don't fix
it first) someone else will probably get to it eventually.

Regards,
                                        Owen



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