EVALUATION
The described problem is really a bug in AWT, so CR is reopened.
|
|
|
EVALUATION
The bug seems to be in XDecoratedPeer.reshape(WindowDimensions, int, boolean) method. When userReshape is true (that is, this is a programmatic reshape request), the following code is executed:
Rectangle reqBounds = newDimensions.getBounds();
Rectangle newBounds = constrainBounds(reqBounds.x, reqBounds.y, reqBounds.width, reqBounds.height);
newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
reqBounds is always the whole window bounds including insets. newBounds is only not equal to reqBounds for constrained windows (shown by untrusted applets) because of security warning banner - not for the given test. And the third line is incorrect: indeed, if newDimensions.isClientSet is true (e.g. when pack() is called) the constructed WindowDimensions object has newBounds equal to its client bounds, which is wrong as newBounds is always a full bounds including insets. That's why it would be correct to pass 'false' instead of newDimensions.isClientSizeSet() or handle the client size separately (subtract current insets from newBounds). The second approach is listed in Suggested Fix.
|
|
|
SUGGESTED FIX
--- a/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Tue Jan 13 20:04:05 2009 +0100
+++ b/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java Mon Jan 19 13:52:20 2009 +0300
@@ -492,7 +492,14 @@ abstract class XDecoratedPeer extends XW
// do nothing but accept it.
Rectangle reqBounds = newDimensions.getBounds();
Rectangle newBounds = constrainBounds(reqBounds.x, reqBounds.y, reqBounds.width, reqBounds.height);
- newDimensions = new WindowDimensions(newBounds, newDimensions.getInsets(), newDimensions.isClientSizeSet());
+ Insets insets = newDimensions.getInsets();
+ // Inherit isClientSizeSet from newDimensions
+ if (newDimensions.isClientSizeSet()) {
+ newBounds = new Rectangle(newBounds.x, newBounds.y,
+ newBounds.width - insets.left - insets.right,
+ newBounds.height - insets.top - insets.bottom);
+ }
+ newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
}
XToolkit.awtLock();
try {
|
|
|
EVALUATION
In Windows it is impossible to make an application window smaller then a certain size,
so for this case, pack() sets the smallest possible width of the window
(you can't make it smaller with the mouse)
closed as not a but
|
|
|
|