This fixes some problems with BorderLayout. Sometimes the components were not being layed out properly, because BorderLayout.layoutContainer was setting negative bounds. This was because validate() was being called in the wrong spots. When layoutContainer was called with an invalid target, the bounds were not being set properly.
The change in GtkComponentPeer fixes the problem with the components not being drawn at the correct location. The change in Window.show fixes the validate problem. toFront and show() (on the Window's children) should not both be called. A check was added to fix this. * The change in GtkFramePeer also fixes the validate problem. We should only validate the component if it is already valid (therefore, needs to be revalidated). 2006-02-17 Lillian Angel <[EMAIL PROTECTED]> * gnu/java/awt/peer/gtk/GtkComponentPeer.java (setBounds): Removed check. Coordinates should always be changed to incorporate the parent's coordinates. * gnu/java/awt/peer/gtk/GtkFramePeer.java (setMenuBar): Added checks. Don't validate component if it has not been validated yet, it will be validated later. Only validate if it has already been validated, in that case it needs to be revalidated. * java/awt/Window.java (show): Added check. If the window is visible, then bring it to the front. Otherwise, iterate through all its children windows and show them. No need to do both.
Index: gnu/java/awt/peer/gtk/GtkComponentPeer.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java,v retrieving revision 1.103 diff -u -r1.103 GtkComponentPeer.java --- gnu/java/awt/peer/gtk/GtkComponentPeer.java 12 Feb 2006 11:40:04 -0000 1.103 +++ gnu/java/awt/peer/gtk/GtkComponentPeer.java 17 Feb 2006 19:19:09 -0000 @@ -460,26 +460,17 @@ // non-lightweight. boolean lightweightChild = false; Insets i; - while (parent.isLightweight ()) + while (parent.isLightweight()) { - lightweightChild = true; + lightweightChild = true; - next_parent = parent.getParent (); + next_parent = parent.getParent(); - i = ((Container) parent).getInsets (); + i = ((Container) parent).getInsets(); + new_x += parent.getX() + i.left; + new_y += parent.getY() + i.top; - if (next_parent instanceof Window) - { - new_x += i.left; - new_y += i.top; - } - else - { - new_x += parent.getX () + i.left; - new_y += parent.getY () + i.top; - } - - parent = next_parent; + parent = next_parent; } // We only need to convert from Java to GTK coordinates if we're Index: gnu/java/awt/peer/gtk/GtkFramePeer.java =================================================================== RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java,v retrieving revision 1.42 diff -u -r1.42 GtkFramePeer.java --- gnu/java/awt/peer/gtk/GtkFramePeer.java 9 Sep 2005 15:06:11 -0000 1.42 +++ gnu/java/awt/peer/gtk/GtkFramePeer.java 17 Feb 2006 19:19:09 -0000 @@ -77,7 +77,10 @@ removeMenuBarPeer (); insets.top -= menuBarHeight; menuBarHeight = 0; - awtComponent.validate (); + // if component has already been validated, we need to revalidate. + // otherwise, it will be validated when it is shown. + if (awtComponent.isValid()) + awtComponent.validate (); gtkFixedSetVisible (true); } else if (bar != null && menuBar == null) @@ -92,7 +95,10 @@ setMenuBarWidth (menuBar, menuBarWidth); menuBarHeight = getMenuBarHeight (); insets.top += menuBarHeight; - awtComponent.validate (); + // if component has already been validated, we need to revalidate. + // otherwise, it will be validated when it is shown. + if (awtComponent.isValid()) + awtComponent.validate (); gtkFixedSetVisible (true); } else if (bar != null && menuBar != null) Index: java/awt/Window.java =================================================================== RCS file: /sources/classpath/classpath/java/awt/Window.java,v retrieving revision 1.63 diff -u -r1.63 Window.java --- java/awt/Window.java 8 Nov 2005 20:59:05 -0000 1.63 +++ java/awt/Window.java 17 Feb 2006 19:19:10 -0000 @@ -281,50 +281,50 @@ public void show() { synchronized (getTreeLock()) - { - if (parent != null && !parent.isDisplayable()) - parent.addNotify(); - if (peer == null) - addNotify(); - - // Show visible owned windows. - Iterator e = ownedWindows.iterator(); - while(e.hasNext()) - { - Window w = (Window)(((Reference) e.next()).get()); - if (w != null) - { - if (w.isVisible()) - w.getPeer().setVisible(true); - } - else - // Remove null weak reference from ownedWindows. - // Unfortunately this can't be done in the Window's - // finalize method because there is no way to guarantee - // synchronous access to ownedWindows there. - e.remove(); - } - validate(); - super.show(); - toFront(); - - KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); - manager.setGlobalFocusedWindow (this); - - if (!shown) { - FocusTraversalPolicy policy = getFocusTraversalPolicy (); - Component initialFocusOwner = null; + if (parent != null && ! parent.isDisplayable()) + parent.addNotify(); + if (peer == null) + addNotify(); + + validate(); + if (visible) + toFront(); + else + { + super.show(); + // Show visible owned windows. + Iterator e = ownedWindows.iterator(); + while (e.hasNext()) + { + Window w = (Window) (((Reference) e.next()).get()); + if (w != null) + w.show(); + else + // Remove null weak reference from ownedWindows. + // Unfortunately this can't be done in the Window's + // finalize method because there is no way to guarantee + // synchronous access to ownedWindows there. + e.remove(); + } + } + KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); + manager.setGlobalFocusedWindow(this); + + if (! shown) + { + FocusTraversalPolicy policy = getFocusTraversalPolicy(); + Component initialFocusOwner = null; - if (policy != null) - initialFocusOwner = policy.getInitialComponent (this); + if (policy != null) + initialFocusOwner = policy.getInitialComponent(this); - if (initialFocusOwner != null) - initialFocusOwner.requestFocusInWindow (); + if (initialFocusOwner != null) + initialFocusOwner.requestFocusInWindow(); - shown = true; + shown = true; + } } - } } public void hide()