diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java index 739713dd713..3fc5c9b8b0c 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java @@ -490,8 +490,7 @@ abstract class XDecoratedPeer extends XWindowPeer { // if the window manager or any other part of the windowing // system sets inappropriate size for this window, we can // do nothing but accept it. - Rectangle reqBounds = newDimensions.getBounds(); - Rectangle newBounds = constrainBounds(reqBounds.x, reqBounds.y, reqBounds.width, reqBounds.height); + Rectangle newBounds = newDimensions.getBounds(); Insets insets = newDimensions.getInsets(); // Inherit isClientSizeSet from newDimensions if (newDimensions.isClientSizeSet()) { @@ -619,46 +618,6 @@ abstract class XDecoratedPeer extends XWindowPeer { // This method gets overriden in XFramePeer & XDialogPeer. abstract boolean isTargetUndecorated(); - @Override - Rectangle constrainBounds(int x, int y, int width, int height) { - // We don't restrict the setBounds() operation if the code is trusted. - if (!hasWarningWindow()) { - return new Rectangle(x, y, width, height); - } - - // If it's undecorated or is not currently visible, - // apply the same constraints as for the Window. - if (!isVisible() || isTargetUndecorated()) { - return super.constrainBounds(x, y, width, height); - } - - // If it's visible & decorated, constraint the size only - int newX = x; - int newY = y; - int newW = width; - int newH = height; - - GraphicsConfiguration gc = ((Window)target).getGraphicsConfiguration(); - Rectangle sB = gc.getBounds(); - Insets sIn = ((Window)target).getToolkit().getScreenInsets(gc); - - Rectangle curBounds = getBounds(); - - int maxW = Math.max(sB.width - sIn.left - sIn.right, curBounds.width); - int maxH = Math.max(sB.height - sIn.top - sIn.bottom, curBounds.height); - - // First make sure the size is withing the visible part of the screen - if (newW > maxW) { - newW = maxW; - } - - if (newH > maxH) { - newH = maxH; - } - - return new Rectangle(newX, newY, newW, newH); - } - /** * @see java.awt.peer.ComponentPeer#setBounds */ diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java index 892d7c94e99..4b9bcc91def 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddedFramePeer.java @@ -196,12 +196,6 @@ public class XEmbeddedFramePeer extends XFramePeer { } } - @Override - Rectangle constrainBounds(int x, int y, int width, int height) { - // We don't constrain the bounds of the EmbeddedFrames - return new Rectangle(x, y, width, height); - } - // don't use getBounds() inherited from XDecoratedPeer public Rectangle getBounds() { return new Rectangle(x, y, width, height); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java index 6c517b19697..5115f464922 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java @@ -156,11 +156,11 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { } XWindow(Component target, long parentWindow) { - this(target, parentWindow, target.getBounds()); + this(target, parentWindow, new Rectangle(target.getBounds())); } XWindow(Component target) { - this(target, (target.getParent() == null) ? 0 : getParentWindowID(target), target.getBounds()); + this(target, (target.getParent() == null) ? 0 : getParentWindowID(target), new Rectangle(target.getBounds())); } XWindow(Object target) { @@ -198,7 +198,7 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { | XConstants.ButtonMotionMask | XConstants.ExposureMask | XConstants.StructureNotifyMask); if (target != null) { - params.putIfNull(BOUNDS, target.getBounds()); + params.putIfNull(BOUNDS, new Rectangle(target.getBounds())); } else { params.putIfNull(BOUNDS, new Rectangle(0, 0, MIN_SIZE, MIN_SIZE)); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java index d3fb2107281..e78d007bdbf 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java @@ -180,9 +180,6 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, GraphicsConfiguration gc = getGraphicsConfiguration(); ((X11GraphicsDevice)gc.getDevice()).addDisplayChangedListener(this); - - Rectangle bounds = (Rectangle)(params.get(BOUNDS)); - params.put(BOUNDS, constrainBounds(bounds.x, bounds.y, bounds.width, bounds.height)); } protected String getWMName() { @@ -437,56 +434,6 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, return ownerPeer; } - // This method is overriden at the XDecoratedPeer to handle - // decorated windows a bit differently. - Rectangle constrainBounds(int x, int y, int width, int height) { - // We don't restrict the setBounds() operation if the code is trusted. - if (!hasWarningWindow()) { - return new Rectangle(x, y, width, height); - } - - // The window bounds should be within the visible part of the screen - int newX = x; - int newY = y; - int newW = width; - int newH = height; - - // Now check each point is within the visible part of the screen - GraphicsConfiguration gc = ((Window)target).getGraphicsConfiguration(); - Rectangle sB = gc.getBounds(); - Insets sIn = ((Window)target).getToolkit().getScreenInsets(gc); - - int screenX = sB.x + sIn.left; - int screenY = sB.y + sIn.top; - int screenW = sB.width - sIn.left - sIn.right; - int screenH = sB.height - sIn.top - sIn.bottom; - - - // First make sure the size is withing the visible part of the screen - if (newW > screenW) { - newW = screenW; - } - - if (newH > screenH) { - newH = screenH; - } - - // Tweak the location if needed - if (newX < screenX) { - newX = screenX; - } else if (newX + newW > screenX + screenW) { - newX = screenX + screenW - newW; - } - - if (newY < screenY) { - newY = screenY; - } else if (newY + newH > screenY + screenH) { - newY = screenY + screenH - newH; - } - - return new Rectangle(newX, newY, newW, newH); - } - //Fix for 6318144: PIT:Setting Min Size bigger than current size enlarges //the window but fails to revalidate, Sol-CDE //This bug is regression for @@ -495,13 +442,11 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, //Note that this function is overriden in XDecoratedPeer so event //posting is not changing for decorated peers public void setBounds(int x, int y, int width, int height, int op) { - Rectangle newBounds = constrainBounds(x, y, width, height); - XToolkit.awtLock(); try { Rectangle oldBounds = getBounds(); - super.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height, op); + super.setBounds(x, y, width, height, op); Rectangle bounds = getBounds(); diff --git a/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java index 96cdb26f6d3..4424f1cc813 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java @@ -114,12 +114,10 @@ class WDialogPeer extends WWindowPeer implements DialogPeer { } public void reshape(int x, int y, int width, int height) { - Rectangle newBounds = constrainBounds(x, y, width, height); - if (((Dialog)target).isUndecorated()) { - super.reshape(newBounds.x, newBounds.y, newBounds.width, newBounds.height); + super.reshape(x, y, width, height); } else { - reshapeFrame(newBounds.x, newBounds.y, newBounds.width, newBounds.height); + reshapeFrame(x, y, width, height); } } diff --git a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java index 2e1e6e618dc..2ed17f60fe3 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java @@ -67,12 +67,6 @@ public class WEmbeddedFramePeer extends WFramePeer { public native void synthesizeWmActivate(boolean doActivate); - @Override - Rectangle constrainBounds(int x, int y, int width, int height) { - // We don't constrain the bounds of the EmbeddedFrames - return new Rectangle(x, y, width, height); - } - @Override public boolean isAccelCapable() { // REMIND: Temp workaround for issues with using HW acceleration diff --git a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java index 79bf6b77e41..86bde26582b 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java @@ -89,12 +89,10 @@ class WFramePeer extends WWindowPeer implements FramePeer { } public void reshape(int x, int y, int width, int height) { - Rectangle newBounds = constrainBounds(x, y, width, height); - if (((Frame)target).isUndecorated()) { - super.reshape(newBounds.x, newBounds.y, newBounds.width, newBounds.height); + super.reshape(x, y, width, height); } else { - reshapeFrame(newBounds.x, newBounds.y, newBounds.width, newBounds.height); + reshapeFrame(x, y, width, height); } } diff --git a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java index 3c624020934..4a23b779d62 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java @@ -546,81 +546,16 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, private volatile int sysW = 0; private volatile int sysH = 0; - Rectangle constrainBounds(int x, int y, int width, int height) { - GraphicsConfiguration gc = this.winGraphicsConfig; - - // We don't restrict the setBounds() operation if the code is trusted. - if (!hasWarningWindow() || gc == null) { - return new Rectangle(x, y, width, height); - } - - int newX = x; - int newY = y; - int newW = width; - int newH = height; - - Rectangle sB = gc.getBounds(); - Insets sIn = Toolkit.getDefaultToolkit().getScreenInsets(gc); - - int screenW = sB.width - sIn.left - sIn.right; - int screenH = sB.height - sIn.top - sIn.bottom; - - // If it's undecorated or is not currently visible - if (!AWTAccessor.getComponentAccessor().isVisible_NoClientCode( - (Component)target) || isTargetUndecorated()) - { - // Now check each point is within the visible part of the screen - int screenX = sB.x + sIn.left; - int screenY = sB.y + sIn.top; - - // First make sure the size is within the visible part of the screen - if (newW > screenW) { - newW = screenW; - } - if (newH > screenH) { - newH = screenH; - } - - // Tweak the location if needed - if (newX < screenX) { - newX = screenX; - } else if (newX + newW > screenX + screenW) { - newX = screenX + screenW - newW; - } - if (newY < screenY) { - newY = screenY; - } else if (newY + newH > screenY + screenH) { - newY = screenY + screenH - newH; - } - } else { - int maxW = Math.max(screenW, sysW); - int maxH = Math.max(screenH, sysH); - - // Make sure the size is withing the visible part of the screen - // OR less that the current size of the window. - if (newW > maxW) { - newW = maxW; - } - if (newH > maxH) { - newH = maxH; - } - } - - return new Rectangle(newX, newY, newW, newH); - } - public native void repositionSecurityWarning(); @Override public void setBounds(int x, int y, int width, int height, int op) { - Rectangle newBounds = constrainBounds(x, y, width, height); + sysX = x; + sysY = y; + sysW = width; + sysH = height; - sysX = newBounds.x; - sysY = newBounds.y; - sysW = newBounds.width; - sysH = newBounds.height; - - super.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height, op); + super.setBounds(x, y, width, height, op); } @Override