summaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-04-09 19:31:23 +0200
committerSven Gothel <[email protected]>2019-04-09 19:31:23 +0200
commitca3bf988bfad6adac9ad9ac240f3c15b129ef85e (patch)
tree52e0b179dea6445cfc6bb207d6fc9da93321ab64 /src/test/com/jogamp/opengl
parenta2f09981ee7d590204bf865314c2cdf802c4ed77 (diff)
Bug 1362: Minimal action required: setBackground + fillRectangle of some space in canvas ONCE before reparenting!
Bug 1362 fix or workaround: Seems GTK3 at least performs lazy initialization Minimal action required: setBackground + fillRectangle of some space in canvas ONCE before reparenting!
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java14
1 files changed, 9 insertions, 5 deletions
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 ddca13914..dafd8f07a 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
@@ -160,14 +160,18 @@ public class TestSWTAccessor02NewtGLWindow extends UITestCase {
SWTAccessor.invoke(true, new Runnable() {
public void run() {
canvas[0] = new Canvas (composite, SWT.NO_BACKGROUND);
+ // Bug 1362 fix or workaround: Seems GTK3 at least performs lazy initialization
+ // Minimal action required: setBackground + fillRectangle of some space in canvas ONCE before reparenting!
+ final boolean paintedOnce[] = { false };
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);
+ if( !paintedOnce[0] ) {
+ paintedOnce[0] = true;
+ final Rectangle r = canvas[0].getClientArea();
+ e.gc.fillRectangle(0, 0, r.width, r.height);
+ canvas[0].removePaintListener(this);
+ }
}});
shell.setText( getClass().getName() );
shell.setBounds( 0, 0, 700, 700 );