aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-09-28 09:56:46 +0200
committerSven Gothel <[email protected]>2012-09-28 09:56:46 +0200
commit54f79e402ddb87de9caa3297228cbd16c452cfb4 (patch)
tree9a85be0b1adc948c37b4f1be59de63674d8b15c8
parent4c24011e3cb0aa12a9d5200075e87eda84a18bcf (diff)
NEWT X11 ScreenMode: Ignore invalid rotation event
-rwxr-xr-xmake/scripts/tests.sh36
-rw-r--r--src/newt/native/X11Screen.c25
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java48
3 files changed, 53 insertions, 56 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 4fc1211db..7faca0b42 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -92,6 +92,7 @@ function jrun() {
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Dnativewindow.debug.X11Util"
#D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Dnewt.test.Screen.disableScreenMode -Dnewt.debug.Screen"
+ D_ARGS="-Dnewt.debug.Screen -Djogl.debug.Animator"
#D_ARGS="-Djogl.debug.ExtensionAvailabilityCache -Djogl.debug=all -Dnativewindow.debug=all -Djogamp.debug.ProcAddressHelper=true -Djogamp.debug.NativeLibrary=true -Djogamp.debug.NativeLibrary.Lookup=true"
#D_ARGS="-Dnewt.debug.MainThread"
#D_ARGS="-Dnewt.debug.Window"
@@ -115,7 +116,6 @@ function jrun() {
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock -Dnativewindow.debug.ToolkitLock.TraceLock"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Dnativewindow.debug.X11Util"
#D_ARGS="-Dnewt.debug.EDT -Djogamp.common.utils.locks.Lock.timeout=600000 -Djogl.debug.Animator -Dnewt.debug.Display -Dnewt.debug.Screen"
- #D_ARGS="-Dnewt.debug.Screen"
#D_ARGS="-Dnewt.debug.Window -Djogamp.common.utils.locks.Lock.timeout=600000 -Djogl.debug.Animator"
#D_ARGS="-Djogl.debug.Animator -Dnewt.debug=all"
#D_ARGS="-Dnewt.debug.EDT -Dnewt.debug.Display -Dnativewindow.debug.X11Util -Djogl.debug.GLDrawable -Djogl.debug.GLCanvas"
@@ -256,38 +256,6 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitchNEWT $*
-# x11 no XinitThreads() specific tests (regressions, concurrent behavior) !
-# Deadlock:
-# com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 - test01
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 $*
-# com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT - testEachWithAnimatorSharedOffscreen
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT $*
-#
-# XCB:
-#
-# com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT - testShaderState01PerformanceDouble
-#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT $*
-# com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT - testWindowParenting02ReparentTop2WinReparentRecreate
-#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $*
-# com.jogamp.opengl.test.junit.newt.parenting.TestParenting04SWT - winHopFrame2FrameDirectHop
-#testawtswt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04SWT $*
-#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
-
-#testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT
-#testnoawt com.jogamp.opengl.test.junit.newt.TestWindows01NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrent01NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrent02NEWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
-#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
-#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteGLWindows01NEWT $*
-#testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTEclipseGLCanvas01GLn $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
-
-
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT $*
@@ -334,7 +302,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode00bNEWT
#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01NEWT
#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode01bNEWT
-#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode02NEWT
+testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode02NEWT
#testnoawt com.jogamp.opengl.test.junit.newt.ManualScreenMode03NEWT
#testnoawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol02NEWT $*
#testnoawt -Djava.awt.headless=true com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT
diff --git a/src/newt/native/X11Screen.c b/src/newt/native/X11Screen.c
index 334c39727..e8a3ca656 100644
--- a/src/newt/native/X11Screen.c
+++ b/src/newt/native/X11Screen.c
@@ -469,15 +469,22 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_setCurrentSc
switch (evt.type - randr_event_base) {
case RRScreenChangeNotify:
- rot = NewtScreen_XRotation2Degree(env, (int)scn_event->rotation);
- DBG_PRINT( "XRANDR: event . RRScreenChangeNotify call %p (root %p) resIdx %d rot %d %dx%d\n",
- (void*)scn_event->window, (void*)scn_event->root,
- (int)scn_event->size_index, rot,
- scn_event->width, scn_event->height);
- // done = scn_event->size_index == resMode_idx; // not reliable ..
- done = rot == rotation &&
- scn_event->width == xrrs[resMode_idx].width &&
- scn_event->height == xrrs[resMode_idx].height;
+ if(0 < scn_event->rotation ) {
+ rot = NewtScreen_XRotation2Degree(env, (int)scn_event->rotation);
+ DBG_PRINT( "XRANDR: event . RRScreenChangeNotify call(1) %p (root %p) resIdx %d rot %d %dx%d\n",
+ (void*)scn_event->window, (void*)scn_event->root,
+ (int)scn_event->size_index, rot,
+ scn_event->width, scn_event->height);
+ // done = scn_event->size_index == resMode_idx; // not reliable ..
+ done = rot == rotation &&
+ scn_event->width == xrrs[resMode_idx].width &&
+ scn_event->height == xrrs[resMode_idx].height;
+ } else {
+ DBG_PRINT( "XRANDR: event . RRScreenChangeNotify call(0) %p (root %p) resIdx %d %dx%d\n",
+ (void*)scn_event->window, (void*)scn_event->root,
+ (int)scn_event->size_index,
+ scn_event->width, scn_event->height);
+ }
break;
default:
DBG_PRINT("RANDR: event . unhandled %d 0x%X call %p\n", (int)evt.type, (int)evt.type, (void*)evt.xany.window);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
index b9f3e67dc..f253f3b58 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
@@ -34,7 +34,6 @@ import javax.media.opengl.GLProfile;
import com.jogamp.opengl.util.Animator;
-import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -48,6 +47,7 @@ import com.jogamp.newt.ScreenMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.ScreenModeUtil;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import java.util.List;
@@ -109,10 +109,12 @@ public class TestScreenMode01NEWT extends UITestCase {
* Remedy B) is shown in {@link TestScreenMode01bNEWT}
* </pre>
*/
- @After
- public void cleanupGL() throws InterruptedException {
+ private void cleanupGL() throws InterruptedException {
+ System.err.println("*** cleanupGL.shutdown");
GLProfile.shutdown();
+ System.err.println("*** cleanupGL.initSingleton");
GLProfile.initSingleton();
+ System.err.println("*** cleanupGL.DONE");
}
static GLWindow createWindow(Screen screen, GLCapabilities caps, int width, int height, boolean onscreen, boolean undecorated) {
@@ -166,7 +168,15 @@ public class TestScreenMode01NEWT extends UITestCase {
Thread.sleep(waitTimeShort);
animator.stop();
- destroyWindow(window);
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isStarted());
+
+ destroyWindow(window);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
+ Assert.assertEquals(false, window.isRealized());
+ Assert.assertEquals(false, window.isNativeValid());
+
+ cleanupGL();
}
@Test
@@ -230,11 +240,15 @@ public class TestScreenMode01NEWT extends UITestCase {
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
- animator.stop();
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isStarted());
+
destroyWindow(window);
- Thread.sleep(waitTimeShort);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
Assert.assertEquals(false,window.isVisible());
+ Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
@@ -246,14 +260,15 @@ public class TestScreenMode01NEWT extends UITestCase {
smCurrent = screen.getCurrentScreenMode();
System.err.println("[1] current/orig: "+smCurrent);
+ screen.destroy();
+ Assert.assertEquals(false,screen.isNativeValid());
+ Assert.assertEquals(false,display.isNativeValid());
Assert.assertNotNull(smCurrent);
Assert.assertEquals(smCurrent, smOrig);
- screen.destroy();
-
- Assert.assertEquals(false,screen.isNativeValid());
- Assert.assertEquals(false,display.isNativeValid());
+
+ cleanupGL();
}
@Test
@@ -326,10 +341,14 @@ public class TestScreenMode01NEWT extends UITestCase {
Assert.assertEquals(true,window.isVisible());
animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isStarted());
+
destroyWindow(window);
- Thread.sleep(waitTimeShort);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
Assert.assertEquals(false,window.isVisible());
+ Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
@@ -341,11 +360,14 @@ public class TestScreenMode01NEWT extends UITestCase {
smCurrent = screen.getCurrentScreenMode();
System.err.println("[1] current/orig: "+smCurrent);
+ screen.destroy();
+ Assert.assertEquals(false,screen.isNativeValid());
+ Assert.assertEquals(false,display.isNativeValid());
Assert.assertNotNull(smCurrent);
Assert.assertEquals(smCurrent, smOrig);
-
- screen.destroy();
+
+ cleanupGL();
}
public static void main(String args[]) throws IOException {