Tweaked linux native isActive() and added printfDebugJava to print debug from native through Sys.log

This commit is contained in:
Elias Naur 2004-12-11 19:44:53 +00:00
parent 1e7a67673d
commit 5ee6565bb5
3 changed files with 18 additions and 1 deletions

View File

@ -70,6 +70,22 @@ void setDebugEnabled(bool enable) {
debug = enable;
}
void printfDebugJava(JNIEnv *env, const char *format, ...) {
#define BUFFER_SIZE 4000
static char buffer[BUFFER_SIZE];
va_list ap;
va_start(ap, format);
if (isDebugEnabled()) {
vsnprintf(buffer, BUFFER_SIZE, format, ap);
buffer[BUFFER_SIZE - 1] = '\0';
jstring str = (*env)->NewStringUTF(env, buffer);
jclass org_lwjgl_Sys_class = (*env)->FindClass(env, "org/lwjgl/Sys");
jmethodID log_method = (*env)->GetMethodID(env, org_lwjgl_Sys_class, "log", "(Ljava/lang/String;)V");
(*env)->CallStaticVoidMethod(env, org_lwjgl_Sys_class, log_method, str);
}
va_end(ap);
}
void printfDebug(const char *format, ...) {
va_list ap;
va_start(ap, format);

View File

@ -130,6 +130,7 @@ extern void throwException(JNIEnv *env, const char *msg);
extern void throwOpenALException(JNIEnv * env, const char * err);
extern void throwFMODException(JNIEnv * env, const char * err);
extern void setDebugEnabled(bool enable);
extern void printfDebugJava(JNIEnv *env, const char *format, ...);
extern void printfDebug(const char *format, ...);
extern bool getBooleanProperty(JNIEnv *env, const char* propertyName);
extern char * GetStringNativeChars(JNIEnv *env, jstring jstr);

View File

@ -785,7 +785,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isCloseRequested
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_LinuxDisplay_isActive
(JNIEnv *env, jobject this) {
return focused ? JNI_TRUE : JNI_FALSE;
return focused || isLegacyFullscreen() ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxDisplay_setVSyncEnabled