comparison android/dw.cpp @ 2484:cb5b67154399

Android: The DWindows class should be org.dbsoft.dwindows, remove dwtest. Not entirely sure how to modify the package for applications yet.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 26 Apr 2021 21:48:54 +0000
parents 9f7af6d8c6a4
children cec43818bd3e
comparison
equal deleted inserted replaced
2483:9f7af6d8c6a4 2484:cb5b67154399
32 32
33 #ifdef __cplusplus 33 #ifdef __cplusplus
34 extern "C" { 34 extern "C" {
35 #endif 35 #endif
36 36
37 #define DW_CLASS_NAME "org/dbsoft/dwindows/dwtest/DWindows" 37 #define DW_CLASS_NAME "org/dbsoft/dwindows/DWindows"
38 38
39 static pthread_key_t _dw_env_key; 39 static pthread_key_t _dw_env_key;
40 static HEV _dw_main_event; 40 static HEV _dw_main_event;
41 static JavaVM *_dw_jvm; 41 static JavaVM *_dw_jvm;
42 static jobject _dw_obj; 42 static jobject _dw_obj;
83 * to be called and return. 83 * to be called and return.
84 * Parameters: 84 * Parameters:
85 * path: The path to the Android app. 85 * path: The path to the Android app.
86 */ 86 */
87 JNIEXPORT jstring JNICALL 87 JNIEXPORT jstring JNICALL
88 Java_org_dbsoft_dwindows_dwtest_DWindows_dwindowsInit(JNIEnv* env, jobject obj, jstring path) 88 Java_org_dbsoft_dwindows_DWindows_dwindowsInit(JNIEnv* env, jobject obj, jstring path)
89 { 89 {
90 char *arg = strdup(env->GetStringUTFChars((jstring) path, NULL)); 90 char *arg = strdup(env->GetStringUTFChars((jstring) path, NULL));
91 91
92 /* Save our class object pointer for later */ 92 /* Save our class object pointer for later */
93 _dw_obj = env->NewGlobalRef(obj); 93 _dw_obj = env->NewGlobalRef(obj);
339 339
340 /* 340 /*
341 * Entry location for all event handlers from the Android UI 341 * Entry location for all event handlers from the Android UI
342 */ 342 */
343 JNIEXPORT jint JNICALL 343 JNIEXPORT jint JNICALL
344 Java_org_dbsoft_dwindows_dwtest_DWindows_eventHandler(JNIEnv* env, jobject obj, jobject obj1, jobject obj2, 344 Java_org_dbsoft_dwindows_DWindows_eventHandler(JNIEnv* env, jobject obj, jobject obj1, jobject obj2,
345 jint message, jstring str1, jstring str2, 345 jint message, jstring str1, jstring str2,
346 jint int1, jint int2, jint int3, jint int4) { 346 jint int1, jint int2, jint int3, jint int4) {
347 const char *utf81 = str1 ? env->GetStringUTFChars(str1, NULL) : NULL; 347 const char *utf81 = str1 ? env->GetStringUTFChars(str1, NULL) : NULL;
348 const char *utf82 = str2 ? env->GetStringUTFChars(str2, NULL) : NULL; 348 const char *utf82 = str2 ? env->GetStringUTFChars(str2, NULL) : NULL;
349 void *params[8] = { (void *)obj2, (void *)utf81, (void *)utf82, 349 void *params[8] = { (void *)obj2, (void *)utf81, (void *)utf82,
353 return _dw_event_handler(obj1, params, message); 353 return _dw_event_handler(obj1, params, message);
354 } 354 }
355 355
356 /* A more simple method for quicker calls */ 356 /* A more simple method for quicker calls */
357 JNIEXPORT void JNICALL 357 JNIEXPORT void JNICALL
358 Java_org_dbsoft_dwindows_dwtest_DWindows_eventHandlerSimple(JNIEnv* env, jobject obj, jobject obj1, jint message) { 358 Java_org_dbsoft_dwindows_DWindows_eventHandlerSimple(JNIEnv* env, jobject obj, jobject obj1, jint message) {
359 void *params[8] = { NULL }; 359 void *params[8] = { NULL };
360 360
361 _dw_event_handler(obj1, params, message); 361 _dw_event_handler(obj1, params, message);
362 } 362 }
363 363