Drop shadows on Windows: use light weight popups by default (issue #94)

this fixes the sub-pixel text rendering issue (on Windows) for popups that fit into the owner window
This commit is contained in:
Karl Tauber
2020-05-13 18:41:26 +02:00
parent a9cfe69ba7
commit b8f953cd26

View File

@@ -53,17 +53,14 @@ public class FlatPopupFactory
if( !UIManager.getBoolean( "Popup.dropShadowPainted" ) )
return super.getPopup( owner, contents, x, y );
// always use heavy weight popup because the drop shadow increases
// the popup size and may overlap the window bounds
Popup popup = getHeavyWeightPopup( owner, contents, x, y );
// failed to get heavy weight popup --> do not add drop shadow
if( popup == null )
return super.getPopup( owner, contents, x, y );
// macOS and Linux adds drop shadow to heavy weight popups
if( SystemInfo.IS_MAC || SystemInfo.IS_LINUX )
return popup;
if( SystemInfo.IS_MAC || SystemInfo.IS_LINUX ) {
Popup popup = getHeavyWeightPopup( owner, contents, x, y );
return (popup != null) ? popup : super.getPopup( owner, contents, x, y );
}
// create popup
Popup popup = super.getPopup( owner, contents, x, y );
// create drop shadow popup
return new DropShadowPopup( popup, contents );
@@ -119,6 +116,7 @@ public class FlatPopupFactory
DropShadowPopup( Popup delegate, Component contents ) {
this.delegate = delegate;
// drop shadows on medium weight popups are not supported
if( delegate.getClass().getName().endsWith( "MediumWeightPopup" ) )
return;