[SDL_TIZEN] code clean up 01/106701/1
authorWonsik, Jung <sidein@samsung.com>
Thu, 22 Dec 2016 12:02:56 +0000 (21:02 +0900)
committerWonsik, Jung <sidein@samsung.com>
Thu, 22 Dec 2016 12:08:25 +0000 (21:08 +0900)
code clean up

Change-Id: Iae599a059a27b76cf6f58d3e3e350b8e53cd8416

src/core/tizen/SDL_tizen.c
src/video/tizen/SDL_ecore_ipc.c
src/video/tizen/SDL_tizenkeyboard.c
src/video/tizen/SDL_tizenmouse.c
src/video/tizen/SDL_tizenopengles.c
src/video/tizen/SDL_tizentouch.c
src/video/tizen/SDL_tizenvulkan.c
src/video/tizen/SDL_tizenwindow.c

index ae8f9ed..70a9ea5 100644 (file)
@@ -214,13 +214,14 @@ SDL_tizen_app_init(int argc, char *argv[])
     int aul_ret = 0;
 
     SDL_Log( "SDL Tizen App initialize");
+
     if (tizen_appcore_initialized) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"Already initialized!");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT,"Already initialized!");
         return 0;
     }
     tizen_appcore_initialized = 1;
     if (argc < 1 || argv == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"APP_ERROR_INVALID_PARAMETER");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT,"APP_ERROR_INVALID_PARAMETER");
         return 0;
     }
 
index 958e38b..971bca2 100755 (executable)
@@ -43,7 +43,7 @@ LockFile* CreateLockeFile(char* LockFileName)
     lockFile->fileDescriptor = open(LockFileName, O_RDWR);
     if(lockFile->fileDescriptor == -1)
     {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"[SDL]Fail to open lock file!");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT,"[SDL]Fail to open lock file!");
         return NULL;
 
     }
@@ -92,7 +92,7 @@ void Tizen_Indicator_SharedFile_Free(SharedIndicatorInfo *shared_info, int n)
         if(lockFile->fileDescriptor>=0) {
             if(lockf(lockFile->fileDescriptor, F_ULOCK, 0) <0 )
             {
-               SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"[SDL] Lock release fail");
+               SDL_LogError(SDL_LOG_CATEGORY_ASSERT,"[SDL] Lock release fail");
                return;
             }
         }
@@ -119,11 +119,9 @@ void LoadSharedImage(Ecore_Ipc_Event_Server_Data*  epcEvent, SharedIndicatorInfo
 {
     char sharedFilename[256];
     int n = epcEvent->response;
-    SDL_Log("[SDL] LoadSharedImage print n: %d\n",n);
     if(n < SHARED_FILE_NUMBER)
     {
         snprintf(sharedFilename, 256, "/%s-%d.%d", shared_info->fileInfo[n].SharedFileName, shared_info->fileInfo[n].SharedFileID, shared_info->fileInfo[n].SharedFileNumber);
-        SDL_Log("[SDL]The shared file name is %s", sharedFilename);
 
         Tizen_Indicator_SharedFile_Free(shared_info, n);
 
@@ -134,7 +132,7 @@ void LoadSharedImage(Ecore_Ipc_Event_Server_Data*  epcEvent, SharedIndicatorInfo
         }
         else
         {
-            SDL_Log("[SDL]fileInfo->sharedFile == NULL");
+            SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "[SDL]fileInfo->sharedFile == NULL");
         }
     }
 }
@@ -146,32 +144,27 @@ void DataReceived(void* event, SharedIndicatorInfo* shared_info)
     {
         case OP_SHM_REF0:
         {
-            SDL_Log("[SDL]Indicator client received: OP_SHM_REF0\n");
             SetSharedImageInfo(epcEvent, shared_info);
             break;
         }
         case OP_SHM_REF1:
         {
-            SDL_Log("[SDL]Indicator client received: OP_SHM_REF1\n");
             SetLockFileInfo(epcEvent, shared_info);
             break;
         }
         case OP_SHM_REF2:
         {
-            SDL_Log("[SDL]Indicator client received: OP_SHM_REF2\n");
             LoadSharedImage(epcEvent, shared_info);
             break;
         }
         case OP_UPDATE:
         {
-            int n = epcEvent->response;
-            SDL_Log("[SDL]Indicator client received: OP_UPDATE : %d\n", n);
+            //int n = epcEvent->response;
             break;
         }
         case OP_UPDATE_DONE:
         {
             int n = epcEvent->response;
-            SDL_Log("[SDL] OP_UPDATE_DONE n: %d\n", n);
             if( n < SHARED_FILE_NUMBER)
             {
                 shared_info->cur_idx = n;
@@ -180,7 +173,6 @@ void DataReceived(void* event, SharedIndicatorInfo* shared_info)
         }
         case OP_GL_REF:
         {
-            SDL_Log("[SDL] receive socket to client (resource_id:%u)", epcEvent->ref);
             if (Tizen_remote_surface_init())
             {
                 Tizen_remote_indicator(epcEvent->ref);
@@ -189,7 +181,6 @@ void DataReceived(void* event, SharedIndicatorInfo* shared_info)
         }
         case OP_RESIZE:
         {
-            SDL_Log("[SDL]Indicator client received: OP_RESIZE\n");
             break;
         }
     }
@@ -197,15 +188,13 @@ void DataReceived(void* event, SharedIndicatorInfo* shared_info)
 
 Eina_Bool handler_server_add(void *data, int ev_type EINA_UNUSED, void *ev)
 {
-    Ecore_Ipc_Event_Server_Add *e = (Ecore_Ipc_Event_Server_Add *)ev;
-    SDL_Log("Got a server add %p", e->server);
+    //Ecore_Ipc_Event_Server_Add *e = (Ecore_Ipc_Event_Server_Add *)ev;
     return 1;
 }
 
 Eina_Bool handler_server_del(void *data, int ev_type EINA_UNUSED, void *ev)
 {
-    Ecore_Ipc_Event_Server_Del *e = (Ecore_Ipc_Event_Server_Del *)ev;
-    SDL_Log("Got a server del %p", e->server);
+    //Ecore_Ipc_Event_Server_Del *e = (Ecore_Ipc_Event_Server_Del *)ev;
     return 1;
 }
 
@@ -222,7 +211,7 @@ Ecore_Ipc_Server* serverConnection(const char* serviceName, SharedIndicatorInfo*
 
     if(!ecore_ipc_init())
     {
-        SDL_Log("cannot init ecore_con!");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "cannot init ecore_con!");
         ecore_shutdown();
         return NULL;
     }
index 506d40f..39da3f8 100755 (executable)
@@ -33,7 +33,6 @@ void
 _ecore_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
 {
     char *commit_str = (char *)event_info;
-    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "commit string : %s\n", commit_str);
     SDL_SendKeyboardText(commit_str);
     return;
 }
@@ -47,7 +46,6 @@ _ecore_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx, void *ev
 
     // get preedit string and attributes
     ecore_imf_context_preedit_string_with_attributes_get(imf_context, &preedit_string, NULL, &cursor_pos);
-    SDL_Log("preedit string : %s, %d", preedit_string, cursor_pos);
 
     SDL_SendEditingText(preedit_string, 0, cursor_pos);
     free(preedit_string);
@@ -58,7 +56,6 @@ _ecore_imf_event_state_change_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED,
 {
     //ECORE_IMF_INPUT_PANEL_STATE_SHOW : 0
     //ECORE_IMF_INPUT_PANEL_STATE_HIDE : 1
-    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Keyboard State  : %d\n", value);
     return;
 }
 
@@ -83,7 +80,7 @@ void Tizen_InitKeyboard(_THIS)
     const char *default_id = ecore_imf_context_default_id_get();
     if (!default_id)
       {
-         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't create ecore_imf_context\n");
+         SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Can't create ecore_imf_context\n");
          return;
       }
 
@@ -125,7 +122,7 @@ Tizen_StartTextInput(_THIS)
     SDL_Window *window;
 
     if (!_this) {
-        SDL_SetError("Video subsystem must be initialized");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Video subsystem must be initialized");
         return;
     }
 
@@ -134,7 +131,7 @@ Tizen_StartTextInput(_THIS)
 
     window = SDL_GetKeyboardFocus();
     if(!window){
-       SDL_SetError("Keyboard focused window is NULL");
+       SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Keyboard focused window is NULL");
        return;
     }
     Tizen_ShowScreenKeyboard(_this, window);
index 81a4158..ef4f1d2 100755 (executable)
@@ -105,14 +105,14 @@ create_buffer_from_shm(Tizen_CursorData *d, int width, int height, uint32_t form
     shm_fd = wayland_create_tmp_file(size);
     if (shm_fd < 0)
     {
-        fprintf(stderr, "creating mouse cursor buffer failed!\n");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "creating mouse cursor buffer failed!\n");
         return -1;
     }
 
     d->shm_data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
     if (d->shm_data == MAP_FAILED) {
         d->shm_data = NULL;
-        fprintf (stderr, "mmap () failed\n");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "mmap () failed\n");
         close (shm_fd);
         return -1;
     }
@@ -288,7 +288,6 @@ _tizen_cb_event_mousedown_change(void *data, int type, void *event)
 
     int x, y;
     _tizen_get_mouseXY(window, (int)e->x, (int)e->y, &x, &y);
-    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse down (%d x %d)", x, y);
     if(Tizen_isTouchIndicator(window, wind->rotation, x, y))
     {
         ModelMatrixTranslateInit(window, wind->rotation);
@@ -319,7 +318,6 @@ _tizen_cb_event_mouseup_change(void *data, int type, void *event)
 
     int x, y;
     _tizen_get_mouseXY(window, (int)e->x, (int)e->y, &x, &y);
-    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse up (%d x %d)", x, y);
     SDL_SendMouseMotion(window, 0, 0, x, y);
     SDL_SendMouseButton(window, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
 
@@ -344,7 +342,6 @@ _tizen_cb_event_mousemove_change(void *data, int type, void *event)
 
     int x, y;
     _tizen_get_mouseXY(window, (int)e->x, (int)e->y, &x, &y);
-    //SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse move (%d x %d)",e->x,e->y);
     SDL_SendMouseMotion(window, 0, 0, x, y);
 
     Tizen_OnTouch(_this,1,e->multi.device,ACTION_POINTER_MOVE, x, y, 1.0f);
index bc68ef0..224fab8 100755 (executable)
@@ -65,7 +65,7 @@ Tizen_GLES_CreateContext(_THIS, SDL_Window *window)
             return context;
         if(!Tizen_Indicator_GLES_Init(window))
         {
-            SDL_Log("Indicator GLES init error!");
+            SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Indicator GLES init error!");
         }
     }
 
index 9e397b9..f05afca 100755 (executable)
@@ -69,7 +69,7 @@ void Tizen_InitTouch(void)
                         SeparateEventsHintWatcher, NULL);
     if(SDL_AddTouch(deviceId, "Tizen_Touch")<0)
     {
-        SDL_Log("error: can't add tizen touch %s, %d", __FILE__, __LINE__);
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "error: can't add tizen touch %s, %d", __FILE__, __LINE__);
     }
 }
 
@@ -93,7 +93,7 @@ void Tizen_OnTouch(_THIS, int touch_device_id_in, int pointer_finger_id_in, int
 
     touchDeviceId = (SDL_TouchID)touch_device_id_in;
     if (SDL_AddTouch(touchDeviceId, "Tizen_Touch") < 0) {
-        SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "error: can't add touch %s, %d", __FILE__, __LINE__);
     }
 
     fingerId = (SDL_FingerID)pointer_finger_id_in;
index 440811f..f4d0897 100755 (executable)
@@ -32,6 +32,7 @@
 #include "SDL_tizenwindow.h"
 #include "SDL_tizenvideo.h"
 #include "SDL_tizenvulkan.h"
+#include "SDL_log.h"
 
 #define DEFAULT_VULKAN "libvulkan.so"
 
@@ -39,7 +40,8 @@
 _this->vk_data->NAME = SDL_LoadFunction(_this->vk_data->vk_dll_handle, #NAME); \
 if (!_this->vk_data->NAME) \
 { \
-    return SDL_SetError("Could not retrieve Vulkan function " #NAME); \
+    SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Could not retrieve Vulkan function " #NAME); \
+    return -1; \
 }
 
 SDL_bool
@@ -50,7 +52,7 @@ Tizen_vulkan_GetInstanceExtensions(_THIS, const char* driver, unsigned int* coun
     VkResult err;
 
     if (strcmp(driver, "tizen")) {
-        SDL_SetError("Unsupported video driver '%s'", driver);
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Unsupported video driver '%s'", driver);
         return SDL_FALSE;
     }
 
@@ -58,7 +60,7 @@ Tizen_vulkan_GetInstanceExtensions(_THIS, const char* driver, unsigned int* coun
 
     err = _this->vk_data->vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
     if (err < 0) {
-        SDL_SetError("Fail to get Instance extension");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Fail to get Instance extension");
         return SDL_FALSE;
     }
 
@@ -112,14 +114,14 @@ Tizen_vulkan_CreateSurface(_THIS, SDL_Window* window, SDL_vulkanInstance instanc
 
             ret = _this->vk_data->vkCreateWaylandSurfaceKHR((VkInstance)instance, &createInfo, NULL, (VkSurfaceKHR*)surface);
             if (ret != VK_SUCCESS) {
-                SDL_SetError("fail to vkCreateWaylandSurfaceKHR : %i", (int)ret);
+                SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "fail to vkCreateWaylandSurfaceKHR : %i", (int)ret);
                 return SDL_FALSE;
             }
             return SDL_TRUE;
         }
     default:
         (void)surface;
-        SDL_SetError("Unsupported subsystem %i", (int)wminfo.subsystem);
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Unsupported subsystem %i", (int)wminfo.subsystem);
         return SDL_FALSE;
     }
 }
@@ -157,7 +159,8 @@ Tizen_vulkan_LoadLibrary(_THIS, const char *vk_path)
     _this->vk_data->vk_dll_handle = vk_dll_handle;
 
     if (vk_dll_handle == NULL) {
-        return SDL_SetError("Could not initialize Vulkan library");
+        SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Could not initialize Vulkan library");
+        return -1;
     }
 
     LOAD_FUNC(vkEnumerateInstanceExtensionProperties);
index d3a049a..64794ad 100755 (executable)
@@ -49,7 +49,7 @@
 _this->tizen_pre_rotation_data->NAME = SDL_LoadFunction(_this->tizen_pre_rotation_data->prerotation_dll_handle, #NAME); \
 if (!_this->tizen_pre_rotation_data->NAME) \
 { \
-    SDL_SetError("Could not retrieve pre-rotation function " #NAME); \
+    SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Could not retrieve pre-rotation function " #NAME); \
     return SDL_FALSE; \
 }
 
@@ -130,7 +130,6 @@ _tizen_pre_rotation_set(SDL_WindowData *_this)
     tizen_wl_egl_window_rotation rot;
     if (!_this->egl_window) return;
 
-    SDL_Log("%s with angle %d",__FUNCTION__, _this->rotation);
     switch (_this->rotation) {
          case 90:
             rot = TIZEN_ROTATION_270;
@@ -149,7 +148,6 @@ _tizen_pre_rotation_set(SDL_WindowData *_this)
             break;
       }
 
-      SDL_SetError("call wl_egl_win_set_rotation with rot %d",rot);
       _this->tizen_pre_rotation_data->wl_egl_window_set_rotation(_this->egl_window, rot);
 }
 
@@ -188,19 +186,15 @@ _tizen_window_orientaiton_hint_callback(void *userdata, const char *name, const
 
             if (i == 0) {
                 checked[j] = 0;
-                SDL_Log("SDL  %s: avaiable rotation: 0", __FUNCTION__);
             }
             else if (i == 1) {
                 checked[j] = 90;
-                SDL_Log("SDL %s: avaiable rotation: 90", __FUNCTION__);
             }
             else if (i == 2) {
                 checked[j] = 180;
-                SDL_Log("SDL %s: avaiable rotation: 180", __FUNCTION__);
             }
             else if (i == 3) {
                 checked[j] = 270;
-                SDL_Log("SDL %s: avaiable rotation: 270", __FUNCTION__);
             }
             j++;
         }
@@ -209,9 +203,7 @@ _tizen_window_orientaiton_hint_callback(void *userdata, const char *name, const
     if (j > 0) {
         if (j == 1) {
             ecore_wl_window_rotation_preferred_rotation_set(window,wind->rotation);
-            SDL_Log("SDL %s: support pre_rotation %d", __FUNCTION__,wind->support_pre_rotation);
             if (wind->support_pre_rotation) {
-                SDL_Log("SDL %s: set pre rotation %d", __FUNCTION__,wind->rotation);
                 _tizen_pre_rotation_set(wind);
             }
         }
@@ -261,7 +253,7 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
 
     if (!(globals = ecore_wl_globals_get()))
       {
-         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get wayland globals");
+         SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Failed to get wayland globals");
          return -1;
       }
 
@@ -281,7 +273,7 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
         /* Create the GLES window surface */
         wind->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) wind->egl_window);
         if (wind->egl_surface == EGL_NO_SURFACE) {
-            SDL_SetError("failed to create a window surface");
+            SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "failed to create a window surface");
             return -1;
         }
 
@@ -290,14 +282,7 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
         if (_tizen_PreRotatotion_LoadLibrary(wind, "libwayland-egl.so")) {
             if (wind->tizen_pre_rotation_data->wl_egl_window_get_capabilities(wind->egl_window) == TIZEN_WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED ) {
                 wind->support_pre_rotation = 1;
-                SDL_Log("Can support PreRotation");
             }
-            else {
-                SDL_Log("can not support PreRotation !!");
-            }
-        }
-        else {
-            SDL_Log("can not support PreRotation !!");
         }
     }
 #endif
@@ -309,9 +294,6 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
     SDL_SetMouseFocus(window);
 
     if (window->flags & 0x00008000) {
-        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "---------------------------------------");
-        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[SDL] touch bypass setting is done!\n");
-        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "---------------------------------------");
         ecore_wl_window_input_region_set(wind->window, -1, -1, 1, 1);
         ecore_wl_window_focus_skip_set(wind->window, EINA_TRUE);
     }
@@ -319,7 +301,6 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
     EINA_INLIST_FOREACH(globals, global) {
          if (!strcmp(global->interface, "tizen_policy_ext")) {
               wind->rotation_supported = 1;
-              SDL_Log("SDL can support rotation in this device!!!!!!!!!!!");
               break;
            }
       }
@@ -362,7 +343,6 @@ _tizen_setwindowsize(SDL_Window *window)
 void
 Tizen_SetWindowSize(_THIS, SDL_Window *window)
 {
-   SDL_Log("[SDL_Size] Tizen_SetWindowSize");
 //    _tizen_setwindowsize(window);
 //    _tizen_egl_window_resize(window);
 }
@@ -434,8 +414,6 @@ _tizen_cb_event_window_visibility_change(void *data, int type, void *event)
     ew = ecore_wl_window_find(ev->win);
     window = Tizen_FindWindow(_this, ew);
 
-    SDL_Log( "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;
@@ -527,8 +505,6 @@ _tizen_cb_event_window_rotate(void *data, int type EINA_UNUSED, void *event)
             wl_egl_window_get_attached_size(wind->egl_window, &aw, &ah);
             wl_egl_window_resize(wind->egl_window, aw, ah, 0, 0);
 
-            SDL_Log("[SDL_Size] * _tizen_cb_event_window_rotate aw ah : %d, %d", aw, ah);
-
             if(wind->rotation == 90 || wind->rotation == 270) {
                 SDL_SetWindowSize(window, ah, aw);
                 window->w = ah;//for Fullscreen
@@ -538,7 +514,6 @@ _tizen_cb_event_window_rotate(void *data, int type EINA_UNUSED, void *event)
                 window->w = aw;//for Fullscreen
                 window->h = ah;
             }
-            SDL_Log("[SDL_Size] * _tizen_cb_event_window_rotate aw ah : %d, %d", window->w, window->h);
     }
 
         // Send Rotation Event