Window decorations: avoid possible endless restore/maximize in WindowStateListener in case of behavior changes in Java (issue #129)

This commit is contained in:
Karl Tauber
2020-07-23 10:43:24 +02:00
parent 38d853b5b2
commit 5a2c0672d4

View File

@@ -250,7 +250,11 @@ public class FlatTitlePane
maximizeButton.setVisible( resizable && !maximized );
restoreButton.setVisible( resizable && maximized );
if( maximized ) {
if( maximized &&
rootPane.getClientProperty( "_flatlaf.maximizedBoundsUpToDate" ) == null )
{
rootPane.putClientProperty( "_flatlaf.maximizedBoundsUpToDate", null );
// In case that frame was maximized from custom code (e.g. when restoring
// window state on application startup), then maximized bounds is not set
// and the window would overlap Windows task bar.
@@ -439,6 +443,9 @@ public class FlatTitlePane
updateMaximizedBounds();
// let our WindowStateListener know that the maximized bounds are up-to-date
rootPane.putClientProperty( "_flatlaf.maximizedBoundsUpToDate", true );
// maximize window
frame.setExtendedState( frame.getExtendedState() | Frame.MAXIMIZED_BOTH );
}