<AWT Dev> RFR: 8040630 Popup menus and tooltips flicker with previous popup contents when first shown

Alexander Zuev alexander.zuev at oracle.com
Mon Mar 9 21:40:09 UTC 2020

On 09-Mar-20 23:55, Sergey Bylokhov wrote:
> On 3/9/20 7:47 am, Alexander Zuev wrote:
>>    as a workaround resetting the internal windows state will do. 
>> Question is - do we use OpenGL framework
>> anywhere aside of OSX? I doubt we do. And does new Metal framework 
>> exhibit this problem? I know this
>> question is probably not for you specifically, but still.
> The OpenGL can be enabled on linux and windows as well. The
> bug does not really OGL specific, it just a matter of chance that
> OGL on macOS is slower than other pipelines on other platforms,
> all depends on how faster the pipeline is able to redraw the window.
> In theory all pipelines are affected.
>>    Anyways - shouldn't we add some specific comments about what this 
>> code is workaround for so we don't
>> forget to clean it up later when the main problem is gone (one way or 
>> another)?
> The main issue cannot be gone, the only possible more generic
> solution is to drop H/W caching.
Ouch. Then it's ok to fix it this way.
>> /Alex
>> On 03-Feb-20 5:07, Sergey Bylokhov wrote:
>>> Hello.
>>> Please review the fix for jdk/client.
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8040630
>>> Fix: http://cr.openjdk.java.net/~serb/8040630/webrev.00
>>> This change is intended to fix the flickering of popup menus on
>>> macOS. The root cause of the problem is that the native windows
>>> for popup menus are cached internally. So when we show such a
>>> cached window to the user he will see old content till the moment
>>> we draw the new one.
>>> As a fix we could
>>>  - Drop the internal state(surface) of the window which contains the
>>>    old content, as suggested in the current fix we set its size to 
>>> 1x1 pixels.
>>>  - Clean the old content by something like graphics.clearRect(), but
>>>    since the draw operation is asynchronous it is possible it will
>>>    not be completed when the user will see the popup.
>>>  - Drop the caching completely, I am not sure that we really needed it,
>>>    I have checked the performance PopupFactory.getPopup() when the
>>>    cache is enabled/disabled and did not found a big difference. But
>>>    since I plan to backport this to jdk11, I would like to minimize the
>>>    fix, and drop the cache sometime later.
>>> Notes:
>>>  - The easiest way to reproduce the bug is to run SwingSet2, and
>>>    quickly open/reopen the "File" and "Look and feel" menu.
>>>  - The bug is not really macOS specific, but java2D OGL pipeline"
>>>    specific where the actual draw operations are asynchronous.

More information about the awt-dev mailing list