Frame shrinkage bug

Marko Rauhamaa marko at
Fri Aug 21 00:56:58 PDT 1998

In X, the Frame objects shrink by 20 pixels vertically and by 8 pixels
horizontally from the preferred size. That, of course, causes the
contained components to be cramped into a smaller space and the results
are unusable.

For example, consider this small application:

    import java.awt.*;
    import java.awt.event.*;
    public class Test extends Frame {
      class QuitCloser extends WindowAdapter {
	public void windowClosing(WindowEvent event) { System.exit(0); }
      public Test() {
	setLayout(new BorderLayout());
	add("North",new Button("Button"));
	add("South",new Button("Button"));
	addWindowListener(new QuitCloser());
      public static void main(String[] args) {
	Test window = new Test();

It is supposed to have two buttons touching each other. Instead, it
produces two overlapping buttons. (Try it!)

I tried to locate the cause for the weird behavior in the kaffe awt
code. The immediate reason seems to be this: createWindow() (in
libraries/clib/awt/X/wnd.c) modifies the size of a frame by subtracting
X->titleBarHeight, X->bottomBarHeight and 2 * X->borderWidth from the
window bounds. The values of those variables are set in the initializer
of the Toolkit class (libraries/javalib/java/awt/ with the
function wndSetFrameOffsets() to default values, which are
Defaults.TitleBarHeight = 20, Defaults.FrameBorderWidth = 4 and
Defaults.BottomBarHeight = 0.

I can't say I quite understand the rationale behind this shrinkage
mechanism since the frame decorations are _outside_ the frame window
(and depend totally on the window manager). The awt code seems to try to
reserve some hardcoded amount of space within the frame window for the

Kaffe 1.0-b1
Red Hat Linux 4.2

Marko Rauhamaa   mailto:marko.rauhamaa at
Suomenkielinen esperantokurssi
    Free Esperanto Course

More information about the kaffe mailing list