RFR: 8366986: [Win] Incorrect position and size after hiding iconified stage [v2]

Kevin Rushforth kcr at openjdk.org
Sat Sep 20 15:17:39 UTC 2025


On Tue, 9 Sep 2025 20:26:15 GMT, Martin Fox <mfox at openjdk.org> wrote:

>> When a top-level HWND is iconified its window rect is updated to a hard-coded location (something like -32000, -32000) and a smaller width and height. For this reason we should not send notifyMove or notifyResize events for an iconified stage.  This PR adds a check while handling WM_SHOWWINDOW to catch the case where a stage is hidden while iconified. This matches similar existing checks like the one for WM_MOVE.
>
> Martin Fox has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Disabled system test on Linux, DECORATED stage is changing height

The fix looks good. The test fails on Windows with a non-integer HiDPI screen scale. I recommend either choosing values that remain integers when multiplied by 0.25 (that will cover 1, 1.25, 1.5, 1.75, 2, etc) or increase the tolerance used in `assertEquals`.

tests/system/src/test/java/test/javafx/stage/HideIconifiedTest.java line 77:

> 75:     private void assertStageProperties() {
> 76:         assertEquals(STAGE_WIDTH, stage.getWidth(), 0.1, "Stage width changed");
> 77:         assertEquals(STAGE_HEIGHT, stage.getHeight(), 0.1, "Stage height changed");

This fails on a HiDPI system with fractional scale. On my Windows 11 system with 125% scaling, I get this failure, even before the Stage is iconified:

org.opentest4j.AssertionFailedError: Stage height changed ==> expected: <350.0> but was: <350.3999938964844>

This fails because window system snaps the scaled positions and sizes of the window to an integer.

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

PR Review: https://git.openjdk.org/jfx/pull/1889#pullrequestreview-3249088757
PR Review Comment: https://git.openjdk.org/jfx/pull/1889#discussion_r2365675455


More information about the openjfx-dev mailing list