From 705c7f7b3fb36c1d654f5d9b9016859506d93764 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 9 Apr 2019 21:33:17 +0200 Subject: Bug 1362: Minimal action required: setBackground of the parent canvas before reparenting! Bug 1362 fix or workaround: Seems SWT/GTK3 at least performs lazy initialization Minimal action required: setBackground of the parent canvas before reparenting! --- src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/newt') diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index d1bd638d8..d30dbe6dc 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -41,7 +41,6 @@ import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.nativewindow.NativeWindowHolder; import com.jogamp.nativewindow.SurfaceUpdatedListener; import com.jogamp.nativewindow.WindowClosingProtocol; -import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode; import com.jogamp.nativewindow.util.Insets; import com.jogamp.nativewindow.util.InsetsImmutable; import com.jogamp.nativewindow.util.Point; @@ -54,6 +53,7 @@ import jogamp.newt.Debug; import jogamp.newt.swt.SWTEDTUtil; import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; @@ -139,6 +139,10 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC setNEWTChild(child); } + // Bug 1362 fix or workaround: Seems SWT/GTK3 at least performs lazy initialization + // Minimal action required: setBackground of the parent canvas before reparenting! + setBackground(new Color(parent.getDisplay(), 255, 255, 255)); + final Listener listener = new Listener () { @Override public void handleEvent (final Event event) { -- cgit v1.2.3