Native window decorations: removed superfluous pixel-line at top of screen when window is maximized (issue #296)

This commit is contained in:
Karl Tauber
2021-03-31 20:56:17 +02:00
parent d13ddeb944
commit 6909bb4b03
2 changed files with 10 additions and 2 deletions

View File

@@ -6,6 +6,8 @@ FlatLaf Change Log
#### Fixed bugs
- Fixed crash when running in Webswing. (issue #290)
- Native window decorations: Removed superfluous pixel-line at top of screen
when window is maximized. (issue #296)
## 1.1.1

View File

@@ -803,7 +803,7 @@ debug*/
} else if( borderColor != null && (rootPane.getJMenuBar() == null || !rootPane.getJMenuBar().isVisible()) )
insets.bottom += UIScale.scale( 1 );
if( hasNativeCustomDecoration() )
if( hasNativeCustomDecoration() && !isWindowMaximized( c ) )
insets = FlatUIUtils.addInsets( insets, WindowTopBorder.getInstance().getBorderInsets() );
return insets;
@@ -822,7 +822,7 @@ debug*/
FlatUIUtils.paintFilledRectangle( g, borderColor, x, y + height - lineHeight, width, lineHeight );
}
if( hasNativeCustomDecoration() )
if( hasNativeCustomDecoration() && !isWindowMaximized( c ) )
WindowTopBorder.getInstance().paintBorder( c, g, x, y, width, height );
}
@@ -830,6 +830,12 @@ debug*/
JMenuBar menuBar = rootPane.getJMenuBar();
return hasVisibleEmbeddedMenuBar( menuBar ) ? menuBar.getBorder() : null;
}
protected boolean isWindowMaximized( Component c ) {
return window instanceof Frame
? (((Frame)window).getExtendedState() & Frame.MAXIMIZED_BOTH) != 0
: false;
}
}
//---- class FlatTitleLabelUI ---------------------------------------------