Mercurial > dwindows
diff android/dw.cpp @ 2668:917f2d1f9cae
Android: Implement dw_window_destroy() and try to add a back button to
secondary windows that will call windowDestroy() on them when pressed.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 17 Oct 2021 00:34:16 +0000 |
parents | ad6fc7f1a9af |
children | e3a95940c18f |
line wrap: on
line diff
--- a/android/dw.cpp Fri Oct 15 23:22:23 2021 +0000 +++ b/android/dw.cpp Sun Oct 17 00:34:16 2021 +0000 @@ -5501,7 +5501,21 @@ */ int API dw_window_destroy(HWND handle) { - return DW_ERROR_GENERAL; + JNIEnv *env; + int retval = DW_ERROR_GENERAL; + + if(handle && (env = (JNIEnv *)pthread_getspecific(_dw_env_key))) + { + // First get the class that contains the method you need to call + jclass clazz = _dw_find_class(env, DW_CLASS_NAME); + // Get the method that you want to call + jmethodID windowDestroy = env->GetMethodID(clazz, "windowDestroy", + "(Landroid/view/View;)I"); + // Call the method on the object + retval = env->CallIntMethod(_dw_obj, windowDestroy, handle); + _dw_jni_check_exception(env); + } + return retval; } /*