summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-04-09 12:55:49 +0200
committerSven Gothel <[email protected]>2019-04-09 12:55:49 +0200
commita2f09981ee7d590204bf865314c2cdf802c4ed77 (patch)
treee0d8ea19d3db0eb9f700444a09a22fa91d749849
parent9b53619079d29483a487e54ed16ed845dd16bcb0 (diff)
Bug 1362: TestSWTAccessor02NewtGLWindow demonstrates a fix by letting the Canvas PAINT!
This commit shows the very little change set required to allow working on SWT >= 4.10 + GTK3, i.e. adding the PAINT listener to Canvas and letting it paint. Almost too ridiculous? I stumbled over it by creating this test in the first place when copying the 01 test -> 02 and adding the native parenting. Possible explanation: The parent Canvas may need to paint once at least due to some lazy initialization within SWT or GTK3?!
-rw-r--r--make/scripts/tests.sh2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java11
2 files changed, 12 insertions, 1 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 30b66bfe4..29333214a 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -118,7 +118,7 @@ function jrun() {
#D_ARGS="-Djogamp.debug.ProcAddressHelper -Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.Lookup -Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil -Djogl.glu.nojava=true"
#D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
- D_ARGS="-Dnativewindow.debug.SWT -Dnativewindow.debug.X11Util -Dnewt.debug.Window"
+ #D_ARGS="-Dnativewindow.debug.SWT -Dnativewindow.debug.X11Util -Dnewt.debug.Window"
#D_ARGS="-Dnativewindow.debug=all -Dnewt.debug.Window"
#D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all -Djogamp.debug.Lock"
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java
index 4aae75484..ddca13914 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.jogl.swt;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
@@ -158,6 +160,15 @@ public class TestSWTAccessor02NewtGLWindow extends UITestCase {
SWTAccessor.invoke(true, new Runnable() {
public void run() {
canvas[0] = new Canvas (composite, SWT.NO_BACKGROUND);
+ canvas[0].setBackground(new Color(display, 255, 255, 255));
+ canvas[0].setForeground(new Color(display, 255, 0, 0));
+ canvas[0].addPaintListener (new PaintListener() {
+ public void paintControl(final PaintEvent e) {
+ final Rectangle r = canvas[0].getClientArea();
+ e.gc.fillRectangle(0, 0, r.width, r.height);
+ e.gc.drawRectangle(50, 50, r.width-100, r.height-100);
+ e.gc.drawString("I am a Canvas", r.width/2, r.height/2);
+ }});
shell.setText( getClass().getName() );
shell.setBounds( 0, 0, 700, 700 );
shell.open();