Native window decorations: fixed broken maximizing window (under special conditions) when restoring frame state at startup (issue #283)

This commit is contained in:
Karl Tauber
2021-05-13 12:10:11 +02:00
parent 359eedf773
commit eea341fb33
7 changed files with 338 additions and 34 deletions

View File

@@ -312,16 +312,7 @@ class FlatWindowsNativeWindowBorder
return;
// remove the OS window title bar
if( window instanceof JFrame && ((JFrame)window).getExtendedState() != 0 ) {
// In case that the frame should be maximized or minimized immediately
// when showing, then it is necessary to defer ::SetWindowPos() invocation.
// Otherwise the frame will not be maximized or minimized.
// This occurs only if frame.pack() was no invoked.
EventQueue.invokeLater( () -> {
updateFrame( hwnd );
});
} else
updateFrame( hwnd );
updateFrame( hwnd, (window instanceof JFrame) ? ((JFrame)window).getExtendedState() : 0 );
}
void uninstall() {
@@ -333,7 +324,7 @@ class FlatWindowsNativeWindowBorder
private native long installImpl( Window window );
private native void uninstallImpl( long hwnd );
private native void updateFrame( long hwnd );
private native void updateFrame( long hwnd, int state );
private native void showWindow( long hwnd, int cmd );
// invoked from native code