[SDL_Tizen] Delete elementary dependency of ui_app_main 40/184440/6
authorhuiyu.eun <huiyu.eun@samsung.com>
Wed, 18 Jul 2018 04:23:55 +0000 (13:23 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Fri, 20 Jul 2018 08:01:11 +0000 (17:01 +0900)
Change-Id: I081ae08851a8cac8d5d55f1ef05e825765a15a7b
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
configure
configure.in
packaging/SDL2.spec
src/core/tizen/SDL_tizen.c
src/video/tizen/SDL_tizenwindow.c

index 31c4940..df47fd5 100755 (executable)
--- a/configure
+++ b/configure
@@ -19378,9 +19378,9 @@ $as_echo_n "checking for Tizen support... " >&6; }
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then
-                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
-                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
+            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc appcore-ui; then
+                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc appcore-ui`
+                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc appcore-ui`
                 video_tizen=yes
             fi
         fi
index 5b88da9..564ff70 100755 (executable)
@@ -1490,9 +1490,9 @@ CheckTizen()
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then
-                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
-                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc`
+            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc appcore-ui; then
+                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc appcore-ui`
+                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-egl-tizen ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc appcore-ui`
                 video_tizen=yes
             fi
         fi
index dae758b..f6666ab 100755 (executable)
@@ -58,6 +58,7 @@ BuildRequires:  libpng-devel
 BuildRequires:  libtiff-devel
 #BuildRequires: libwebp-devel
 BuildRequires:  pkgconfig(vulkan)
+BuildRequires:  pkgconfig(appcore-ui)
 
 %description
 This is the Simple DirectMedia Layer, a generic API that provides low
index 1f1ad18..d23de9a 100644 (file)
@@ -24,8 +24,9 @@
 
 #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"
@@ -37,7 +38,6 @@
 
 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;
@@ -127,26 +127,6 @@ _tizen_app_lang_changed(app_event_info_h event_info, void *user_data)
     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)
 {
@@ -228,6 +208,75 @@ _tizen_terminate_event_filter(void *userdata, SDL_Event * event)
     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[])
 {
@@ -245,14 +294,8 @@ 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);
 
@@ -265,14 +308,32 @@ SDL_tizen_app_init(int argc, char *argv[])
     /* 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
index 85cc2d2..0b6734a 100755 (executable)
@@ -672,7 +672,6 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
 
     wind->window = ecore_wl2_window_new(wl2_display, NULL,
                                        window->x, window->y, window->w, window->h);
-
     if (!wind->window) {
         SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Failed to create wayland window");
         if(globals) {