Window decorations: do not restore maximized bounds in method maximize() because when restoring an iconified frame by clicking on the Windows 10 taskbar the maximize() method is not invoked and the frame size becomes full screen size and overlaps taskbar

This commit is contained in:
Karl Tauber
2020-06-07 11:27:29 +02:00
parent 5e5b9f0990
commit d081b9e182

View File

@@ -366,12 +366,10 @@ class FlatTitlePane
Frame frame = (Frame) window;
// set maximized bounds to avoid that maximized window overlaps Windows task bar
if( !hasJBRCustomDecoration() ) {
GraphicsConfiguration gc = window.getGraphicsConfiguration();
// remember current maximized bounds
Rectangle oldMaximizedBounds = frame.getMaximizedBounds();
// Screen bounds, which may be smaller than physical size on Java 9+.
// E.g. if running a 3840x2160 screen at 200%, screenBounds.size is 1920x1080.
// In Java 9+, each screen can have its own scale factor.
@@ -415,20 +413,12 @@ class FlatTitlePane
maximizedWidth - screenInsets.left - screenInsets.right,
maximizedHeight - screenInsets.top - screenInsets.bottom );
// temporary change maximized bounds
// change maximized bounds
frame.setMaximizedBounds( maximizedBounds );
// maximize window
frame.setExtendedState( frame.getExtendedState() | Frame.MAXIMIZED_BOTH );
// restore old maximized bounds
frame.setMaximizedBounds( oldMaximizedBounds );
} else {
// not necessary to set maximized bounds when running in JBR
// maximize window
frame.setExtendedState( frame.getExtendedState() | Frame.MAXIMIZED_BOTH );
}
// maximize window
frame.setExtendedState( frame.getExtendedState() | Frame.MAXIMIZED_BOTH );
}
private void restore() {