RFR: 8258970: Disabled JPasswordField foreground color is wrong with GTK LAF [v3]

Prasanta Sadhukhan psadhukhan at openjdk.org
Fri Sep 1 11:23:40 UTC 2023


On Fri, 1 Sep 2023 08:00:28 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> Disabled JPasswordField foreground color was not grayed out in GTK LAF.
>> 
>> The foreground color in disabled state was close to black color (RGB 0,0,0) for password field which is not differentiable from enabled state foreground color.
>> 
>> To fix for this problem, the widget type is changed to `TEXT_AREA `for disable password field which returns the foreground color as gray. Checked with Oracle linux as well and fix worked fine.
>> 
>> An automated test case has been added and checked in CI, link is added in JBS. Test mentioned in JBS also works fine with the fix.
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review comment update

src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c line 2409:

> 2407:                 } else if (state_type == GTK_STATE_INSENSITIVE && color_type == TEXT_FOREGROUND) {
> 2408:                     widget_type = TEXT_AREA;
> 2409:                 }

I think there's no need of another else if
It can be just

if ((state_type == GTK_STATE_SELECTED && color_type == TEXT_BACKGROUND)) ||
    (state_type == GTK_STATE_INSENSITIVE && color_type == TEXT_FOREGROUND)) {
  widget_type =TEXT_AREA:

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15263#discussion_r1312905129


More information about the client-libs-dev mailing list