+/*SDL indicator*/
+
+
+
+Ecore_Ipc_Server *ipc = NULL;
+
+#define IPC_HEAD(_type) \
+ Ecore_Ipc_Event_Client_##_type *e = event; \
+ if (ecore_ipc_client_server_get(e->client) != ipc) \
+ return ECORE_CALLBACK_PASS_ON
+
+void SDL_ExecuteIndicatorProcess()
+{
+ _tizen_init_ecore_ipc();
+ unsigned int childPID = fork();
+ if(childPID == 0)
+ {
+ SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] child process : %d", getpid());
+ int ret = execl("/usr/apps/org.tizen.sdl_indicator/bin/sdl_indicator", "/usr/apps/org.tizen.sdl_indicator/bin/sdl_indicator", NULL);
+ if(ret==-1)
+ {
+ SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Failed indicator process error:%s", strerror(errno));
+ kill(getpid(), SIGKILL);
+ }
+ }
+ else if(childPID==-1)
+ {
+ SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] Failed fork");
+ }
+ else
+ {
+ SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "[SDL] parent process : %d", getpid());
+ }
+}
+
+void _tizen_ecore_ipc_client_send(int major, int minor, int ref, int ref_to)
+{
+ Eina_List *ipc_clients = ecore_ipc_server_clients_get(ipc);
+ Eina_List *l;
+ Ecore_Ipc_Client *cl;
+ EINA_LIST_FOREACH(ipc_clients, l, cl)
+ ecore_ipc_client_send(cl, major, minor, ref, ref_to, 0, NULL, 0);
+}
+
+static Eina_Bool _cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ IPC_HEAD(Add);
+
+ SDL_Log("[SDL]_cb_client_add");
+ SDL_Window * window = SDL_GetVideoDevice()->windows;
+ SDL_WindowData *wind = window->driverdata;
+ wind->indicator = SDL_TRUE;
+
+ int window_w, window_h;
+ ecore_wl_screen_size_get(&window_w, &window_h);
+ _tizen_ecore_ipc_client_send(OP_RESIZE, wind->rotation, window_w, window_h);
+
+ return ECORE_CALLBACK_DONE;
+}
+
+static Eina_Bool _cb_client_del(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
+{
+ IPC_HEAD(Del);
+ SDL_Log("[SDL]_cb_client_del");
+ Eina_List *ipc_clients = ecore_ipc_server_clients_get(ipc);
+ Eina_List *l;
+ Ecore_Ipc_Client *cl;
+ EINA_LIST_FOREACH(ipc_clients, l, cl)
+ {
+ ecore_ipc_client_del(cl);
+ }
+
+ SDL_Window * window = SDL_GetVideoDevice()->windows;
+ SDL_WindowData *wind = window->driverdata;
+ wind->indicator = SDL_FALSE;
+ return ECORE_CALLBACK_DONE;
+}
+
+static Eina_Bool _cb_client_data(void *data, int type EINA_UNUSED, void *event)
+{
+ IPC_HEAD(Data);
+
+ Ecore_Ipc_Event_Server_Data* epcEvent = (Ecore_Ipc_Event_Server_Data*)event;
+ SDL_Log("[SDL]_cb_client_data: %d -> %d", epcEvent->major, epcEvent->minor);
+ return ECORE_CALLBACK_DONE;
+}
+
+int _tizen_init_ecore_ipc()
+{
+
+ if(!ipc)
+ {
+ if(!ecore_ipc_init())
+ SDL_Log("[SDL]Fail ecore_ipc");
+
+ ipc = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, "sdl_indicator", 0, NULL);
+
+ if(!ipc)
+ ecore_ipc_shutdown();
+
+ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, _cb_client_add, NULL);
+ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, _cb_client_del, NULL);
+ ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, _cb_client_data, NULL);
+ }
+ return 0;
+}
+