summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-10-09 01:54:32 +0200
committerSven Gothel <[email protected]>2015-10-09 01:54:32 +0200
commite418a665756af52fe2ca691ca220644e9b27c22c (patch)
tree5aad1e3803b5cbf177b591912985d992afec6894 /src
parentdca5d36370ec5eb44998bae593880e3b10cc9a4e (diff)
Bug 1249 - NEWT X11: setVisible(*) _NET_WM_STATE_HIDDEN update not received at ConfigureNotify event (2)
On gnome shell WM, sometimes KDE WM, it has been observed that the _NET_WM_STATE_HIDDEN update (visible or invisible) is not received at ConfigureNotify event. Turns out the state is finally updated at FocusOut! This change tests _NET_WM_STATE_HIDDEN visibility hint for mapped window also for FocusIn and FocusOut events, besides the ConfigureNotify event. Further more, NormalState to restore a hidden but mapped window did not work, so it is no more being sent. We limit us here to _NET_ACTIVE_WINDOW. 2 unit tests are prepared to test this issue: - TestGLWindows00NEWT - TestParenting01NEWT
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java48
-rw-r--r--src/newt/native/X11Common.h3
-rw-r--r--src/newt/native/X11Display.c66
-rw-r--r--src/newt/native/X11Window.c37
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java66
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java76
6 files changed, 194 insertions, 102 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 922b75a2e..8fe3dceca 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -96,11 +96,12 @@ import com.jogamp.newt.event.WindowUpdateEvent;
public abstract class WindowImpl implements Window, NEWTEventConsumer
{
public static final boolean DEBUG_TEST_REPARENT_INCOMPATIBLE;
+ private static final boolean DEBUG_FREEZE_AT_VISIBILITY_FAILURE;
static {
Debug.initSingleton();
DEBUG_TEST_REPARENT_INCOMPATIBLE = PropertyAccess.isPropertyDefined("newt.test.Window.reparent.incompatible", true);
-
+ DEBUG_FREEZE_AT_VISIBILITY_FAILURE = PropertyAccess.isPropertyDefined("newt.debug.Window.visibility.failure.freeze", true);
ScreenImpl.initSingleton();
}
@@ -4420,14 +4421,30 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if( visible != _visible ) {
final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+_visible;
- if(failFast) {
+ if(DEBUG_FREEZE_AT_VISIBILITY_FAILURE) {
+ System.err.println("XXXX: "+msg);
+ System.err.println("XXXX: FREEZE");
+ try {
+ while(true) {
+ Thread.sleep(1000);
+ }
+ } catch (final InterruptedException e) {
+ ExceptionUtils.dumpThrowable("", e);
+ Thread.currentThread().interrupt(); // keep state
+ }
throw new NativeWindowException(msg);
- } else if (DEBUG_IMPLEMENTATION) {
- System.err.println(msg);
- ExceptionUtils.dumpStack(System.err);
+ } else {
+ if(failFast) {
+ throw new NativeWindowException(msg);
+ } else {
+ if (DEBUG_IMPLEMENTATION) {
+ System.err.println(msg);
+ ExceptionUtils.dumpStack(System.err);
+ }
+ return -1;
+ }
}
- return -1;
- } else if( 0 < remaining ){
+ } else if( 0 < remaining ) {
return remaining;
} else {
return 0;
@@ -4704,6 +4721,23 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* Triggered by implementation's WM events to update the client-area position, size, insets and maximized flags.
*
* @param defer
+ * @param focusChange -1 ignored, 0 unfocused, > 0 focused
+ * @param visibleChange -1 ignored, 0 invisible, > 0 visible
+ */
+ protected final void focusVisibleChanged(final boolean defer,
+ final int focusChange,
+ final int visibleChange) {
+ if( 0 <= focusChange ) { // ignore focus < 0
+ focusChanged(defer, 0 < focusChange);
+ }
+ if( 0 <= visibleChange ) { // ignore visible < 0
+ visibleChanged(defer, 0 < visibleChange);
+ }
+ }
+ /**
+ * Triggered by implementation's WM events to update the client-area position, size, insets and maximized flags.
+ *
+ * @param defer
* @param left insets, -1 ignored
* @param right insets, -1 ignored
* @param top insets, -1 ignored
diff --git a/src/newt/native/X11Common.h b/src/newt/native/X11Common.h
index e46996441..f9254ab76 100644
--- a/src/newt/native/X11Common.h
+++ b/src/newt/native/X11Common.h
@@ -83,6 +83,7 @@ typedef struct {
uint32_t lastDesktop;
Bool maxHorz;
Bool maxVert;
+ /** flag whether window is mapped */
Bool isMapped;
} JavaWindow;
@@ -142,6 +143,8 @@ Bool NewtWindows_updateMaximized(Display *dpy, JavaWindow * w, uint32_t netWMSta
#define _WM_CHANGE_STATE_IDX 23
#define _MOTIF_WM_HINTS_IDX 24
+void NewtWindows_setUrgency(Display *dpy, Window window, Bool enable);
+void NewtWindows_sendNET_WM_STATE(Display *dpy, Window root, JavaWindow *w, int prop1Idx, int prop2Idx, Bool enable);
uint32_t NewtWindows_getNET_WM_STATE(Display *dpy, JavaWindow *w);
#endif /* _X11COMMON_H_ */
diff --git a/src/newt/native/X11Display.c b/src/newt/native/X11Display.c
index b3373827a..a98f707ca 100644
--- a/src/newt/native/X11Display.c
+++ b/src/newt/native/X11Display.c
@@ -46,7 +46,7 @@ static jmethodID getCurrentThreadNameID = NULL;
static jmethodID dumpStackID = NULL;
static jmethodID sizeChangedID = NULL;
static jmethodID positionChangedID = NULL;
-static jmethodID focusChangedID = NULL;
+static jmethodID focusVisibleChangedID = NULL;
static jmethodID reparentNotifyID = NULL;
static jmethodID windowDestroyNotifyID = NULL;
static jmethodID windowRepaintID = NULL;
@@ -253,7 +253,7 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_initIDs0
insetsChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "insetsChanged", "(ZIIII)V");
sizeChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "sizeChanged", "(ZIIZ)V");
positionChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "positionChanged", "(ZII)V");
- focusChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "focusChanged", "(ZZ)V");
+ focusVisibleChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "focusVisibleChanged", "(ZII)V");
visibleChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "visibleChanged", "(ZZ)V");
insetsVisibleChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "insetsVisibleChanged", "(ZIIIII)V");
sizePosMaxInsetsVisibleChangedID = (*env)->GetMethodID(env, X11NewtWindowClazz, "sizePosMaxInsetsVisibleChanged", "(ZIIIIIIIIIIIZ)V");
@@ -271,7 +271,7 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_initIDs0
insetsChangedID == NULL ||
sizeChangedID == NULL ||
positionChangedID == NULL ||
- focusChangedID == NULL ||
+ focusVisibleChangedID == NULL ||
visibleChangedID == NULL ||
insetsVisibleChangedID == NULL ||
sizePosMaxInsetsVisibleChangedID == NULL ||
@@ -356,6 +356,29 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_DisplayRelease0
DBG_PRINT("X11: X11Display_DisplayRelease dpy %p\n", dpy);
}
+static int NewtWindows_updateVisibility(JNIEnv *env, Display *dpy, JavaWindow *jw, uint32_t netWMState, const char *dbgs) {
+ int visibleChange;
+ if( jw->isMapped && 0 != ( _MASK_NET_WM_STATE_HIDDEN & jw->supportedAtoms ) ) {
+ if( 0 != ( _MASK_NET_WM_STATE_HIDDEN & netWMState ) ) {
+ visibleChange = 0;
+ } else {
+ visibleChange = 1;
+ }
+ } else {
+ visibleChange = -1;
+ }
+ #ifdef VERBOSE_ON
+ XWindowAttributes xwa;
+ memset(&xwa, 0, sizeof(XWindowAttributes));
+ XGetWindowAttributes(dpy, jw->window, &xwa);
+
+ // map_state: IsUnmapped(0), IsUnviewable(1), IsViewable(2)
+ DBG_PRINT( "X11: event . %s call %p - isMapped %d, visibleChanged %d, map_state %d\n",
+ dbgs, (void*)jw->window, jw->isMapped, visibleChange, xwa.map_state);
+ #endif
+ return visibleChange;
+}
+
/*
* Class: jogamp_newt_driver_x11_DisplayDriver
* Method: DispatchMessages0
@@ -584,26 +607,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_DispatchMessage
// insets: negative values are ignored
int left=-1, right=-1, top=-1, bottom=-1;
uint32_t netWMState = NewtWindows_getNET_WM_STATE(dpy, jw);
- int visibleChange;
- if( jw->isMapped && 0 != ( _MASK_NET_WM_STATE_HIDDEN & jw->supportedAtoms ) ) {
- if( 0 != ( _MASK_NET_WM_STATE_HIDDEN & netWMState ) ) {
- visibleChange = 0;
- } else {
- visibleChange = 1;
- }
- } else {
- visibleChange = -1;
- }
- #ifdef VERBOSE_ON
- XWindowAttributes xwa;
- memset(&xwa, 0, sizeof(XWindowAttributes));
- XGetWindowAttributes(dpy, jw->window, &xwa);
-
- // map_state: IsUnmapped(0), IsUnviewable(1), IsViewable(2)
- DBG_PRINT( "X11: event . ConfigureNotify call %p - isMapped %d, visibleChanged %d, map_state %d\n",
- (void*)evt.xconfigure.window, jw->isMapped, visibleChange, xwa.map_state);
- #endif
-
+ int visibleChange = NewtWindows_updateVisibility(env, dpy, jw, netWMState, "ConfigureNotify");
NewtWindows_updateInsets(dpy, jw, &left, &right, &top, &bottom);
Bool maxChanged = NewtWindows_updateMaximized(dpy, jw, netWMState);
(*env)->CallVoidMethod(env, jw->jwindow, sizePosMaxInsetsVisibleChangedID, JNI_FALSE,
@@ -630,13 +634,21 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_DisplayDriver_DispatchMessage
break;
case FocusIn:
- DBG_PRINT( "X11: event . FocusIn call %p\n", (void*)evt.xvisibility.window);
- (*env)->CallVoidMethod(env, jw->jwindow, focusChangedID, JNI_FALSE, JNI_TRUE);
+ DBG_PRINT( "X11: event . FocusIn call %p\n", (void*)evt.xfocus.window);
+ {
+ uint32_t netWMState = NewtWindows_getNET_WM_STATE(dpy, jw);
+ int visibleChange = NewtWindows_updateVisibility(env, dpy, jw, netWMState, "FocusIn");
+ (*env)->CallVoidMethod(env, jw->jwindow, focusVisibleChangedID, JNI_FALSE, (jint)1, (jint)visibleChange);
+ }
break;
case FocusOut:
- DBG_PRINT( "X11: event . FocusOut call %p\n", (void*)evt.xvisibility.window);
- (*env)->CallVoidMethod(env, jw->jwindow, focusChangedID, JNI_FALSE, JNI_FALSE);
+ DBG_PRINT( "X11: event . FocusOut call %p\n", (void*)evt.xfocus.window);
+ {
+ uint32_t netWMState = NewtWindows_getNET_WM_STATE(dpy, jw);
+ int visibleChange = NewtWindows_updateVisibility(env, dpy, jw, netWMState, "FocusOut");
+ (*env)->CallVoidMethod(env, jw->jwindow, focusVisibleChangedID, JNI_FALSE, (jint)0, (jint)visibleChange);
+ }
break;
case Expose:
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index 26029801b..f10db317a 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -211,7 +211,7 @@ static JavaWindow* createJavaWindowProperty(JNIEnv *env, Display *dpy, Window ro
res->lastDesktop = 0; //undef
res->maxHorz = False;
res->maxVert = False;
- res->isMapped=False;
+ res->isMapped = False;
}
unsigned long jogl_java_object_data[2]; // X11 is based on 'unsigned long'
int nitems_32 = putPtrIn32Long( jogl_java_object_data, (uintptr_t) res);
@@ -515,7 +515,16 @@ static void NewtWindows_setWindowTypeEWMH (Display *dpy, JavaWindow * w, int typ
}
}
-static void NewtWindows_sendNET_WM_STATE(Display *dpy, Window root, JavaWindow *w, int prop1Idx, int prop2Idx, Bool enable) {
+void NewtWindows_setUrgency(Display *dpy, Window window, Bool enable) {
+ XWMHints wmh;
+ memset ( &wmh, 0, sizeof(wmh) );
+ if( enable ) {
+ wmh.flags = XUrgencyHint;
+ }
+ XSetWMHints(dpy, window, &wmh);
+}
+
+void NewtWindows_sendNET_WM_STATE(Display *dpy, Window root, JavaWindow *w, int prop1Idx, int prop2Idx, Bool enable) {
XEvent xev;
int i=0;
@@ -666,21 +675,12 @@ static void NewtWindows_setVisible(Display *dpy, Window root, JavaWindow* jw, Bo
if( useWM && jw->isMapped && 0 != ( _MASK_NET_WM_STATE_HIDDEN & jw->supportedAtoms ) ) {
// It has been experienced that MapNotify/UnmapNotify is not sent for windows when using NormalState/IconicState!
// See X11Display.c::Java_jogamp_newt_driver_x11_DisplayDriver_DispatchMessages0 case ConfigureNotify
+ // NewtWindows_sendNET_WM_STATE(dpy, root, jw, _NET_WM_STATE_DEMANDS_ATTENTION_IDX, 0, True);
+ // NewtWindows_setUrgency(dpy, jw->window, True);
XEvent xev;
memset ( &xev, 0, sizeof(xev) );
- xev.type = ClientMessage;
- xev.xclient.window = jw->window;
- xev.xclient.message_type = jw->allAtoms[_WM_CHANGE_STATE_IDX];
- xev.xclient.format = 32;
- if( visible ) {
- xev.xclient.data.l[0] = NormalState;
- } else {
- xev.xclient.data.l[0] = IconicState;
- }
- XSendEvent ( dpy, root, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev );
if( visible ) {
- // NormalState may not work on some WMs (Gnome, KDE) ?
- memset ( &xev, 0, sizeof(xev) );
+ // NormalState does not work on some WMs (Gnome, KDE)
xev.type = ClientMessage;
xev.xclient.window = jw->window;
xev.xclient.message_type = jw->allAtoms[_NET_ACTIVE_WINDOW_IDX];
@@ -688,6 +688,13 @@ static void NewtWindows_setVisible(Display *dpy, Window root, JavaWindow* jw, Bo
xev.xclient.data.l[0] = 1; //source indication for normal applications
xev.xclient.data.l[1] = CurrentTime;
XSendEvent ( dpy, root, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev );
+ } else {
+ xev.type = ClientMessage;
+ xev.xclient.window = jw->window;
+ xev.xclient.message_type = jw->allAtoms[_WM_CHANGE_STATE_IDX];
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = IconicState;
+ XSendEvent ( dpy, root, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev );
}
} else {
if( visible ) {
@@ -840,7 +847,7 @@ JNIEXPORT jlongArray JNICALL Java_jogamp_newt_driver_x11_WindowDriver_CreateWind
xswa.override_redirect = False; // use the window manager, always (default)
xswa.event_mask = X11_MOUSE_EVENT_MASK;
xswa.event_mask |= KeyPressMask | KeyReleaseMask ;
- xswa.event_mask |= FocusChangeMask | SubstructureNotifyMask | StructureNotifyMask | ExposureMask ;
+ xswa.event_mask |= FocusChangeMask | SubstructureNotifyMask | StructureNotifyMask | ExposureMask;
{
int _x = x, _y = y; // pos for CreateWindow, might be tweaked
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
index 8f1cdaae0..38620ad92 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
@@ -49,6 +49,8 @@ import com.jogamp.nativewindow.AbstractGraphicsDevice;
public class TestGLWindows00NEWT extends UITestCase {
static GLProfile glp;
static int width, height;
+ static boolean manual = false;
+ static int loopVisibleToggle = 10;
static long durationPerTest = 100; // ms
@BeforeClass
@@ -98,6 +100,9 @@ public class TestGLWindows00NEWT extends UITestCase {
@Test
public void test01WindowCreateSimple() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, false /* undecor */); // local
@@ -116,6 +121,9 @@ public class TestGLWindows00NEWT extends UITestCase {
@Test
public void test02WindowCreateUndecor() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, true /* undecor */); // local
@@ -133,14 +141,17 @@ public class TestGLWindows00NEWT extends UITestCase {
}
@Test
- public void test10WindowSimpleToggleVisibility() throws InterruptedException {
- test1xWindowToggleVisibility(false /* undecor */);
+ public void test11WindowSimpleToggleVisibility() throws InterruptedException {
+ test1xWindowToggleVisibility(false /* undecor */, loopVisibleToggle);
}
@Test
- public void test10WindowUndecorToggleVisibility() throws InterruptedException {
- test1xWindowToggleVisibility(true /* undecor */);
+ public void test12WindowUndecorToggleVisibility() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
+ test1xWindowToggleVisibility(true /* undecor */, loopVisibleToggle);
}
- private void test1xWindowToggleVisibility(final boolean undecor) throws InterruptedException {
+ private void test1xWindowToggleVisibility(final boolean undecor, final int loopVisibleToggle) throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, undecor); // local
@@ -154,30 +165,31 @@ public class TestGLWindows00NEWT extends UITestCase {
Thread.sleep(100);
}
- System.err.println("XXX VISIBLE.1 -> FALSE");
- window.setVisible(false);
- Assert.assertEquals(true,window.isNativeValid());
- Assert.assertEquals(false,window.isVisible());
- for(int state=0; state*100<durationPerTest; state++) {
- Thread.sleep(100);
- }
+ for(int i=1; i<=loopVisibleToggle; i++) {
+ System.err.println("XXX VISIBLE."+i+" -> FALSE");
+ window.setVisible(false);
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
- window.display();
- Assert.assertEquals(true,window.isNativeValid());
- Assert.assertEquals(false,window.isVisible());
+ window.display();
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
- System.err.println("XXX VISIBLE.2 -> TRUE");
- window.setVisible(true);
- Assert.assertEquals(true,window.isNativeValid());
- Assert.assertEquals(true,window.isVisible());
- for(int state=0; state*100<durationPerTest; state++) {
- Thread.sleep(100);
+ System.err.println("XXX VISIBLE."+i+" -> TRUE");
+ window.setVisible(true);
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+ window.display();
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
}
- window.display();
- Assert.assertEquals(true,window.isNativeValid());
- Assert.assertEquals(true,window.isVisible());
-
destroyWindow(window);
}
@@ -193,6 +205,10 @@ public class TestGLWindows00NEWT extends UITestCase {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
durationPerTest = atoi(args[++i]);
+ } else if(args[i].equals("-loopvt")) {
+ loopVisibleToggle = atoi(args[++i]);
+ } else if(args[i].equals("-manual")) {
+ manual = true;
}
}
System.out.println("durationPerTest: "+durationPerTest);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
index 86614c3c3..eb4227607 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -50,7 +50,9 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting01NEWT extends UITestCase {
static int width, height;
- static long durationPerTest = 600;
+ static long durationPerTest = 100;
+ static boolean manual = false;
+ static int loopVisibleToggle = 10;
static GLCapabilities glCaps;
@BeforeClass
@@ -139,32 +141,34 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0,Display.getActiveDisplayNumber());
// visible test
- Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
- Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
- System.err.println("XXX VISIBLE.1 -> TRUE");
- glWindow1.setVisible(true);
- Assert.assertEquals(true, glWindow1.isVisible());
- Assert.assertEquals(true, glWindow1.isNativeValid());
- Assert.assertEquals(true, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeValid());
- Assert.assertEquals(1,display.getReferenceCount());
- Assert.assertEquals(true,display.isNativeValid());
- Assert.assertNotNull(display.getEDTUtil());
- Assert.assertEquals(true,display.getEDTUtil().isRunning());
- Assert.assertEquals(2,screen.getReferenceCount());
- Assert.assertEquals(true,screen.isNativeValid());
- Assert.assertEquals(1,Display.getActiveDisplayNumber());
- waitForFrames("window1.setVisible(true)", 1, glWindow1, glWindow2, 2000, true);
-
- System.err.println("XXX VISIBLE.2 -> FALSE");
- glWindow1.setVisible(false);
- Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(true, glWindow1.isNativeValid());
- Assert.assertEquals(false, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeValid());
-
- glWindow1.resetFPSCounter();
- glWindow2.resetFPSCounter();
+ for(int i=1; i<=loopVisibleToggle; i++) {
+ Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
+ Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
+ System.err.println("XXX VISIBLE."+i+" -> TRUE");
+ glWindow1.setVisible(true);
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
+ Assert.assertEquals(true, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
+ Assert.assertEquals(1,display.getReferenceCount());
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertNotNull(display.getEDTUtil());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
+ Assert.assertEquals(2,screen.getReferenceCount());
+ Assert.assertEquals(true,screen.isNativeValid());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ waitForFrames("window1.setVisible(true)", 1, glWindow1, glWindow2, 2000, true);
+
+ System.err.println("XXX VISIBLE."+i+" -> FALSE");
+ glWindow1.setVisible(false);
+ Assert.assertEquals(false, glWindow1.isVisible());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
+ Assert.assertEquals(false, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
+
+ glWindow1.resetFPSCounter();
+ glWindow2.resetFPSCounter();
+ }
Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
System.err.println("XXX VISIBLE.3 -> TRUE");
@@ -307,11 +311,17 @@ public class TestParenting01NEWT extends UITestCase {
@Test
public void test02aReparentTop2WinReparentRecreate() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
test02ReparentTop2WinImpl(true);
}
@Test
public void test02bReparentTop2WinReparentNative() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
test02ReparentTop2WinImpl(false);
}
@@ -536,11 +546,17 @@ public class TestParenting01NEWT extends UITestCase {
@Test
public void test03aReparentWin2TopReparentRecreate() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
test03ReparentWin2TopImpl(true);
}
@Test
public void test03bReparentWin2TopReparentNative() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
test03ReparentWin2TopImpl(false);
}
@@ -765,6 +781,10 @@ public class TestParenting01NEWT extends UITestCase {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
durationPerTest = atoi(args[++i]);
+ } else if(args[i].equals("-loopvt")) {
+ loopVisibleToggle = atoi(args[++i]);
+ } else if(args[i].equals("-manual")) {
+ manual = true;
} else if(args[i].equals("-asMain")) {
asMain = true;
}
@@ -774,8 +794,8 @@ public class TestParenting01NEWT extends UITestCase {
try {
TestParenting01NEWT.initClass();
final TestParenting01NEWT m = new TestParenting01NEWT();
- m.test02aReparentTop2WinReparentRecreate();
m.test01CreateVisibleDestroy();
+ m.test02aReparentTop2WinReparentRecreate();
} catch (final Throwable t ) {
t.printStackTrace();
}