[SDL_Tizen] Fix rotation issue
[platform/upstream/SDL.git] / src / video / tizen / SDL_tizenwindow.c
index 6764bcd..9d0b26d 100755 (executable)
@@ -388,13 +388,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);
@@ -412,8 +407,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;
@@ -435,7 +431,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
@@ -492,7 +488,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
@@ -676,7 +673,7 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
     // Add orientaiton hint cb
     _tizen_window_orientation_add_hint((void*)wind);
 
-    Tizen_rotate_update(wind);
+    Tizen_rotate_update(window);
 
     return 0;
 }