From: Wonsik, Jung Date: Fri, 12 Aug 2016 13:48:40 +0000 (+0900) Subject: [SDL_Tizen] Add Tizen app control X-Git-Tag: accepted/tizen/common/20160823.132802~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F83890%2F1;p=platform%2Fupstream%2FSDL.git [SDL_Tizen] Add Tizen app control Add Tizen App control for passing app's param Change-Id: I0aa8a70119e30ed0fd640652c451cbd07d8580ee --- diff --git a/include/SDL_events.h b/include/SDL_events.h index 6cdcf66..f677fcb 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -84,6 +84,9 @@ typedef enum Called on iOS in applicationDidBecomeActive() Called on Android in onResume() */ + SDL_APP_CONTROL, /**< The application is launching with some arguments. + Called on Tizen in onAppControl() + */ /* Window events */ SDL_WINDOWEVENT = 0x200, /**< Window state change */ diff --git a/src/SDL_log.c b/src/SDL_log.c index 25c9e8a..278f829 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -37,6 +37,10 @@ #include #endif +#ifndef __TIZEN__ +#define __TIZEN__ +#endif + #if defined(__TIZEN__) #include #ifdef LOG_TAG @@ -46,6 +50,8 @@ #define _SECURE_LOG #endif + + #define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL #define DEFAULT_ASSERT_PRIORITY SDL_LOG_PRIORITY_WARN #define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO diff --git a/src/core/tizen/SDL_tizen.c b/src/core/tizen/SDL_tizen.c index 4beaec1..62f628a 100644 --- a/src/core/tizen/SDL_tizen.c +++ b/src/core/tizen/SDL_tizen.c @@ -30,6 +30,13 @@ #include #include #include +#include + +#ifdef LOG_TAG +#undef LOG_TAG +#endif + +#define LOG_TAG "SDL" static int tizen_appcore_initialized = 0; static appcore_context_h appcore_handle = NULL; @@ -43,14 +50,14 @@ static app_event_handler_h handlers[5] = {NULL, }; static bool _tizen_sdl_create(void *data) { - SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore CreateCB"); + LOGI("SDL_AppCore CreateCB"); return true; } static void _tizen_sdl_terminate(void *data) { - SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore TermincateCB"); + LOGI("SDL_AppCore TermincateCB"); SDL_SendQuit(); SDL_SendAppEvent(SDL_APP_TERMINATING); return; @@ -59,7 +66,7 @@ _tizen_sdl_terminate(void *data) static void _tizen_sdl_pause (void *data) { - SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore PauseCB"); + LOGI("SDL_AppCore PauseCB"); SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); return; @@ -68,7 +75,7 @@ _tizen_sdl_pause (void *data) static void _tizen_sdl_resume(void *data) { - SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore ResumeCB"); + LOGI("SDL_AppCore ResumeCB"); SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); return; @@ -77,7 +84,16 @@ _tizen_sdl_resume(void *data) static void _tizen_sdl_control(app_control_h app_control, void *data) { - SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore ControlCB"); + LOGI("SDL_AppCore ControlCB"); + + SDL_Event event; + SDL_memset(&event, 0, sizeof(event)); + event.type = SDL_APP_CONTROL; + event.user.code = 0; + event.user.data1 = (void*)app_control; + event.user.data2 = (void*)data; + + SDL_PushEvent(&event); return; } @@ -86,7 +102,7 @@ _tizen_app_lang_changed(app_event_info_h event_info, void *user_data) { /*APP_EVENT_LANGUAGE_CHANGED*/ char *locale = NULL; - SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Language changedCB"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Language changedCB"); system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); free(locale); return; @@ -103,7 +119,7 @@ _tizen_app_orient_changed(app_event_info_h event_info, void *user_data) SDL_memset(&event, 0, sizeof(event)); event.type = SDL_ROTATEEVENT; event.user.code = 0; - event.window.data1 = (void*)orientation; + event.user.data1 = (void*)orientation; event.user.data2 = -1; SDL_PushEvent(&event); @@ -135,10 +151,10 @@ _tizen_app_low_memory(app_event_info_h event_info, void *user_data) int SDL_tizen_app_init(int argc, char *argv[]) { - SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL Tizen App initialize"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL Tizen App initialize"); if (tizen_appcore_initialized) { - SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Already initialized!"); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Already initialized!"); return 0; } tizen_appcore_initialized = 1;