Merge "[SDL_Tizen] Fix rotation issue" into tizen
authorhuiyu.eun <huiyu.eun@samsung.com>
Tue, 4 Jul 2017 05:49:42 +0000 (05:49 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 4 Jul 2017 05:49:42 +0000 (05:49 +0000)
src/video/tizen/SDL_tizenopengles.c
src/video/tizen/SDL_tizenwindow.c
src/video/tizen/SDL_tizenwindow.h

index f2a91c8..5452cad 100755 (executable)
@@ -66,7 +66,7 @@ Tizen_GLES_SwapWindow(_THIS, SDL_Window *window)
     SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
     SDL_WindowData* wdata = (SDL_WindowData*)window->driverdata;
     if (wdata->received_rotation == 1) {
-        Tizen_rotate_update(wdata);
+        Tizen_rotate_update(window);
         ecore_wl_window_rotation_change_done_send(wdata->window);
         wdata->received_rotation = 0;
     }
index b959168..7811e2f 100755 (executable)
@@ -395,13 +395,8 @@ _tizen_send_rotation_event(SDL_Window *window, unsigned int angle)
 }
 
 void
-_tizen_rotation_do(SDL_WindowData *wind, int rotation)
+_tizen_rotation_do(SDL_Window *window, SDL_WindowData* wind, int rotation)
 {
-    if(!wind) return;
-
-    SDL_Window *window = SDL_GetVideoDevice()->windows;
-    if(!window) return;
-
     int window_w, window_h;
     if(wind->rotation == 0 || wind->rotation == 180)
         ecore_wl_window_geometry_get(wind->window, 0, 0, &window_w, &window_h);
@@ -419,8 +414,9 @@ _tizen_rotation_do(SDL_WindowData *wind, int rotation)
 }
 
 void
-Tizen_rotate_update(SDL_WindowData *wind)
+Tizen_rotate_update(SDL_Window *window)
 {
+    SDL_WindowData *wind = window->driverdata;
     if(!wind) return;
 
     int screen_rotation;
@@ -442,7 +438,7 @@ Tizen_rotate_update(SDL_WindowData *wind)
     ecore_wl_window_rotation_set(wind->window, wind->rotation);
 
     int rotation = (wind->output_rotation + wind->rotation) % 360;
-    _tizen_rotation_do(wind, rotation);
+    _tizen_rotation_do(window, wind, rotation);
 }
 
 void
@@ -499,7 +495,8 @@ _tizen_window_orientaiton_hint_callback(void *userdata, const char *name, const
             ecore_wl_window_rotation_available_rotations_set(window, (const int*)checked, j);
         }
     }
-    Tizen_rotate_update(wind);
+
+    Tizen_rotate_update(Tizen_FindWindow(SDL_GetVideoDevice(), window));
 }
 
 void
@@ -703,7 +700,7 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
     _tizen_window_orientation_add_hint((void*)wind);
     SDL_AddHintCallback(SDL_HINT_TIZEN_INDICATOR_OPACITY, _tizen_indicator_opacity_hint_callback, data);
 
-    Tizen_rotate_update(wind);
+    Tizen_rotate_update(window);
 
     return 0;
 }
index 43c2679..cb0da77 100755 (executable)
@@ -87,7 +87,7 @@ extern int Tizen_InitWindow(_THIS);
 extern void Tizen_DeinitWindow(_THIS);
 
 extern void Tizen_pre_rotation_set(SDL_WindowData *_this, int rotation);
-extern void Tizen_rotate_update(SDL_WindowData *wind);
+extern void Tizen_rotate_update(SDL_Window *window);
 
 extern int _tizen_init_ecore_ipc();
 extern void _tizen_ecore_ipc_client_send(int major, int minor, int ref, int ref_to);