main ()
{
+ uint32_t instance_layer_count = 0;
+ vkEnumerateInstanceLayerProperties(&instance_layer_count, NULL);
;
return 0;
AC_TRY_COMPILE([
#include <vulkan/vulkan.h>
],[
+ uint32_t instance_layer_count = 0;
+ vkEnumerateInstanceLayerProperties(&instance_layer_count, NULL);
],[
video_vulkan=yes
])
#include <app_internal.h>
#include <app_extension.h>
#include <system_settings.h>
-#include <dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "SDL"
static int tizen_appcore_initialized = 0;
static appcore_context_h appcore_handle = NULL;
static bool
_tizen_sdl_create(void *data)
{
- LOGI("SDL_AppCore CreateCB");
+ SDL_Log("App Create");
return true;
}
static void
_tizen_sdl_terminate(void *data)
{
- LOGI("SDL_AppCore TermincateCB");
+ SDL_Log("App Termincate");
SDL_SendQuit();
SDL_SendAppEvent(SDL_APP_TERMINATING);
return;
static void
_tizen_sdl_pause (void *data)
{
- LOGI("SDL_AppCore PauseCB");
+ SDL_Log("App Pause");
SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
return;
static void
_tizen_sdl_resume(void *data)
{
- LOGI("SDL_AppCore ResumeCB");
+ SDL_Log("App Resume");
SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
return;
static void
_tizen_sdl_control(app_control_h app_control, void *data)
{
- LOGI("SDL_AppCore ControlCB");
+ SDL_Log("App Control");
SDL_Event event;
SDL_memset(&event, 0, sizeof(event));
{
/*APP_EVENT_LANGUAGE_CHANGED*/
char *locale = NULL;
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Language changedCB");
+ SDL_Log("Language changed");
system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
free(locale);
return;
/*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
app_device_orientation_e orientation;
app_event_get_device_orientation(event_info, &orientation);
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION," Orientation Changed CB, Rotation Degree : %d", orientation);
+ SDL_Log("Orientation Changed, Rotation Degree : %d", orientation);
SDL_Event event;
SDL_memset(&event, 0, sizeof(event));
event.type = SDL_ROTATEEVENT;
event.user.code = 0;
event.user.data1 = (void*)orientation;
- event.user.data2 = -1;
+ event.user.data2 = (void*)-1;
SDL_PushEvent(&event);
return;
_tizen_app_region_changed(app_event_info_h event_info, void *user_data)
{
/*APP_EVENT_REGION_FORMAT_CHANGED*/
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "region changedCB");
+ SDL_Log("region changed");
}
static void
_tizen_app_low_battery(app_event_info_h event_info, void *user_data)
{
/*APP_EVENT_LOW_BATTERY*/
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "low battery CB");
+ SDL_Log("low battery");
}
static void
_tizen_app_low_memory(app_event_info_h event_info, void *user_data)
{
/*APP_EVENT_LOW_MEMORY*/
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "low memory CB");
+ SDL_Log("low memory");
SDL_SendAppEvent(SDL_APP_LOWMEMORY);
}
int
SDL_tizen_app_init(int argc, char *argv[])
{
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL Tizen App initialize");
- if (tizen_appcore_initialized)
- {
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Already initialized!");
+ SDL_Log( "SDL Tizen App initialize");
+ if (tizen_appcore_initialized) {
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"Already initialized!");
return 0;
}
tizen_appcore_initialized = 1;
- if (argc < 1 || argv == NULL)
- {
- SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "APP_ERROR_INVALID_PARAMETER");
+ if (argc < 1 || argv == NULL) {
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"APP_ERROR_INVALID_PARAMETER");
return 0;
}
SDL_bool (*vulkan_GetInstanceExtensions) (const char* driver, unsigned int* count, char** names);
SDL_bool (*vulkan_CreateSurface) (_THIS, SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface);
+#if __TIZEN__
+ void (*GetWindowSize) (_THIS, SDL_Window * window, int *w, int *h);
+#endif
};
typedef struct VideoBootStrap
SDL_GetWindowSize(SDL_Window * window, int *w, int *h)
{
CHECK_WINDOW_MAGIC(window,);
+#ifdef __TIZEN__
+ if (_this->GetWindowSize) {
+ _this->GetWindowSize(_this, window, w, h);
+ }
+ else {
+ if (w) {
+ *w = window->w;
+ }
+ if (h) {
+ *h = window->h;
+ }
+ }
+#else
if (w) {
*w = window->w;
}
if (h) {
*h = window->h;
}
+#endif
}
void
}
Eina_Bool
-__tizen_cb_event_keyup_change(void *data, int type, void *event)
+_tizen_cb_event_keyup_change(void *data, int type, void *event)
{
if (!event) return ECORE_CALLBACK_PASS_ON;
}
Eina_Bool
-__tizen_cb_event_keydown_change(void *data, int type, void *event)
+_tizen_cb_event_keydown_change(void *data, int type, void *event)
{
if (!event) return ECORE_CALLBACK_PASS_ON;
extern void Tizen_PumpEvents(_THIS);
-extern Eina_Bool __tizen_cb_event_keyup_change(void *data, int type, void *event);
+extern Eina_Bool _tizen_cb_event_keyup_change(void *data, int type, void *event);
-extern Eina_Bool __tizen_cb_event_keydown_change(void *data, int type, void *event);
+extern Eina_Bool _tizen_cb_event_keydown_change(void *data, int type, void *event);
#endif /* _SDL_tizenevents_h */
/*
Tizen Keyboard
*/
+static TizenKeyboard tizen_keyboard;
void
_ecore_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
void Tizen_InitKeyboard(_THIS)
{
+ //TODO : need the ref count
+ if (tizen_keyboard.imf_context) return;
+
ecore_imf_init();
- memset(&keyboard, 0, sizeof(keyboard));
+ memset(&tizen_keyboard, 0, sizeof(tizen_keyboard));
const char *default_id = ecore_imf_context_default_id_get();
if (!default_id)
return;
}
- keyboard.imf_context = ecore_imf_context_add(default_id);
+ tizen_keyboard.imf_context = ecore_imf_context_add(default_id);
SDL_Window *window = _this->windows;
SDL_WindowData *wind = window->driverdata;
- ecore_imf_context_client_window_set(keyboard.imf_context, (void*)wind->id);
+ ecore_imf_context_client_window_set(tizen_keyboard.imf_context, (void*)wind->id);
- ecore_imf_context_event_callback_add(keyboard.imf_context, ECORE_IMF_CALLBACK_COMMIT , _ecore_imf_event_commit_cb, NULL);
- ecore_imf_context_input_panel_event_callback_add (keyboard.imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _ecore_imf_event_state_change_cb, NULL);
+ ecore_imf_context_event_callback_add(tizen_keyboard.imf_context, ECORE_IMF_CALLBACK_COMMIT , _ecore_imf_event_commit_cb, NULL);
+ ecore_imf_context_input_panel_event_callback_add (tizen_keyboard.imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _ecore_imf_event_state_change_cb, NULL);
- ecore_imf_context_cursor_position_set(keyboard.imf_context, 0);
- ecore_imf_context_focus_out(keyboard.imf_context);
- ecore_imf_context_input_panel_hide(keyboard.imf_context);
+ ecore_imf_context_cursor_position_set(tizen_keyboard.imf_context, 0);
+ ecore_imf_context_focus_out(tizen_keyboard.imf_context);
+ ecore_imf_context_input_panel_hide(tizen_keyboard.imf_context);
}
void Tizen_FiniKeyboard(void)
{
- if(keyboard.imf_context == NULL)
+ if(tizen_keyboard.imf_context == NULL)
return;
- ecore_imf_context_del(keyboard.imf_context);
- keyboard.imf_context = NULL;
+ ecore_imf_context_del(tizen_keyboard.imf_context);
+ tizen_keyboard.imf_context = NULL;
ecore_imf_shutdown();
}
return;
}
- if(keyboard.imf_context == NULL)
+ if(tizen_keyboard.imf_context == NULL)
Tizen_InitKeyboard(_this);
Tizen_ShowScreenKeyboard(_this, NULL);
Tizen_StopTextInput(_THIS)
{
if (!_this) return;
- if (keyboard.imf_context)
+ if (tizen_keyboard.imf_context)
{
Tizen_HideScreenKeyboard(_this, _this->windows);
}
void
Tizen_ShowScreenKeyboard(_THIS, SDL_Window * window)
{
- if (!keyboard.imf_context)
+ if (!tizen_keyboard.imf_context)
return;
- ecore_imf_context_focus_in(keyboard.imf_context);
- ecore_imf_context_input_panel_show(keyboard.imf_context);
+ ecore_imf_context_focus_in(tizen_keyboard.imf_context);
+ ecore_imf_context_input_panel_show(tizen_keyboard.imf_context);
}
void
Tizen_HideScreenKeyboard(_THIS, SDL_Window * window)
{
- if (!keyboard.imf_context)
+ if (!tizen_keyboard.imf_context)
return;
- ecore_imf_context_focus_out(keyboard.imf_context);
- ecore_imf_context_input_panel_hide(keyboard.imf_context);
+ ecore_imf_context_focus_out(tizen_keyboard.imf_context);
+ ecore_imf_context_input_panel_hide(tizen_keyboard.imf_context);
}
SDL_bool
Tizen_IsScreenKeyboardShown(_THIS, SDL_Window * window)
{
- if (!keyboard.imf_context)
+ if (!tizen_keyboard.imf_context)
return SDL_FALSE;
//EAPI Ecore_IMF_Input_Panel_State ecore_imf_context_input_panel_state_get (Ecore_IMF_Context *ctx)
- return ecore_imf_context_input_panel_state_get(keyboard.imf_context);
+ return ecore_imf_context_input_panel_state_get(tizen_keyboard.imf_context);
}
Ecore_IMF_Context *imf_context;
};
-static TizenKeyboard keyboard;
-
extern void Tizen_InitKeyboard(_THIS);
extern void Tizen_FiniKeyboard(void);
}
Eina_Bool
-__tizen_cb_event_mousedown_change(void *data, int type, void *event)
+_tizen_cb_event_mousedown_change(void *data, int type, void *event)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
}
Eina_Bool
-__tizen_cb_event_mouseup_change(void *data, int type, void *event)
+_tizen_cb_event_mouseup_change(void *data, int type, void *event)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
if (!event) return ECORE_CALLBACK_PASS_ON;
}
Eina_Bool
-__tizen_cb_event_mousemove_change(void *data, int type, void *event)
+_tizen_cb_event_mousemove_change(void *data, int type, void *event)
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
extern void Tizen_InitMouse(void);
extern void Tizen_FiniMouse(void);
-extern Eina_Bool __tizen_cb_event_mouseup_change(void *data, int type, void *event);
-extern Eina_Bool __tizen_cb_event_mousedown_change(void *data, int type, void *event);
-extern Eina_Bool __tizen_cb_event_mousemove_change(void *data, int type, void *event);
+extern Eina_Bool _tizen_cb_event_mouseup_change(void *data, int type, void *event);
+extern Eina_Bool _tizen_cb_event_mousedown_change(void *data, int type, void *event);
+extern Eina_Bool _tizen_cb_event_mousemove_change(void *data, int type, void *event);
void
Tizen_GLES_SwapWindow(_THIS, SDL_Window *window)
{
+ SDL_WindowData* wdata = (SDL_WindowData*)window->driverdata;
+ if (wdata->received_rotation == 1) {
+ ecore_wl_window_rotation_change_done_send(wdata->window);
+ wdata->received_rotation = 0;
+ }
+
SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
}
device->DestroyWindow = Tizen_DestroyWindow;
device->SetWindowHitTest = Tizen_SetWindowHitTest;
device->GetWindowWMInfo = Tizen_GetWindowWMInfo;
+ device->SetWindowPosition = Tizen_SetWindowPosition;
/* Text input */
device->StartTextInput = Tizen_StartTextInput;
device->vulkan_GetInstanceExtensions = Tizen_vulkan_GetInstanceExtensions;
device->vulkan_CreateSurface = Tizen_vulkan_CreateSurface;
#endif
+ device->GetWindowSize = Tizen_GetWindowSize;
return device;
}
{
uint32_t instance_extension_count = 0;
uint32_t enabled_extension_count = 0;
- VkBool32 surfaceExtFound = 0;
- VkBool32 platformSurfaceExtFound = 0;
VkResult err;
if (strcmp(driver, "tizen")) {
#include "SDL_tizenmouse.h"
#include "SDL_tizenevents_c.h"
#include "SDL_log.h"
+#include "SDL_hints.h"
#include "../../events/SDL_mouse_c.h"
#include <wayland-egl.h>
Tizen_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_WindowData *wmdata = (SDL_WindowData *)window->driverdata;
- SDL_VideoData *video_data = (SDL_VideoData *)_this->driverdata;
-
-// info->info.tizen.display = video_data->display;
-// info->info.tizen.surface = wmdata->surface;
-// info->info.tizen.shell_surface = NULL;
info->info.tizen.egl_display = NULL;
info->info.tizen.egl_surface = NULL;
#if SDL_VIDEO_OPENGL_EGL
Tizen_ShowWindow(_THIS, SDL_Window *window)
{
SDL_WindowData *wind = window->driverdata;
-
ecore_wl_window_show(wind->window);
}
/*DO NOTHING*/
}
+static void
+_tizen_window_orientaiton_hint_callback(void *userdata, const char *name, const char *oldValue, const char *newValue)
+{
+ char *p_str = NULL;
+ char orientation_type[4][20] = {"Portrait","LandscapeLeft","PortraitUpsideDown","LandscapeRight"};
+ int checked[4] = {0,};
+ int i;
+ unsigned int j = 0;
+ SDL_WindowData *wind = (SDL_WindowData*)userdata;
+ Ecore_Wl_Window *window = wind->window;
+
+ if (wind->rotation_supported == 0)
+ {
+ return;
+ }
+
+ SDL_assert(SDL_strncmp(name, SDL_HINT_ORIENTATIONS, SDL_strlen(SDL_HINT_ORIENTATIONS)) == 0);
+
+ if ((oldValue == NULL) && (newValue == NULL)) {
+ return;
+ }
+
+ for (i=0;i<4;i++) {
+ p_str = SDL_strstr(newValue, orientation_type[i]);
+ if (p_str) {
+ if (p_str == newValue) {
+ int rot = 0;
+ if (i == 0) rot = 0;
+ else if (i == 1) rot = 90;
+ else if (i == 2) rot = 180;
+ else if (i == 3) rot = 270;
+ wind->rotation = rot;
+ }
+
+ if (i == 0) {
+ checked[j] = 0;
+ SDL_Log("SDL %s: avaiable rotation: 0", __FUNCTION__);
+ }
+ else if (i == 1) {
+ checked[j] = 90;
+ SDL_Log("SDL %s: avaiable rotation: 90", __FUNCTION__);
+ }
+ else if (i == 2) {
+ checked[j] = 180;
+ SDL_Log("SDL %s: avaiable rotation: 180", __FUNCTION__);
+ }
+ else if (i == 3) {
+ checked[j] = 270;
+ SDL_Log("SDL %s: avaiable rotation: 270", __FUNCTION__);
+ }
+ j++;
+ }
+ }
+
+ if (j > 0) {
+ if (j == 1) {
+ ecore_wl_window_rotation_preferred_rotation_set(window,wind->rotation);
+ }
+ ecore_wl_window_rotation_available_rotations_set(window, (const int*)checked, j);
+ }
+}
+
+static void
+_tizen_window_orientation_add_hint(void *data)
+{
+ SDL_WindowData *wind = (SDL_WindowData*)data;
+ if (wind->rotation_supported == 0) {
+ return;
+ }
+
+ SDL_AddHintCallback(SDL_HINT_ORIENTATIONS, _tizen_window_orientaiton_hint_callback, data);
+}
+
int
Tizen_CreateWindow(_THIS, SDL_Window *window)
{
SDL_VideoData *data = _this->driverdata;
SDL_WindowData *wind;
+ Ecore_Wl_Global *global;
+ Eina_Inlist *globals;
wind = calloc(1, sizeof * wind);
- if (!wind)
+ if (!wind) {
return SDL_OutOfMemory();
+ }
window->driverdata = wind;
window->y = 0;
}
+ if (!(globals = ecore_wl_globals_get()))
+ {
+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get wayland globals");
+ return -1;
+ }
+
wind->window = ecore_wl_window_new(NULL,
window->x, window->y, window->w, window->h,
ECORE_WL_WINDOW_BUFFER_TYPE_SHM);
wind->surface = ecore_wl_window_surface_create(wind->window);
+ wind->rotation = 0;
+ wind->rotation_supported = 0;
+ wind->received_rotation = 0;
ecore_wl_window_opaque_region_set(wind->window, window->x, window->y, window->w, window->h);
+
+ if (window->flags & 0x00008000)
+ {
+ ecore_wl_window_input_region_set(wind->window, 0, 0, 0, 0);
+ ecore_wl_window_focus_skip_set(wind->window, EINA_TRUE);
+ }
+
#if SDL_VIDEO_OPENGL_EGL
if (window->flags & SDL_WINDOW_OPENGL) {
wind->egl_window = wl_egl_window_create(ecore_wl_window_surface_get(wind->window), window->w, window->h);
/* Create the GLES window surface */
wind->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) wind->egl_window);
if (wind->egl_surface == EGL_NO_SURFACE) {
- return SDL_SetError("failed to create a window surface");
+ SDL_SetError("failed to create a window surface");
+ return -1;
}
}
#endif
wind->id = ecore_wl_window_id_get(wind->window);
eina_hash_add(data->windows, &wind->id, window);
- if(keyboard.imf_context == NULL)
- Tizen_InitKeyboard(_this);
+ Tizen_InitKeyboard(_this);
SDL_SetMouseFocus(window);
//ecore_wl_window_focus_skip_set(wind->window, EINA_TRUE);
}
+ EINA_INLIST_FOREACH(globals, global) {
+ if (!strcmp(global->interface, "tizen_policy_ext")) {
+ wind->rotation_supported = 1;
+ SDL_Log("SDL can support rotation in this device!!!!!!!!!!!");
+ break;
+ }
+ }
+ // Add orientaiton hint cb
+ _tizen_window_orientation_add_hint((void*)wind);
return 0;
}
void
-Tizen_SetWindowSize(_THIS, SDL_Window *window)
+_tizen_setwindowsize(SDL_Window *window, int update_egl)
{
SDL_WindowData *wind = window->driverdata;
+ if (!wind->window)
+ {
+ return;
+ }
+
+ // TODO : consider to rotation status.
#if SDL_VIDEO_OPENGL_EGL
- if (window->flags & SDL_WINDOW_OPENGL) {
- ecore_wl_window_opaque_region_set(wind->window,window->x, window->y, window->w, window->h);
- wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
+ if ((window->flags & SDL_WINDOW_OPENGL) && (update_egl == 1)) {
+ 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.
+ wl_egl_window_resize(wind->egl_window, window->w, window->h, dx, dy);
}
#endif
+ ecore_wl_window_update_size(wind->window, window->w, window->h);
+}
+
+void
+Tizen_SetWindowSize(_THIS, SDL_Window *window)
+{
+ _tizen_setwindowsize(window, 1);
+}
+
+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;
+ }
+
+ 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
+Tizen_SetWindowPosition(_THIS, SDL_Window * window)
+{
+ SDL_WindowData *wind = window->driverdata;
+ if (!wind->window) {
+ return;
+ }
+
+ // TODO : consider to rotation status.
+ ecore_wl_window_position_set(wind->window, window->x, window->y);
}
void
}
static SDL_Window*
-__tizen_find_window(_THIS, Ecore_Wl_Window *ewin)
+_tizen_find_window(_THIS, Ecore_Wl_Window *ewin)
{
SDL_VideoData *data = _this->driverdata;
int id;
}
static Eina_Bool
-__tizen_cb_window_visibility_change(void *data, int type, void *event)
+_tizen_cb_event_window_visibility_change(void *data, int type, void *event)
{
_THIS = data;
Ecore_Wl_Event_Window_Visibility_Change *ev;
ev = event;
ew = ecore_wl_window_find(ev->win);
- window = __tizen_find_window(_this, ew);
+ window = _tizen_find_window(_this, ew);
- SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "visibility window: %p, ecore_wl_window: %p\n", window, ew);
+ SDL_Log( "visibility window: %p, ecore_wl_window: %p\n", window, ew);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+ return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_tizen_cb_window_configure(void *data, int type EINA_UNUSED, void *event)
+{
+ _THIS = data;
+ Ecore_Wl_Window *ew;
+ SDL_Window *window;
+ SDL_WindowData *wind;
+ Ecore_Wl_Event_Window_Configure *ev;
+ int nx = 0, ny = 0, nw = 0, nh = 0;
+ ev = event;
+ ew = ecore_wl_window_find(ev->win);
+ window = _tizen_find_window(_this, ew);
+ wind = window->driverdata;
+
+ if (wind->rotation_supported == 0){
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ SDL_Log( "configure notify window: %p, ecore_wl_window: %p\n", window, ew);
+
+ ecore_wl_window_geometry_get(ew, &nx, &ny, &nw, &nh);
+ if (nw < 1) nw = 1;
+ if (nh < 1) nh = 1;
+
+ 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, 0);
+ }
+ return ECORE_CALLBACK_PASS_ON;
+}
+static Eina_Bool
+_tizen_cb_event_window_rotate(void *data, int type EINA_UNUSED, void *event)
+{
+ _THIS = data;
+ Ecore_Wl_Event_Window_Rotate *ev;
+ Ecore_Wl_Window *ew;
+ SDL_Window *window;
+ SDL_WindowData *wind;
+
+ ev = event;
+ if (!ev) {
+ return ECORE_CALLBACK_PASS_ON;
+ }
+
+ ew = ecore_wl_window_find(ev->win);
+ window = _tizen_find_window(_this, ew);
+ wind = window->driverdata;
+
+ if (wind->rotation != ev->angle) {
+ /* set ecore_wayland window rotation */
+ wind->rotation = ev->angle;
+ ecore_wl_window_rotation_set(ew, ev->angle);
+ _tizen_setwindowsize(window, 1);
+ 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);
+ }
+ wind->received_rotation = 1;
return ECORE_CALLBACK_PASS_ON;
}
data->windows = eina_hash_int32_new(NULL);
ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE,
- __tizen_cb_window_visibility_change, _this);
+ _tizen_cb_event_window_visibility_change,_this);
ecore_event_handler_add(ECORE_EVENT_KEY_UP,
- __tizen_cb_event_keyup_change, NULL);
+ _tizen_cb_event_keyup_change,_this);
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
- __tizen_cb_event_keydown_change, NULL);
+ _tizen_cb_event_keydown_change,_this);
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
- __tizen_cb_event_mousedown_change, _this);
+ _tizen_cb_event_mousedown_change,_this);
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
- __tizen_cb_event_mouseup_change, _this);
+ _tizen_cb_event_mouseup_change,_this);
ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
- __tizen_cb_event_mousemove_change, _this);
+ _tizen_cb_event_mousemove_change,_this);
+ ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_ROTATE,
+ _tizen_cb_event_window_rotate,_this);
+ ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE,
+ _tizen_cb_window_configure,_this);
return 0;
}
struct wl_shell_surface *shell_surface;
struct wl_egl_window *egl_window;
EGLSurface egl_surface;
+ int rotation;
+ int rotation_supported;
+ int received_rotation;
} SDL_WindowData;
extern void Tizen_ShowWindow(_THIS, SDL_Window *window);
SDL_bool fullscreen);
extern int Tizen_CreateWindow(_THIS, SDL_Window *window);
extern void Tizen_SetWindowSize(_THIS, SDL_Window *window);
+extern void Tizen_GetWindowSize(_THIS, SDL_Window *window, int *w, int *h);
extern void Tizen_DestroyWindow(_THIS, SDL_Window *window);
extern SDL_bool Tizen_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info);
extern int Tizen_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
+extern void Tizen_SetWindowPosition(_THIS, SDL_Window * window);
extern int Tizen_InitWindow(_THIS);
extern void Tizen_DeinitWindow(_THIS);
{
uint32_t instance_extension_count = 0;
uint32_t enabled_extension_count = 0;
- VkBool32 surfaceExtFound = 0;
- VkBool32 platformSurfaceExtFound = 0;
VkResult err;
if (strcmp(driver, "wayland")) {