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

Alexey Ivanov aivanov at openjdk.org
Thu Sep 22 19:54:30 UTC 2022


On Thu, 22 Sep 2022 19:24:25 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> On Windows, the insets obtained for a Non-Resizable AWT Frame was different when frame.pack() was called and subsequent call to frame.getInsets() or frame.getPreferredSize(). Due to this, the actual and preferred size differed when frame.pack() was called for Non-Resizable frame (on Windows).  
>> 
>> Earlier the insets returned when frame.getInsets() was called, was that of a Resizable frame and not the correct insets associated with Non-Resizable frame. Fix is added to native code to get the correct insets. The test - AwtFramePackTest.java has been updated to test actual and expected/preferred size for both Resizable and Non-Resizable Frames.
>> 
>> The test is generic though the issue and fix is on Windows platform because the condition 
>> `frame.getSize() == frame.getPreferredSize()` should be true on all platforms when frame.pack() is called.
>> 
>> Following is the link to Windows System Metrics (used for native insets) - https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsystemmetrics
>
> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   added comments, changed system metric

Marked as reviewed by aivanov (Reviewer).

src/java.desktop/windows/native/libawt/windows/awt_Window.cpp line 1419:

> 1417:             // System metrics are same for resizable & non-resizable frame.
> 1418:             // SM_CXFRAME is the width of the horizontal border in pixels.
> 1419:             // SM_CYFRAME is the height of the vertical border in pixels.

I guess the meaning of `CX/CYFRAME` is quite obvious.

The first sentence about the metrics being the same is helpful.

src/java.desktop/windows/native/libawt/windows/awt_Window.cpp line 1482:

> 1480:         env->CallVoidMethod(peer, AwtComponent::replaceSurfaceDataLaterMID);
> 1481:     }
> 1482: 

Probably, this line could remain.

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

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



More information about the client-libs-dev mailing list