From 5434aec0531db200921e1eea81b6d8763f28f9b7 Mon Sep 17 00:00:00 2001 From: xianjimli Date: Thu, 2 May 2019 18:46:45 +0800 Subject: [PATCH] modify for awtk-web-js --- docs/changes.md | 3 +++ src/base/canvas.c | 2 +- src/base/idle_info.c | 8 ++++++++ src/base/timer_info.c | 8 ++++++++ src/tkc/emitter.c | 8 ++++++++ src/tkc/object_default.c | 1 - 6 files changed, 28 insertions(+), 2 deletions(-) mode change 100755 => 100644 src/tkc/emitter.c diff --git a/docs/changes.md b/docs/changes.md index 908286075..16cb069fd 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -1,4 +1,7 @@ # 最新动态 +* 2019/05/02 + * 支持AWTK-JS的开发的应用程序在WEB上运行。 + * 2019/05/01 * 修改image base函数名在jerryscript中引起的问题。 diff --git a/src/base/canvas.c b/src/base/canvas.c index 9eed92452..dda5d6ef1 100644 --- a/src/base/canvas.c +++ b/src/base/canvas.c @@ -123,7 +123,7 @@ ret_t canvas_set_clip_rect(canvas_t* c, const rect_t* r_in) { lcd_w = c->lcd->w; lcd_h = c->lcd->h; - + if (r) { c->clip_left = tk_max(0, r->x); c->clip_top = tk_max(0, r->y); diff --git a/src/base/idle_info.c b/src/base/idle_info.c index 11e62273f..7b9fa7070 100644 --- a/src/base/idle_info.c +++ b/src/base/idle_info.c @@ -22,11 +22,19 @@ #include "base/idle_info.h" #include "base/idle_manager.h" +#ifdef AWTK_WEB_JS +#include +#endif /*AWTK_WEB_JS*/ + static ret_t idle_info_on_destroy(idle_info_t* info) { if (info->on_destroy != NULL) { info->on_destroy(info); } +#ifdef AWTK_WEB_JS + EM_ASM_INT({ return TBrowser.releaseFunction($0); }, info->on_idle); +#endif /*AWTK_WEB_JS*/ + return RET_OK; } diff --git a/src/base/timer_info.c b/src/base/timer_info.c index f590669c2..d9cc61f6d 100644 --- a/src/base/timer_info.c +++ b/src/base/timer_info.c @@ -22,11 +22,19 @@ #include "base/timer_info.h" #include "base/timer_manager.h" +#ifdef AWTK_WEB_JS +#include +#endif /*AWTK_WEB_JS*/ + static ret_t timer_info_on_destroy(timer_info_t* info) { if (info->on_destroy != NULL) { info->on_destroy(info); } +#ifdef AWTK_WEB_JS + EM_ASM_INT({ return TBrowser.releaseFunction($0); }, info->on_timer); +#endif /*AWTK_WEB_JS*/ + return RET_OK; } diff --git a/src/tkc/emitter.c b/src/tkc/emitter.c old mode 100755 new mode 100644 index a4037952a..57ec86074 --- a/src/tkc/emitter.c +++ b/src/tkc/emitter.c @@ -39,11 +39,19 @@ emitter_t* emitter_init(emitter_t* emitter) { return emitter; } +#ifdef AWTK_WEB_JS +#include +#endif /*AWTK_WEB_JS*/ + static ret_t emitter_item_destroy(emitter_item_t* iter) { if (iter->on_destroy) { iter->on_destroy(iter); } +#ifdef AWTK_WEB_JS + EM_ASM_INT({ return TBrowser.releaseFunction($0); }, iter->handler); +#endif /*AWTK_WEB_JS*/ + memset(iter, 0x00, sizeof(emitter_item_t)); TKMEM_FREE(iter); diff --git a/src/tkc/object_default.c b/src/tkc/object_default.c index 665c67553..f98740029 100644 --- a/src/tkc/object_default.c +++ b/src/tkc/object_default.c @@ -304,4 +304,3 @@ object_t* object_default_clone(object_default_t* o) { ret_t object_default_unref(object_t* obj) { return object_unref(obj); } -