<Swing Dev> RFR: 8249251: [dark_mode ubuntu 20.04] The selected menu is not highlighted in GTKLookAndFeel

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Jul 14 07:13:57 UTC 2020


Hi, Pankaj.

A few notes about the fix and test:
  - The usage of textarea selection as a temporal solution is fine, but did you notice that mouse over effect over JButtons
    in the SwingSet use correct "light color"? Did you tried to check can we use it for menu as well?
  - The test should not check exact selection color and compare it to the textarea selection, it should check
    that the selection color is clearly visible on the background. I guess it should use the logic similar to the
    logic which was deleted by the fix.

  - The next code should be inverted, or additional waitForIdle should be added:
        frame.setVisible(true);
        ........
        SwingUtilities.invokeAndWait(() -> {
           point = menu.getLocationOnScreen();
           rect = menu.getBounds();
        });
        robot.waitForIdle();
        robot.delay(500);
    You need to wait and then read the bounds, otherwise the test may fail(It sometimes fail on my local run for that reason)


On 13.07.2020 11:30, Pankaj Bansal wrote:
> Hi All,
> 
> Please review the following fix for jdk15.
> 
> Bug : https://bugs.openjdk.java.net/browse/JDK-8249251
> webrev: http://cr.openjdk.java.net/~pbansal/8249251/webrev01/ <http://cr.openjdk.java.net/%7Epbansal/8249251/webrev01/>
> 
> Issue: In Ubuntu 20.04 in dark mode, the selected Menu is not being highlighted properly. so, there is no difference between selected and unselected Menu. The issue can be reproduced by running Swingset2 or using the test added in fix.
> 
> Cause: In dark mode, the highlight color for Menu is not visible over the dark background color for the Menubar. So, the highlight is not visible properly and it looks like there is no highlight being drawn.
> 
> Fix: The fix is to use some color for highlighting, which will be properly visible. We have taken the background color for selected text. This color is is visible over the dark Background easily. The fix is tested on Ubuntu 18.04, Ubuntu 20.04 and OL 8.2.
> 
> Added an automated test to verify that the highlight color is same as background color for selected text. The test passes on mach5 with multiple iterations. Link added in JBS.
> 
> 
> Regards
> Pankaj
> 


-- 
Best regards, Sergey.


More information about the swing-dev mailing list