#if __TIZEN__
#include <app_internal.h>
-#include <app_extension.h>
-#include <system_settings.h>
+#include <app_common_internal.h>
+#include <appcore_ui_base.h>
+#include <app_control_internal.h>
#include <aul.h>
#include "SDL_log.h"
static int tizen_appcore_initialized = 0;
static appcore_context_h appcore_handle = NULL;
-static ui_app_lifecycle_callback_s event_callback = {0,};
static app_event_handler_h handlers[5] = {NULL, };
static app_control_h event_app_control;
return;
}
-/*
-//APP_EVENT_DEVICE_ORIENTATION_CHANGED
-static void
-_tizen_app_orient_changed(app_event_info_h event_info, void *user_data)
-{
- app_device_orientation_e orientation;
- app_event_get_device_orientation(event_info, &orientation);
- SDL_Log("Orientation Changed, Rotation Degree : %d", orientation);
- SDL_Event event;
- SDL_memset(&event, 0, sizeof(event));
- event.type = SDL_ROTATEEVENT;
- event.user.code = 0;
- event.user.data1 = (void*)orientation;
- event.user.data2 = (void*)-1;
-
- SDL_PushEvent(&event);
- return;
-}
-*/
-
static void
_tizen_app_region_changed(app_event_info_h event_info, void *user_data)
{
return 1;
}
+static int AppCreate(void *data)
+{
+ appcore_ui_base_on_create();
+ _tizen_sdl_create(data);
+
+ return 0;
+}
+
+static int AppTerminate(void *data)
+{
+ appcore_ui_base_on_terminate();
+
+ return 0;
+}
+
+static int AppPause(void *data)
+{
+ appcore_ui_base_on_pause();
+ _tizen_sdl_pause(data);
+
+ return 0;
+}
+
+static int AppResume(void *data)
+{
+ appcore_ui_base_on_resume();
+ _tizen_sdl_resume(data);
+
+ return 0;
+}
+
+static void AppInit(int argc, char **argv, void *data)
+{
+ ecore_init();
+ ecore_app_args_set( argc, (const char **)argv );
+}
+
+static void AppFinish(void)
+{
+ ecore_shutdown();
+
+ if(getenv("AUL_LOADER_INIT"))
+ {
+ unsetenv("AUL_LOADER_INIT");
+ ecore_shutdown();
+ }
+}
+
+static int AppControl(bundle *b, void *data)
+{
+ app_control_h app_control = NULL;
+
+ appcore_ui_base_on_control(b);
+
+ if (b) {
+ if (app_control_create_event(b, &app_control) != APP_ERROR_NONE)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to create an app_control handle");
+ }
+ else {
+ if (app_control_create(&app_control) != APP_ERROR_NONE)
+ return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "Failed to create an app_control handle");
+ }
+ _tizen_sdl_control(app_control, data);
+
+ app_control_destroy(app_control);
+
+ return APP_ERROR_NONE;
+}
+
int
SDL_tizen_app_init(int argc, char *argv[])
{
return APP_ERROR_INVALID_PARAMETER;
}
- event_callback.create = _tizen_sdl_create;
- event_callback.pause = _tizen_sdl_pause;
- event_callback.resume = _tizen_sdl_resume;
- event_callback.app_control = _tizen_sdl_control;
-
ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, _tizen_app_low_battery, NULL);
ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, _tizen_app_low_memory, NULL);
-// ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, _tizen_app_orient_changed, NULL);
ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, _tizen_app_lang_changed, NULL);
ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, _tizen_app_region_changed, NULL);
/* add event watch for SDL_APP_TERMINATING */
SDL_AddEventWatch(_tizen_terminate_event_filter, NULL);
- return ui_app_init(argc, argv, &event_callback, NULL, &appcore_handle);
+
+ appcore_ui_base_ops ops = appcore_ui_base_get_default_ops();
+
+ /* override methods */
+ ops.base.create = AppCreate;
+ ops.base.control = AppControl;
+ ops.base.terminate = AppTerminate;
+ ops.pause = AppPause;
+ ops.resume = AppResume;
+ ops.base.init = AppInit;
+ ops.base.finish = AppFinish;
+ ops.base.run = NULL;
+ ops.base.exit = NULL;
+
+ return appcore_ui_base_init(ops, argc, argv, NULL, APPCORE_UI_BASE_HINT_WINDOW_GROUP_CONTROL |
+ APPCORE_UI_BASE_HINT_WINDOW_STACK_CONTROL |
+ APPCORE_UI_BASE_HINT_BG_LAUNCH_CONTROL |
+ APPCORE_UI_BASE_HINT_HW_ACC_CONTROL |
+ APPCORE_UI_BASE_HINT_WINDOW_AUTO_CONTROL );
+
}
void
SDL_tizen_app_exit(void)
{
- SDL_Log("call ui_app_fini");
- ui_app_fini(appcore_handle);
+ appcore_ui_base_exit();
appcore_handle = NULL;
}
#endif