aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-02-27 10:23:53 +0100
committerSven Gothel <[email protected]>2012-02-27 10:23:53 +0100
commitf519190f0cf97eb6b3fda61f4eb8c1f55de43b51 (patch)
tree6344e06ee2f6bc92d52d71dfc42ed880eed86a14 /src
parentfc5b20cb62db5b7675071dee57b3679ce8f7102b (diff)
ScreenMode/X11: Use common defaults in case of undefined values. X11: Tolerate invalid refresh rate and use default.
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/jogamp/newt/ScreenImpl.java16
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/X11Screen.java10
2 files changed, 17 insertions, 9 deletions
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index fdf80586a..ea103025e 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -62,6 +62,12 @@ import com.jogamp.newt.util.ScreenModeUtil;
public abstract class ScreenImpl extends Screen implements ScreenModeListener {
protected static final boolean DEBUG_TEST_SCREENMODE_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableScreenMode", true);
+ protected static final int default_sm_bpp = 32;
+ protected static final int default_sm_widthmm = 519;
+ protected static final int default_sm_heightmm = 324;
+ protected static final int default_sm_rate = 60;
+ protected static final int default_sm_rotation = 0;
+
protected DisplayImpl display;
protected int screen_idx;
protected String fqname;
@@ -501,11 +507,11 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
props[i++] = 0; // set later for verification of iterator
props[i++] = getWidth(); // width
props[i++] = getHeight(); // height
- props[i++] = 32; // bpp
- props[i++] = 519; // widthmm
- props[i++] = 324; // heightmm
- props[i++] = 60; // rate
- props[i++] = 0; // rot
+ props[i++] = default_sm_bpp;
+ props[i++] = default_sm_widthmm;
+ props[i++] = default_sm_heightmm;
+ props[i++] = default_sm_rate;
+ props[i++] = default_sm_rotation;
props[i - ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL] = i; // count
res = ScreenModeUtil.streamIn(props, 0);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java b/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
index 9dbac5d7f..ba1aed308 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/X11Screen.java
@@ -124,10 +124,12 @@ public class X11Screen extends ScreenImpl {
if(0>=res[0] || 0>=res[1]) {
throw new InternalError("invalid resolution: "+res[0]+"x"+res[1]+" for res idx "+nres_index+"/"+nres_number);
}
- int bpp = 32; // FIXME
int rate = nrates[nrate_index];
if(0>=rate) {
- throw new InternalError("invalid rate: "+rate+" at index "+nrate_index+"/"+nrates.length);
+ rate = default_sm_rate;
+ if(DEBUG) {
+ System.err.println("Invalid rate: "+rate+" at index "+nrate_index+"/"+nrates.length+", using default: "+default_sm_rate);
+ }
}
int rotation = nrotations[nrotation_index];
@@ -137,7 +139,7 @@ public class X11Screen extends ScreenImpl {
props[i++] = 0; // set later for verification of iterator
props[i++] = res[0]; // width
props[i++] = res[1]; // height
- props[i++] = bpp; // bpp
+ props[i++] = default_sm_bpp; // FIXME
props[i++] = res[2]; // widthmm
props[i++] = res[3]; // heightmm
props[i++] = rate; // rate
@@ -217,7 +219,7 @@ public class X11Screen extends ScreenImpl {
props[i++] = 0; // set later for verification of iterator
props[i++] = res[0]; // width
props[i++] = res[1]; // height
- props[i++] = 32; // FIXME: bpp
+ props[i++] = default_sm_bpp; // FIXME
props[i++] = res[2]; // widthmm
props[i++] = res[3]; // heightmm
props[i++] = rate; // rate