<AWT Dev> [PATCH] Fix X11 window size calculation

Artem Ananiev Artem.Ananiev at Sun.COM
Mon Jan 19 03:40:15 PST 2009


Hi, Omair,

I've just updated bug #6721088 and included the information about the 
fix and the source of the problem. Do you prefer to push the fix into 
workspace yourself? You/your company must have signed SCA for doing 
that, and you also need a second reviewer from AWT group then.

As for isClientSizeSet() - it's pretty self-explanatory :) What kind of 
additional comments do you suggest? Probably, something like this:

/**
  * If isClient is true, the given rectangle is treated as a client 
rect, otherwise as a whole window rect with insets included.
  */
public WindowDimensions(Rectangle rec, Insets ins, boolean isClient);

?

Thanks,

Artem

Omair Majid wrote:
> Hi Artem,
> 
> Artem Ananiev wrote:
>> Hi, Omair,
>>
>> thank you for the patch. It seems that the bug was closed by mistake, 
>> so I have just reopened it against AWT.
>>
> Thanks!
> 
>> As for proposed changes, there is a single question:
>>
>> --- jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java.orig 
>> 2009-01-08 16:53:54.000000000 -0500
>> +++ jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java    
>> 2009-01-08 16:54:08.000000000 -0500
>> @@ -478,7 +478,10 @@
>>              // 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();
>> +            Rectangle fixedBounds = new Rectangle(newBounds.x, 
>> newBounds.y, newBounds.width - insets.left - insets.right,
>> +                    newBounds.height - insets.top - insets.bottom);
>> +            newDimensions = new WindowDimensions(fixedBounds, insets, 
>> newDimensions.isClientSizeSet());
>>          }
>>          XToolkit.awtLock();
>>          try {
>>
>> WindowDimensions class contains either client size or full size of the 
>> window, depending on 'isClientSizeSet' flag. fixedBounds from your 
>> patch is always a client rect, however isClientSizeSet is used from 
>> newDimensions... I'd rewrite the last changed line this way:
>>
>> +            newDimensions = new WindowDimensions(fixedBounds, insets, 
>> true);
>>
>> or, even better, this this one:
>>
>> +            newDimensions = new 
>> WindowDimensions(newDimensions.isClientSizeSet() ? fixedBounds : 
>> newBounds, insets, newDimensions.isClientSizeSet());
>>
>> Your comments?
>>
> 
> Thanks for looking over the patch! As for your change, that seems like 
> the correct thing to do. Would it be possible to add the explanation for 
> isClientSizeSet()'s usage to WindowDimensions class? I just want to make 
> sure that nobody else makes the mistake I just did.
> 
> Cheers,
> 
> Omair
> 



More information about the awt-dev mailing list