summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR11.java19
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR13.java17
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java19
4 files changed, 35 insertions, 26 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR.java b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
index c569e5fd8..769ebe225 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
@@ -31,11 +31,17 @@ import java.util.List;
import jogamp.newt.MonitorModeProps;
+import com.jogamp.common.util.VersionNumber;
import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
public interface RandR {
+ public static final VersionNumber version110 = new VersionNumber(1, 1, 0);
+ public static final VersionNumber version130 = new VersionNumber(1, 3, 0);
+ public static final VersionNumber version140 = new VersionNumber(1, 4, 0);
+ VersionNumber getVersion();
+
void dumpInfo(final long dpy, final int screen_idx);
/**
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
index a938b4064..58468e112 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
@@ -34,20 +34,17 @@ import com.jogamp.common.util.VersionNumber;
import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
-public class RandR11 implements RandR {
+class RandR11 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
- public static VersionNumber version = new VersionNumber(1, 1, 0);
-
- public static RandR11 createInstance(VersionNumber rAndRVersion) {
- if( rAndRVersion.compareTo(version) >= 0 ) {
- return new RandR11();
- }
- return null;
- }
- private RandR11() {
+ RandR11() {
}
-
+
+ @Override
+ public final VersionNumber getVersion() {
+ return version110;
+ }
+
@Override
public void dumpInfo(final long dpy, final int screen_idx) {
// NOP
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
index d10591381..375cffe42 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
@@ -43,18 +43,15 @@ import com.jogamp.newt.MonitorMode;
* MonitorDevice.id == XRR monitor-idx (not id)
* </pre>
*/
-public class RandR13 implements RandR {
+class RandR13 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
- public static VersionNumber version = new VersionNumber(1, 3, 0);
-
- public static RandR13 createInstance(VersionNumber rAndRVersion) {
- if( rAndRVersion.compareTo(version) >= 0 ) {
- return new RandR13();
- }
- return null;
- }
- private RandR13() {
+ RandR13() {
+ }
+
+ @Override
+ public final VersionNumber getVersion() {
+ return version130;
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
index e1373bba5..19a69a3f9 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
@@ -84,11 +84,12 @@ public class ScreenDriver extends ScreenImpl {
randrVersion = new VersionNumber(v[0], v[1], 0);
}
{
- final RandR13 rAndR13 = DEBUG_TEST_RANDR13_DISABLED ? null : RandR13.createInstance(randrVersion);
- if( null != rAndR13 ) {
- rAndR = rAndR13;
+ if( !DEBUG_TEST_RANDR13_DISABLED && randrVersion.compareTo(RandR.version130) >= 0 ) {
+ rAndR = new RandR13();
+ } else if( randrVersion.compareTo(RandR.version110) >= 0 ) {
+ rAndR = new RandR11();
} else {
- rAndR = RandR11.createInstance(randrVersion);
+ rAndR = null;
}
}
if( DEBUG ) {
@@ -186,7 +187,7 @@ public class ScreenDriver extends ScreenImpl {
if( null == rAndR ) { return false; }
final long t0 = System.currentTimeMillis();
- boolean done = runWithTempDisplayHandle( new DisplayImpl.DisplayRunnable<Boolean>() {
+ boolean done = runWithOptTempDisplayHandle( new DisplayImpl.DisplayRunnable<Boolean>() {
public Boolean run(long dpy) {
return Boolean.valueOf( rAndR.setCurrentMonitorMode(dpy, ScreenDriver.this, monitor, mode) );
}
@@ -248,6 +249,14 @@ public class ScreenDriver extends ScreenImpl {
return res;
}
+ private final <T> T runWithOptTempDisplayHandle(DisplayRunnable<T> action) {
+ if( null != rAndR && rAndR.getVersion().compareTo(RandR.version130) >= 0 ) {
+ return display.runWithLockedDisplayDevice(action);
+ } else {
+ return runWithTempDisplayHandle(action);
+ }
+ }
+
private static native long GetScreen0(long dpy, int scrn_idx);
private static native int getWidth0(long display, int scrn_idx);