I'm porting a program that uses JNI to use Panama instead. This program uses OpenGL to draw onto a Canvas
object. I can port the Windows and OpenGL calls to use Panama, but the problem is I need to get the HWND of the Canvas I want to draw to. The C code looks like this:
JNIEXPORT void JNICALL Java_somepackage_SomeCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
{
JAWT awt;
awt.version = JAWT_VERSION_1_4;
JAWT_GetAWT(env, &awt);
JAWT_DrawingSurface* ds = awt.GetDrawingSurface(env, canvas);
ds->Lock(ds);
JAWT_DrawingSurfaceInfo* dsi = ds->GetDrawingSurfaceInfo(ds);
JAWT_Win32DrawingSurfaceInfo* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
HWND hwnd = dsi_win->hwnd;
...
}
I can't call JAWT_GetAWT
from Panama though, because it needs a JNIEnv
argument, which is only available in JNI calls. How do I get the HWND
(or JAWT_DrawingSurface
) of the Canvas instead?
I've tried looking online for any sort of API I could use to do this, but I haven't found anything. I'm hoping someone here might know.