Christopher, This is a bug. If you hide a stage while iconified the position and size properties are updated to incorrect values. I’ll enter a bug report. The fix looks straightforward.
We shouldn’t send move and size notifications when an HWND is iconified since its rectangle contains useless coordinates. We check for this at various points but missed one (namely when processing WM_SHOWWINDOW). Martin > On Sep 2, 2025, at 2:08 PM, Christopher Schnick <[email protected]> wrote: > > Hello, > > I encountered an issue on Windows where the xProperty() and yProperty() of > stages will be set to the special value -32000 when an iconified stage is > closed. Simply calling .setIconified(true) on a stage and closing the window > in the taskbar sends updates to any listeners with this value. > > I understand that in the win32 API, this value is used to indicate that the > window is iconified. But in my opinion the JavaFX state should not return > that and instead keep the last x/y coordinates of where it was when it was > iconified, so I assume that this is a bug. > > In practice, this breaks various situations in which the application will > store the last window coordinates for the next time it is opened. If the > application is closed while the stage was iconified, the stage won't show > again as it is off the screen. > > This happens in the latest ea build. > > Here is a reproducer: > > public static void main(String[] args) { > Platform.startup(() -> { > var stage = new Stage(); > stage.setWidth(500); > stage.setHeight(500); > stage.show(); > stage.setIconified(true); > stage.xProperty().subscribe(number -> System.out.println(number)); > stage.hide(); > stage.show(); > }); > } > Best > Christopher Schnick >
