diff android/dw.cpp @ 2495:5664c91d03fb

Android: Attempts to sort out the various issues... still not working but... Wanted to commit so I can change locations later tonight.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 03 May 2021 01:17:40 +0000
parents b3e28eed0e50
children 3bf2f08fdc45
line wrap: on
line diff
--- a/android/dw.cpp	Sun May 02 10:46:21 2021 +0000
+++ b/android/dw.cpp	Mon May 03 01:17:40 2021 +0000
@@ -89,8 +89,15 @@
 {
     static int runcount = 0;
 
-    /* Safety check to prevent multiple initializations */
+    /* Safety check to prevent multiple initializations...
+     * In the simulator I get multiple calls, and code only works on the second call.
+     * On actual hardware we only get called once... so this works around that.
+     */
+#if defined(__arm__) || defined(__aarch64__)
+    if(runcount == 0)
+#else
     if(runcount == 1)
+#endif
     {
         char *arg = strdup(env->GetStringUTFChars((jstring) path, NULL));
 
@@ -303,9 +310,9 @@
             case 15:
             {
                 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction;
-                int pageid = DW_POINTER_TO_INT(params[3]);
-
-                return switchpagefunc(handler->window, pageid, handler->data);
+                unsigned long pageID = DW_POINTER_TO_INT(params[3]);
+
+                return switchpagefunc(handler->window, pageID, handler->data);
             }
                 /* Tree expand event */
             case 16:
@@ -367,6 +374,15 @@
     _dw_event_handler(obj1, params, message);
 }
 
+/* A more simple method for quicker calls */
+JNIEXPORT void JNICALL
+Java_org_dbsoft_dwindows_DWindows_eventHandlerNotebook(JNIEnv* env, jobject obj, jobject obj1, jint message, jlong pageID) {
+    void *params[8] = { NULL };
+
+    params[3] = DW_INT_TO_POINTER(pageID);
+    _dw_event_handler(obj1, params, message);
+}
+
 /* Handler for Timer events */
 JNIEXPORT jint JNICALL
 Java_org_dbsoft_dwindows_DWindows_eventHandlerTimer(JNIEnv* env, jobject obj, jlong sigfunc, jlong data) {
@@ -814,9 +830,10 @@
  * Returns:
  *       A handle to a scrollbox or NULL on failure.
  */
-HWND API dw_scrollbox_new( int type, int pad )
-{
-    return 0;
+HWND API dw_scrollbox_new(int type, int pad)
+{
+    /* TODO: Just create a normal box for now */
+    return dw_box_new(type, pad);
 }
 
 /*