From 4904d3c8aedc391092d63952e5f1ed56c4237834 Mon Sep 17 00:00:00 2001 From: weisj <31143295+weisJ@users.noreply.github.com> Date: Fri, 17 Sep 2021 20:24:11 +0200 Subject: [PATCH] Popup [Linux]: Fix content not being rendered with double buffering disabled on Java 8. The fix for non-transparent tooltips on X11 surfaces involved disabling double buffering for the component hierarchy. Somehow this doesn't seem to work on Java 8. Luckily it is a version where we are free to apply the reflection hack to fix it. This fixes #274 --- .../com/github/weisj/darklaf/ui/DarkPopupFactory.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 cfbeee01a..a55b8cc8c 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 @@ -164,7 +164,7 @@ protected void setupWindowBackground(final Window window, final JRootPane rootPa if (!opaque) { boolean doubleBufferHint = PropertyUtil.getBooleanProperty(content, KEY_DOUBLE_BUFFERED); LOGGER.fine("Content wants to be double buffered = " + doubleBufferHint); - linuxOpacityFix(rootPane, doubleBufferHint); + setupDoubleBuffering(rootPane, doubleBufferHint); } while (p != null && p != window) { @@ -177,8 +177,10 @@ protected void setupWindowBackground(final Window window, final JRootPane rootPa window.setBackground(bg); } - private void linuxOpacityFix(final JRootPane rootPane, final boolean doubleBufferHint) { - boolean useDoubleBuffering = doubleBufferHint && canApplyRootPaneFix(); + private void setupDoubleBuffering(final JRootPane rootPane, final boolean doubleBufferHint) { + // On Linux (X11) Java 8 the regular fix doesn't work and the hacky workaround is needed. + boolean isLinuxJava8 = !SystemInfo.isJava9OrGreater && SystemInfo.isLinux; + boolean useDoubleBuffering = (isLinuxJava8 || doubleBufferHint) && canApplyRootPaneFix(); LOGGER.fine("Content can use double buffering = " + useDoubleBuffering); // See: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6848852