From e92e6195934a08913ff5ffa20e5ea842be4e6008 Mon Sep 17 00:00:00 2001 From: "huiyu.eun" Date: Fri, 2 Dec 2016 22:57:00 +0900 Subject: [PATCH] [SDL_Tizen] Modify prerotation Add 'wl_egl_window_resize' before calling prerotation. Change-Id: Iad6b33972c3e2c9f7e3887383185702824a7e445 Signed-off-by: huiyu.eun --- src/video/tizen/SDL_tizenwindow.c | 51 +++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/video/tizen/SDL_tizenwindow.c b/src/video/tizen/SDL_tizenwindow.c index f7a87fd..ea0a432 100755 --- a/src/video/tizen/SDL_tizenwindow.c +++ b/src/video/tizen/SDL_tizenwindow.c @@ -85,13 +85,13 @@ _tizen_pre_rotation_set(struct wl_egl_window *win, int angle) SDL_Log("%s with angle %d",__FUNCTION__, angle); switch (angle) { - case 270: + case 90: rot = ROTATION_270; break; case 180: rot = ROTATION_180; break; - case 90: + case 270: rot = ROTATION_90; break; case 0: @@ -311,12 +311,17 @@ _tizen_setwindowsize(SDL_Window *window) if (!wind->window) { return; } - ecore_wl_window_update_size(wind->window, window->w, window->h); + + if ((wind->rotation == 0) || (wind->rotation == 180)) + ecore_wl_window_update_size(wind->window, window->w, window->h); + else + ecore_wl_window_update_size(wind->window, window->h, window->w); } void Tizen_SetWindowSize(_THIS, SDL_Window *window) { + SDL_Log("[SDL_Size] Tizen_SetWindowSize"); _tizen_setwindowsize(window); _tizen_egl_window_resize(window); } @@ -426,14 +431,12 @@ _tizen_cb_window_configure(void *data, int type EINA_UNUSED, void *event) ecore_wl_window_geometry_get(ew, &nx, &ny, &nw, &nh); if (nw < 1) nw = 1; if (nh < 1) nh = 1; - + + SDL_Log("[SDL_Size] * _tizen_cb_window_configure :: w->w:%d, w->h:%d, nw:%d, nh:%d", window->w, window->h, nw, nh); if ((window->x != nx) || (window->y != ny)) ecore_wl_window_position_set(ew, nx, ny); if ((window->w != nw) || (window->h != nh)) { - window->w = nw; - window->h = nh; - _tizen_setwindowsize(window); } return ECORE_CALLBACK_PASS_ON; @@ -487,31 +490,31 @@ _tizen_cb_event_window_rotate(void *data, int type EINA_UNUSED, void *event) /* set ecore_wayland window rotation */ _tizen_setwindowsize(window); + SDL_Log("[SDL_Size] * _tizen_cb_event_window_rotate : %d, %d", window->w, window->h); + // Send Rotation Event + _tizen_send_rotation_event(window, ev->angle); + + int retW = window->w; + int retH = window->h; if(!wind->support_pre_rotation) { _tizen_egl_window_resize(window); } else { - _tizen_pre_rotation_set(wind->egl_window, (int)ev->angle); + if ((wind->rotation == 90) || (wind->rotation == 270)) { + retW = window->h; + retH = window->w; + } + wl_egl_window_resize(wind->egl_window, retW, retH, 0, 0); } - - // Send Rotation Event - _tizen_send_rotation_event(window, ev->angle); - - if (wind->rotation == 0 || wind->rotation == 180) - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h); - else if (wind->rotation == 90 || wind->rotation == 270) - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->h, window->w); + ecore_wl_window_rotation_geometry_set(wind->window, wind->rotation, 0, 0,retW, retH); + _tizen_pre_rotation_set(wind->egl_window, (int)ev->angle); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, retW, retH); } - wind->received_rotation = 1; + wind->received_rotation = 1; const char* hint = SDL_GetHint(SDL_HINT_ORIENTATIONS); - if(hint) - { - if(*hint != '\0') - { - SDL_IndicatorProcessEvent(_this->current_glwin, wind->rotation); - } - } + if(hint && *hint != '\0') + SDL_IndicatorProcessEvent(_this->current_glwin, wind->rotation); return ECORE_CALLBACK_PASS_ON; } -- 2.7.4