6987945: XDecoratedPeer shouldn't allow to resize a frame to zero size
authoromajid
Tue, 28 Sep 2010 10:16:18 -0400
changeset 6637 64ecd501905b
parent 6636 a636784de382
child 6639 ecf7952e13ef
6987945: XDecoratedPeer shouldn't allow to resize a frame to zero size Reviewed-by: anthony
jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java
jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java	Tue Sep 28 14:57:23 2010 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java	Tue Sep 28 10:16:18 2010 -0400
@@ -705,12 +705,8 @@
             throw new IllegalStateException("Attempt to resize uncreated window");
         }
         insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height);
-        if (width <= 0) {
-            width = 1;
-        }
-        if (height <= 0) {
-            height = 1;
-        }
+        width = Math.max(MIN_SIZE, width);
+        height = Math.max(MIN_SIZE, height);
         XToolkit.awtLock();
         try {
              XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getWindow(), x,y,width,height);
--- a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Tue Sep 28 14:57:23 2010 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Tue Sep 28 10:16:18 2010 -0400
@@ -763,12 +763,8 @@
     }
 
     private void checkShellRectSize(Rectangle shellRect) {
-        if (shellRect.width < 0) {
-            shellRect.width = 1;
-        }
-        if (shellRect.height < 0) {
-            shellRect.height = 1;
-        }
+        shellRect.width = Math.max(MIN_SIZE, shellRect.width);
+        shellRect.height = Math.max(MIN_SIZE, shellRect.height);
     }
 
     private void checkShellRectPos(Rectangle shellRect) {