changeset 2796:0c534743b7a9

Android: Allow passing a menu window handle to dw_window_destroy(). Internally if it is a menu, instead of following the Window/View code path, instead pass the handle to menuDestroy().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 15 Jul 2022 23:58:19 +0000
parents 5c61aba17b69
children 62837ceeec46
files android/DWindows.kt android/dw.cpp
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/android/DWindows.kt	Fri Jul 15 11:50:09 2022 +0000
+++ b/android/DWindows.kt	Fri Jul 15 23:58:19 2022 +0000
@@ -3198,10 +3198,13 @@
         }
     }
 
-    fun windowDestroy(window: View): Int {
+    fun windowDestroy(window: Any): Int {
         var retval: Int = 1 // DW_ERROR_GENERAL
 
-        if(windowLayout != null) {
+        if(window is DWMenu) {
+            menuDestroy(window as DWMenu)
+            retval = 0 // DW_ERROR_NONE
+        } else if(windowLayout != null && window is View) {
             waitOnUiThread {
                 val adapter: DWTabViewPagerAdapter = windowLayout!!.adapter as DWTabViewPagerAdapter
                 val index = adapter.viewList.indexOf(window)
--- a/android/dw.cpp	Fri Jul 15 11:50:09 2022 +0000
+++ b/android/dw.cpp	Fri Jul 15 23:58:19 2022 +0000
@@ -5963,7 +5963,7 @@
         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");
+                                                   "(Ljava/lang/Object;)I");
         // Call the method on the object
         retval = env->CallIntMethod(_dw_obj, windowDestroy, handle);
         _dw_jni_check_exception(env);