Browse Source

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
pull/284/head
weisj 3 years ago committed by Jannis Weis
parent
commit
4904d3c8ae
  1. 8
      core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java

8
core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java

@ -164,7 +164,7 @@ public class DarkPopupFactory extends PopupFactory {
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 @@ public class DarkPopupFactory extends PopupFactory {
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

Loading…
Cancel
Save