[regression] In Java apps like Netbeans, dark menu bars don't look good for disabled elements

Bug #1729558 reported by md_5
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ubuntu theme
Invalid
Low
Unassigned
openjdk-8 (Ubuntu)
Fix Released
Low
Unassigned
openjdk-9 (Ubuntu)
Confirmed
Low
Unassigned
ubuntu-themes (Ubuntu)
Invalid
Low
Unassigned

Bug Description

This fix, #961679, specifically Ambiance/gtk-2.0/gtkrc:346 (http://bazaar.launchpad.net/~ubuntu-art-pkg/ubuntu-themes/trunk/revision/583), makes disabled elements in menus look terrible.

Unfortunately I'm not aware of an easy way to get screenshots of open menus, so hopefully these attached phone pictures of Netbeans are enough to illustrate the issue.

As you can see it is hard to tell the difference between what is disabled and what isn't, and the disabled items look fuzzy (easier to observe on monitor).

I really don't see the issue with lighter menus, but if they must stay dark then the readability / contrast of disabled items needs to be fixed.

Thanks

Revision history for this message
md_5 (md-5) wrote :
Revision history for this message
md_5 (md-5) wrote :
Revision history for this message
md_5 (md-5) wrote :

Firefox / Libreoffice etc which I'm guessing use gtk3 show disabled items fine.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Re: In Java apps like Netbeans, dark menu bars don't look good for disabled elements

Confirmed. But the problem is just Java failing to pay attention to the theme correctly. It uses the right background colour, but not the right font colours. It's still using a fixed font colour that works only on lighter backgrounds. This is a bug in openjdk-8 (or netbeans itself, not sure).

summary: - Fix for #961679 - dark menu bars doesn't look good for disabled elements
+ In Java apps like Netbeans, dark menu bars don't look good for disabled
+ elements
affects: ubuntu-themes (Ubuntu) → openjdk-8 (Ubuntu)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Although if you say everything was fine before the fix for bug 961679 then this is a regression and it possibly is the fault of ubuntu-themes :)

summary: - In Java apps like Netbeans, dark menu bars don't look good for disabled
- elements
+ [regression] In Java apps like Netbeans, dark menu bars don't look good
+ for disabled elements
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-8 (Ubuntu):
status: New → Confirmed
Changed in ubuntu-themes (Ubuntu):
status: New → Confirmed
Changed in ubuntu-themes:
importance: Undecided → Low
Changed in openjdk-8 (Ubuntu):
importance: Undecided → Low
Changed in ubuntu-themes (Ubuntu):
importance: Undecided → Low
Changed in ubuntu-themes:
status: New → Confirmed
tags: added: visual-quality
Revision history for this message
md_5 (md-5) wrote :

Java isn’t hardcoding them, it’s pulling them from GTK. There is the possibility that it’s pulling the wrong type of element colour (sorry not sure about terminology).

I guess the test is to find a GTK 2 app with disabled menu elements that previously had a white menu which is now black wih this patch.

I did make a test Java Swing app and the disabled elements looked bad, so it’s not constrained to Netbeans at least.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I think it's more the Swing/other toolkit's unique way of rendering things than GTK. Testing a native GTK-2 app (geeqie) doesn't seem to exhibit the problem.

Yes I agree with your terminology. Worth noting though even the font rendering style looks messed up in Netbeans. From what I recall in years gone by that's a Java-specific issue.

Revision history for this message
md_5 (md-5) wrote :

If you were testing your own install the font rendering is messed because of this bug in freetype https://bugs.launchpad.net/bugs/1722508
Downgrading to the Zesty version of freetype (as in my screenshots) fixes that issue.

Revision history for this message
md_5 (md-5) wrote :

Java looks to be using the disabled foreground colour correctly (to me, the untrained observer):

    gtk2_widget = gtk2_get_widget(widget_type);
    GtkStyle* style = gtk2_widget->style;

    switch (color_type)
    {
        case FOREGROUND:
            color = &(style->fg[state_type]);
            break;

Worth noting using GTK3 breaks other things, but actually fixes this bug (but that could simply point to an issue with Java's GTK2 code).

Revision history for this message
md_5 (md-5) wrote :

Ok Turns out Java has some super funky code:

        int componentState = context.getComponentState();
        if ((componentState & SynthConstants.DISABLED) ==
                              SynthConstants.DISABLED){
            if (!GTKLookAndFeel.is3()) {
                Color orgColor = g.getColor();
                g.setColor(context.getStyle().getColor(context,
                        GTKColorType.WHITE));
                x += 1;
                y += 1;
                super.paintText(context, g, text, x, y, mnemonicIndex);

                g.setColor(orgColor);
                x -= 1;
                y -= 1;
            }
            super.paintText(context, g, text, x, y, mnemonicIndex);
        }

Removing this silly +1 white shadowing nonsense results in perfect looking menus both when dark and light.
I will take this upstream and see if it can be patched into Ubuntu, not a theming bug after all.

Changed in ubuntu-themes:
status: Confirmed → Invalid
Changed in ubuntu-themes (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
md_5 (md-5) wrote :

Patch I submitted upstream is attached, not through yet though.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Great, thanks. Do you have a link to the upstream bug?

Changed in openjdk-9 (Ubuntu):
importance: Undecided → Low
Revision history for this message
md_5 (md-5) wrote :

No upstream bug yet unfortunately (OpenJDK bugtracker is restricted access as I'm sure you know).
I made a mailing list thread a few days ago here http://mail.openjdk.java.net/pipermail/swing-dev/2017-November/007904.html although haven't had any feedback aside from the patch not being attached!

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "disabled.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
md_5 (md-5) wrote :

Patch was applied upstream,

http://hg.openjdk.java.net/jdk/jdk/rev/d4ed3b8d166c

Requesting a backport to 8/9 please. Should apply without conflicts - file hasn't been otherwise modified in either version.

Thanks
Michael

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-9 (Ubuntu):
status: New → Confirmed
Revision history for this message
Thorsten Glaser (mirabilos) wrote :

As far as I see, openjdk-8 (8u275-b01-1) contains this patch, so it was backported upstream.

Changed in openjdk-8 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.