diff --git a/CHANGELOG.md b/CHANGELOG.md index 49a16b22..b01d1fa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ FlatLaf Change Log - Popup: Fixed flicker of popups (e.g. tooltips) while they are moving (e.g. following mouse pointer). (issues #832 and #672) +#### Fixed bugs + +- FlatLaf window decorations: Window top border on Windows 10 in "full window + content" mode was not fully repainted when activating or deactivating window. + (issue #809) + #### Incompatibilities - ProgressBar: Log warning (including stack trace) when uninstalling diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java index 7afcb8f7..181b7aeb 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java @@ -222,7 +222,7 @@ public class FlatTitlePane windowTopBorderLayer = new JPanel(); windowTopBorderLayer.setVisible( false ); windowTopBorderLayer.setOpaque( false ); - windowTopBorderLayer.setBorder( FlatUIUtils.nonUIResource( FlatNativeWindowBorder.WindowTopBorder.getInstance() ) ); + windowTopBorderLayer.setBorder( FlatUIUtils.nonUIResource( WindowTopBorder.getInstance() ) ); } else windowTopBorderLayer = null; @@ -745,16 +745,6 @@ public class FlatTitlePane g.fillRect( 0, 0, getWidth(), getHeight() ); } - protected void repaintWindowBorder() { - int width = rootPane.getWidth(); - int height = rootPane.getHeight(); - Insets insets = rootPane.getInsets(); - rootPane.repaint( 0, 0, width, insets.top ); // top - rootPane.repaint( 0, 0, insets.left, height ); // left - rootPane.repaint( 0, height - insets.bottom, width, insets.bottom ); // bottom - rootPane.repaint( width - insets.right, 0, insets.right, height ); // right - } - /** * Iconifies the window. */ @@ -1352,10 +1342,7 @@ public class FlatTitlePane activeChanged( true ); updateNativeTitleBarHeightAndHitTestSpots(); - if( isWindowTopBorderNeeded() ) - WindowTopBorder.getInstance().repaintBorder( FlatTitlePane.this ); - - repaintWindowBorder(); + repaintBorder(); } @Override @@ -1363,10 +1350,22 @@ public class FlatTitlePane activeChanged( false ); updateNativeTitleBarHeightAndHitTestSpots(); - if( isWindowTopBorderNeeded() ) + repaintBorder(); + } + + private void repaintBorder() { + // Windows 10 top border + if( windowTopBorderLayer != null && windowTopBorderLayer.isShowing()) + WindowTopBorder.getInstance().repaintBorder( windowTopBorderLayer ); + else if( isWindowTopBorderNeeded() && !isWindowMaximized() && !isFullWindowContent() ) WindowTopBorder.getInstance().repaintBorder( FlatTitlePane.this ); - repaintWindowBorder(); + // Window border used for non-native window decorations + if( rootPane.getBorder() instanceof FlatRootPaneUI.FlatWindowBorder ) { + // not repainting four areas on the four sides because RepaintManager + // unions dirty regions, which also results in repaint of whole rootpane + rootPane.repaint(); + } } @Override