From e93efe83a96fcacb812a8ff8f4102578f88423f9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 26 Dec 2011 00:00:25 +0100 Subject: NEWT/Android: MonitorMode: Don't validate refreshRate (0 on some devices); AndroidWindow: Trigger ScreenModeChanged only if Screen is already valid. --- src/newt/classes/com/jogamp/newt/util/MonitorMode.java | 5 +++-- src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorMode.java b/src/newt/classes/com/jogamp/newt/util/MonitorMode.java index 5a8bf5bf2..8104f207a 100644 --- a/src/newt/classes/com/jogamp/newt/util/MonitorMode.java +++ b/src/newt/classes/com/jogamp/newt/util/MonitorMode.java @@ -43,8 +43,9 @@ public class MonitorMode { int refreshRate; public MonitorMode(SurfaceSize surfaceSize, DimensionImmutable screenSizeMM, int refreshRate) { - if(null==surfaceSize || refreshRate<=0) { - throw new IllegalArgumentException("surfaceSize must be set and refreshRate greater 0"); + // Don't validate screenSizeMM and refreshRate, since they may not be supported by the OS + if(null==surfaceSize) { + throw new IllegalArgumentException("surfaceSize must be set ("+surfaceSize+")"); } this.surfaceSize=surfaceSize; this.screenSizeMM=screenSizeMM; diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java index 32879b037..6348cf19e 100644 --- a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java +++ b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java @@ -343,7 +343,9 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 { surfaceHandle = 0; surface=null; } - getScreen().getCurrentScreenMode(); // if ScreenMode changed .. trigger ScreenMode event + if(getScreen().isNativeValid()) { + getScreen().getCurrentScreenMode(); // if ScreenMode changed .. trigger ScreenMode event + } if(0>x || 0>y) { x = 0; -- cgit v1.2.3