diff --git a/CHANGELOG.md b/CHANGELOG.md index 30e8bc0d..ed79e0fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ FlatLaf Change Log ================== +## 3.7.1-SNAPSHOT + +- Popup: Fixed scrolling popup painting issue on Windows 10 when a glass pane is + visible and frame is maximized. (issue #1071) + + ## 3.7 #### New features and improvements diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java index bc265567..4a82a60f 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java @@ -108,10 +108,8 @@ public class FlatPopupFactory } } - boolean forceHeavyWeight = isOptionEnabled( owner, contents, FlatClientProperties.POPUP_FORCE_HEAVY_WEIGHT, "Popup.forceHeavyWeight" ); - if( !isOptionEnabled( owner, contents, FlatClientProperties.POPUP_DROP_SHADOW_PAINTED, "Popup.dropShadowPainted" ) || SystemInfo.isProjector || SystemInfo.isWebswing ) - return new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight ), owner, contents ); + return new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, isForceHeavyWeight( owner, contents, x, y ) ), owner, contents ); // macOS and Linux adds drop shadow to heavy weight popups if( SystemInfo.isMacOS || SystemInfo.isLinux ) { @@ -131,12 +129,8 @@ public class FlatPopupFactory return popup; } - // check whether popup overlaps a heavy weight component - if( !forceHeavyWeight && overlapsHeavyWeightComponent( owner, contents, x, y ) ) - forceHeavyWeight = true; - // create drop shadow popup - Popup popupForScreenOfOwner = getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight ); + Popup popupForScreenOfOwner = getPopupForScreenOfOwner( owner, contents, x, y, isForceHeavyWeight( owner, contents, x, y ) ); GraphicsConfiguration gc = (owner != null) ? owner.getGraphicsConfiguration() : null; return (gc != null && gc.isTranslucencyCapable()) ? new DropShadowPopup( popupForScreenOfOwner, owner, contents ) @@ -226,6 +220,11 @@ public class FlatPopupFactory } } + private static boolean isForceHeavyWeight( Component owner, Component contents, int x, int y ) { + boolean forceHeavyWeight = isOptionEnabled( owner, contents, FlatClientProperties.POPUP_FORCE_HEAVY_WEIGHT, "Popup.forceHeavyWeight" ); + return forceHeavyWeight || hasVisibleGlassPane( owner ) || overlapsHeavyWeightComponent( owner, contents, x, y ); + } + private static boolean isOptionEnabled( Component owner, Component contents, String clientKey, String uiKey ) { Object value = getOption( owner, contents, clientKey, uiKey ); return (value instanceof Boolean) ? (Boolean) value : false; @@ -469,6 +468,18 @@ public class FlatPopupFactory //---- fixes -------------------------------------------------------------- + private static boolean hasVisibleGlassPane( Component owner ) { + if( owner == null ) + return false; + + Window window = SwingUtilities.windowForComponent( owner ); + if( !(window instanceof RootPaneContainer) ) + return false; + + Component glassPane = ((RootPaneContainer)window).getGlassPane(); + return (glassPane != null && glassPane.isVisible()); + } + private static boolean overlapsHeavyWeightComponent( Component owner, Component contents, int x, int y ) { if( owner == null ) return false; diff --git a/gradle.properties b/gradle.properties index 8d9a9e23..972affd0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ # flatlaf.releaseVersion = 3.7 -flatlaf.developmentVersion = 3.8-SNAPSHOT +flatlaf.developmentVersion = 3.7.1-SNAPSHOT org.gradle.configuration-cache = true # org.gradle.warning.mode = all