improve for awtk web

This commit is contained in:
xianjimli 2019-04-20 11:24:54 +08:00
parent e5563163e0
commit 3a8139150c
6 changed files with 21 additions and 4 deletions

View File

@ -255,7 +255,7 @@ typedef struct _widget_vtable_t widget_vtable_t;
#define TK_LONG_PRESS_TIME 1000
#if defined(WITH_SDL) || defined(LINUX)
#if defined(WITH_SDL) || defined(LINUX) || defined(AWTK_WEB)
#define WITH_WIDGET_TYPE_CHECK 1
#endif /*WITH_SDL || defined(LINUX)*/

View File

@ -30,11 +30,17 @@
#include "input_method_sdl.inc"
#endif /*WITH_SDL*/
#if defined(AWTK_WEB)
extern input_method_t* input_method_web_create(void);
#endif /*AWTK_WEB*/
input_method_t* input_method_create(void) {
input_method_t* im = NULL;
#if defined(WITH_NULL_IM)
im = input_method_null_create();
#elif defined(AWTK_WEB)
im = input_method_web_create();
#elif defined(WITH_SDL)
if (system_info()->app_type == APP_DESKTOP) {
im = input_method_sdl_create();

View File

@ -31,7 +31,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAS_STDIO
#if defined(HAS_STDIO) || defined(AWTK_WEB)
#include <stdio.h>
#else
#define STBI_NO_STDIO
@ -161,7 +161,7 @@ typedef enum _ret_t {
#define log_warn(format, ...) printf(format, __VA_ARGS__)
#define log_error(format, ...) printf(format, __VA_ARGS__)
#define snprintf _snprintf
#elif defined(HAS_STDIO)
#elif defined(HAS_STDIO) || defined(AWTK_WEB)
#define log_debug(format, args...) printf(format, ##args)
#define log_info(format, args...) printf(format, ##args)
#define log_warn(format, args...) printf(format, ##args)

View File

@ -140,6 +140,10 @@ static ret_t dialog_idle_close(const idle_info_t* info) {
}
uint32_t dialog_modal(widget_t* widget) {
#ifdef AWTK_WEB
log_debug("awtk web not support dialog_modal\n");
return 0;
#else
bool_t running = FALSE;
dialog_t* dialog = DIALOG(widget);
return_value_if_fail(dialog != NULL, RET_BAD_PARAMS);
@ -157,15 +161,21 @@ uint32_t dialog_modal(widget_t* widget) {
idle_add(dialog_idle_close, widget);
return dialog->quit_code;
#endif/*AWTK_WEB*/
}
ret_t dialog_quit(widget_t* widget, uint32_t code) {
#ifdef AWTK_WEB
log_debug("awtk web not support dialog_modal\n");
dialog_close(widget);
#else
dialog_t* dialog = DIALOG(widget);
return_value_if_fail(dialog != NULL, RET_BAD_PARAMS);
dialog->quited = TRUE;
dialog->quit_code = code;
main_loop_quit(main_loop());
#endif/*AWTK_WEB*/
return RET_OK;
}

View File

@ -27,9 +27,10 @@ AWKT_WINDOW_ANIMATORS_FILES=glob.glob(AWTK_SRC_DIR+'/window_animators/*.c')
AWKT_DIALOG_HIGHLIGHTERS_FILES=glob.glob(AWTK_SRC_DIR+'/dialog_highlighters/*.c')
AWKT_FONT_LOADER_FILES=glob.glob(AWTK_SRC_DIR+'/font_loader/*.c')
AWKT_IMAGE_LOADER_FILES=glob.glob(AWTK_SRC_DIR+'/image_loader/*.c')
AWKT_INPUT_METHOD_FILES=glob.glob(AWTK_SRC_DIR+'/input_methods/input_method_creator.c')
AWKT_FONT_GLOBAL_FILES=glob.glob(AWTK_SRC_DIR+'/*.c')
COMMON_FILES=AWKT_TKC_FILES + AWKT_BASE_FILES + AWKT_WIDGETS_FILES + AWKT_EXT_WIDGETS_FILES + AWKT_UILOADER_FILES + AWKT_LAYOUTERS_FILES + AWKT_SVG_FILES + AWKT_WIDGET_ANIMATORS_FILES + AWKT_WINDOW_ANIMATORS_FILES + AWKT_DIALOG_HIGHLIGHTERS_FILES + AWKT_CLIPBOARD_FILES + AWKT_FONT_GLOBAL_FILES;
COMMON_FILES=AWKT_TKC_FILES + AWKT_BASE_FILES + AWKT_WIDGETS_FILES + AWKT_EXT_WIDGETS_FILES + AWKT_UILOADER_FILES + AWKT_LAYOUTERS_FILES + AWKT_SVG_FILES + AWKT_WIDGET_ANIMATORS_FILES + AWKT_WINDOW_ANIMATORS_FILES + AWKT_DIALOG_HIGHLIGHTERS_FILES + AWKT_CLIPBOARD_FILES + AWKT_FONT_GLOBAL_FILES + AWKT_INPUT_METHOD_FILES;
INFER_FILES=COMMON_FILES
WEB_FILES=COMMON_FILES + AWKT_XML_FILES

Binary file not shown.