<AWT Dev> RFR: 8208996 X11 icon window color handing bug

Ichiroh Takiguchi takiguc at linux.vnet.ibm.com
Mon Aug 6 16:06:48 UTC 2018


Thanks Sergey.

Hello.
Could you review it ?

Bug:    https://bugs.openjdk.java.net/browse/JDK-8208996
Change: http://cr.openjdk.java.net/~aleonard/8208996/webrev.00/

Thanks,
Ichiroh Takiguchi
IBM Japan, Ltd.

On 2018-08-05 10:10, Sergey Bylokhov wrote:
> Hello.
> I was able to reproduce the bug as described and verify that the
> proposed fix works.
> I have filed a bug:
> https://bugs.openjdk.java.net/browse/JDK-8208996
> Please send an official review request.
> 
> Thank you for the fix.
> 
> On 13/06/2018 02:36, Ichiroh Takiguchi wrote:
>> Hello,
>> IBM would like to contribute X11 icon window color handing patch to 
>> OpenJDK project.
>> 
>> Issue:
>> It seems some of colors on icon for pseudo color are not appropriate.
>> Test program is as follows:
>> ======
>> $ cat IconifiedFrame.java
>> import java.awt.*;
>> import java.awt.event.*;
>> 
>> public class IconifiedFrame extends Frame {
>>    IconifiedFrame() {
>>      super("IconifiedFrame");
>>      setSize(100, 100);
>>      addWindowListener(new WindowAdapter() {
>>        public void windowClosing(WindowEvent event) { 
>> System.exit(0); }
>>      });
>>      setExtendedState(Frame.ICONIFIED);
>>      setVisible(true);
>>    }
>>    public static void main(String[] args) {
>>      new IconifiedFrame();
>>    }
>> }
>> ======
>> 
>> To recreate this issue on RHEL7, please try following steps.
>> (xorg-x11-server-Xephyr and openmotif rpm packages are required)
>> 
>> 1. Type following commands from terminal
>> $ Xephyr :1 -ac -screen 800x600x8 &
>> $ xterm -display :1 &
>> 2. On xterm on Xephyr
>> $ mwm &
>> $ javac IconifiedFrame.java
>> $ java IconifiedFrame
>> 
>> Reason:
>> Pseudo color is handled by unsigned byte data.
>> But Java's byte is signed, it was not converted to unsigned.
>> Modified code is as follows:
>> ======
>> --- old/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java  
>>  2018-06-13 16:23:17.889946251 +0900
>> +++ new/src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java  
>>  2018-06-13 16:23:17.274958922 +0900
>> @@ -281,8 +281,9 @@
>>                   ColorData cdata = 
>> adata.get_color_data(0);
>>                   int num_colors = 
>> cdata.get_awt_numICMcolors();
>>                   for (int i = 0; i < buf.length; i++) 
>> {
>> -                    buf[i] = (buf[i] >= 
>> num_colors) ?
>> -                        0 : 
>> cdata.get_awt_icmLUT2Colors(buf[i]);
>> +                    int b = 
>> Byte.toUnsignedInt(buf[i]);
>> +                    buf[i] = (b >= num_colors) ?
>> +                        0 : 
>> cdata.get_awt_icmLUT2Colors(b);
>>                   }
>>                   bytes = Native.toData(buf);
>>               } else if (srcBuf instanceof DataBufferInt) 
>> {
>> ======
>> 
>> I'd like contribute following 1 file:
>> M src/java.desktop/unix/classes/sun/awt/X11/XIconWindow.java
>> 
>> I appreciate any feedback please, and how I would go about obtaining a 
>> sponsor and contributor?
>> 
>> Thanks,
>> Ichiroh Takiguchi
>> IBM Japan, Ltd.
>> 



More information about the awt-dev mailing list