diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java b/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java index 0e733643..cb9237b2 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java @@ -30,6 +30,8 @@ import javax.swing.*; import com.github.weisj.darklaf.platform.DecorationsHandler; import com.github.weisj.darklaf.ui.rootpane.DarkRootPaneUI; +import com.github.weisj.darklaf.uiresource.DarkColorUIResource; +import com.github.weisj.darklaf.util.ColorUtil; import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.Pair; import com.github.weisj.darklaf.util.PropertyUtil; @@ -95,13 +97,13 @@ public class DarkPopupFactory extends PopupFactory { final boolean isFocusable, final boolean startHidden) { boolean noDecorations = PropertyUtil.getBooleanProperty(contents, KEY_NO_DECORATION); boolean opaque = PropertyUtil.getBooleanProperty(contents, KEY_OPAQUE); - setupWindowBackground(window, opaque); + setupWindowBackground(window, opaque, !noDecorations); setupWindowFocusableState(isFocusable, window); setupWindowDecorations(window, noDecorations); setupWindowOpacity(contents, startHidden, window); } - protected void setupWindowBackground(final Window window, final boolean opaque) { + protected void setupWindowBackground(final Window window, final boolean opaque, final boolean decorations) { // Sometimes the background is java.awt.SystemColor[i=7] // It results in a flash of white background, that is repainted with // the proper popup background later. @@ -112,7 +114,8 @@ public class DarkPopupFactory extends PopupFactory { if (opaque) { window.setBackground(rootPane.getBackground()); } else { - window.setBackground(getTranslucentPopupBackground()); + Color bg = getTranslucentPopupBackground(decorations); + window.setBackground(bg); } } } @@ -154,8 +157,10 @@ public class DarkPopupFactory extends PopupFactory { return heavyWeightParent; } - protected Color getTranslucentPopupBackground() { - return UIManager.getColor("PopupMenu.translucentBackground"); + protected Color getTranslucentPopupBackground(final boolean decorated) { + Color c = UIManager.getColor("PopupMenu.translucentBackground"); + if (!decorated) c = new DarkColorUIResource(ColorUtil.toAlpha(c, 0)); + return c; } private static class HeavyWeightParent extends JComponent { 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 caba3030..2cd57869 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 @@ -122,6 +122,7 @@ public class DarkTooltipUI extends BasicToolTipUI implements PropertyChangeListe toolTip.putClientProperty(DarkPopupFactory.KEY_NO_DECORATION, true); toolTip.putClientProperty(DarkPopupFactory.KEY_START_HIDDEN, true); toolTip.putClientProperty(DarkPopupFactory.KEY_FORCE_HEAVYWEIGHT, true); + // toolTip.putClientProperty(DarkPopupFactory.KEY_OPAQUE, false); fadeAnimator = new FadeInAnimator(); c.setOpaque(false); DarkTooltipBorder border = new DarkTooltipBorder(); diff --git a/windows/src/main/cpp/Decorations.cpp b/windows/src/main/cpp/Decorations.cpp index 77b4f615..326be880 100644 --- a/windows/src/main/cpp/Decorations.cpp +++ b/windows/src/main/cpp/Decorations.cpp @@ -320,7 +320,7 @@ LRESULT CALLBACK WindowWrapper::WindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_ case WM_PAINT: if (!wrapper->bgBrush) break; - if (!wrapper->moving) + if (!wrapper->moving || wrapper->popup_menu) PaintBackground(hwnd, wParam, wrapper); if (uMsg == WM_ERASEBKGND) return TRUE;