/* This effectively assumes that nobody else touches SDL_Mouse which is effectively a singleton */
SDL_Mouse *mouse = SDL_GetMouse();
- /* Free the current cursor if not the same pointer as the default cursor */
+ /* Free the current cursor if not the same pointer as
+ * the default cursor */
if (mouse->def_cursor != mouse->cur_cursor)
Tizen_FreeCursor (mouse->cur_cursor);
SDL_bool isTouchIndicator(SDL_Window *window, int rot, int x, int y)
{
- if(x > window->x && x < window->x + window->w && y > window->y && y < window->y + 52)
+ if(rot==0 && x > window->x && x < window->x + window->w && y > window->y && y < window->y + 52)
return SDL_TRUE;
- return SDL_FALSE;
-}
+ if(rot==90 && x > window->x && x < window->x + 52 && y > window->y && y < window->y + window->h)
+ return SDL_TRUE;
-void _tizen_get_mouseXY(SDL_Window* window, int x, int y, int* retX, int* retY)
-{
- SDL_WindowData *wind = window->driverdata;
- if(!wind->support_pre_rotation || wind->rotation==0)
- {
- *retX = x;
- *retY = y;
- return;
- };
+ if(rot==270 && x > window->x + window->w -52 && x < window->x + window->w && y > window->y && y < window->y + window->h)
+ return SDL_TRUE;
- switch (wind->rotation)
- {
- case 90:
- *retX = window->w-y;
- *retY = x;
- break;
- case 270:
- *retX = y;
- *retY = window->h-x;
- break;
- }
- return;
+ return SDL_FALSE;
}
Eina_Bool
window = Tizen_FindWindow(_this, ew);
wind = window->driverdata;
- int x, y;
- _tizen_get_mouseXY(window, (int)e->x, (int)e->y, &x, &y);
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse down (%d x %d)", x, y);
- if(isTouchIndicator(window, wind->rotation, x, y))
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse down (%d x %d)",e->x,e->y);
+ if(isTouchIndicator(window, wind->rotation, e->x, e->y))
{
ModelMatrixTranslateInit(&mMatrix);
wind->indicator_show = SDL_TRUE;
_tizen_indicator_event_filter();
}
- SDL_SendMouseMotion(window, 0, 0, x, y);
+ SDL_SendMouseMotion(window, 0, 0, e->x, e->y);
SDL_SendMouseButton(window, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
- Tizen_OnTouch(_this, 1, e->multi.device, ACTION_POINTER_DOWN, x, y, 1.0f);
+ Tizen_OnTouch(_this,1,e->multi.device,ACTION_POINTER_DOWN,e->x,e->y,1.0f);
return ECORE_CALLBACK_PASS_ON;
}
ew = ecore_wl_window_find(e->window);
window = Tizen_FindWindow(_this, ew);
- int x, y;
- _tizen_get_mouseXY(window, (int)e->x, (int)e->y, &x, &y);
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse up (%d x %d)", x, y);
- SDL_SendMouseMotion(window, 0, 0, x, y);
+ SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse up (%d x %d)",e->x,e->y);
+ SDL_SendMouseMotion(window, 0, 0, e->x, e->y);
SDL_SendMouseButton(window, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
- Tizen_OnTouch(_this,1,e->multi.device,ACTION_POINTER_UP, x, y, 1.0f);
+ Tizen_OnTouch(_this,1,e->multi.device,ACTION_POINTER_UP,e->x,e->y,1.0f);
return ECORE_CALLBACK_PASS_ON;
}
ew = ecore_wl_window_find(e->window);
window = Tizen_FindWindow(_this, ew);
- int x, y;
- _tizen_get_mouseXY(window, (int)e->x, (int)e->y, &x, &y);
//SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse move (%d x %d)",e->x,e->y);
- SDL_SendMouseMotion(window, 0, 0, x, y);
+ SDL_SendMouseMotion(window, 0, 0, e->x, e->y);
- Tizen_OnTouch(_this,1,e->multi.device,ACTION_POINTER_MOVE, x, y, 1.0f);
+ Tizen_OnTouch(_this,1,e->multi.device,ACTION_POINTER_MOVE,e->x,e->y,1.0f);
return ECORE_CALLBACK_PASS_ON;
}
SDL_Log("Can support PreRotation");
}
else {
- SDL_Log("can not support PreRotation !!");
+ SDL_Log("can not support PreRotation !!!!!!!!!!!!!!");
}
}
#endif
// TODO : consider to rotation status.
#if SDL_VIDEO_OPENGL_EGL
if (window->flags & SDL_WINDOW_OPENGL) {
+ int aw, ah, dx = 0, dy = 0;
+
+ if ((wind->rotation == 90) || (wind->rotation == 270))
+ wl_egl_window_get_attached_size(wind->egl_window, &ah, &aw);
+ else
+ wl_egl_window_get_attached_size(wind->egl_window, &aw, &ah);
+
+ SDL_Log("SDL %s:wl_egl_window_get_attached_size:rot(%i)%ix%i",__FUNCTION__,wind->rotation,aw,ah);
+
// TODO : if window size is not FULL, we need the code about Non FullSize Window.
- 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);
+ wl_egl_window_resize(wind->egl_window, window->w, window->h, dx, dy);
}
#endif
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);
+ _tizen_setwindowsize(window);
+ _tizen_egl_window_resize(window);
}
void
Tizen_GetWindowSize(_THIS, SDL_Window *window, int *w, int *h)
{
SDL_WindowData *wind = window->driverdata;
+ int tmp_w, tmp_h;
if (!wind->window) {
return;
}
- if (w) *w = window->w;
- if (h) *h = window->h;
+ tmp_w = window->w;
+ tmp_h = window->h;
+ if (wind->rotation == 90 || wind->rotation == 270) {
+ tmp_w = window->h;
+ tmp_h = window->w;
+ }
+
+ if (w) *w = tmp_w;
+ if (h) *h = tmp_h;
}
void
wind->rotation = ev->angle;
ecore_wl_window_rotation_set(ew, ev->angle);
- if(wind->support_pre_rotation) {
- _tizen_pre_rotation_set(wind->egl_window, (int)ev->angle);
-
- 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);
- else
- SDL_SetWindowSize(window, aw, ah);//->call wl_egl_window_resize()
-
- SDL_Log("[SDL_Size] * _tizen_cb_event_window_rotate aw ah : %d, %d", window->w, window->h);
- }
+ // support prerotation
+ /* 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);
- SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
+
+ int retW = window->w;
+ int retH = window->h;
+ if(!wind->support_pre_rotation) {
+ _tizen_egl_window_resize(window);
+ }
+ else {
+ if ((wind->rotation == 90) || (wind->rotation == 270)) {
+ retW = window->h;
+ retH = window->w;
+ }
+ wl_egl_window_resize(wind->egl_window, retW, retH, 0, 0);
+ }
+ 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;