<AWT Dev> Request for review: x11 - ensure non zero heights and widths

Anthony Petrov anthony.petrov at oracle.com
Fri Sep 24 13:27:30 PDT 2010


Hi Omair,

On 9/24/2010 6:12 PM, Omair Majid wrote:
> While trying out a Java program, I noticed that some BadValue X errors
> were being reported (I had to set -Dsun.awt.noisyerrorhandler=True
> first). The webrev at
> http://cr.openjdk.java.net/~omajid/webrevs/x11-bad-widths-heights/webrev.00/
> attempts to fix the issue.

Please make sure you put the true-branches of the if statements into {} 
blocks.

Do I understand correctly that we're fixing an issue with top-level 
windows only? If so, then I suggest to not touch the code in the 
XBasWindow, but rather tweak the bounds in the XWindowPeer where we add 
them to the create params map. (and perhaps in the XDecoratedPeer - need 
to check if their logic of initializing the params is separate or not.)


> The problem is that there are some cases where the jdk is creating or
> resizing windows and setting widths and/or heights to 0. The man page

What are the exact cases?

--
best regards,
Anthony

> for XResizeWindow states "If either width or height is zero, a BadValue
> error results". I looked at the source code for xorg-xserver and it
> appears that specifying a height or width of 0 for pretty much any X
> call will cause a BadValue error.
>
> The patch takes an approach similar to what is currently being done in
> XBaseWindow.xSetBounds(). It checks heights and widths, setting them to
> 1 if needed.
>
> Any comments?
>
> Cheers,
> Omair



More information about the awt-dev mailing list