summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake/scripts/java-win64-dbg.bat6
-rwxr-xr-xmake/scripts/java-win64.bat4
-rwxr-xr-xmake/scripts/make.jogl.all.win64.bat2
-rw-r--r--make/scripts/tests.bat2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java13
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java38
-rw-r--r--src/newt/native/NewtCommon.c41
-rw-r--r--src/newt/native/NewtCommon.h1
-rw-r--r--src/newt/native/WindowsWindow.c69
-rw-r--r--src/newt/native/X11Window.c55
11 files changed, 131 insertions, 102 deletions
diff --git a/make/scripts/java-win64-dbg.bat b/make/scripts/java-win64-dbg.bat
index 57281d6fd..1a3bd5910 100755
--- a/make/scripts/java-win64-dbg.bat
+++ b/make/scripts/java-win64-dbg.bat
@@ -1,7 +1,7 @@
set BLD_SUB=build-win64
-set J2RE_HOME=c:\jre1.6.0_20_x64
-set JAVA_HOME=c:\jdk1.6.0_20_x64
+set J2RE_HOME=c:\jre1.6.0_21_x64
+set JAVA_HOME=c:\jdk1.6.0_21_x64
set ANT_PATH=C:\apache-ant-1.8.1
set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
@@ -18,7 +18,7 @@ REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnativewindow.debug.TraceLock"
REM set D_ARGS="-Dnativewindow.debug.TraceLock"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display"
-set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.EDT" "-Dnativewindow.debug=all" "-Djogamp.common.utils.locks.Lock.timeout=600000" "-Djogamp.debug.Lock" "-Djogamp.debug.Lock.TraceLock"
+set D_ARGS="-Dnewt.debug=all" "-Dnewt.debug.EDT" "-Dnativewindow.debug=all" "-Djogamp.common.utils.locks.Lock.timeout=600000" "-Djogamp.debug.Lock" "-Djogamp.debug.Lock.TraceLock"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.test.Window.reparent.incompatible=true"
set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true"
diff --git a/make/scripts/java-win64.bat b/make/scripts/java-win64.bat
index 96df81720..eb40ca40c 100755
--- a/make/scripts/java-win64.bat
+++ b/make/scripts/java-win64.bat
@@ -1,7 +1,7 @@
set BLD_SUB=build-win64
-set J2RE_HOME=c:\jre1.6.0_20_x64
-set JAVA_HOME=c:\jdk1.6.0_20_x64
+set J2RE_HOME=c:\jre1.6.0_21_x64
+set JAVA_HOME=c:\jdk1.6.0_21_x64
set ANT_PATH=C:\apache-ant-1.8.1
set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
diff --git a/make/scripts/make.jogl.all.win64.bat b/make/scripts/make.jogl.all.win64.bat
index 8dd932df4..15df3878a 100755
--- a/make/scripts/make.jogl.all.win64.bat
+++ b/make/scripts/make.jogl.all.win64.bat
@@ -14,4 +14,4 @@ REM -DuseKD=true
REM -Djogl.cg=1
REM -Dbuild.noarchives=true
-ant -Dbuild.noarchives=true -Drootrel.build=build-win64 -Djogl.cg=1 %1 %2 %3 %4 %5 %6 %7 %8 %9 > make.jogl.all.win64.log 2>&1
+ant -Dc.compiler.debug=true -Dbuild.noarchives=true -Drootrel.build=build-win64 -Djogl.cg=1 %1 %2 %3 %4 %5 %6 %7 %8 %9 > make.jogl.all.win64.log 2>&1
diff --git a/make/scripts/tests.bat b/make/scripts/tests.bat
index 4049fc278..5d7944abc 100644
--- a/make/scripts/tests.bat
+++ b/make/scripts/tests.bat
@@ -15,8 +15,8 @@ REM scripts\java-win64-dbg.bat com.jogamp.test.junit.nativewindow.TestRecursiveT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.parenting.TestParenting03AWT -time 100000
REM scripts\java-win64.bat com.jogamp.test.junit.newt.TestFocus02SwingAWTRobot
+scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestScreenMode00NEWT
REM scripts\java-win64.bat com.jogamp.test.junit.newt.TestScreenMode01NEWT
-scripts\java-win64.bat com.jogamp.test.junit.newt.TestScreenMode02NEWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.TestDisplayLifecycle01NEWT
REM scripts\java-win64-dbg.bat com.jogamp.test.junit.newt.parenting.TestParenting01NEWT
diff --git a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
index 05732deb1..8aa6f92a5 100644
--- a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
+++ b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java
@@ -243,7 +243,7 @@ public abstract class ScreenImpl extends Screen implements ScreenModeListener {
public final List/*<ScreenMode>*/ getScreenModes() {
ArrayHashSet screenModes = getScreenModesOrig();
- if(null != screenModes) {
+ if(null != screenModes || screenModes.size()>0) {
return screenModes.toArrayList();
}
return null;
diff --git a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java
index d35021605..23d41c21e 100644
--- a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java
+++ b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsScreen.java
@@ -62,7 +62,7 @@ public class WindowsScreen extends ScreenImpl {
private int[] getScreenModeIdx(int idx) {
int[] modeProps = getScreenMode0(screen_idx, idx);
- if (null == modeProps) {
+ if (null == modeProps || 0 == modeProps.length) {
return null;
}
if(modeProps.length != ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL + 1) {
@@ -80,14 +80,19 @@ public class WindowsScreen extends ScreenImpl {
protected int[] getScreenModeNextImpl() {
int[] modeProps = getScreenModeIdx(nativeModeIdx);
- if (null != modeProps) {
+ if (null != modeProps && 0 != modeProps.length) {
nativeModeIdx++;
+ return modeProps;
}
- return modeProps;
+ return null;
}
protected ScreenMode getCurrentScreenModeImpl() {
- return ScreenModeUtil.streamIn(getScreenModeIdx(-1), 0);
+ int[] modeProps = getScreenModeIdx(-1);
+ if (null != modeProps && 0 != modeProps.length) {
+ return ScreenModeUtil.streamIn(modeProps, 0);
+ }
+ return null;
}
protected boolean setCurrentScreenModeImpl(ScreenMode sm) {
diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java
index a04ce4242..3f49b5e79 100644
--- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java
+++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Screen.java
@@ -73,16 +73,21 @@ public class X11Screen extends ScreenImpl {
protected int[] getScreenModeFirstImpl() {
// initialize iterators and static data
nrotations = getAvailableScreenModeRotations0(display.getHandle(), screen_idx);
- if(null==nrotations) {
- nrotations = new int[1];
- nrotations[0]=0;
+ if(null==nrotations || 0==nrotations.length) {
+ return null;
}
nrotation_index = 0;
nres_number = getNumScreenModeResolutions0(display.getHandle(), screen_idx);
+ if(0==nres_number) {
+ return null;
+ }
nres_index = 0;
nrates = getScreenModeRates0(display.getHandle(), screen_idx, nres_index);
+ if(null==nrates || 0==nrates.length) {
+ return null;
+ }
nrate_index = 0;
nmode_number = 0;
@@ -100,8 +105,8 @@ public class X11Screen extends ScreenImpl {
System.err.println("res "+nres_index); */
int[] res = getScreenModeResolution0(display.getHandle(), screen_idx, nres_index);
- if(null == res) {
- throw new InternalError("null resolution received for res idx "+nres_index+"/"+nres_number);
+ if(null==res || 0==res.length) {
+ return null;
}
if(0>=res[0] || 0>=res[1]) {
throw new InternalError("invalid resolution: "+res[0]+"x"+res[1]+" for res idx "+nres_index+"/"+nres_number);
@@ -143,6 +148,9 @@ public class X11Screen extends ScreenImpl {
}
nrates = getScreenModeRates0(display.getHandle(), screen_idx, nres_index);
+ if(null==nrates || 0==nrates.length) {
+ return null;
+ }
nrate_index = 0;
}
}
@@ -152,19 +160,31 @@ public class X11Screen extends ScreenImpl {
protected ScreenMode getCurrentScreenModeImpl() {
int resNumber = getNumScreenModeResolutions0(display.getHandle(), screen_idx);
+ if(0==resNumber) {
+ return null;
+ }
int resIdx = getCurrentScreenResolutionIndex0(display.getHandle(), screen_idx);
- if(0>resIdx || resIdx>=resNumber) {
- throw new RuntimeException("Invalid resolution index: ! 0 < "+resIdx+" < "+resNumber);
+ if(0>resIdx) {
+ return null;
+ }
+ if(resIdx>=resNumber) {
+ throw new RuntimeException("Invalid resolution index: ! "+resIdx+" < "+resNumber);
}
int[] res = getScreenModeResolution0(display.getHandle(), screen_idx, resIdx);
- if(null == res) {
- throw new InternalError("null resolution received for res idx "+resIdx+"/"+resNumber);
+ if(null==res || 0==res.length) {
+ return null;
}
if(0>=res[0] || 0>=res[1]) {
throw new InternalError("invalid resolution: "+res[0]+"x"+res[1]+" for res idx "+resIdx+"/"+resNumber);
}
int rate = getCurrentScreenRate0(display.getHandle(), screen_idx);
+ if(0>rate) {
+ return null;
+ }
int rot = getCurrentScreenRotation0(display.getHandle(), screen_idx);
+ if(0>rot) {
+ return null;
+ }
int[] props = new int[ScreenModeUtil.NUM_SCREEN_MODE_PROPERTIES_ALL];
int i = 0;
diff --git a/src/newt/native/NewtCommon.c b/src/newt/native/NewtCommon.c
index 353dcb46f..0e3f99282 100644
--- a/src/newt/native/NewtCommon.c
+++ b/src/newt/native/NewtCommon.c
@@ -4,16 +4,41 @@
static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException";
static jclass runtimeExceptionClz=NULL;
+void NewtCommon_FatalError(JNIEnv *env, const char* msg, ...)
+{
+ char buffer[512];
+ va_list ap;
+
+ va_start(ap, msg);
+ vsnprintf(buffer, sizeof(buffer), msg, ap);
+ va_end(ap);
+
+ fprintf(stderr, "%s\n", buffer);
+ (*env)->FatalError(env, buffer);
+}
+
+void NewtCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...)
+{
+ char buffer[512];
+ va_list ap;
+
+ va_start(ap, msg);
+ vsnprintf(buffer, sizeof(buffer), msg, ap);
+ va_end(ap);
+
+ (*env)->ThrowNew(env, runtimeExceptionClz, buffer);
+}
+
void NewtCommon_init(JNIEnv *env) {
if(NULL==runtimeExceptionClz) {
jclass c = (*env)->FindClass(env, ClazzNameRuntimeException);
if(NULL==c) {
- _FatalError(env, "NEWT X11Window: can't find %s", ClazzNameRuntimeException);
+ NewtCommon_FatalError(env, "NEWT X11Window: can't find %s", ClazzNameRuntimeException);
}
runtimeExceptionClz = (jclass)(*env)->NewGlobalRef(env, c);
(*env)->DeleteLocalRef(env, c);
if(NULL==runtimeExceptionClz) {
- _FatalError(env, "NEWT X11Window: can't use %s", ClazzNameRuntimeException);
+ NewtCommon_FatalError(env, "NEWT X11Window: can't use %s", ClazzNameRuntimeException);
}
}
}
@@ -28,15 +53,3 @@ jchar* NewtCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str)
return strChars;
}
-void NewtCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...)
-{
- char buffer[512];
- va_list ap;
-
- va_start(ap, msg);
- vsnprintf(buffer, sizeof(buffer), msg, ap);
- va_end(ap);
-
- (*env)->ThrowNew(env, runtimeExceptionClz, buffer);
-}
-
diff --git a/src/newt/native/NewtCommon.h b/src/newt/native/NewtCommon.h
index 00ce0b643..f5835f7c8 100644
--- a/src/newt/native/NewtCommon.h
+++ b/src/newt/native/NewtCommon.h
@@ -9,6 +9,7 @@ void NewtCommon_init(JNIEnv *env);
jchar* NewtCommon_GetNullTerminatedStringChars(JNIEnv* env, jstring str);
+void NewtCommon_FatalError(JNIEnv *env, const char* msg, ...);
void NewtCommon_throwNewRuntimeException(JNIEnv *env, const char* msg, ...);
#endif
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index de501bfbc..54143f012 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -97,10 +97,11 @@
#include "MouseEvent.h"
#include "InputEvent.h"
#include "KeyEvent.h"
+#include "ScreenMode.h"
#include "NewtCommon.h"
-// #define VERBOSE_ON 1
+#define VERBOSE_ON 1
// #define DEBUG_KEYS 1
#ifdef VERBOSE_ON
@@ -111,19 +112,6 @@
#define STD_PRINT(...) fprintf(stderr, __VA_ARGS__); fflush(stderr)
-static void _FatalError(JNIEnv *env, const char* msg, ...)
-{
- char buffer[512];
- va_list ap;
-
- va_start(ap, msg);
- vsnprintf(buffer, sizeof(buffer), msg, ap);
- va_end(ap);
-
- fprintf(stderr, "%s\n", buffer);
- (*env)->FatalError(env, buffer);
-}
-
static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point";
static const char * const ClazzAnyCstrName = "<init>";
static const char * const ClazzNamePointCstrSignature = "(II)V";
@@ -1146,7 +1134,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getHeight
return (jint)GetSystemMetrics(SM_CYSCREEN);
}
-static int NewtScreen_RotationNative2Newt(int native) {
+static int NewtScreen_RotationNative2Newt(JNIEnv *env, int native) {
int rot;
switch (native) {
case DMDO_DEFAULT:
@@ -1168,18 +1156,18 @@ static int NewtScreen_RotationNative2Newt(int native) {
return rot;
}
-static LPCTSTR NewtScreen_getDisplayDeviceName(int scrn_idx) {
- DISPLAY_DEVICE device;
-
- if( FALSE == EnumDisplayDevices(NULL, scrn_idx, &device, 0) ) {
+static LPCTSTR NewtScreen_getDisplayDeviceName(DISPLAY_DEVICE * device, int scrn_idx) {
+ if( FALSE == EnumDisplayDevices(NULL, scrn_idx, device, 0) ) {
+ DBG_PRINT("*** WindowsWindow: getDisplayDeviceName.EnumDisplayDevices(scrn_idx %d) -> FALSE\n", scrn_idx);
return NULL;
}
- if( 0 == ( device.StateFlags & DISPLAY_DEVICE_ACTIVE ) ) {
+ /* if( 0 == ( device->StateFlags & DISPLAY_DEVICE_ACTIVE ) ) {
+ DBG_PRINT("*** WindowsWindow: !DISPLAY_DEVICE_ACTIVE(scrn_idx %d)\n", scrn_idx);
return NULL;
- }
+ } */
- return device.DeviceName;
+ return device->DeviceName;
}
static HDC NewtScreen_createDisplayDC(LPCTSTR displayDeviceName) {
@@ -1194,10 +1182,12 @@ static HDC NewtScreen_createDisplayDC(LPCTSTR displayDeviceName) {
JNIEXPORT jintArray JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getScreenMode0
(JNIEnv *env, jobject obj, jint scrn_idx, jint mode_idx)
{
+ DISPLAY_DEVICE device;
int prop_num = NUM_SCREEN_MODE_PROPERTIES_ALL;
- LPCTSTR deviceName = NewtScreen_getDisplayDeviceName(scrn_idx);
+ LPCTSTR deviceName = NewtScreen_getDisplayDeviceName(&device, scrn_idx);
if(NULL == deviceName) {
- return null;
+ DBG_PRINT("*** WindowsWindow: getScreenMode.getDisplayDeviceName(scrn_idx %d) -> NULL\n", scrn_idx);
+ return (*env)->NewIntArray(env, 0);
}
int widthmm, heightmm;
@@ -1214,21 +1204,21 @@ JNIEXPORT jintArray JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getS
int devModeID = (int)mode_idx;
- if(devModeID == -1) {
+ if(-1 == devModeID) {
devModeID = ENUM_CURRENT_SETTINGS;
+ } else {
prop_num++; // add 1st extra prop, mode_idx
}
- if (0 == EnumDisplaySettings(deviceName, devModeID, &dm))
- {
- return NULL;
+ if (0 == EnumDisplaySettings(deviceName, devModeID, &dm)) {
+ DBG_PRINT("*** WindowsWindow: getScreenMode.EnumDisplaySettings(mode_idx %d/%d) -> NULL\n", mode_idx, devModeID);
+ return (*env)->NewIntArray(env, 0);
}
-
jint prop[ prop_num ];
int propIndex = 0;
- if(devModeID == -1) {
+ if(-1 < devModeID ) {
prop[propIndex++] = mode_idx;
}
prop[propIndex++] = 0; // set later for verification of iterator
@@ -1238,8 +1228,8 @@ JNIEXPORT jintArray JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getS
prop[propIndex++] = widthmm;
prop[propIndex++] = heightmm;
prop[propIndex++] = dm.dmDisplayFrequency;
- prop[propIndex++] = NewtScreen_RotationNative2Newt(dm.dmDisplayOrientation);
- props[propIndex - NUM_SCREEN_MODE_PROPERTIES_ALL] = propIndex ; // count
+ prop[propIndex++] = NewtScreen_RotationNative2Newt(env, dm.dmDisplayOrientation);
+ prop[propIndex - NUM_SCREEN_MODE_PROPERTIES_ALL] = propIndex ; // count
jintArray properties = (*env)->NewIntArray(env, prop_num);
if (properties == NULL) {
@@ -1258,9 +1248,11 @@ JNIEXPORT jintArray JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_getS
JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_setScreenMode0
(JNIEnv *env, jobject object, jint scrn_idx, jint width, jint height, jint bits, jint rate, jint rot)
{
- LPCTSTR deviceName = NewtScreen_getDisplayDeviceName(scrn_idx);
+ DISPLAY_DEVICE device;
+ LPCTSTR deviceName = NewtScreen_getDisplayDeviceName(&device, scrn_idx);
if(NULL == deviceName) {
- return null;
+ DBG_PRINT("*** WindowsWindow: setScreenMode.getDisplayDeviceName(scrn_idx %d) -> NULL\n", scrn_idx);
+ return JNI_FALSE;
}
DEVMODE dm;
@@ -1269,6 +1261,7 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_setSc
dm.dmSize = sizeof(dm);
if (0 == EnumDisplaySettings(deviceName, ENUM_CURRENT_SETTINGS, &dm)) {
+ DBG_PRINT("*** WindowsWindow: setScreenMode.EnumDisplaySettings(ENUM_CURRENT_SETTINGS) -> NULL\n");
return JNI_FALSE;
}
@@ -1316,7 +1309,7 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsScreen_setSc
break;
default:
//requested rotation not available
- return SCREEN_MODE_ERROR;
+ NewtCommon_throwNewRuntimeException(env, "invalid rotation: %d", rotation);
break;
}
/** swap width and height if changing from vertical to horizantal
@@ -1347,16 +1340,16 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_windows_WindowsWindow_initI
if(NULL==pointClz) {
jclass c = (*env)->FindClass(env, ClazzNamePoint);
if(NULL==c) {
- _FatalError(env, "NEWT WindowsWindows: can't find %s", ClazzNamePoint);
+ NewtCommon_FatalError(env, "NEWT WindowsWindows: can't find %s", ClazzNamePoint);
}
pointClz = (jclass)(*env)->NewGlobalRef(env, c);
(*env)->DeleteLocalRef(env, c);
if(NULL==pointClz) {
- _FatalError(env, "NEWT WindowsWindows: can't use %s", ClazzNamePoint);
+ NewtCommon_FatalError(env, "NEWT WindowsWindows: can't use %s", ClazzNamePoint);
}
pointCstr = (*env)->GetMethodID(env, pointClz, ClazzAnyCstrName, ClazzNamePointCstrSignature);
if(NULL==pointCstr) {
- _FatalError(env, "NEWT WindowsWindows: can't fetch %s.%s %s",
+ NewtCommon_FatalError(env, "NEWT WindowsWindows: can't fetch %s.%s %s",
ClazzNamePoint, ClazzAnyCstrName, ClazzNamePointCstrSignature);
}
}
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index f105b0889..025c0e500 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -137,19 +137,6 @@ static jint X11KeySym2NewtVKey(KeySym keySym) {
return keySym;
}
-static void _FatalError(JNIEnv *env, const char* msg, ...)
-{
- char buffer[512];
- va_list ap;
-
- va_start(ap, msg);
- vsnprintf(buffer, sizeof(buffer), msg, ap);
- va_end(ap);
-
- fprintf(stderr, "%s\n", buffer);
- (*env)->FatalError(env, buffer);
-}
-
static const char * const ClazzNameNewtWindow = "com/jogamp/newt/Window";
static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point";
@@ -235,28 +222,28 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Display_initIDs0
if(NULL==newtWindowClz) {
c = (*env)->FindClass(env, ClazzNameNewtWindow);
if(NULL==c) {
- _FatalError(env, "NEWT X11Window: can't find %s", ClazzNameNewtWindow);
+ NewtCommon_FatalError(env, "NEWT X11Window: can't find %s", ClazzNameNewtWindow);
}
newtWindowClz = (jclass)(*env)->NewGlobalRef(env, c);
(*env)->DeleteLocalRef(env, c);
if(NULL==newtWindowClz) {
- _FatalError(env, "NEWT X11Window: can't use %s", ClazzNameNewtWindow);
+ NewtCommon_FatalError(env, "NEWT X11Window: can't use %s", ClazzNameNewtWindow);
}
}
if(NULL==pointClz) {
c = (*env)->FindClass(env, ClazzNamePoint);
if(NULL==c) {
- _FatalError(env, "NEWT X11Windows: can't find %s", ClazzNamePoint);
+ NewtCommon_FatalError(env, "NEWT X11Windows: can't find %s", ClazzNamePoint);
}
pointClz = (jclass)(*env)->NewGlobalRef(env, c);
(*env)->DeleteLocalRef(env, c);
if(NULL==pointClz) {
- _FatalError(env, "NEWT X11Windows: can't use %s", ClazzNamePoint);
+ NewtCommon_FatalError(env, "NEWT X11Windows: can't use %s", ClazzNamePoint);
}
pointCstr = (*env)->GetMethodID(env, pointClz, ClazzAnyCstrName, ClazzNamePointCstrSignature);
if(NULL==pointCstr) {
- _FatalError(env, "NEWT X11Windows: can't fetch %s.%s %s",
+ NewtCommon_FatalError(env, "NEWT X11Windows: can't fetch %s.%s %s",
ClazzNamePoint, ClazzAnyCstrName, ClazzNamePointCstrSignature);
}
}
@@ -276,7 +263,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Display_CompleteDisplay0
jlong windowDeleteAtom;
if(dpy==NULL) {
- _FatalError(env, "invalid display connection..");
+ NewtCommon_FatalError(env, "invalid display connection..");
}
javaObjectAtom = (jlong) XInternAtom(dpy, "JOGL_JAVA_OBJECT", False);
@@ -328,7 +315,7 @@ static void setJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, jlon
{
jobject test = (jobject) getPtrOut32Long(jogl_java_object_data);
if( ! (jwindow==test) ) {
- _FatalError(env, "Internal Error .. Encoded Window ref not the same %p != %p !", jwindow, test);
+ NewtCommon_FatalError(env, "Internal Error .. Encoded Window ref not the same %p != %p !", jwindow, test);
}
}
@@ -789,7 +776,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_GetScreen0
DBG_PRINT("X11: X11Screen_GetScreen0 dpy %p START\n", dpy);
if(dpy==NULL) {
- _FatalError(env, "invalid display connection..");
+ NewtCommon_FatalError(env, "invalid display connection..");
}
scrn = ScreenOfDisplay(dpy,screen_index);
@@ -865,7 +852,9 @@ JNIEXPORT jintArray JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getAvailable
int major, minor;
if(False == NewtScreen_getRANDRVersion(dpy, &major, &minor)) {
+ DBG_PRINT(stderr, "Java_com_jogamp_newt_impl_x11_X11Screen_getAvailableScreenModeRotations0: RANDR not available\n");
fprintf(stderr, "RANDR not available\n");
+ return (*env)->NewIntArray(env, 0);
}
rotations_supported = XRRRotations (dpy, (int)scrn_idx, &cur_rotation);
@@ -887,8 +876,7 @@ JNIEXPORT jintArray JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getAvailable
if(num_rotations>0) {
properties = (*env)->NewIntArray(env, num_rotations);
- if (properties == NULL)
- {
+ if (properties == NULL) {
NewtCommon_throwNewRuntimeException(env, "Could not allocate int array of size %d", num_rotations);
}
@@ -911,6 +899,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getNumScreenModeR
Window root = RootWindow(dpy, (int)scrn_idx);
if(False == NewtScreen_hasRANDR(dpy)) {
+ DBG_PRINT(stderr, "Java_com_jogamp_newt_impl_x11_X11Screen_getNumScreenModeResolutions0: RANDR not available\n");
return 0;
}
@@ -932,7 +921,8 @@ JNIEXPORT jintArray JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getScreenMod
Window root = RootWindow(dpy, (int)scrn_idx);
if(False == NewtScreen_hasRANDR(dpy)) {
- return NULL;
+ DBG_PRINT(stderr, "Java_com_jogamp_newt_impl_x11_X11Screen_getScreenModeResolution0: RANDR not available\n");
+ return (*env)->NewIntArray(env, 0);
}
int num_sizes;
@@ -974,7 +964,8 @@ JNIEXPORT jintArray JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getScreenMod
Window root = RootWindow(dpy, (int)scrn_idx);
if(False == NewtScreen_hasRANDR(dpy)) {
- return NULL;
+ DBG_PRINT(stderr, "Java_com_jogamp_newt_impl_x11_X11Screen_getScreenModeRates0: RANDR not available\n");
+ return (*env)->NewIntArray(env, 0);
}
int num_sizes;
@@ -1017,6 +1008,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getCurrentScreenR
Window root = RootWindow(dpy, (int)scrn_idx);
if(False == NewtScreen_hasRANDR(dpy)) {
+ DBG_PRINT(stderr, "Java_com_jogamp_newt_impl_x11_X11Screen_getCurrentScreenRate0: RANDR not available\n");
return -1;
}
@@ -1042,6 +1034,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getCurrentScreenR
Window root = RootWindow(dpy, (int)scrn_idx);
if(False == NewtScreen_hasRANDR(dpy)) {
+ DBG_PRINT(stderr, "Java_com_jogamp_newt_impl_x11_X11Screen_getCurrentScreenRotation0: RANDR not available\n");
return -1;
}
@@ -1070,6 +1063,7 @@ JNIEXPORT jint JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_getCurrentScreenR
Window root = RootWindow(dpy, (int)scrn_idx);
if(False == NewtScreen_hasRANDR(dpy)) {
+ DBG_PRINT(stderr, "Java_com_jogamp_newt_impl_x11_X11Screen_getCurrentScreenResolutionIndex0: RANDR not available\n");
return -1;
}
@@ -1099,6 +1093,7 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_setCurrentScr
Window root = RootWindow(dpy, (int)screen_idx);
if(False == NewtScreen_hasRANDR(dpy)) {
+ DBG_PRINT(stderr, "Java_com_jogamp_newt_impl_x11_X11Screen_setCurrentScreenMode0: RANDR not available\n");
return JNI_FALSE;
}
@@ -1170,6 +1165,8 @@ JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_impl_x11_X11Screen_setCurrentScr
//free
XRRFreeScreenConfigInfo(conf);
XSync(dpy, False);
+
+ return JNI_TRUE;
}
/**
@@ -1248,7 +1245,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_x11_X11Window_CreateWindow0
Atom wm_delete_atom;
if(dpy==NULL) {
- _FatalError(env, "invalid display connection..");
+ NewtCommon_FatalError(env, "invalid display connection..");
}
if(visualID<0) {
@@ -1263,7 +1260,7 @@ JNIEXPORT jlong JNICALL Java_com_jogamp_newt_impl_x11_X11Window_CreateWindow0
windowParent = XRootWindowOfScreen(scrn);
}
if( XRootWindowOfScreen(scrn) != XRootWindow(dpy, scrn_idx) ) {
- _FatalError(env, "XRoot Malfunction: %p != %p"+XRootWindowOfScreen(scrn), XRootWindow(dpy, scrn_idx));
+ NewtCommon_FatalError(env, "XRoot Malfunction: %p != %p"+XRootWindowOfScreen(scrn), XRootWindow(dpy, scrn_idx));
}
DBG_PRINT( "X11: CreateWindow dpy %p, parent %p, %x/%d %dx%d, undeco %d\n",
(void*)dpy, (void*)windowParent, x, y, width, height, undecorated);
@@ -1364,7 +1361,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Window_CloseWindow0
jobject jwindow;
if(dpy==NULL) {
- _FatalError(env, "invalid display connection..");
+ NewtCommon_FatalError(env, "invalid display connection..");
}
DBG_PRINT( "X11: CloseWindow START dpy %p, win %p\n", (void*)dpy, (void*)w);
@@ -1426,7 +1423,7 @@ JNIEXPORT void JNICALL Java_com_jogamp_newt_impl_x11_X11Window_setVisible0
DBG_PRINT( "X11: setVisible0 vis %d\n", visible);
if(dpy==NULL) {
- _FatalError(env, "invalid display connection..");
+ NewtCommon_FatalError(env, "invalid display connection..");
}
if(visible==JNI_TRUE) {