summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java75
3 files changed, 26 insertions, 55 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 1be5949fe..ba7d51e67 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -49,8 +49,8 @@ public interface Window extends NativeWindow, ScreenModeListener {
public static final boolean DEBUG_WINDOW_EVENT = Debug.debug("Window.WindowEvent");
public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window");
- /** A 500ms timeout while waiting for a native action response, ie {@link #setVisible(boolean)}. */
- public static final long TIMEOUT_NATIVEWINDOW = 500;
+ /** A 1s timeout while waiting for a native action response, ie {@link #setVisible(boolean)}. */
+ public static final long TIMEOUT_NATIVEWINDOW = 1000;
//
// Lifecycle
diff --git a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
index 474eac31d..ebb496988 100644
--- a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
@@ -466,8 +466,6 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
num++;
} while ( null != smProps && 0 < smProps.length );
- ScreenModeUtil.validate(screenModePool, true);
-
if(DEBUG) {
System.err.println("ScreenImpl.collectNativeScreenModes: ScreenMode number : "+screenModePool.size());
System.err.println("ScreenImpl.collectNativeScreenModes: MonitorMode number : "+monitorModePool.size());
diff --git a/src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java b/src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java
index 9cb04c2a1..3e0e3dac5 100644
--- a/src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java
+++ b/src/newt/classes/com/jogamp/newt/util/ScreenModeUtil.java
@@ -80,59 +80,14 @@ public class ScreenModeUtil {
}
/**
- * Validate the given list of {@link com.jogamp.newt.ScreenMode}s, testing on:<br>
- * <ul>
- * <li> unique {@link com.jogamp.newt.ScreenMode}s by equality and hash code
- * </ul>
- * This
- * @param screenModes list of {@link com.jogamp.newt.ScreenMode}s
- * @param throwException if true and invalid throw IllegalArgumentException
- * @return true if valid, otherwise false or throw IllegalArgumentException
- * @throws IllegalArgumentException if invalid
- */
- public static boolean validate(List/*<ScreenMode>*/ screenModes, boolean throwException) {
- for (int j=0; null!=screenModes && j<screenModes.size(); j++) {
- ScreenMode sm = (ScreenMode)screenModes.get(j);
- List dups = new ArrayList();
-
- /*** don't check slow-path 'equals' for now, hash is working
- for (int i=0; i<screenModes.size(); i++) {
- ScreenMode sm2 = (ScreenMode)screenModes.get(i);
- if( i!=j && sm.equals(sm2) ) {
- dups.add(new Integer(i));
- }
- }
- if(dups.size()>0) {
- if(throwException) {
- throw new IllegalArgumentException("Element "+sm+" at index "+j+" is not unique (equality), duplicates: "+dups);
- } else {
- return false;
- }
- } */
-
- for (int i=0; null!=screenModes && i<screenModes.size(); i++) {
- ScreenMode sm2 = (ScreenMode)screenModes.get(i);
- if ( i!=j && sm.hashCode() == sm2.hashCode() ) {
- dups.add(new Integer(i));
- }
- }
- if(dups.size()>0) {
- if(throwException) {
- throw new IllegalArgumentException("Element "+sm+" at index "+j+" is not unique (hash), duplicates: "+dups);
- } else {
- return false;
- }
- }
- }
- return true;
- }
-
- /**
* @param screenModes
* @param resolution
* @return modes with nearest resolution, or matching ones
*/
public static List/*<ScreenMode>*/ filterByResolution(List/*<ScreenMode>*/ screenModes, DimensionReadOnly resolution) {
+ if(null==screenModes || screenModes.size()==0) {
+ return null;
+ }
List out = new ArrayList();
int resolution_sq = resolution.getHeight()*resolution.getWidth();
int sm_dsq=resolution_sq, sm_dsq_idx=0;
@@ -158,6 +113,9 @@ public class ScreenModeUtil {
}
public static List/*<ScreenMode>*/ filterBySurfaceSize(List/*<ScreenMode>*/ screenModes, SurfaceSize surfaceSize) {
+ if(null==screenModes || screenModes.size()==0) {
+ return null;
+ }
List out = new ArrayList();
for (int i=0; null!=screenModes && i<screenModes.size(); i++) {
ScreenMode sm = (ScreenMode)screenModes.get(i);
@@ -165,10 +123,13 @@ public class ScreenModeUtil {
out.add(sm);
}
}
- return out;
+ return out.size()>0 ? out : null;
}
public static List/*<ScreenMode>*/ filterByRotation(List/*<ScreenMode>*/ screenModes, int rotation) {
+ if(null==screenModes || screenModes.size()==0) {
+ return null;
+ }
List out = new ArrayList();
for (int i=0; null!=screenModes && i<screenModes.size(); i++) {
ScreenMode sm = (ScreenMode)screenModes.get(i);
@@ -176,10 +137,13 @@ public class ScreenModeUtil {
out.add(sm);
}
}
- return out;
+ return out.size()>0 ? out : null;
}
public static List/*<ScreenMode>*/ filterByBpp(List/*<ScreenMode>*/ screenModes, int bitsPerPixel) {
+ if(null==screenModes || screenModes.size()==0) {
+ return null;
+ }
List out = new ArrayList();
for (int i=0; null!=screenModes && i<screenModes.size(); i++) {
ScreenMode sm = (ScreenMode)screenModes.get(i);
@@ -187,7 +151,7 @@ public class ScreenModeUtil {
out.add(sm);
}
}
- return out;
+ return out.size()>0 ? out : null;
}
/**
@@ -197,6 +161,9 @@ public class ScreenModeUtil {
* @return modes with nearest refreshRate, or matching ones
*/
public static List/*<ScreenMode>*/ filterByRate(List/*<ScreenMode>*/ screenModes, int refreshRate) {
+ if(null==screenModes || screenModes.size()==0) {
+ return null;
+ }
int sm_dr = refreshRate;
int sm_dr_idx = -1;
List out = new ArrayList();
@@ -219,6 +186,9 @@ public class ScreenModeUtil {
}
public static List/*<ScreenMode>*/ getHighestAvailableBpp(List/*<ScreenMode>*/ screenModes) {
+ if(null==screenModes || screenModes.size()==0) {
+ return null;
+ }
int highest = -1;
for (int i=0; null!=screenModes && i < screenModes.size(); i++) {
ScreenMode sm = (ScreenMode)screenModes.get(i);
@@ -231,6 +201,9 @@ public class ScreenModeUtil {
}
public static List/*<ScreenMode>*/ getHighestAvailableRate(List/*<ScreenMode>*/ screenModes) {
+ if(null==screenModes || screenModes.size()==0) {
+ return null;
+ }
int highest = -1;
for (int i=0; null!=screenModes && i < screenModes.size(); i++) {
ScreenMode sm = (ScreenMode)screenModes.get(i);