summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java13
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java38
3 files changed, 39 insertions, 14 deletions
diff --git a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
index 05732deb1..8aa6f92a5 100644
--- a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
@@ -243,7 +243,7 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
public final List/*<ScreenMode>*/ getScreenModes() {
ArrayHashSet screenModes = getScreenModesOrig();
- if(null != screenModes) {
+ if(null != screenModes || screenModes.size()>0) {
return screenModes.toArrayList();
}
return null;
diff --git a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java
index d35021605..23d41c21e 100644
--- a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java
+++ b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java
@@ -62,7 +62,7 @@ public class WindowsScreen extends ScreenImpl {
private int[] getScreenModeIdx(int idx) {
int[] modeProps = getScreenMode0(screen_idx, idx);
- if (null == modeProps) {
+ if (null == modeProps || 0 == modeProps.length) {
return null;
}
if(modeProps.length != ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL + 1) {
@@ -80,14 +80,19 @@ public class WindowsScreen extends ScreenImpl {
protected int[] getScreenModeNextImpl() {
int[] modeProps = getScreenModeIdx(nativeModeIdx);
- if (null != modeProps) {
+ if (null != modeProps && 0 != modeProps.length) {
nativeModeIdx++;
+ return modeProps;
}
- return modeProps;
+ return null;
}
protected ScreenMode getCurrentScreenModeImpl() {
- return ScreenModeUtil.streamIn(getScreenModeIdx(-1), 0);
+ int[] modeProps = getScreenModeIdx(-1);
+ if (null != modeProps && 0 != modeProps.length) {
+ return ScreenModeUtil.streamIn(modeProps, 0);
+ }
+ return null;
}
protected boolean setCurrentScreenModeImpl(ScreenMode sm) {
diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java
index a04ce4242..3f49b5e79 100644
--- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java
+++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java
@@ -73,16 +73,21 @@ public class X11Screen extends ScreenImpl {
protected int[] getScreenModeFirstImpl() {
// initialize iterators and static data
nrotations = getAvailableScreenModeRotations0(display.getHandle(), screen_idx);
- if(null==nrotations) {
- nrotations = new int[1];
- nrotations[0]=0;
+ if(null==nrotations || 0==nrotations.length) {
+ return null;
}
nrotation_index = 0;
nres_number = getNumScreenModeResolutions0(display.getHandle(), screen_idx);
+ if(0==nres_number) {
+ return null;
+ }
nres_index = 0;
nrates = getScreenModeRates0(display.getHandle(), screen_idx, nres_index);
+ if(null==nrates || 0==nrates.length) {
+ return null;
+ }
nrate_index = 0;
nmode_number = 0;
@@ -100,8 +105,8 @@ public class X11Screen extends ScreenImpl {
System.err.println("res "+nres_index); */
int[] res = getScreenModeResolution0(display.getHandle(), screen_idx, nres_index);
- if(null == res) {
- throw new InternalError("null resolution received for res idx "+nres_index+"/"+nres_number);
+ if(null==res || 0==res.length) {
+ return null;
}
if(0>=res[0] || 0>=res[1]) {
throw new InternalError("invalid resolution: "+res[0]+"x"+res[1]+" for res idx "+nres_index+"/"+nres_number);
@@ -143,6 +148,9 @@ public class X11Screen extends ScreenImpl {
}
nrates = getScreenModeRates0(display.getHandle(), screen_idx, nres_index);
+ if(null==nrates || 0==nrates.length) {
+ return null;
+ }
nrate_index = 0;
}
}
@@ -152,19 +160,31 @@ public class X11Screen extends ScreenImpl {
protected ScreenMode getCurrentScreenModeImpl() {
int resNumber = getNumScreenModeResolutions0(display.getHandle(), screen_idx);
+ if(0==resNumber) {
+ return null;
+ }
int resIdx = getCurrentScreenResolutionIndex0(display.getHandle(), screen_idx);
- if(0>resIdx || resIdx>=resNumber) {
- throw new RuntimeException("Invalid resolution index: ! 0 < "+resIdx+" < "+resNumber);
+ if(0>resIdx) {
+ return null;
+ }
+ if(resIdx>=resNumber) {
+ throw new RuntimeException("Invalid resolution index: ! "+resIdx+" < "+resNumber);
}
int[] res = getScreenModeResolution0(display.getHandle(), screen_idx, resIdx);
- if(null == res) {
- throw new InternalError("null resolution received for res idx "+resIdx+"/"+resNumber);
+ if(null==res || 0==res.length) {
+ return null;
}
if(0>=res[0] || 0>=res[1]) {
throw new InternalError("invalid resolution: "+res[0]+"x"+res[1]+" for res idx "+resIdx+"/"+resNumber);
}
int rate = getCurrentScreenRate0(display.getHandle(), screen_idx);
+ if(0>rate) {
+ return null;
+ }
int rot = getCurrentScreenRotation0(display.getHandle(), screen_idx);
+ if(0>rot) {
+ return null;
+ }
int[] props = new int[ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL];
int i = 0;