aboutsummaryrefslogtreecommitdiffstats
path: root/CNativeCode/OpenGL_Win32_jawt.c
diff options
context:
space:
mode:
Diffstat (limited to 'CNativeCode/OpenGL_Win32_jawt.c')
-rwxr-xr-xCNativeCode/OpenGL_Win32_jawt.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/CNativeCode/OpenGL_Win32_jawt.c b/CNativeCode/OpenGL_Win32_jawt.c
index 5eefec3..2f69ad7 100755
--- a/CNativeCode/OpenGL_Win32_jawt.c
+++ b/CNativeCode/OpenGL_Win32_jawt.c
@@ -92,6 +92,71 @@ Java_gl4java_GLContext_hasJAWTSurfaceChanged( JNIEnv *env, jobject obj,
}
JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_lockJAWT( JNIEnv *env, jobject obj,
+ jobject canvas,
+ jlong thisWin, jboolean verbose
+ )
+{
+ jboolean ret = JNI_TRUE;
+ JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
+
+ if(pData==0)
+ {
+ fprintf(stderr, "GL4Java ERROR: LockAWT NO JAWT Holder exist ! (pData=%p, thisWin=%lX) ...\n", pData, (long)thisWin);
+ fflush(stderr);
+ return JNI_FALSE;
+ }
+
+ if(jawt_open(env, canvas, pData, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ fprintf(stderr,"\nGL4Java ERROR: LockAWT could not open JAWT reference!\n");
+ fflush(stderr);
+ ret=JNI_FALSE;
+ jawt_close_unlock(env, pData, JNI_FALSE);
+ return ret;
+ }
+
+ if(jawt_lock(env, pData, JNI_FALSE, verbose)==JNI_FALSE ||
+ pData->result==JNI_FALSE
+ )
+ {
+ /* this can happen:
+ if ( (pJData->lock & JAWT_LOCK_SURFACE_CHANGED) != 0 )
+
+ In this case, we need a new GLXContext ...
+
+ This has to be queried by the java class,
+ while using the native method hasJAWTSurfaceChanged !
+ */
+ if(verbose)
+ {
+ fprintf(stderr,"\nGL4Java ERROR: LockAWT could not lock JAWT reference!\n");
+ fflush(stderr);
+ }
+ ret=JNI_FALSE;
+ jawt_close_unlock(env, pData, JNI_FALSE);
+ return ret;
+ }
+ return ret;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_gl4java_GLContext_unlockJAWT( JNIEnv *env, jobject obj,
+ jlong thisWin, jboolean verbose
+ )
+{
+ jboolean ret = JNI_TRUE;
+ JAWTDataHolder * pData = (JAWTDataHolder *) ( (PointerHolder) thisWin );
+
+ jawt_close_unlock(env, pData, verbose);
+
+ return ret;
+}
+
+
+JNIEXPORT jboolean JNICALL
Java_gl4java_GLContext_openOpenGLNative( JNIEnv *env, jobject obj,
jobject canvas)
{
@@ -489,7 +554,7 @@ Java_gl4java_GLContext_gljFreeNative( JNIEnv *env, jobject obj,
}
if(pData!=NULL)
- jawt_close_unlock(env, pData, verbose);
+ jawt_close_unlock(env, pData, JNI_FALSE);
return ret;
}
@@ -642,7 +707,7 @@ Java_gl4java_GLContext_gljDestroyNative( JNIEnv *env, jobject obj,
gc = 0;
thisWin = 0;
- jawt_free_close_unlock(env, &pData, verbose);
+ jawt_free_close_unlock(env, &pData, JNI_FALSE);
pData=0;
ret=JNI_TRUE; // force ..