diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | gnu/java/awt/peer/gtk/GtkComponentPeer.java | 23 | ||||
-rw-r--r-- | gnu/java/awt/peer/gtk/GtkContainerPeer.java | 26 |
3 files changed, 22 insertions, 37 deletions
@@ -1,3 +1,13 @@ +2006-03-03 Mark Wielaard <mark@klomp.org> + + * gnu/java/awt/peer/gtk/GtkComponentPeer.java (GtkComponentPeer): + Always call setParentAndBounds(). + (setComponentBounds): Always call setBounds(). + (setBounds): Call setVisible(). + (setVisible): If no pixels are showing then don't make it visible. + * gnu/java/awt/peer/gtk/GtkContainerPeer.java (endValidate): No need + to call setParentAndBounds() anymore. + 2006-03-03 Roman Kennke <kennke@aicas.com> * javax/swing/JInternalFrame.java diff --git a/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/gnu/java/awt/peer/gtk/GtkComponentPeer.java index b48479bb2..821183927 100644 --- a/gnu/java/awt/peer/gtk/GtkComponentPeer.java +++ b/gnu/java/awt/peer/gtk/GtkComponentPeer.java @@ -145,12 +145,7 @@ public class GtkComponentPeer extends GtkGenericPeer Component parent = awtComponent.getParent (); - // Only set our parent on the GTK side if our parent on the AWT - // side is not showing. Otherwise the gtk peer will be shown - // before we've had a chance to position and size it properly. - if (awtComponent instanceof Window - || (parent != null && ! parent.isShowing ())) - setParentAndBounds (); + setParentAndBounds (); setNativeEventMask (); @@ -201,11 +196,6 @@ public class GtkComponentPeer extends GtkGenericPeer void setComponentBounds () { Rectangle bounds = awtComponent.getBounds (); - - if (bounds.x == 0 && bounds.y == 0 - && bounds.width == 0 && bounds.height == 0) - return; - setBounds (bounds.x, bounds.y, bounds.width, bounds.height); } @@ -487,6 +477,10 @@ public class GtkComponentPeer extends GtkGenericPeer } setNativeBounds (new_x, new_y, width, height); + + // If the height or width were (or are now) smaller than zero + // then we want to adjust the visibility. + setVisible(awtComponent.isVisible()); } void setCursor () @@ -537,6 +531,13 @@ public class GtkComponentPeer extends GtkGenericPeer public void setVisible (boolean b) { + // Only really set visible when component is bigger than zero pixels. + if (b) + { + Rectangle bounds = awtComponent.getBounds(); + b = (bounds.width > 0) && (bounds.height > 0); + } + if (Thread.currentThread() == GtkToolkit.mainThread) setVisibleNativeUnlocked (b); else diff --git a/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/gnu/java/awt/peer/gtk/GtkContainerPeer.java index 37ed36131..23737b0b0 100644 --- a/gnu/java/awt/peer/gtk/GtkContainerPeer.java +++ b/gnu/java/awt/peer/gtk/GtkContainerPeer.java @@ -65,32 +65,6 @@ public class GtkContainerPeer extends GtkComponentPeer public void endValidate () { - Component parent = awtComponent.getParent (); - - // We only set our parent on the GTK side if our parent on the AWT - // side is not showing in the constuctor. Otherwise the gtk peer will - // be shown before we've had a chance to position and size it properly. - // So we set it here at the end of validation. - if ((parent != null && parent.isShowing()) - || (awtComponent instanceof Window - && ((Window) awtComponent).isShowing())) - { - Component[] components = ((Container) awtComponent).getComponents (); - int ncomponents = components.length; - - for (int i = 0; i < ncomponents; i++) - { - ComponentPeer peer = components[i].getPeer (); - - // Skip lightweight peers. - if (peer instanceof GtkComponentPeer) - ((GtkComponentPeer) peer).setParentAndBounds (); - } - - // GTK windows don't have parents. - if (!(awtComponent instanceof Window)) - setParentAndBounds (); - } } public Insets getInsets() |