#include "../../joystick/tizen/SDL_sysjoystick_c.h"
#include <wayland-egl.h>
+int
+_tizen_PreRotatotion_LoadLibrary(SDL_WindowData *_this, const char *lib_path)
+{
+ void *lib_dll_handle = NULL;
+ char *path = NULL;
+
+ if (_this->isLoaded_pre_rotation)
+ return SDL_TRUE;
+
+ _this->tizen_pre_rotation_data = (struct Tizen_Prerotation_Data *) SDL_calloc(1, sizeof(Tizen_Prerotation_Data));
+ if (!_this->tizen_pre_rotation_data) {
+ return SDL_OutOfMemory();
+ }
+
+ if (!lib_path)
+ lib_dll_handle = SDL_LoadObject(lib_path);
+
+ if (!lib_dll_handle) {
+ path = "libwayland-egl.so";
+ lib_dll_handle = SDL_LoadObject(path);
+ }
+
+ _this->tizen_pre_rotation_data->prerotation_dll_handle = lib_dll_handle;
+
+ if (lib_dll_handle == NULL)
+ return SDL_FALSE;
+
+ _this->tizen_pre_rotation_data->wl_egl_window_set_rotation = SDL_LoadFunction(lib_dll_handle, "wl_egl_window_set_rotation");
+ if (!_this->tizen_pre_rotation_data->wl_egl_window_set_rotation)
+ return SDL_FALSE;
+
+ _this->tizen_pre_rotation_data->wl_egl_window_get_capabilities = SDL_LoadFunction(lib_dll_handle, "wl_egl_window_get_capabilities"); \
+ if (!_this->tizen_pre_rotation_data->wl_egl_window_get_capabilities)
+ return SDL_FALSE;
+
+ _this->isLoaded_pre_rotation = 1;
+
+ return SDL_TRUE;
+}
+
SDL_bool
Tizen_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{
}
void
-_tizen_pre_rotation_set(struct wl_egl_window *win, int angle)
+_tizen_pre_rotation_set(SDL_WindowData *_this)
{
wl_egl_window_rotation rot;
- if (!win) return;
+ if (!_this->egl_window) return;
- SDL_Log("%s with angle %d",__FUNCTION__, angle);
- switch (angle) {
+ SDL_Log("%s with angle %d",__FUNCTION__, _this->rotation);
+ switch (_this->rotation) {
case 90:
rot = ROTATION_270;
break;
}
SDL_SetError("call wl_egl_win_set_rotation with rot %d",rot);
- wl_egl_window_set_rotation(win, rot);
+ _this->tizen_pre_rotation_data->wl_egl_window_set_rotation(_this->egl_window, rot);
}
void
SDL_Log("SDL %s: support pre_rotation %d", __FUNCTION__,wind->support_pre_rotation);
if (wind->support_pre_rotation) {
SDL_Log("SDL %s: set pre rotation %d", __FUNCTION__,wind->rotation);
- _tizen_pre_rotation_set(wind->egl_window, wind->rotation);
+ _tizen_pre_rotation_set(wind);
}
}
ecore_wl_window_rotation_available_rotations_set(window, (const int*)checked, j);
//Support PreRotation
wind->support_pre_rotation = 0;
- SDL_Log("SDL %s: call wl_egl_window_get_capabilities()", __FUNCTION__);
- if (wl_egl_window_get_capabilities(wind->egl_window) == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED ) {
- wind->support_pre_rotation = 1;
- SDL_Log("Can support PreRotation");
+ if (_tizen_PreRotatotion_LoadLibrary(wind, "libwayland-egl.so")) {
+ SDL_Log("SDL %s: call wl_egl_window_get_capabilities()", __FUNCTION__);
+ if (wind->tizen_pre_rotation_data->wl_egl_window_get_capabilities(wind->egl_window) == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED ) {
+ wind->support_pre_rotation = 1;
+ SDL_Log("Can support PreRotation");
+ }
+ else {
+ SDL_Log("can not support PreRotation !!");
+ }
}
else {
SDL_Log("can not support PreRotation !!");
eina_hash_add(data->windows, &wind->id, window);
Tizen_InitKeyboard(_this);
-
SDL_SetMouseFocus(window);
if (window->flags & 0x00008000) {
ecore_wl_window_rotation_set(ew, ev->angle);
if(wind->support_pre_rotation) {
- _tizen_pre_rotation_set(wind->egl_window, (int)ev->angle);
+ _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);
+ 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()
+ 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);
+ SDL_Log("[SDL_Size] * _tizen_cb_event_window_rotate aw ah : %d, %d", window->w, window->h);
}
// Send Rotation Event