RFR: 8288325: [windows] Actual and Preferred Size of AWT Non-resizable frame are different

Alexey Ivanov aivanov at openjdk.org
Mon Aug 22 21:59:28 UTC 2022


On Mon, 22 Aug 2022 21:52:59 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>>> Does it mean that now we will always request the insets from the platform?
>> 
>> **_Yes the following block of code runs when window isn't sized yet (first time) or when the incoming taget is a frame to obtain platform insets_**
>> 
>>> Was this code run before the frame was changed from resizeable to non-resizeable? Therefore the insets weren't updated correctly.
>> 
>>  _**It was not going into this block for resizable frames. The issue was with the cached insets. The first time when frame,pack() is called on non-resizable frame the correct insets associated with it is returned and the frame is sized accordingly. But any subsequent calls to frame.getInsets() or frame.getPreferredSize() which gets the cached insets from [WPanelPeer](https://github.com/openjdk/jdk/blob/27af0144ea57e86d9b81c2b328fad66e4a046f61/src/java.desktop/windows/classes/sun/awt/windows/WPanelPeer.java#L62) was returning the cached insets of Resizable frame and not that of the Non-Resizable frame**_
>
> And this is unclear to me. The frame is set to non-resizeable, `frame.pack()` is called. This, I assume, results in this code block being executed, so the calculated insets should be cached.
> 
> Why do the following calls to `getInsets` or `getPreferredSize` return the *resizeable* insets if the cached ones are *non-resizeable*?

> Is this applicable to windows?

I mean to `Window` objects.

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

PR: https://git.openjdk.org/jdk/pull/9954



More information about the client-libs-dev mailing list