Tweaked linux native isActive() and added printfDebugJava to print debug from native through Sys.log
This commit is contained in:
parent
1e7a67673d
commit
5ee6565bb5
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue