From 65f77630857ebcaa66e5c522a84b6c689d9ebbd6 Mon Sep 17 00:00:00 2001 From: weisj Date: Wed, 17 Jun 2020 00:44:38 +0200 Subject: [PATCH] Reduce issue of non-available subpixel AA on windows for plain tooltips. --- .../weisj/darklaf/ui/tooltip/DarkToolTipUI.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java index 5920e22c..b0625cc6 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java @@ -178,8 +178,19 @@ public class DarkToolTipUI extends BasicToolTipUI implements PropertyChangeListe startAnimation(); } else { Window window = DarkUIUtil.getWindow(c); - if (window != null && window.getOpacity() != 1 && !transparencySupported(window)) { - window.setOpacity(1); + if (window != null) { + if (window.getOpacity() != 1 && !transparencySupported(window)) { + window.setOpacity(1); + } + /* + * In non opaque windows on Windows subpixel AA doesn't work. The translucent background isn't needed + * for the plain tooltip style, so we set it here. + * + * See https://bugs.openjdk.java.net/browse/JDK-8215980?attachmentOrder=desc + */ + if (style == ToolTipStyle.PLAIN) { + window.setBackground(c.getBackground()); + } } } GraphicsContext context = GraphicsUtil.setupAntialiasing(g);