diff android/DWindows.kt @ 2483:9f7af6d8c6a4

Android: Fix signal handlers so they actually work. Create Weak Global References for the returned jobject handles. The jobject references passed from the event handler will be local references so we need to use IsSameObject() to compare the handles. Also create a more simple entrypoint to reduce calls.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 26 Apr 2021 21:08:02 +0000
parents 4888503c3e3e
children cb5b67154399
line wrap: on
line diff
--- a/android/DWindows.kt	Mon Apr 26 18:34:51 2021 +0000
+++ b/android/DWindows.kt	Mon Apr 26 21:08:02 2021 +0000
@@ -131,7 +131,7 @@
         val button = Button(this)
         button.text = text
         button.setOnClickListener {
-            eventHandler(button, null, 8, null, null, 0, 0, 0, 0)
+            eventHandlerSimple(button, 8)
         }
         return button
     }
@@ -151,7 +151,7 @@
         val radiobutton = RadioButton(this)
         radiobutton.text = text
         radiobutton.setOnClickListener {
-            eventHandler(radiobutton, null, 8, null, null, 0, 0, 0, 0)
+            eventHandlerSimple(radiobutton, 8)
         }
         return radiobutton
     }
@@ -161,7 +161,7 @@
         val checkbox = CheckBox(this)
         checkbox.text = text
         checkbox.setOnClickListener {
-            eventHandler(checkbox, null, 8, null, null, 0, 0, 0, 0)
+            eventHandlerSimple(checkbox, 8)
         }
         return checkbox
     }
@@ -184,6 +184,7 @@
      */
     external fun dwindowsInit(dataDir: String): String
     external fun eventHandler(obj1: View, obj2: View?, message: Int, str1: String?, str2: String?, int1: Int, int2: Int, int3: Int, int4: Int): Int
+    external fun eventHandlerSimple(obj1: View, message: Int)
 
     companion object
     {