Mercurial > dwindows
comparison android/dw.cpp @ 2503:1c2a79313b04
Android: Implment dw_window_hide/show(). Set the initial visibility to GONE.
The window won't be laid out until dw_window_show() is called on the window.
Put the dwindowsInit() hack back in... keep hoping some of these changes
will fix it, but it persists. HTML mostly works, but getting cache miss?
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 06 May 2021 10:39:55 +0000 |
parents | b6319aed3298 |
children | a149dabf6a1f |
comparison
equal
deleted
inserted
replaced
2502:b6319aed3298 | 2503:1c2a79313b04 |
---|---|
88 Java_org_dbsoft_dwindows_DWindows_dwindowsInit(JNIEnv* env, jobject obj, jstring path) | 88 Java_org_dbsoft_dwindows_DWindows_dwindowsInit(JNIEnv* env, jobject obj, jstring path) |
89 { | 89 { |
90 static int runcount = 0; | 90 static int runcount = 0; |
91 | 91 |
92 /* Safety check to prevent multiple initializations... */ | 92 /* Safety check to prevent multiple initializations... */ |
93 #if defined(__arm__) || defined(__aarch64__) | |
93 if(runcount == 0) | 94 if(runcount == 0) |
95 #else | |
96 if(runcount == 1) | |
97 #endif | |
94 { | 98 { |
95 char *arg = strdup(env->GetStringUTFChars((jstring) path, NULL)); | 99 char *arg = strdup(env->GetStringUTFChars((jstring) path, NULL)); |
96 | 100 |
97 /* Save our class object pointer for later */ | 101 /* Save our class object pointer for later */ |
98 _dw_obj = env->NewGlobalRef(obj); | 102 _dw_obj = env->NewGlobalRef(obj); |
3262 */ | 3266 */ |
3263 void API dw_window_set_pointer(HWND handle, int pointertype) | 3267 void API dw_window_set_pointer(HWND handle, int pointertype) |
3264 { | 3268 { |
3265 } | 3269 } |
3266 | 3270 |
3271 int _dw_window_hide_show(HWND handle, int state) | |
3272 { | |
3273 JNIEnv *env; | |
3274 | |
3275 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key))) | |
3276 { | |
3277 // First get the class that contains the method you need to call | |
3278 jclass clazz = _dw_find_class(env, DW_CLASS_NAME); | |
3279 // Get the method that you want to call | |
3280 jmethodID windowHideShow = env->GetMethodID(clazz, "windowHideShow", | |
3281 "(Landroid/view/View;I)V"); | |
3282 // Call the method on the object | |
3283 env->CallVoidMethod(_dw_obj, windowHideShow, handle, state); | |
3284 return DW_ERROR_NONE; | |
3285 } | |
3286 return DW_ERROR_GENERAL; | |
3287 } | |
3288 | |
3267 /* | 3289 /* |
3268 * Makes the window visible. | 3290 * Makes the window visible. |
3269 * Parameters: | 3291 * Parameters: |
3270 * handle: The window handle to make visible. | 3292 * handle: The window handle to make visible. |
3271 * Returns: | 3293 * Returns: |
3272 * DW_ERROR_NONE (0) on success. | 3294 * DW_ERROR_NONE (0) on success. |
3273 */ | 3295 */ |
3274 int API dw_window_show(HWND handle) | 3296 int API dw_window_show(HWND handle) |
3275 { | 3297 { |
3276 return DW_ERROR_GENERAL; | 3298 return _dw_window_hide_show(handle, TRUE); |
3277 } | 3299 } |
3278 | 3300 |
3279 /* | 3301 /* |
3280 * Makes the window invisible. | 3302 * Makes the window invisible. |
3281 * Parameters: | 3303 * Parameters: |
3283 * Returns: | 3305 * Returns: |
3284 * DW_ERROR_NONE (0) on success. | 3306 * DW_ERROR_NONE (0) on success. |
3285 */ | 3307 */ |
3286 int API dw_window_hide(HWND handle) | 3308 int API dw_window_hide(HWND handle) |
3287 { | 3309 { |
3288 return DW_ERROR_GENERAL; | 3310 return _dw_window_hide_show(handle, FALSE); |
3289 } | 3311 } |
3290 | 3312 |
3291 /* | 3313 /* |
3292 * Sets the colors used by a specified window (widget) handle. | 3314 * Sets the colors used by a specified window (widget) handle. |
3293 * Parameters: | 3315 * Parameters: |