Re: getting window manager borders from GtkWindow widgets.



nicholas allen <nicholas allen ireland sun com> writes:

We are currently working on a Gtk+ port of the AWT peerset for
embedded devices here at Sun and need to determine the border width
(ie title bar height etc) of GtkWindows. This is needed becasue Java
assumes the dimensions of a window include the border and Gtk does
not. Does anyone know how I can get this information? I can't find
anything suitable in the Gtk API and don't want to use X APIs as I
would like to write purely to the Gtk APIs (allowing it to run on a
frame buffer or even windows). Any help would be greatly appreciated.

Unfortunately, the way Java was specified here is basically
incompatible with X:

 - X has no way of specifying to the window manager the size
   including the frame.

 - Many window managers decorate different windows with different
   size borders, so there is no way of knowing what size
   the borders will be until the window is displayed on the
   screen.
  
The Motif peers do horrible things that mostly work on MWM
and relatives, and mostly don't work on any other window
manager.

So, GTK+-1.2 doesn't have anything at all like this.

We've done some work on adding API's to GTK+-2.0 to allow
setting the frame size, so at least applications get as good
emulation as possible on X, and may work properly on other
windowing systems.

(It's also possible that in the future the extended window
manager hint might be changed to allow such speccification.)

The hacks you have to do on X to try and set the size including
the borders are pretty awful:

 - Guess how big the borders might be, based perhaps on the 
   size of previously mapped window.

 - Compute a size based on your guess and map the window

 - Adjust the size of the result to try and correct.

Regards,
                                        Owen







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