Mercurial > controlcenter
changeset 84:5d11b526472e
Android: Avoid calling dw_main_sleep() and dw_main_iteration() during expose
callbacks. Expose callbacks are the only ones that run on the UI thread...
due to Android implementation restrictions. Therefore calling any blocking
functions such as dw_mutex_lock() will cause a message loop to be run, via
dw_main_sleep() or dw_main_iteration(), these use hacky stuctured exception
handling methods to return on Android, so to be safe avoid it completely.
Call dw_mutex_trylock() instead, and if it can't lock the mutex... call
dw_render_redraw() to trigger a new expose event.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Thu, 16 Dec 2021 09:20:24 -0600 |
parents | 4ceb8271a180 |
children | c9449a0e11c5 |
files | cc.c cc.h |
diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/cc.c Tue Aug 31 14:13:03 2021 -0500 +++ b/cc.c Thu Dec 16 09:20:24 2021 -0600 @@ -714,11 +714,14 @@ if(inst) { - dw_mutex_lock(hMtx); + if(dw_mutex_trylock(hMtx) == DW_ERROR_NONE) + { + inst->Draw(inst); - inst->Draw(inst); - - dw_mutex_unlock(hMtx); + dw_mutex_unlock(hMtx); + } + else + dw_render_redraw(hwnd); } return TRUE; }
--- a/cc.h Tue Aug 31 14:13:03 2021 -0500 +++ b/cc.h Thu Dec 16 09:20:24 2021 -0600 @@ -39,9 +39,9 @@ void(*Draw)(struct _instance *); void(*Create)(struct _instance *, HWND owner); void(*Update)(struct _instance *, HWND owner); - unsigned Flags; + unsigned long Flags; int page; - int width, height, vsize; + unsigned long width, height, vsize; void *custom, *internal; HWND hwnd, other, *hwndDraw; HPIXMAP *pixmap;