diff options
author | Sven Gothel <[email protected]> | 2011-11-27 17:28:04 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-11-27 17:28:04 +0100 |
commit | 3602649d8e15d2272ac58e9d2abbf60e1e17ff0d (patch) | |
tree | 84559f5af0a3cca29831b5ab2239fa94ec53b3c4 /src/nativewindow/classes/jogamp | |
parent | f842b59caa0b98c0c0e229ecb9f7c615650e50e8 (diff) |
JAWTWindow: Impl. insets (if AWT component is a Container)
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java index a75af0be3..712d5ddae 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java @@ -41,6 +41,7 @@ import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; import java.awt.Component; +import java.awt.Container; import java.applet.Applet; import javax.media.nativewindow.AbstractGraphicsConfiguration; import javax.media.nativewindow.AbstractGraphicsDevice; @@ -75,7 +76,8 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface private boolean isOffscreenLayerSurface; protected long drawable; protected Rectangle bounds; - + protected Insets insets; + /** * Constructed by {@link jogamp.nativewindow.NativeWindowFactoryImpl#getNativeWindow(Object, AbstractGraphicsConfiguration)} * via this platform's specialization (X11, OSX, Windows, ..). @@ -122,6 +124,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface isOffscreenLayerSurface = false; drawable= 0; bounds = new Rectangle(); + insets = new Insets(); } protected abstract void invalidateNative(); @@ -130,12 +133,20 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface bounds.setY(jawtBounds.getY()); bounds.setWidth(jawtBounds.getWidth()); bounds.setHeight(jawtBounds.getHeight()); + + if(component instanceof Container) { + java.awt.Insets contInsets = ((Container)component).getInsets(); + insets.setLeftWidth(contInsets.left); + insets.setRightWidth(contInsets.right); + insets.setTopHeight(contInsets.top); + insets.setBottomHeight(contInsets.bottom); + } } /** @return the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds, updated with lock */ public final RectangleImmutable getBounds() { return bounds; } - public final InsetsImmutable getInsets() { return Insets.getZero(); } + public final InsetsImmutable getInsets() { return insets; } public final Component getAWTComponent() { return component; @@ -449,7 +460,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface sb.append("JAWT-Window["+ "windowHandle 0x"+Long.toHexString(getWindowHandle())+ ", surfaceHandle 0x"+Long.toHexString(getSurfaceHandle())+ - ", bounds "+bounds); + ", bounds "+bounds+", insets "+insets); if(null!=component) { sb.append(", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+ ", visible "+component.isVisible()); |