[SDL_Tizen] Move pre-rotaion function 66/107466/2
authorhuiyu.eun <huiyu.eun@samsung.com>
Wed, 28 Dec 2016 07:00:43 +0000 (16:00 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Wed, 28 Dec 2016 07:34:43 +0000 (16:34 +0900)
[Problem] When using pre-rotate, stretched screen view.
Move function related about pre-rotation into Tizen_GLES_SwapWindow().

Change-Id: I6d4422d3990ebf0bc7af4515ff8b18d559ed7c7c
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/video/tizen/SDL_tizenopengles.c
src/video/tizen/SDL_tizenwindow.c
src/video/tizen/SDL_tizenwindow.h

index a1f3264..6604d88 100755 (executable)
 #if SDL_VIDEO_OPENGL_EGL
 
 #include "SDL_log.h"
+#include "SDL_hints.h"
 #include "SDL_tizenopengles.h"
 #include "SDL_tizenindicator.h"
 #include "SDL_tizenvideo.h"
 #include "SDL_tizenwindow.h"
 
+#include "../../events/SDL_windowevents_c.h"
+
 #if SDL_VIDEO_OPENGL
 #include "SDL_opengl.h"
 #endif /* SDL_VIDEO_OPENGL */
@@ -93,6 +96,27 @@ Tizen_GLES_SwapWindow(_THIS, SDL_Window *window)
     Tizen_DrawIndicator(window);
 
     if (wdata->received_rotation == 1) {
+        if(wdata->support_pre_rotation) {
+            Tizen_pre_rotation_set(wdata);
+            int aw, ah;
+            wl_egl_window_get_attached_size(wdata->egl_window, &aw, &ah);
+            wl_egl_window_resize(wdata->egl_window, aw, ah, 0, 0);
+            if(wdata->rotation == 90 || wdata->rotation == 270) {
+                SDL_SetWindowSize(window, ah, aw);
+                window->w = ah;//for Fullscreen
+                window->h = aw;
+            } else {
+                SDL_SetWindowSize(window, aw, ah);//->call wl_egl_window_resize()
+                window->w = aw;//for Fullscreen
+                window->h = ah;
+            }
+        }
+        SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
+
+        const char* hint = SDL_GetHint(SDL_HINT_ORIENTATIONS);
+        if(hint && *hint != '\0')
+            Tizen_IndicatorProcessEvent(_this->current_glwin, wdata->rotation);
+
         ecore_wl_window_rotation_change_done_send(wdata->window);
         wdata->received_rotation = 0;
     }
index 557910d..608bb74 100755 (executable)
@@ -126,7 +126,7 @@ Tizen_SetWindowFullscreen(_THIS, SDL_Window *window,
 }
 
 void
-_tizen_pre_rotation_set(SDL_WindowData *_this)
+Tizen_pre_rotation_set(SDL_WindowData *_this)
 {
     tizen_wl_egl_window_rotation rot;
     if (!_this->egl_window) return;
@@ -205,7 +205,7 @@ _tizen_window_orientaiton_hint_callback(void *userdata, const char *name, const
         if (j == 1) {
             ecore_wl_window_rotation_preferred_rotation_set(window,wind->rotation);
             if (wind->support_pre_rotation) {
-                _tizen_pre_rotation_set(wind);
+                Tizen_pre_rotation_set(wind);
             }
         }
         ecore_wl_window_rotation_available_rotations_set(window, (const int*)checked, j);
@@ -517,35 +517,11 @@ _tizen_cb_event_window_rotate(void *data, int type EINA_UNUSED, void *event)
         /* set ecore_wayland window rotation */
         wind->rotation = ev->angle;
         ecore_wl_window_rotation_set(ew, ev->angle);
-
-        if(wind->support_pre_rotation) {
-            _tizen_pre_rotation_set(wind);
-
-            int aw, ah;
-            wl_egl_window_get_attached_size(wind->egl_window, &aw, &ah);
-            wl_egl_window_resize(wind->egl_window, aw, ah, 0, 0);
-
-            if(wind->rotation == 90 || wind->rotation == 270) {
-                SDL_SetWindowSize(window, ah, aw);
-                window->w = ah;//for Fullscreen
-                window->h = aw;
-            } else {
-                SDL_SetWindowSize(window, aw, ah);//->call wl_egl_window_resize()
-                window->w = aw;//for Fullscreen
-                window->h = ah;
-            }
-    }
-
         // Send Rotation Event
         _tizen_send_rotation_event(window, ev->angle);
-        SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
     }
 
     wind->received_rotation = 1;
-    const char* hint = SDL_GetHint(SDL_HINT_ORIENTATIONS);
-    if(hint && *hint != '\0')
-        Tizen_IndicatorProcessEvent(_this->current_glwin, wind->rotation);
-
     return ECORE_CALLBACK_PASS_ON;
 }
 
index d523c34..23eb9cc 100755 (executable)
@@ -93,6 +93,9 @@ extern void Tizen_SetWindowPosition(_THIS, SDL_Window * window);
 extern int Tizen_InitWindow(_THIS);
 extern void Tizen_DeinitWindow(_THIS);
 
+extern void Tizen_pre_rotation_set(SDL_WindowData *_this);
+
+
 #endif /* _SDL_tizenwindow_h */
 
 /* vi: set ts=4 sw=4 expandtab: */