Skip to content

Commit

Permalink
Popup [Linux]: Fix content not being rendered with double buffering d…
Browse files Browse the repository at this point in the history
…isabled 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
  • Loading branch information
weisJ committed Sep 17, 2021
1 parent 11fe4b5 commit 4904d3c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down

0 comments on commit 4904d3c

Please sign in to comment.