#include "../SDL_sysvideo.h"
#include "../../events/SDL_windowevents_c.h"
+#include <Ecore_Ipc.h>
+#include <unistd.h>
+#include <errno.h>
+
enum {
ROTATION_TYPE_NORMAL_ROTATION = 0,
ROTATION_TYPE_PRE_ROTATION, /* use pre-rotation */
return SDL_FALSE; \
}
+/*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;
+}
+
static int
_tizen_rotation_type_get()
{
{
SDL_WindowData *wind = window->driverdata;
- if((window->flags & SDL_WINDOW_FULLSCREEN) || (window->flags & SDL_WINDOW_BORDERLESS))
- {
- ecore_wl_window_indicator_state_set(wind->window, ECORE_WL_INDICATOR_STATE_OFF);
- ecore_wl_window_indicator_opacity_set(wind->window, ECORE_WL_INDICATOR_TRANSPARENT);
- ecore_wl_indicator_visible_type_set(wind->window, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN);
- }
- else
+ if(!(window->flags & SDL_WINDOW_FULLSCREEN) && !(window->flags & SDL_WINDOW_BORDERLESS) && !wind->indicator)
{
- ecore_wl_window_indicator_state_set(wind->window, ECORE_WL_INDICATOR_STATE_ON);
- ecore_wl_window_indicator_opacity_set(wind->window, ECORE_WL_INDICATOR_OPAQUE);
- ecore_wl_indicator_visible_type_set(wind->window, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN);
+ SDL_ExecuteIndicatorProcess();
}
ecore_wl_window_show(wind->window);
}
void
Tizen_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
{
-//Add setting window bordered.
+ SDL_WindowData *wind = window->driverdata;
+ if(!wind->indicator)
+ {
+ SDL_ExecuteIndicatorProcess();
+ }
}
void