aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR.java39
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR11.java (renamed from src/newt/classes/jogamp/newt/driver/x11/ScreenRandR11.java)29
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR13.java51
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java26
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/ScreenRandR.java12
-rw-r--r--src/newt/native/X11Common.h3
-rw-r--r--src/newt/native/X11RandR11.c (renamed from src/newt/native/X11ScreenRandR11.c)73
-rw-r--r--src/newt/native/X11RandR13.c (renamed from src/newt/native/X11ScreenRandR13.c)94
-rw-r--r--src/newt/native/X11Screen.c21
-rw-r--r--src/newt/native/X11Screen.h2
10 files changed, 222 insertions, 128 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR.java b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
new file mode 100644
index 000000000..485d976ec
--- /dev/null
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.newt.driver.x11;
+
+import com.jogamp.newt.ScreenMode;
+
+public interface RandR {
+
+ int[] getScreenModeFirstImpl(final long dpy, final int screen_idx);
+ int[] getScreenModeNextImpl(final long dpy, final int screen_idx);
+ ScreenMode getCurrentScreenModeImpl(final long dpy, final int screen_idx);
+ boolean setCurrentScreenModeImpl(final long dpy, final int screen_idx, final ScreenMode screenMode, final int screenModeIdx, final int resolutionIdx);
+
+}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenRandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
index e8a616b99..ee67bd304 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenRandR11.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
@@ -1,3 +1,30 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
package jogamp.newt.driver.x11;
import jogamp.newt.ScreenImpl;
@@ -5,7 +32,7 @@ import jogamp.newt.ScreenImpl;
import com.jogamp.newt.ScreenMode;
import com.jogamp.newt.util.ScreenModeUtil;
-public class ScreenRandR11 implements ScreenRandR {
+public class RandR11 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
private int[] nrotations;
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
new file mode 100644
index 000000000..24c9806af
--- /dev/null
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.newt.driver.x11;
+
+import com.jogamp.newt.ScreenMode;
+
+public class RandR13 implements RandR {
+
+ public int[] getScreenModeFirstImpl(final long dpy, final int screen_idx) {
+ return null;
+ }
+ public int[] getScreenModeNextImpl(final long dpy, final int screen_idx) {
+ return null;
+ }
+ public ScreenMode getCurrentScreenModeImpl(final long dpy, final int screen_idx) {
+ return null;
+ }
+
+ public boolean setCurrentScreenModeImpl(final long dpy, final int screen_idx, final ScreenMode screenMode, final int screenModeIdx, final int resolutionIdx) {
+ return false;
+ }
+
+ private static native long getScreenResources0(long display, int screen_index);
+ private static native void freeScreenResources0(long screenConfiguration);
+
+}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
index d94f27371..cd8da9b60 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
@@ -73,11 +73,13 @@ public class ScreenDriver extends ScreenImpl {
int v[] = getRandRVersion0(dpy);
randrVersion = new VersionNumber(v[0], v[1], 0);
}
- System.err.println("RandR "+randrVersion);
+ if( DEBUG ) {
+ System.err.println("RandR "+randrVersion);
+ }
if( !randrVersion.isZero() ) {
- screenRandR = new ScreenRandR11();
+ rAndR = new RandR11();
} else {
- screenRandR = null;
+ rAndR = null;
}
}
@@ -85,42 +87,42 @@ public class ScreenDriver extends ScreenImpl {
}
private VersionNumber randrVersion;
- private ScreenRandR screenRandR;
+ private RandR rAndR;
@Override
protected int[] getScreenModeFirstImpl() {
- if( null == screenRandR ) { return null; }
+ if( null == rAndR ) { return null; }
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<int[]>() {
public int[] run(long dpy) {
- return screenRandR.getScreenModeFirstImpl(dpy, screen_idx);
+ return rAndR.getScreenModeFirstImpl(dpy, screen_idx);
} } );
}
@Override
protected int[] getScreenModeNextImpl() {
- if( null == screenRandR ) { return null; }
+ if( null == rAndR ) { return null; }
// assemble: w x h x bpp x f x r
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<int[]>() {
public int[] run(long dpy) {
- return screenRandR.getScreenModeNextImpl(dpy, screen_idx);
+ return rAndR.getScreenModeNextImpl(dpy, screen_idx);
} } );
}
@Override
protected ScreenMode getCurrentScreenModeImpl() {
- if( null == screenRandR ) { return null; }
+ if( null == rAndR ) { return null; }
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<ScreenMode>() {
public ScreenMode run(long dpy) {
- return screenRandR.getCurrentScreenModeImpl(dpy, screen_idx);
+ return rAndR.getCurrentScreenModeImpl(dpy, screen_idx);
} } );
}
@Override
protected boolean setCurrentScreenModeImpl(final ScreenMode screenMode) {
- if( null == screenRandR ) { return false; }
+ if( null == rAndR ) { return false; }
final List<ScreenMode> screenModes = this.getScreenModesOrig();
final int screenModeIdx = screenModes.indexOf(screenMode);
@@ -131,7 +133,7 @@ public class ScreenDriver extends ScreenImpl {
boolean done = runWithTempDisplayHandle( new DisplayImpl.DisplayRunnable<Boolean>() {
public Boolean run(long dpy) {
final int resIdx = getScreenModesIdx2NativeIdx().get(screenModeIdx);
- return Boolean.valueOf( screenRandR.setCurrentScreenModeImpl(dpy, screen_idx, screenMode, screenModeIdx, resIdx) );
+ return Boolean.valueOf( rAndR.setCurrentScreenModeImpl(dpy, screen_idx, screenMode, screenModeIdx, resIdx) );
}
}).booleanValue();
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenRandR.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenRandR.java
deleted file mode 100644
index abf20ba59..000000000
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenRandR.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package jogamp.newt.driver.x11;
-
-import com.jogamp.newt.ScreenMode;
-
-public interface ScreenRandR {
-
- int[] getScreenModeFirstImpl(final long dpy, final int screen_idx);
- int[] getScreenModeNextImpl(final long dpy, final int screen_idx);
- ScreenMode getCurrentScreenModeImpl(final long dpy, final int screen_idx);
- boolean setCurrentScreenModeImpl(final long dpy, final int screen_idx, final ScreenMode screenMode, final int screenModeIdx, final int resolutionIdx);
-
-}
diff --git a/src/newt/native/X11Common.h b/src/newt/native/X11Common.h
index 7f35216e3..e58cdb755 100644
--- a/src/newt/native/X11Common.h
+++ b/src/newt/native/X11Common.h
@@ -47,7 +47,8 @@
#include "jogamp_newt_driver_x11_DisplayDriver.h"
#include "jogamp_newt_driver_x11_ScreenDriver.h"
-#include "jogamp_newt_driver_x11_ScreenRandR11.h"
+#include "jogamp_newt_driver_x11_RandR11.h"
+#include "jogamp_newt_driver_x11_RandR13.h"
#include "jogamp_newt_driver_x11_WindowDriver.h"
#include "Window.h"
diff --git a/src/newt/native/X11ScreenRandR11.c b/src/newt/native/X11RandR11.c
index a457fd47b..cbf911a38 100644
--- a/src/newt/native/X11ScreenRandR11.c
+++ b/src/newt/native/X11RandR11.c
@@ -29,11 +29,11 @@
#include "X11Screen.h"
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: getAvailableScreenModeRotations0
* Signature: (JI)I
*/
-JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getAvailableScreenModeRotations0
+JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_RandR11_getAvailableScreenModeRotations0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -43,11 +43,6 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getAvailab
int rotations[4];
int major, minor;
- if(False == NewtScreen_getRANDRVersion(dpy, &major, &minor)) {
- fprintf(stderr, "RANDR not available\n");
- return (*env)->NewIntArray(env, 0);
- }
-
rotations_supported = XRRRotations (dpy, (int)scrn_idx, &cur_rotation);
if(0 != (rotations_supported & RR_Rotate_0)) {
@@ -79,11 +74,11 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getAvailab
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: getNumScreenModeResolution0
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getNumScreenModeResolutions0
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_RandR11_getNumScreenModeResolutions0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -93,11 +88,6 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getNumScreenMod
timespec_now(&t0);
#endif
- if(False == NewtScreen_hasRANDR(dpy)) {
- DBG_PRINT("Java_jogamp_newt_driver_x11_ScreenRandR11_getNumScreenModeResolutions0: RANDR not available\n");
- return 0;
- }
-
#ifdef DBG_PERF
timespec_now(&t1); timespec_subtract(&td, &t1, &t0); td_ms = timespec_milliseconds(&td);
fprintf(stderr, "X11Screen_getNumScreenModeResolution0.1: %ld ms\n", td_ms); fflush(NULL);
@@ -117,20 +107,15 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getNumScreenMod
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: getScreenModeResolutions0
* Signature: (JII)[I
*/
-JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenModeResolution0
+JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_RandR11_getScreenModeResolution0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx, jint resMode_idx)
{
Display *dpy = (Display *) (intptr_t) display;
- if(False == NewtScreen_hasRANDR(dpy)) {
- DBG_PRINT("Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenModeResolution0: RANDR not available\n");
- return (*env)->NewIntArray(env, 0);
- }
-
int num_sizes;
XRRScreenSize *xrrs = XRRSizes(dpy, (int)scrn_idx, &num_sizes); //get possible screen resolutions
@@ -159,20 +144,15 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenM
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: getScreenModeRates0
* Signature: (JII)[I
*/
-JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenModeRates0
+JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_RandR11_getScreenModeRates0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx, jint resMode_idx)
{
Display *dpy = (Display *) (intptr_t) display;
- if(False == NewtScreen_hasRANDR(dpy)) {
- DBG_PRINT("Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenModeRates0: RANDR not available\n");
- return (*env)->NewIntArray(env, 0);
- }
-
int num_sizes;
XRRScreenSize *xrrs = XRRSizes(dpy, (int)scrn_idx, &num_sizes); //get possible screen resolutions
@@ -202,11 +182,11 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenM
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: getScreenConfiguration0
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenConfiguration0
+JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_x11_RandR11_getScreenConfiguration0
(JNIEnv *env, jclass clazz, jlong display, jint screen_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -217,10 +197,6 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenConfi
timespec_now(&t0);
#endif
- if(False == NewtScreen_hasRANDR(dpy)) {
- DBG_PRINT("Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenConfiguration0: RANDR not available\n");
- return 0;
- }
#ifdef DBG_PERF
timespec_now(&t1); timespec_subtract(&td, &t1, &t0); td_ms = timespec_milliseconds(&td);
fprintf(stderr, "X11Screen_getScreenConfiguration0.1: %ld ms\n", td_ms); fflush(NULL);
@@ -237,22 +213,22 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getScreenConfi
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: freeScreenConfiguration0
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_freeScreenConfiguration0
+JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_RandR11_freeScreenConfiguration0
(JNIEnv *env, jclass clazz, jlong screenConfiguration)
{
XRRFreeScreenConfigInfo( (XRRScreenConfiguration *) (intptr_t) screenConfiguration );
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: getCurrentScreenRate0
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getCurrentScreenRate0
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_RandR11_getCurrentScreenRate0
(JNIEnv *env, jclass clazz, jlong screenConfiguration)
{
XRRScreenConfiguration *conf = (XRRScreenConfiguration *) (intptr_t) screenConfiguration;
@@ -264,11 +240,11 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getCurrentScree
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: getCurrentScreenRotation0
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getCurrentScreenRotation0
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_RandR11_getCurrentScreenRotation0
(JNIEnv *env, jclass clazz, jlong screenConfiguration)
{
XRRScreenConfiguration *conf = (XRRScreenConfiguration *) (intptr_t) screenConfiguration;
@@ -281,11 +257,11 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getCurrentScree
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: getCurrentScreenResolutionIndex0
* Signature: (J)I
*/
-JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getCurrentScreenResolutionIndex0
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_RandR11_getCurrentScreenResolutionIndex0
(JNIEnv *env, jclass clazz, jlong screenConfiguration)
{
XRRScreenConfiguration *conf = (XRRScreenConfiguration *) (intptr_t) screenConfiguration;
@@ -300,11 +276,11 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_getCurrentScree
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: setCurrentScreenModeStart0
* Signature: (JIJIII)Z
*/
-JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_setCurrentScreenModeStart0
+JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_RandR11_setCurrentScreenModeStart0
(JNIEnv *env, jclass clazz, jlong display, jint screen_idx, jlong screenConfiguration, jint resMode_idx, jint freq, jint rotation)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -349,11 +325,11 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_setCurrentS
}
/*
- * Class: jogamp_newt_driver_x11_ScreenRandR11
+ * Class: jogamp_newt_driver_x11_RandR11
* Method: setCurrentScreenModePollEnd0
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_setCurrentScreenModePollEnd0
+JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_RandR11_setCurrentScreenModePollEnd0
(JNIEnv *env, jclass clazz, jlong display, jint screen_idx, jint resMode_idx, jint freq, jint rotation)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -361,11 +337,6 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_ScreenRandR11_setCurrentS
XEvent evt;
XRRScreenChangeNotifyEvent * scn_event = (XRRScreenChangeNotifyEvent *) &evt;
- if(False == NewtScreen_hasRANDR(dpy)) {
- DBG_PRINT("Java_jogamp_newt_driver_x11_ScreenRandR11_setCurrentScreenModePollEnd0: RANDR not available\n");
- return JNI_FALSE;
- }
-
int num_sizes;
XRRScreenSize *xrrs = XRRSizes(dpy, (int)screen_idx, &num_sizes); //get possible screen resolutions
XRRScreenConfiguration *conf;
diff --git a/src/newt/native/X11ScreenRandR13.c b/src/newt/native/X11RandR13.c
index da90d15c9..ea72cd35d 100644
--- a/src/newt/native/X11ScreenRandR13.c
+++ b/src/newt/native/X11RandR13.c
@@ -28,7 +28,48 @@
#include "X11Common.h"
-JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getOrigin0_RandR13
+/*
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: getScreenResources0
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_x11_RandR13_getScreenResources0
+ (JNIEnv *env, jclass clazz, jlong display, jint screen_idx)
+{
+ Display *dpy = (Display *) (intptr_t) display;
+ Window root = RootWindow(dpy, (int)screen_idx);
+#ifdef DBG_PERF
+ struct timespec t0, t1, td;
+ long td_ms;
+ timespec_now(&t0);
+#endif
+
+#ifdef DBG_PERF
+ timespec_now(&t1); timespec_subtract(&td, &t1, &t0); td_ms = timespec_milliseconds(&td);
+ fprintf(stderr, "X11Screen_getScreenResources0.1: %ld ms\n", td_ms); fflush(NULL);
+#endif
+
+ XRRScreenResources *res = XRRGetScreenResourcesCurrent( dpy, root);
+#ifdef DBG_PERF
+ timespec_now(&t1); timespec_subtract(&td, &t1, &t0); td_ms = timespec_milliseconds(&td);
+ fprintf(stderr, "X11Screen_getScreenResources0.2 (XRRScreenResources): %ld ms\n", td_ms); fflush(NULL);
+#endif
+
+ return (jlong) (intptr_t) res;
+}
+
+/*
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: freeScreenResources0
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_RandR13_freeScreenResources0
+ (JNIEnv *env, jclass clazz, jlong screenResources)
+{
+ XRRFreeScreenResources( (XRRScreenResources *) (intptr_t) screenResources );
+}
+
+JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_RandR13_getOrigin0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -55,7 +96,7 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getOrigin0_
return jpos;
}
-JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getAvailableScreenModeRotations0_RandR13
+JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_RandR13_getAvailableScreenModeRotations0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -65,11 +106,6 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getAvailabl
int rotations[4];
int major, minor;
- if(False == NewtScreen_getRANDRVersion(dpy, &major, &minor)) {
- fprintf(stderr, "RANDR not available\n");
- return (*env)->NewIntArray(env, 0);
- }
-
rotations_supported = XRRRotations (dpy, (int)scrn_idx, &cur_rotation);
if(0 != (rotations_supported & RR_Rotate_0)) {
@@ -100,7 +136,7 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getAvailabl
return properties;
}
-JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getNumScreenModeResolutions0_RandR13
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_RandR13_getNumScreenModeResolutions0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -131,11 +167,11 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getNumScreenMode
}
/*
- * Class: jogamp_newt_driver_x11_ScreenDriver
- * Method: getScreenModeResolutions0_RandR13
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: getScreenModeResolutions0
* Signature: (JII)[I
*/
-JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getScreenModeResolution0_RandR13
+JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_RandR13_getScreenModeResolution0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx, jint resMode_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -168,11 +204,11 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getScreenMo
}
/*
- * Class: jogamp_newt_driver_x11_ScreenDriver
- * Method: getScreenModeRates0_RandR13
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: getScreenModeRates0
* Signature: (JII)[I
*/
-JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getScreenModeRates0_RandR13
+JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_RandR13_getScreenModeRates0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx, jint resMode_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -206,11 +242,11 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getScreenMo
}
/*
- * Class: jogamp_newt_driver_x11_ScreenDriver
- * Method: getCurrentScreenRate0_RandR13
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: getCurrentScreenRate0
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getCurrentScreenRate0_RandR13
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_RandR13_getCurrentScreenRate0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -229,11 +265,11 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getCurrentScreen
}
/*
- * Class: jogamp_newt_driver_x11_ScreenDriver
- * Method: getCurrentScreenRotation0_RandR13
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: getCurrentScreenRotation0
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getCurrentScreenRotation0_RandR13
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_RandR13_getCurrentScreenRotation0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -253,11 +289,11 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getCurrentScreen
/*
- * Class: jogamp_newt_driver_x11_ScreenDriver
- * Method: getCurrentScreenResolutionIndex0_RandR13
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: getCurrentScreenResolutionIndex0
* Signature: (JI)I
*/
-JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getCurrentScreenResolutionIndex0_RandR13
+JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_RandR13_getCurrentScreenResolutionIndex0
(JNIEnv *env, jclass clazz, jlong display, jint scrn_idx)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -278,11 +314,11 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getCurrentScreen
}
/*
- * Class: jogamp_newt_driver_x11_ScreenDriver
- * Method: setCurrentScreenModeStart0_RandR13
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: setCurrentScreenModeStart0
* Signature: (JIIII)Z
*/
-JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_setCurrentScreenModeStart0_RandR13
+JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_RandR13_setCurrentScreenModeStart0
(JNIEnv *env, jclass clazz, jlong display, jint screen_idx, jint resMode_idx, jint freq, jint rotation)
{
Display *dpy = (Display *) (intptr_t) display;
@@ -318,11 +354,11 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_setCurrentSc
}
/*
- * Class: jogamp_newt_driver_x11_ScreenDriver
- * Method: setCurrentScreenModePollEnd0_RandR13
+ * Class: jogamp_newt_driver_x11_RandR13
+ * Method: setCurrentScreenModePollEnd0
* Signature: (J)Z
*/
-JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_setCurrentScreenModePollEnd0_RandR13
+JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_x11_RandR13_setCurrentScreenModePollEnd0
(JNIEnv *env, jclass clazz, jlong display, jint screen_idx, jint resMode_idx, jint freq, jint rotation)
{
Display *dpy = (Display *) (intptr_t) display;
diff --git a/src/newt/native/X11Screen.c b/src/newt/native/X11Screen.c
index 69a06aad0..3d4b2a26c 100644
--- a/src/newt/native/X11Screen.c
+++ b/src/newt/native/X11Screen.c
@@ -74,24 +74,6 @@ JNIEXPORT jint JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getHeight0
return (jint) DisplayHeight( dpy, scrn_idx);
}
-static int showedRandRVersion = 0;
-
-Bool NewtScreen_getRANDRVersion(Display *dpy, int *major, int *minor) {
- if( 0 == XRRQueryVersion(dpy, major, minor) ) {
- return False;
- }
- if(0 == showedRandRVersion) {
- DBG_PRINT("X11 RandR Version %d.%d\n", *major, *minor);
- showedRandRVersion = 1;
- }
- return True;
-}
-
-Bool NewtScreen_hasRANDR(Display *dpy) {
- int major, minor;
- return NewtScreen_getRANDRVersion(dpy, &major, &minor);
-}
-
int NewtScreen_XRotation2Degree(JNIEnv *env, int xrotation) {
int rot;
if(xrotation == RR_Rotate_0) {
@@ -121,8 +103,7 @@ JNIEXPORT jintArray JNICALL Java_jogamp_newt_driver_x11_ScreenDriver_getRandRVer
{
Display * dpy = (Display *)(intptr_t)display;
jint version[2];
- Bool res = NewtScreen_getRANDRVersion(dpy, &version[0], &version[1]);
- if( False == res ) {
+ if( 0 == XRRQueryVersion(dpy, &version[0], &version[1] ) ) {
version[0] = 0;
version[1] = 0;
}
diff --git a/src/newt/native/X11Screen.h b/src/newt/native/X11Screen.h
index a5b8e3e70..1a1440054 100644
--- a/src/newt/native/X11Screen.h
+++ b/src/newt/native/X11Screen.h
@@ -32,8 +32,6 @@
#include "X11Common.h"
-Bool NewtScreen_getRANDRVersion(Display *dpy, int *major, int *minor);
-Bool NewtScreen_hasRANDR(Display *dpy);
int NewtScreen_XRotation2Degree(JNIEnv *env, int xrotation);
#endif /* _X11SCREEN_H */