mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
Native window decorations: fixed missing top window border in dark themes if window drop shadows are disabled in system settings (issue #554)
This commit is contained in:
@@ -15,6 +15,9 @@ FlatLaf Change Log
|
|||||||
Windows because they have bad vertically placement.
|
Windows because they have bad vertically placement.
|
||||||
- Native window decorations (Windows 10/11 only): Do not use window decorations
|
- Native window decorations (Windows 10/11 only): Do not use window decorations
|
||||||
if system property `sun.java2d.opengl` is `true` on Windows 10. (issue #540)
|
if system property `sun.java2d.opengl` is `true` on Windows 10. (issue #540)
|
||||||
|
- Native window decorations (Windows 10 only): Fixed missing top window border
|
||||||
|
in dark themes if window drop shadows are disabled in system settings. (issue
|
||||||
|
#554)
|
||||||
|
|
||||||
|
|
||||||
## 2.3
|
## 2.3
|
||||||
|
|||||||
@@ -195,11 +195,13 @@ public class JBRCustomDecorations
|
|||||||
{
|
{
|
||||||
private static JBRWindowTopBorder instance;
|
private static JBRWindowTopBorder instance;
|
||||||
|
|
||||||
private final Color defaultActiveBorder = new Color( 0x707070 );
|
private final Color activeLightColor = new Color( 0x707070 );
|
||||||
|
private final Color activeDarkColor = new Color( 0x2D2E2F );
|
||||||
private final Color inactiveLightColor = new Color( 0xaaaaaa );
|
private final Color inactiveLightColor = new Color( 0xaaaaaa );
|
||||||
|
private final Color inactiveDarkColor = new Color( 0x494A4B );
|
||||||
|
|
||||||
private boolean colorizationAffectsBorders;
|
private boolean colorizationAffectsBorders;
|
||||||
private Color activeColor = defaultActiveBorder;
|
private Color activeColor;
|
||||||
|
|
||||||
static JBRWindowTopBorder getInstance() {
|
static JBRWindowTopBorder getInstance() {
|
||||||
if( instance == null )
|
if( instance == null )
|
||||||
@@ -250,7 +252,7 @@ public class JBRCustomDecorations
|
|||||||
|
|
||||||
private Color calculateActiveBorderColor() {
|
private Color calculateActiveBorderColor() {
|
||||||
if( !colorizationAffectsBorders )
|
if( !colorizationAffectsBorders )
|
||||||
return defaultActiveBorder;
|
return null;
|
||||||
|
|
||||||
Color colorizationColor = getColorizationColor();
|
Color colorizationColor = getColorizationColor();
|
||||||
if( colorizationColor != null ) {
|
if( colorizationColor != null ) {
|
||||||
@@ -285,15 +287,11 @@ public class JBRCustomDecorations
|
|||||||
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
||||||
Window window = SwingUtilities.windowForComponent( c );
|
Window window = SwingUtilities.windowForComponent( c );
|
||||||
boolean active = window != null && window.isActive();
|
boolean active = window != null && window.isActive();
|
||||||
|
boolean dark = FlatLaf.isLafDark();
|
||||||
|
|
||||||
// paint top border
|
g.setColor( active
|
||||||
// - in light themes
|
? (activeColor != null ? activeColor : (dark ? activeDarkColor : activeLightColor))
|
||||||
// - in dark themes only for active windows if colorization affects borders
|
: (dark ? inactiveDarkColor : inactiveLightColor) );
|
||||||
boolean paintTopBorder = !FlatLaf.isLafDark() || (active && colorizationAffectsBorders);
|
|
||||||
if( !paintTopBorder )
|
|
||||||
return;
|
|
||||||
|
|
||||||
g.setColor( active ? activeColor : inactiveLightColor );
|
|
||||||
HiDPIUtils.paintAtScale1x( (Graphics2D) g, x, y, width, height, this::paintImpl );
|
HiDPIUtils.paintAtScale1x( (Graphics2D) g, x, y, width, height, this::paintImpl );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user