summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-02-17 05:41:45 +0100
committerSven Gothel <[email protected]>2015-02-17 05:41:45 +0100
commit3ec3d5cedd7902b2fe14dc56a3f845cfe0752905 (patch)
tree0d22a4153f3faaf194ace0de1da5d6de513293f2 /src/newt/classes/jogamp
parent480f4251cf3cf530493611d8924f905cacc349d5 (diff)
MonitorDevice: Add 'throws IllegalStateException' for [query|set]CurrentMode(..) if !screen.isNativeValid()
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/MonitorDeviceImpl.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
index 138aedc29..3f039a9f4 100644
--- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
+++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
@@ -28,8 +28,6 @@
package jogamp.newt;
-import java.util.ArrayList;
-
import com.jogamp.nativewindow.ScalableSurface;
import com.jogamp.nativewindow.util.DimensionImmutable;
import com.jogamp.nativewindow.util.Rectangle;
@@ -59,8 +57,11 @@ public class MonitorDeviceImpl extends MonitorDevice {
}
@Override
- public final MonitorMode queryCurrentMode() {
+ public final MonitorMode queryCurrentMode() throws IllegalStateException {
final ScreenImpl screenImpl = (ScreenImpl)screen;
+ if( !screenImpl.isNativeValid() ) {
+ throw new IllegalStateException("Screen is not created natively: "+screenImpl);
+ }
final ScreenMonitorState sms = screenImpl.getScreenMonitorStatus(true);
sms.lock();
try {
@@ -89,11 +90,14 @@ public class MonitorDeviceImpl extends MonitorDevice {
}
@Override
- public final boolean setCurrentMode(final MonitorMode mode) {
+ public final boolean setCurrentMode(final MonitorMode mode) throws IllegalStateException {
+ final ScreenImpl screenImpl = (ScreenImpl)screen;
+ if( !screenImpl.isNativeValid() ) {
+ throw new IllegalStateException("Screen is not created natively: "+screenImpl);
+ }
if(Screen.DEBUG) {
System.err.println("Screen.setCurrentMode.0: "+this+" -> "+mode);
}
- final ScreenImpl screenImpl = (ScreenImpl)screen;
final ScreenMonitorState sms = screenImpl.getScreenMonitorStatus(true);
sms.lock();
try {