summaryrefslogtreecommitdiff
path: root/gnu/java/awt
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@redhat.com>2005-08-13 00:22:26 +0000
committerThomas Fitzsimmons <fitzsim@redhat.com>2005-08-13 00:22:26 +0000
commit4c4e2e24b83fb47b9bdc9c9c6963a084500f1762 (patch)
tree906fcd6fb0c6984be74fe6b0abfa81e745be32d9 /gnu/java/awt
parentc003a1bcaf559a779f625bd02ddc195a9c10f5d9 (diff)
downloadclasspath-4c4e2e24b83fb47b9bdc9c9c6963a084500f1762.tar.gz
2005-08-12 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GtkComponentPeer.java (setBounds): Get frame insets directly from peer rather than from Window.getInsets. (toString): New method.
Diffstat (limited to 'gnu/java/awt')
-rw-r--r--gnu/java/awt/peer/gtk/GtkComponentPeer.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index a7aea091d..4de2b27d0 100644
--- a/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -418,6 +418,9 @@ public class GtkComponentPeer extends GtkGenericPeer
public void setBounds (int x, int y, int width, int height)
{
+ int new_x = x;
+ int new_y = y;
+
Component parent = awtComponent.getParent ();
// Heavyweight components that are children of one or more
@@ -438,8 +441,8 @@ public class GtkComponentPeer extends GtkGenericPeer
i = ((Container) parent).getInsets ();
- x += parent.getX () + i.left;
- y += parent.getY () + i.top;
+ new_x += parent.getX () + i.left;
+ new_y += parent.getY () + i.top;
parent = parent.getParent ();
}
@@ -448,18 +451,22 @@ public class GtkComponentPeer extends GtkGenericPeer
// placing a heavyweight component in a Window.
if (parent instanceof Window && !lightweightChild)
{
- Insets insets = ((Window) parent).getInsets ();
GtkWindowPeer peer = (GtkWindowPeer) parent.getPeer ();
+ // important: we want the window peer's insets here, not the
+ // window's, since user sub-classes of Window can override
+ // getInset and we only want to correct for the frame borders,
+ // not for any user-defined inset values
+ Insets insets = peer.getInsets ();
+
int menuBarHeight = 0;
if (peer instanceof GtkFramePeer)
menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight ();
- // Convert from Java coordinates to GTK coordinates.
- setNativeBounds (x - insets.left, y - insets.top + menuBarHeight,
- width, height);
+ new_x = x - insets.left;
+ new_y = y - insets.top + menuBarHeight;
}
- else
- setNativeBounds (x, y, width, height);
+
+ setNativeBounds (new_x, new_y, width, height);
}
void setCursor ()
@@ -671,4 +678,9 @@ public class GtkComponentPeer extends GtkGenericPeer
{
backBuffer.flush();
}
+
+ public String toString ()
+ {
+ return "peer of " + awtComponent.toString();
+ }
}