From: huiyu.eun Date: Fri, 23 Dec 2016 10:25:37 +0000 (+0900) Subject: [SDL_Tizen] Support environment which is not using pre-rotation X-Git-Tag: accepted/tizen/unified/20170407.190801~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b65b4596ebc3615739830bb8705ac0a9de273280;p=platform%2Fupstream%2FSDL.git [SDL_Tizen] Support environment which is not using pre-rotation Support environment which is not using pre-rotation. Change-Id: I4f1b72b2096c112d05b06f2518d9a43ecb9e15c6 Signed-off-by: huiyu.eun --- diff --git a/src/video/tizen/SDL_tizenindicator.c b/src/video/tizen/SDL_tizenindicator.c index ad9d0a3..2a08f40 100644 --- a/src/video/tizen/SDL_tizenindicator.c +++ b/src/video/tizen/SDL_tizenindicator.c @@ -110,6 +110,16 @@ GLuint programObject; GLuint vIndex; GLuint cIndex; +GLfloat _tizen_cal_indicator_ratio(SDL_Window *window) +{ + SDL_WindowData *wind = window->driverdata; + GLfloat ratio = 1 - (GLfloat)(IINDICATOR_HEIGHT*2) / window->h; + + if (!wind->support_pre_rotation && (wind->rotation==90 || wind->rotation==270)) + ratio = 1 - (GLfloat)(IINDICATOR_HEIGHT*2) / window->w; + return ratio; +} + Eina_Bool _tizen_timer_callback_indicator(void *data) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -209,8 +219,7 @@ void ModelMatrixTranslateInit(SDL_Window *window, int rot) for( ; i<12; i+=2) vVertices[i] = 1.0f; - GLfloat ratio = 1 - (GLfloat)(IINDICATOR_HEIGHT*2) / window->h; - vVertices[3] = vVertices[5] = vVertices[11] = ratio; + vVertices[3] = vVertices[5] = vVertices[11] = _tizen_cal_indicator_ratio(window); } void ModelMatrixMultiply(ModelMatrix *lhs, ModelMatrix *rhs, ModelMatrix *r) @@ -282,12 +291,19 @@ void Tizen_UploadIndicatorImage(int idx) 0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)(shared_info.fileInfo[idx].sharedFile->address)); } -SDL_bool Tizen_isTouchIndicator(SDL_Window *window, int rot, int x, int y) +SDL_bool Tizen_isTouchIndicator(SDL_Window *window, SDL_WindowData *wind, int rot, int x, int y) { if((window->flags & SDL_WINDOW_FULLSCREEN) || (window->flags & SDL_WINDOW_BORDERLESS)) return SDL_FALSE; - if(x > window->x && x < window->x + window->w && y > window->y && y < window->y + IINDICATOR_HEIGHT) + if(wind->support_pre_rotation && x > window->x && x < window->x + window->w && y > window->y && y < window->y + IINDICATOR_HEIGHT) + return SDL_TRUE; + + if(rot==0 && x > window->x && x < window->x + window->w && y > window->y && y < window->y + IINDICATOR_HEIGHT) + return SDL_TRUE; + if(rot==90 && x > window->x && x < window->x + IINDICATOR_HEIGHT && y > window->y && y < window->y + window->h) + return SDL_TRUE; + if(rot==270 && x > window->x + window->w -IINDICATOR_HEIGHT && x < window->x + window->w && y > window->y && y < window->y + window->h) return SDL_TRUE; return SDL_FALSE; @@ -459,8 +475,7 @@ Tizen_IndicatorProcessEvent(SDL_Window *window, int rot) GLES2_Context Mainctx; LoadContext(&Mainctx); - GLfloat ratio = 1 - (GLfloat)(52*2) / window->h; - vVertices[3] = vVertices[5] = vVertices[11] = ratio; + vVertices[3] = vVertices[5] = vVertices[11] = _tizen_cal_indicator_ratio(window); Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_vbo); Mainctx.glBufferData(GL_ARRAY_BUFFER, 12 * 4, vVertices, GL_STATIC_DRAW); diff --git a/src/video/tizen/SDL_tizenindicator.h b/src/video/tizen/SDL_tizenindicator.h index 7da31a0..2c6fb04 100644 --- a/src/video/tizen/SDL_tizenindicator.h +++ b/src/video/tizen/SDL_tizenindicator.h @@ -29,10 +29,11 @@ #include "../SDL_sysvideo.h" #include "SDL_ecore_ipc.h" +#include "SDL_tizenwindow.h" extern void ModelMatrixTranslateInit(SDL_Window *window, int rot); -extern SDL_bool Tizen_isTouchIndicator(SDL_Window *window, int rot, int x, int y); +extern SDL_bool Tizen_isTouchIndicator(SDL_Window *window, SDL_WindowData *wind, int rot, int x, int y); extern int Tizen_Indicator_GLES_Init(SDL_Window* window); extern int Tizen_indicator_event_filter(void); diff --git a/src/video/tizen/SDL_tizenmouse.c b/src/video/tizen/SDL_tizenmouse.c index ef4f1d2..151eda1 100755 --- a/src/video/tizen/SDL_tizenmouse.c +++ b/src/video/tizen/SDL_tizenmouse.c @@ -288,11 +288,14 @@ _tizen_cb_event_mousedown_change(void *data, int type, void *event) int x, y; _tizen_get_mouseXY(window, (int)e->x, (int)e->y, &x, &y); - if(Tizen_isTouchIndicator(window, wind->rotation, x, y)) + if(Tizen_isTouchIndicator(window, wind, wind->rotation, x, y)) { ModelMatrixTranslateInit(window, wind->rotation); wind->indicator_show = SDL_TRUE; wind->last_indicator_showtime = SDL_GetTicks(); + + if(!wind->support_pre_rotation) + Tizen_IndicatorProcessEvent(_this->current_glwin, wind->rotation); } SDL_SendMouseMotion(window, 0, 0, x, y);