macro(CheckTizen)
if(VIDEO_TIZEN)
- pkg_check_modules(TIZEN wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl dlog)
+ pkg_check_modules(TIZEN wayland-client wayland-egl ecore ecore-wayland evas eina capi-appfw-application capi-appfw-application dlog)
if(TIZEN_FOUND)
link_directories(
${TIZEN_LIBRARY_DIRS}
FindLibraryAndSONAME(ecore-wayland)
FindLibraryAndSONAME(evas)
FindLibraryAndSONAME(eina)
- FindLibraryAndSONAME(appcore-efl)
+ FindLibraryAndSONAME(capi-appfw-application)
+ FindLibraryAndSONAME(capi-system-system-settings)
FindLibraryAndSONAME(dlog)
set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"")
set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"")
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 ecore ecore-wayland evas eina appcore-efl ecore-input dlog; then
- TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog`
- TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog`
+ if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland evas eina capi-appfw-application capi-system-system-settings ecore-input dlog; then
+ TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland evas eina capi-appfw-application capi-system-system-settings ecore-input dlog`
+ TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland evas eina capi-appfw-application capi-system-system-settings ecore-input dlog`
video_tizen=yes
fi
fi
SOURCES="$SOURCES $srcdir/src/video/tizen/*.c"
SOURCES="$SOURCES $srcdir/src/core/tizen/*.c"
-
SDLMAIN_SOURCES="$srcdir/src/main/tizen/*.c"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $TIZEN_CFLAGS -DTIZEN"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $TIZEN_CFLAGS"
+ SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
+ SDL_LIBS="-lSDL2main $SDL_LIBS"
+
+ EXTRA_CFLAGS="$EXTRA_CFLAGS $TIZEN_CFLAGS -DTIZEN"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $TIZEN_LIBS"
SUMMARY_video="${SUMMARY_video} tizen"
have_video=yes
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 ecore ecore-wayland evas eina appcore-efl ecore-input dlog; then
- TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog`
- TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland evas eina appcore-efl ecore-input dlog`
+ if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland evas eina capi-appfw-application capi-system-system-settings ecore-input dlog; then
+ TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland evas eina capi-appfw-application capi-system-system-settings ecore-input dlog`
+ TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland evas eina capi-appfw-application capi-system-system-settings ecore-input dlog`
video_tizen=yes
fi
fi
AC_DEFINE(SDL_VIDEO_DRIVER_TIZEN, 1, [ ])
SOURCES="$SOURCES $srcdir/src/video/tizen/*.c"
SOURCES="$SOURCES $srcdir/src/core/tizen/*.c"
-
SDLMAIN_SOURCES="$srcdir/src/main/tizen/*.c"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $TIZEN_CFLAGS -DTIZEN"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $TIZEN_CFLAGS"
+ SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
+ SDL_LIBS="-lSDL2main $SDL_LIBS"
+
+ EXTRA_CFLAGS="$EXTRA_CFLAGS $TIZEN_CFLAGS -DTIZEN"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $TIZEN_LIBS"
SUMMARY_video="${SUMMARY_video} tizen"
have_video=yes
BuildRequires: pkgconfig(ecore)
BuildRequires: pkgconfig(evas)
BuildRequires: pkgconfig(ecore-wayland)
-BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(capi-system-system-settings)
BuildRequires: pkgconfig(dlog)
%description
#if defined(__TIZEN__)
#include <dlog/dlog.h>
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
#define LOG_TAG "SDL_LOG"
+#define _SECURE_LOG
#endif
#define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL
fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message);
fclose (pFile);
}
+#elif defined(__TIZEN__)
+ {
+ SDL_PrintDlog(priority, "%s: %s", SDL_priority_prefixes[priority], message);
+ }
#endif
#if HAVE_STDIO_H
-#if defined(__TIZEN__)
- SDL_PrintDlog(priority, "%s: %s", SDL_priority_prefixes[priority], message);
-#else
fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
#endif
#if __NACL__
fflush(stderr);
#endif
-#endif
}
void
#if __TIZEN__
#include "SDL_tizen.h"
-#include <appcore-efl.h>
-
-typedef enum {
- APP_STATE_NOT_RUNNING,
- APP_STATE_CREATING,
- APP_STATE_RUNNING,
-} app_state_e;
-
-struct ui_app_context {
- char *package;
- char *app_name;
- app_state_e state;
- void *callback;
- void *data;
-};
+#include "SDL_log.h"
+#include "SDL_events.h"
+#include <app_internal.h>
+#include <app_extension.h>
+#include <system_settings.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, };
/* TODO ::
* Impplementation of serveral app core callback function for SDL Application and App Core
* */
-static int
-_tizen_app_create(void *data)
+static bool
+_tizen_sdl_create(void *data)
+{
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore CreateCB");
+ return true;
+}
+
+static void
+_tizen_sdl_terminate(void *data)
+{
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore TermincateCB");
+ SDL_SendQuit();
+ SDL_SendAppEvent(SDL_APP_TERMINATING);
+ return;
+}
+
+static void
+_tizen_sdl_pause (void *data)
+{
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore PauseCB");
+ SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
+ SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
+ return;
+}
+
+static void
+_tizen_sdl_resume(void *data)
+{
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore ResumeCB");
+ SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
+ SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
+ return;
+}
+
+static void
+_tizen_sdl_control(app_control_h app_control, void *data)
+{
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore ControlCB");
+ return;
+}
+
+static void
+_tizen_app_lang_changed(app_event_info_h event_info, void *user_data)
{
- fprintf(stderr,"%s:%d\n",__FUNCTION__, __LINE__);
- return 0;
+ /*APP_EVENT_LANGUAGE_CHANGED*/
+ char *locale = NULL;
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Language changedCB");
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+ free(locale);
+ return;
}
-static int
-_tizen_app_terminate(void *data)
+static void
+_tizen_app_orient_changed(app_event_info_h event_info, void *user_data)
{
- fprintf(stderr,"%s:%d\n",__FUNCTION__, __LINE__);
- return 0;
+ /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "orient changedCB");
+ return;
}
-static int
-_tizen_app_pause (void *data)
+static void
+_tizen_app_region_changed(app_event_info_h event_info, void *user_data)
{
- fprintf(stderr,"%s:%d\n",__FUNCTION__, __LINE__);
- return 0;
+ /*APP_EVENT_REGION_FORMAT_CHANGED*/
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "region changedCB");
}
-static int
-_tizen_app_resume(void *data)
+static void
+_tizen_app_low_battery(app_event_info_h event_info, void *user_data)
{
- fprintf(stderr,"%s:%d\n",__FUNCTION__, __LINE__);
- return 0;
+ /*APP_EVENT_LOW_BATTERY*/
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "low battery CB");
}
-static int
-_tizen_app_reset(bundle *bun, void *data)
+static void
+_tizen_app_low_memory(app_event_info_h event_info, void *user_data)
{
- fprintf(stderr,"%s:%d\n",__FUNCTION__, __LINE__);
- return 0;
+ /*APP_EVENT_LOW_MEMORY*/
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "low memory CB");
+ SDL_SendAppEvent(SDL_APP_LOWMEMORY);
}
int
SDL_tizen_app_init(int argc, char *argv[])
{
- struct ui_app_context app_context = {
- .package = NULL,
- .app_name = NULL,
- .state = APP_STATE_NOT_RUNNING,
- .callback = NULL,
- .data = NULL,
- };
-
- struct appcore_ops appcore_context = {
- .data = &app_context,
- .create = _tizen_app_create,
- .terminate = _tizen_app_terminate,
- .pause = _tizen_app_pause,
- .resume = _tizen_app_resume,
- .reset = _tizen_app_reset,
- };
-
- if (argc < 1 || argv == NULL)
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL Tizen App initialize");
+ if (tizen_appcore_initialized)
{
- fprintf(stderr,"%s: APP_ERROR_INVALID_PARAMETER",__FUNCTION__);
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Already initialized!");
return 0;
}
-
- if (app_context.state != APP_STATE_NOT_RUNNING)
+ tizen_appcore_initialized = 1;
+ if (argc < 1 || argv == NULL)
{
- fprintf(stderr,"%s: APP_STATE_NOT_RUNNING\n",__FUNCTION__);
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "APP_ERROR_INVALID_PARAMETER");
return 0;
}
- /* TODO ::
- * At first, check the necessary calling app_get_id()/app_get_package_app_name() while app_init.
- * If necessary, help these functions can be export.
- * After that, determine the implementation of them.
- * */
-#if 0
- if (app_get_id(&(app_context.package)) != 0)
- {
- fprintf(stderr,"%s: APP_ERROR_INVALID_CONTEXT",__FUNCTION__);
- return 0;
- }
+ event_callback.create = _tizen_sdl_create;
+ event_callback.terminate = _tizen_sdl_terminate;
+ event_callback.pause = _tizen_sdl_pause;
+ event_callback.resume = _tizen_sdl_resume;
+ event_callback.app_control = _tizen_sdl_control;
- if (app_get_package_app_name(app_context.package, &(app_context.app_name)) != 0)
- {
- free(app_context.package);
- fprintf(stderr,"%s: APP_ERROR_INVALID_CONTEXT",__FUNCTION__);
- return 0;
- }
-#endif
- return appcore_efl_init(app_context.app_name, &argc, &argv, &appcore_context);
+ 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);
+
+ return ui_app_init(argc, argv, &event_callback, NULL, &appcore_handle);
}
void
SDL_tizen_app_exit(void)
{
- appcore_efl_fini();
+ ui_app_fini(appcore_handle);
}
#endif
SDL_PumpEvents(void)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
-
/* Get events from the video subsystem */
if (_this) {
_this->PumpEvents(_this);
SDL_JoystickUpdate();
}
#endif
-
SDL_SendPendingQuit(); /* in case we had a signal handler fire, etc. */
}
if (timeout > 0)
expiration = SDL_GetTicks() + timeout;
-
for (;;) {
SDL_PumpEvents();
switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) {
#include <stdio.h>
#include "SDL.h"
#include "SDL_main.h"
-//#include "../../core/tizen/SDL_tizen.h"
#ifdef main
#undef main
int main(int argc, char *argv[])
{
- printf("Start MAIN!!!!!!\n");
SDL_tizen_app_init(argc, argv);
SDL_SetMainReady();
(void)SDL_main(argc, argv);
#include "SDL_tizenvideo.h"
#include "SDL_tizenevents_c.h"
#include "SDL_tizenwindow.h"
+#include "SDL_log.h"
void
Tizen_PumpEvents(_THIS)
Eina_Bool
__tizen_cb_event_keyup_change(void *data, int type, void *event)
{
- printf("SAMPLE EV :key up\n");
-
if (!event) return ECORE_CALLBACK_PASS_ON;
Ecore_Event_Key * e = event;
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "key up: %d",e->keycode);
SDL_SendKeyboardKey(SDL_RELEASED, e->keycode);
return ECORE_CALLBACK_PASS_ON;
Eina_Bool
__tizen_cb_event_keydown_change(void *data, int type, void *event)
{
- printf("SAMPLE EV :key down\n");
-
if (!event) return ECORE_CALLBACK_PASS_ON;
Ecore_Event_Key * e = event;
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "key down: %d",e->keycode);
SDL_SendKeyboardKey(SDL_PRESSED, e->keycode);
return ECORE_CALLBACK_PASS_ON;
#include "../../SDL_internal.h"
#include "SDL_tizenmouse.h"
+#include "SDL_log.h"
Eina_Bool
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
- printf("SAMPLE EV :mouse down\n");
if (!event) return ECORE_CALLBACK_PASS_ON;
Ecore_Event_Mouse_Button *e = event;
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse down (%d x %d)",e->x,e->y);
SDL_SendMouseMotion(_this->current_glwin, 0, 0, e->x, e->y);
SDL_SendMouseButton(_this->current_glwin, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
return ECORE_CALLBACK_PASS_ON;
if (!event) return ECORE_CALLBACK_PASS_ON;
Ecore_Event_Mouse_Button *e = event;
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse up (%d x %d)",e->x,e->y);
SDL_SendMouseMotion(_this->current_glwin, 0, 0, e->x, e->y);
SDL_SendMouseButton(_this->current_glwin, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
return ECORE_CALLBACK_PASS_ON;
if (!event) return ECORE_CALLBACK_PASS_ON;
Ecore_Event_Mouse_Move *e = event;
+ //SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse move (%d x %d)",e->x,e->y);
SDL_SendMouseMotion(_this->current_glwin, 0, 0, e->x, e->y);
return ECORE_CALLBACK_PASS_ON;
#include "SDL_tizenmouse.h"
#include "SDL_tizenevents_c.h"
+#include "SDL_log.h"
#include <wayland-egl.h>
ew = ecore_wl_window_find(ev->win);
window = __tizen_find_window(_this, ew);
- printf("SAMPLE EV : visibility window:%p, ecore_wl_window:%p\n", window, ew);
-
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "visibility window: %p, ecore_wl_window: %p\n", window, ew);
+
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+
return ECORE_CALLBACK_PASS_ON;
}