aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-09-29 03:22:28 +0200
committerSven Gothel <[email protected]>2023-09-29 03:22:28 +0200
commit2e46eb1bf06ef07801062122716aa99a6c871646 (patch)
tree0ef44b49991e270b5e956240056d6ce6a392871f /src/newt/classes/com/jogamp
parenta0e6d5883de009d4649d011633090d7660fa229a (diff)
Bug 1430 - Fix Background erase not disabled with AWT GLCanvas and NewtCanvasAWT
Commit c5431f46b7bf64f109315ec78461859dd88f202a reduced the disableBackgroundErase(..) to SunToolkit's variation which doesn't work on Windows as it does not act upon the java.awt.Canvas peer post addNotify(). This re-introduces the java.awt.Canvas method via class JAWTUtil.BackgroundEraseControl and its called only after addNotify() on Windows and ASAP for everyone else. Method also calles the SunTookit variation just to be sure.
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 783bc6857..fc885e591 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -69,6 +69,8 @@ import jogamp.newt.driver.DriverClearFocus;
import jogamp.opengl.awt.AWTTilePainter;
import com.jogamp.common.ExceptionUtils;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.os.Platform.OSType;
import com.jogamp.common.util.awt.AWTEDTExecutor;
import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration;
import com.jogamp.nativewindow.awt.AWTPrintLifecycle;
@@ -100,6 +102,8 @@ import com.jogamp.opengl.util.TileRenderer;
public class NewtCanvasAWT extends java.awt.Canvas implements NativeWindowHolder, WindowClosingProtocol, OffscreenLayerOption, AWTPrintLifecycle {
public static final boolean DEBUG = Debug.debug("Window");
+ private static JAWTUtil.BackgroundEraseControl backgroundEraseControl = new JAWTUtil.BackgroundEraseControl();
+
private final Object sync = new Object();
private volatile JAWTWindow jawtWindow = null; // the JAWTWindow presentation of this AWT Canvas, bound to the 'drawable' lifecycle
private boolean isApplet = false;
@@ -589,7 +593,9 @@ public class NewtCanvasAWT extends java.awt.Canvas implements NativeWindowHolder
* This code order also allows recreation, ie re-adding the GLCanvas.
*/
// before native peer is valid: X11
- JAWTUtil.disableBackgroundErase(this);
+ if( OSType.WINDOWS != Platform.getOSType() ) {
+ backgroundEraseControl.disable(this);
+ }
// Query AWT GraphicsDevice from parent tree, default
final GraphicsConfiguration gc = super.getGraphicsConfiguration();
@@ -607,7 +613,9 @@ public class NewtCanvasAWT extends java.awt.Canvas implements NativeWindowHolder
super.addNotify();
// after native peer is valid: Windows
- JAWTUtil.disableBackgroundErase(this);
+ if( OSType.WINDOWS == Platform.getOSType() ) {
+ backgroundEraseControl.disable(this);
+ }
synchronized(sync) {
determineIfApplet();