On Fri, 19 Aug 2022 23:47:49 GMT, Harshitha Onkar <hon...@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 all platforms > when frame.pack() is called. src/java.desktop/windows/native/libawt/windows/awt_Window.cpp line 1413: > 1411: { > 1412: /* This window hasn't been sized yet -- use system metrics. */ > 1413: jobject target = GetTarget(env); Moving the declaration and deletion of `target` out of `if` block was on purpose? Any particular reason related to the issue? ------------- PR: https://git.openjdk.org/jdk/pull/9954