<AWT Dev> RFR: 8239583 [AIX] simplify the native references in X input methods

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Feb 21 07:39:11 UTC 2020

Please review the fix for jdk/client.

Bug: https://bugs.openjdk.java.net/browse/JDK-8239583
Fix: http://cr.openjdk.java.net/~serb/8239583/webrev.00

The purpose of the change is to eliminate the usage of the
AwtScreenDataPtr in the AIX code. This usage was added in
the JDK-8201429 to access the "whitepixel/blackpixel" colors
instead of bg/hg colors defined in createStatusWindow.

So current logic of createStatusWindow looks like this:

1. The colors for foreground and background are initialized
     533     bg    = adata->AwtColorMatch(255, 255, 255, adata);
     534     fg    = adata->AwtColorMatch(0, 0, 0, adata);

2. The "foreground context" is created using whitepixel as background
    and blackpixel as foreground.
     652     statusWindow->fgGC = create_gc(status, FALSE);

3. The foreground of the "foreground context" created at step2
    replaced by the "fg"
     653     XSetForeground(dpy, statusWindow->fgGC, fg);

4. The "background context" is created using blackpixel as background
    and whitepixel as foreground.
     654     statusWindow->bgGC = create_gc(status, TRUE);

5. The foreground of the "background context" created at step4
    replaced by the "bg"
     655     XSetForeground(dpy, statusWindow->bgGC, bg);

The logic above looks redundant we do not need to initialize the
foreground color in the create_gc() because we immediately override it
by the XSetForeground, and it is possible to eliminate the create_gc()
completely and set default background color by the XSetBackground();

I don't know why "whitepixel/blackpixel" are used here but if the "fg"
and "bg" colors at step 1 are incorrect then that colors should be fixed or
some other local colors should be added.

Best regards, Sergey.

More information about the awt-dev mailing list