From f7fbe6175dabffa438e770f3c7876fd488777a16 Mon Sep 17 00:00:00 2001 From: "huiyu.eun" Date: Wed, 28 Dec 2016 16:00:43 +0900 Subject: [PATCH] [SDL_Tizen] Move pre-rotaion function [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 --- src/video/tizen/SDL_tizenopengles.c | 24 ++++++++++++++++++++++++ src/video/tizen/SDL_tizenwindow.c | 28 ++-------------------------- src/video/tizen/SDL_tizenwindow.h | 3 +++ 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/video/tizen/SDL_tizenopengles.c b/src/video/tizen/SDL_tizenopengles.c index a1f3264..6604d88 100755 --- a/src/video/tizen/SDL_tizenopengles.c +++ b/src/video/tizen/SDL_tizenopengles.c @@ -24,11 +24,14 @@ #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; } diff --git a/src/video/tizen/SDL_tizenwindow.c b/src/video/tizen/SDL_tizenwindow.c index 557910d..608bb74 100755 --- a/src/video/tizen/SDL_tizenwindow.c +++ b/src/video/tizen/SDL_tizenwindow.c @@ -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; } diff --git a/src/video/tizen/SDL_tizenwindow.h b/src/video/tizen/SDL_tizenwindow.h index d523c34..23eb9cc 100755 --- a/src/video/tizen/SDL_tizenwindow.h +++ b/src/video/tizen/SDL_tizenwindow.h @@ -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: */ -- 2.7.4