<AWT Dev> [9] Review request for 8072069: Toolkit.getScreenInsets() doesn't update if insets change

Anton Nashatyrev anton.nashatyrev at oracle.com
Fri Feb 13 15:01:08 UTC 2015


Hi, Alexander

     I tried the ToplevelFactory.jar demo with security warning: on a 
single window resize the insets are queried ~10-20 times. I've tested 
the native method call time with a microbenchmark: it shows < 
0.1ms/call. Thus we got ~1-2ms overhead for a single window resize. 
Visually there is no performance degradation.

Thanks!
Anton.

On 13.02.2015 16:03, Alexander Zvegintsev wrote:
> Hello Anton,
>
> getScreenInsets() is called from repositionSecurityWarning() also 
> (which is called on every LWWindowPeer.notifyReshape()).
> It probably may affect performance in case when security warning is 
> shown while resizing a window.
> Could you please  check this case?
> If this leads to impaired performance we may consider to use 
> NSApplicationDidChangeScreenParametersNotification [0]
> to update cached values.
>
> [0] 
> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/#//apple_ref/c/data/NSApplicationDidChangeScreenParametersNotification
>
> Thanks,
>
> Alexander.
>
> On 02/13/2015 03:06 PM, Anton Nashatyrev wrote:
>> Hello,
>>
>>     could you please review the following fix:
>>
>> fix: http://cr.openjdk.java.net/~anashaty/8072069/9/webrev.00/ 
>> <http://cr.openjdk.java.net/%7Eanashaty/8072069/9/webrev.00/>
>> bug: https://bugs.openjdk.java.net/browse/JDK-8072069
>>
>>     Problem: Toolkit.getScreenInsets() returns old value after Dock 
>> moved/resized on Mac
>>
>>     Fix: remove the value caching and always ask native for insets.
>> This shouldn't cause any performance drawbacks since the 
>> getScreenInsets() is rarely called (mostly on window init and on 
>> popup positioning).
>>
>> Thanks!
>> Anton.
>



More information about the awt-dev mailing list