diff options
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/x11/RandR13.java | 1 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java | 18 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java index 95bff0118..bd3c7925e 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java @@ -275,7 +275,6 @@ class RandR13 implements RandR { private static native int[] getAvailableRotations0(long monitorInfo); private static native int[] getMonitorViewport0(long monitorInfo); - private static native int[] getMonitorCurrentMode0(long monitorInfo); private static native int[] getMonitorMode0(long screenResources, int mode_index); private static native int[] getMonitorCurrentMode0(long screenResources, long monitorInfo); diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java index 517d229b7..873ee3f53 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java @@ -121,7 +121,7 @@ public class ScreenDriver extends ScreenImpl { if( rAndR.beginInitialQuery(device.getHandle(), this) ) { try { final int[] crt_ids = rAndR.getMonitorDeviceIds(device.getHandle(), this); - final int crtCount = crt_ids.length; + final int crtCount = null != crt_ids ? crt_ids.length : 0; // Gather all available rotations final ArrayHashSet<Integer> availableRotations = new ArrayHashSet<Integer>(false, ArrayHashSet.DEFAULT_INITIAL_CAPACITY, ArrayHashSet.DEFAULT_LOAD_FACTOR); @@ -173,9 +173,13 @@ public class ScreenDriver extends ScreenImpl { device.lock(); try { final int[] viewportProps = rAndR.getMonitorDeviceViewport(device.getHandle(), this, monitor.getId()); - viewportPU.set(viewportProps[0], viewportProps[1], viewportProps[2], viewportProps[3]); - viewportWU.set(viewportProps[0], viewportProps[1], viewportProps[2], viewportProps[3]); // equal window-units and pixel-units - return true; + if( null != viewportProps ) { + viewportPU.set(viewportProps[0], viewportProps[1], viewportProps[2], viewportProps[3]); + viewportWU.set(viewportProps[0], viewportProps[1], viewportProps[2], viewportProps[3]); // equal window-units and pixel-units + return true; + } else { + return false; + } } finally { device.unlock(); } @@ -189,7 +193,11 @@ public class ScreenDriver extends ScreenImpl { @Override public MonitorMode run(final long dpy) { final int[] currentModeProps = rAndR.getCurrentMonitorModeProps(dpy, ScreenDriver.this, monitor.getId()); - return MonitorModeProps.streamInMonitorMode(null, null, currentModeProps, 0); + if( null != currentModeProps ) { + return MonitorModeProps.streamInMonitorMode(null, null, currentModeProps, 0); + } else { + return null; + } } } ); } |