From 3689fa2d8a6abe9829fab3ded1900edf06b7ee64 Mon Sep 17 00:00:00 2001 From: "Wonsik, Jung" Date: Mon, 19 Mar 2018 16:33:07 +0900 Subject: [PATCH] [Tizen] : adding ecore-wl2 feature To upgrade EFL 1.20, adding ecore-wl2 feature in tizen backend Change-Id: Iaec3e55784d9ccce9a245124df1ef09c22afe254 --- CMakeLists.txt | 2 + cmake/sdlchecks.cmake | 16 ++- configure | 6 +- configure.in | 9 +- include/SDL_config.h.in | 2 +- packaging/SDL2.spec | 6 +- src/video/tizen/SDL_tizenevents.c | 9 +- src/video/tizen/SDL_tizenkeyboard.h | 5 +- src/video/tizen/SDL_tizenmouse.c | 33 +++-- src/video/tizen/SDL_tizenopengles.c | 9 +- src/video/tizen/SDL_tizenvideo.c | 15 ++- src/video/tizen/SDL_tizenvideo.h | 6 +- src/video/tizen/SDL_tizenwindow.c | 160 ++++++++++++++----------- src/video/tizen/SDL_tizenwindow.h | 7 +- src/video/tizen/indicator/Makefile | 4 +- src/video/tizen/indicator/SDL_tizenindicator.c | 22 ++-- 16 files changed, 186 insertions(+), 125 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 914aabb..8f785e6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -824,6 +824,7 @@ elseif(UNIX AND NOT APPLE) CheckOpenGLX11() CheckOpenGLESX11() CheckWayland() + CheckTizen() CheckVivante() endif() @@ -1292,6 +1293,7 @@ elseif(HAIKU) CheckPTHREAD() elseif(TIZEN) if(SDL_VIDEO) + add_definitions(-D_EFL_BETA_API_SUPPORT) if(VIDEO_VULKAN) set(SDL_VIDEO_VULKAN 1) set(HAVE_VIDEO_VULKAN TRUE) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index f232c65..4feb3d1 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -594,7 +594,7 @@ endmacro() macro(CheckTizen) if(VIDEO_TIZEN) - pkg_check_modules(TIZEN wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-appfw-application dlog ecore-imf) + pkg_check_modules(TIZEN wayland-client wayland-egl ecore ecore-wl2 eina capi-appfw-application capi-appfw-application dlog ecore-imf) if(TIZEN_FOUND) link_directories( ${TIZEN_LIBRARY_DIRS} @@ -612,21 +612,19 @@ macro(CheckTizen) if(NOT HAVE_DLOPEN) message_warn("You must have SDL_LoadObject() support for dynamic Tizen loading") else() - FindLibraryAndSONAME(wayland-client) - FindLibraryAndSONAME(wayland-egl) FindLibraryAndSONAME(ecore) - FindLibraryAndSONAME(ecore-wayland) + FindLibraryAndSONAME(ecore-wl2) FindLibraryAndSONAME(eina) + FindLibraryAndSONAME(evas) FindLibraryAndSONAME(capi-appfw-application) FindLibraryAndSONAME(capi-system-system-settings) FindLibraryAndSONAME(dlog) - set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"") - set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_ECORE "\"${ECORE_LIB_SONAME}\"") - set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_ECORE_WAYLAND "\"${ECORE_WAYLAND_LIB_SONAME}\"") - set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_EVAS "\"${EVAS_LIB_SONAME}\"") + set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_ECORE_WL2 "\"${ECORE_WL2_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_EINA "\"${EINA_LIB_SONAME}\"") - set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_APPCORE_EFL "\"${APPCORE_EFL_LIB_SONAME}\"") + set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_EVAS "\"${EVAS_LIB_SONAME}\"") + set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_CAPI_APPFW_APPLICATION "\"${CAPI_APPFW_APPLICATION_LIB_SONAME}\"") + set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_CAPI_SYSTEM_SYSTEM_SETTINGS "\"${CAPI_SYSTEM_SYSTEM_SETTINGS_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_DLOG "\"${DLOG_LIB_SONAME}\"") set(HAVE_TIZEN_SHARED TRUE) endif() diff --git a/configure b/configure index 77e6e37..73b2156 100755 --- a/configure +++ b/configure @@ -18943,9 +18943,9 @@ $as_echo_n "checking for Tizen support... " >&6; } if test x$PKG_CONFIG != xno && \ test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then - TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc` - TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc` + if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then + TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc` + TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc` video_tizen=yes fi fi diff --git a/configure.in b/configure.in index e6eb71c..a5b9fc9 100755 --- a/configure.in +++ b/configure.in @@ -1164,7 +1164,7 @@ CheckWayland() { AC_ARG_ENABLE(video-wayland, AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]), - ,enable_video_wayland=yes) + ,enable_video_wayland=no) AC_ARG_ENABLE(video-wayland-qt-touch, AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]), @@ -1269,13 +1269,12 @@ CheckTizen() if test x$PKG_CONFIG != xno && \ test x$video_opengl_egl = xyes && \ test x$video_opengles_v2 = xyes; then - if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then - TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc` - TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc` + if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm ecore-ipc; then + TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc` + TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wl2 xdg-shell-client text-client tizen-extension-client eina elementary capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf libdrm aul ecore-ipc` video_tizen=yes fi fi - AC_MSG_RESULT($video_tizen) if test x$video_tizen = xyes; then diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 07f3879..9687e8e 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -278,7 +278,6 @@ #undef SDL_VIDEO_DRIVER_DUMMY #undef SDL_VIDEO_DRIVER_WINDOWS #undef SDL_VIDEO_DRIVER_WAYLAND -#undef SDL_VIDEO_DRIVER_TIZEN #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @@ -287,6 +286,7 @@ #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT +#undef SDL_VIDEO_DRIVER_TIZEN #undef SDL_VIDEO_DRIVER_MIR #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON diff --git a/packaging/SDL2.spec b/packaging/SDL2.spec index f2c653b..9f6c57d 100755 --- a/packaging/SDL2.spec +++ b/packaging/SDL2.spec @@ -24,7 +24,6 @@ BuildRequires: pkgconfig(wayland-client) BuildRequires: pkgconfig(wayland-cursor) BuildRequires: pkgconfig(wayland-egl) BuildRequires: pkgconfig(text-client) -BuildRequires: pkgconfig(xdg-shell-client) BuildRequires: pkgconfig(tizen-extension-client) BuildRequires: pkgconfig(tizen-remote-surface-client) BuildRequires: pkgconfig(wayland-tbm-client) @@ -42,13 +41,14 @@ BuildRequires: binutils-devel BuildRequires: which BuildRequires: autoconf BuildRequires: pkgconfig(ecore) -BuildRequires: pkgconfig(ecore-wayland) +BuildRequires: pkgconfig(ecore-wl2) BuildRequires: pkgconfig(appcore-common) BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(capi-system-system-settings) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore-imf) BuildRequires: pkgconfig(aul) +BuildRequires: pkgconfig(elementary) #BuildRequires: Vulkan-LoaderAndValidationLayers #BuildRequires: Vulkan-LoaderAndValidationLayers-devel @@ -84,7 +84,7 @@ cd ../../../../ LDFLAGS+=" -lasan -ldl " %endif %ifos linux -CFLAGS="$RPM_OPT_FLAGS" %configure --prefix=%{prefix} --disable-video-directfb --enable-video-tizen %{?asan:--disable-assembly} +CFLAGS="$RPM_OPT_FLAGS" %configure --prefix=%{prefix} --disable-video-directfb --disable-video-wayland --enable-video-tizen %{?asan:--disable-assembly} %else %configure %{?asan:--disable-assembly} %endif diff --git a/src/video/tizen/SDL_tizenevents.c b/src/video/tizen/SDL_tizenevents.c index 69160e9..989604f 100755 --- a/src/video/tizen/SDL_tizenevents.c +++ b/src/video/tizen/SDL_tizenevents.c @@ -207,12 +207,15 @@ Eina_Bool _tizen_cb_event_focus_in(void *data, int type EINA_UNUSED, void *event) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - Ecore_Wl_Event_Focus_In *ev; - Ecore_Wl_Window *ew; + Ecore_Wl2_Event_Focus_In *ev; + Ecore_Wl2_Window *ew; + Ecore_Wl2_Display *wl2_display; SDL_Window *window; ev = event; - ew = ecore_wl_window_find(ev->win); + wl2_display = ecore_wl2_connected_display_get(NULL); + + ew = ecore_wl2_display_window_find(wl2_display, ev->window); window = Tizen_FindWindow(_this, ew); SDL_SetKeyboardFocus(window); diff --git a/src/video/tizen/SDL_tizenkeyboard.h b/src/video/tizen/SDL_tizenkeyboard.h index 8beb408..1fe1e91 100755 --- a/src/video/tizen/SDL_tizenkeyboard.h +++ b/src/video/tizen/SDL_tizenkeyboard.h @@ -24,7 +24,10 @@ #include "../SDL_sysvideo.h" #include "SDL_tizenwindow.h" -#include +#ifndef EFL_BETA_API_SUPPORT +#define EFL_BETA_API_SUPPORT +#endif +#include #include typedef struct _TizenKeyboard TizenKeyboard; diff --git a/src/video/tizen/SDL_tizenmouse.c b/src/video/tizen/SDL_tizenmouse.c index c6f8e89..04f5ad7 100755 --- a/src/video/tizen/SDL_tizenmouse.c +++ b/src/video/tizen/SDL_tizenmouse.c @@ -42,7 +42,7 @@ typedef struct { struct wl_buffer *buffer; - struct wl_surface *surface; + Ecore_Wl2_Surface *surface; SDL_WindowData *win_data; int hot_x, hot_y; @@ -101,6 +101,8 @@ create_buffer_from_shm(Tizen_CursorData *d, int width, int height, uint32_t form int shm_fd; + Ecore_Wl2_Display *wl2_display = NULL; + shm_fd = wayland_create_tmp_file(size); if (shm_fd < 0) { @@ -116,7 +118,9 @@ create_buffer_from_shm(Tizen_CursorData *d, int width, int height, uint32_t form return -1; } - shm_pool = wl_shm_create_pool(ecore_wl_shm_get(), shm_fd, size); + wl2_display = ecore_wl2_connected_display_get(NULL); + + shm_pool = wl_shm_create_pool(ecore_wl2_display_shm_get(wl2_display), shm_fd, size); d->buffer = wl_shm_pool_create_buffer(shm_pool, 0, width, height, stride, format); wl_buffer_add_listener(d->buffer, &mouse_buffer_listener, d); @@ -139,6 +143,7 @@ Tizen_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) Tizen_CursorData *data = calloc (1, sizeof (Tizen_CursorData)); if(data) { + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); data->win_data = window->driverdata; cursor->driverdata = (void *) data; @@ -161,7 +166,7 @@ Tizen_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) surface->pixels, surface->h * surface->pitch); - data->surface = wl_compositor_create_surface(ecore_wl_compositor_get()); + data->surface = wl_compositor_create_surface(ecore_wl2_display_compositor_get(wl2_display)); data->hot_x = hot_x; data->hot_y = hot_y; @@ -289,10 +294,11 @@ _tizen_cb_event_mousedown_change(void *data, int type, void *event) if (!event) return ECORE_CALLBACK_PASS_ON; Ecore_Event_Mouse_Button *e = event; - Ecore_Wl_Window *ew; + Ecore_Wl2_Window *ew; SDL_Window *window; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); - ew = ecore_wl_window_find(e->window); + ew = ecore_wl2_display_window_find(wl2_display, e->window); window = Tizen_FindWindow(_this, ew); int x = 0, y = 0; @@ -324,10 +330,11 @@ _tizen_cb_event_mouseup_change(void *data, int type, void *event) if (!event) return ECORE_CALLBACK_PASS_ON; Ecore_Event_Mouse_Button *e = event; - Ecore_Wl_Window *ew; + Ecore_Wl2_Window *ew; SDL_Window *window; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); - ew = ecore_wl_window_find(e->window); + ew = ecore_wl2_display_window_find(wl2_display, e->window); window = Tizen_FindWindow(_this, ew); SDL_VideoData* videoData = SDL_GetVideoDevice()->driverdata; @@ -356,10 +363,11 @@ _tizen_cb_event_mousemove_change(void *data, int type, void *event) if (!event) return ECORE_CALLBACK_PASS_ON; Ecore_Event_Mouse_Move *e = event; - Ecore_Wl_Window *ew; + Ecore_Wl2_Window *ew; SDL_Window *window; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); - ew = ecore_wl_window_find(e->window); + ew = ecore_wl2_display_window_find(wl2_display, e->window); window = Tizen_FindWindow(_this, ew); int x = 0, y = 0; @@ -375,12 +383,13 @@ Eina_Bool _tizen_cb_event_mouse_in(void *data, int type EINA_UNUSED, void *event) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - Ecore_Wl_Event_Mouse_In *ev; - Ecore_Wl_Window *ew; + Ecore_Event_Mouse_IO *ev; + Ecore_Wl2_Window *ew; SDL_Window *window; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); ev = event; - ew = ecore_wl_window_find(ev->window); + ew = ecore_wl2_display_window_find(wl2_display, ev->window); window = Tizen_FindWindow(_this, ew); SDL_SetMouseFocus(window); diff --git a/src/video/tizen/SDL_tizenopengles.c b/src/video/tizen/SDL_tizenopengles.c index dd19536..0e145ec 100755 --- a/src/video/tizen/SDL_tizenopengles.c +++ b/src/video/tizen/SDL_tizenopengles.c @@ -49,7 +49,9 @@ Tizen_GLES_LoadLibrary(_THIS, const char *path) { int ret; - ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType)ecore_wl_display_get()); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + + ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType)ecore_wl2_display_get(wl2_display)); return ret; } @@ -65,11 +67,14 @@ Tizen_GLES_SwapWindow(_THIS, SDL_Window *window) { SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); SDL_WindowData* wind = (SDL_WindowData*)window->driverdata; + int x, y, w, h; if (wind->received_rotation != TIZEN_ROTATION_RECEIVED_NONE) { Tizen_rotate_update(window); + ecore_wl2_window_geometry_get(wind->window, &x, &y, &w, &h); + if(wind->received_rotation == TIZEN_ROTATION_RECEIVED_WINDOW_ROATION) - ecore_wl_window_rotation_change_done_send(wind->window); + ecore_wl2_window_rotation_change_done_send(wind->window, wind->rotation, w, h); wind->received_rotation = TIZEN_ROTATION_RECEIVED_NONE; diff --git a/src/video/tizen/SDL_tizenvideo.c b/src/video/tizen/SDL_tizenvideo.c index db8ab1f..7858dfe 100755 --- a/src/video/tizen/SDL_tizenvideo.c +++ b/src/video/tizen/SDL_tizenvideo.c @@ -49,13 +49,20 @@ _tizen_add_display(SDL_VideoData *d, uint32_t id) SDL_VideoDisplay display; SDL_DisplayMode mode; static char *display_name = "tizen"; + Ecore_Wl2_Display *wl2_display = NULL; SDL_zero(display); SDL_zero(mode); display.name = display_name; - ecore_wl_screen_size_get(&mode.w, &mode.h); + if (!ecore_wl2_init()) return; + + wl2_display = ecore_wl2_display_connect(NULL); + if (!wl2_display) return; + + d->wl2_display = wl2_display; + ecore_wl2_display_screen_size_get(wl2_display, &mode.w, &mode.h); mode.refresh_rate = 60; //Hz mode.format = SDL_PIXELFORMAT_ARGB8888; @@ -162,9 +169,8 @@ Tizen_VideoInit(_THIS) _this->driverdata = data; - ecore_wl_init(NULL); _tizen_add_display(data, 0); - data->display = ecore_wl_display_get(); + data->display = ecore_wl2_display_get(data->wl2_display); Tizen_InitWindow(_this); Tizen_InitMouse(); @@ -199,7 +205,8 @@ Tizen_VideoQuit(_THIS) Tizen_FiniKeyboard(); Tizen_FiniMouse(); - ecore_wl_shutdown(); + ecore_wl2_display_disconnect(data->wl2_display); + ecore_wl2_shutdown(); SDL_tizen_app_exit(); } diff --git a/src/video/tizen/SDL_tizenvideo.h b/src/video/tizen/SDL_tizenvideo.h index 45acdb6..f453fc1 100755 --- a/src/video/tizen/SDL_tizenvideo.h +++ b/src/video/tizen/SDL_tizenvideo.h @@ -28,7 +28,10 @@ #include "../SDL_sysvideo.h" #include -#include +#ifndef EFL_BETA_API_SUPPORT +#define EFL_BETA_API_SUPPORT +#endif +#include #include typedef struct Tizen_Rotation_Data{ @@ -43,6 +46,7 @@ typedef struct Tizen_Rotation_Data{ typedef struct { struct wl_display *display; + Ecore_Wl2_Display *wl2_display; Eina_Hash *windows; Tizen_Rotation_Data tizen_rotation_data; diff --git a/src/video/tizen/SDL_tizenwindow.c b/src/video/tizen/SDL_tizenwindow.c index 29f809b..1e1e8e1 100755 --- a/src/video/tizen/SDL_tizenwindow.c +++ b/src/video/tizen/SDL_tizenwindow.c @@ -67,15 +67,15 @@ Ecore_Ipc_Server *ipc = NULL; void _tizen_quickpanel_on(SDL_WindowData *wind) { SDL_Log("[SDL]Quick panel on"); - ecore_wl_window_indicator_state_set(wind->window, ECORE_WL_INDICATOR_STATE_ON); - ecore_wl_indicator_visible_type_set(wind->window, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN); + ecore_wl2_window_indicator_state_set(wind->window, ECORE_WL2_INDICATOR_STATE_ON); + ecore_wl2_indicator_visible_type_set(wind->window, ECORE_WL2_INDICATOR_VISIBLE_TYPE_SHOWN); } void _tizen_quickpanel_off(SDL_WindowData *wind) { SDL_Log("[SDL]Quick panel off"); - ecore_wl_window_indicator_state_set(wind->window, ECORE_WL_INDICATOR_STATE_OFF); - ecore_wl_indicator_visible_type_set(wind->window, ECORE_WL_INDICATOR_VISIBLE_TYPE_HIDDEN); + ecore_wl2_window_indicator_state_set(wind->window, ECORE_WL2_INDICATOR_STATE_OFF); + ecore_wl2_indicator_visible_type_set(wind->window, ECORE_WL2_INDICATOR_VISIBLE_TYPE_HIDDEN); } void Tizen_ExecuteIndicatorProcess(SDL_WindowData *wind) @@ -130,10 +130,12 @@ Tizen_chk_indicator(SDL_Window *window) SDL_WindowData *wind = window->driverdata; int screen_w, screen_h; int rotation = wind->rotation % 360; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + if(rotation % 180 == 0) - ecore_wl_screen_size_get(&screen_w, &screen_h); + ecore_wl2_display_screen_size_get(wl2_display, &screen_w, &screen_h); else - ecore_wl_screen_size_get(&screen_h, &screen_w); + ecore_wl2_display_screen_size_get(wl2_display, &screen_h, &screen_w); if(window->w == screen_w && window->h == screen_h && window->x == 0 && window->y == 0 && !(window->flags & SDL_WINDOW_BORDERLESS)) { @@ -175,7 +177,9 @@ _cb_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) SDL_WindowData *wind = window->driverdata; int window_w, window_h; - ecore_wl_screen_size_get(&window_w, &window_h); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + + ecore_wl2_display_screen_size_get(wl2_display, &window_w, &window_h); _tizen_ecore_ipc_client_send(OP_INDICATOR_SHOW, wind->rotation, wind->g_res_id, videoData->indicator_mode); @@ -329,14 +333,14 @@ void Tizen_SetWindowTitle(_THIS, SDL_Window * window) { SDL_WindowData *wind = window->driverdata; - ecore_wl_window_title_set(wind->window, window->title); + ecore_wl2_window_title_set(wind->window, window->title); } void Tizen_ShowWindow(_THIS, SDL_Window *window) { SDL_WindowData *wind = window->driverdata; - ecore_wl_window_show(wind->window); + ecore_wl2_window_show(wind->window); Tizen_chk_indicator(window); } @@ -345,14 +349,14 @@ void Tizen_HideWindow(_THIS, SDL_Window *window) { SDL_WindowData *wind = window->driverdata; - ecore_wl_window_hide(wind->window); + ecore_wl2_window_hide(wind->window); } void Tizen_RaiseWindow(_THIS, SDL_Window *window) { SDL_WindowData *wind = window->driverdata; - ecore_wl_window_raise(wind->window); + ecore_wl2_window_raise(wind->window); } void @@ -364,10 +368,12 @@ Tizen_SetWindowFullscreen(_THIS, SDL_Window *window, int screen_w, screen_h; int rotation = (wind->output_rotation + wind->rotation) % 360; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + if(rotation == 90 || rotation == 270) - ecore_wl_screen_size_get(&screen_h, &screen_w); + ecore_wl2_display_screen_size_get(wl2_display, &screen_h, &screen_w); else - ecore_wl_screen_size_get(&screen_w, &screen_h); + ecore_wl2_display_screen_size_get(wl2_display, &screen_w, &screen_h); _tizen_set_window_size(window, screen_w, screen_h); Tizen_SetWindowSize(_this, window); @@ -467,9 +473,9 @@ _tizen_rotation_do(SDL_Window *window, SDL_WindowData* wind, int rotation) { int window_w, window_h; if(wind->rotation == 0 || wind->rotation == 180) - ecore_wl_window_geometry_get(wind->window, 0, 0, &window_w, &window_h); + ecore_wl2_window_geometry_get(wind->window, 0, 0, &window_w, &window_h); else - ecore_wl_window_geometry_get(wind->window, 0, 0, &window_h, &window_w); + ecore_wl2_window_geometry_get(wind->window, 0, 0, &window_h, &window_w); _tizen_set_window_size(window, window_w, window_h); @@ -508,32 +514,32 @@ Tizen_rotate_update(SDL_Window *window) if(!wind) return; int screen_rotation; - if (ecore_wl_window_ignore_output_transform_get(wind->window)) + if (ecore_wl2_window_ignore_output_transform_get(wind->window)) { screen_rotation = 0; } else { - Ecore_Wl_Output *output = ecore_wl_window_output_find(wind->window); - screen_rotation = ecore_wl_output_transform_get(output) * 90; + Ecore_Wl2_Output *output = ecore_wl2_window_output_find(wind->window); + screen_rotation = ecore_wl2_output_transform_get(output) * 90; } //Set Screen Rotation wind->output_rotation = screen_rotation; - ecore_wl_window_rotation_set(wind->window, wind->rotation); + ecore_wl2_window_rotation_set(wind->window, wind->rotation); int rotation = (wind->output_rotation + wind->rotation) % 360; _tizen_rotation_do(window, wind, rotation); } SDL_Window* -Tizen_FindWindow(_THIS, Ecore_Wl_Window *ewin) +Tizen_FindWindow(_THIS, Ecore_Wl2_Window *ewin) { SDL_VideoData *data = _this->driverdata; int id; - id = ecore_wl_window_id_get(ewin); + id = ecore_wl2_window_id_get(ewin); return (SDL_Window*)eina_hash_find(data->windows, &id); } @@ -546,7 +552,7 @@ _tizen_window_orientaiton_hint_callback(void *userdata, const char *name, const int i; unsigned int j = 0; SDL_WindowData *wind = (SDL_WindowData*)userdata; - Ecore_Wl_Window *window = wind->window; + Ecore_Wl2_Window *window = wind->window; if (wind->rotation_supported == 0) return; @@ -586,9 +592,9 @@ _tizen_window_orientaiton_hint_callback(void *userdata, const char *name, const if (j > 0) { if (j == 1) { - ecore_wl_window_rotation_preferred_rotation_set(window, wind->rotation); + ecore_wl2_window_preferred_rotation_set(window, wind->rotation); }else { - ecore_wl_window_rotation_available_rotations_set(window, (const int*)checked, j); + ecore_wl2_window_available_rotations_set(window, (const int*)checked, j); } } @@ -613,10 +619,10 @@ _tizen_cb_output_transform(void *data, int type EINA_UNUSED, void *event) if(!wind) return ECORE_CALLBACK_PASS_ON; - Ecore_Wl_Event_Output_Transform *ev = event; - Ecore_Wl_Output *output; + Ecore_Wl2_Event_Output_Transform *ev = event; + Ecore_Wl2_Output *output; - output = ecore_wl_window_output_find(wind->window); + output = ecore_wl2_window_output_find(wind->window); if (output != ev->output) return ECORE_CALLBACK_PASS_ON; wind->received_rotation = TIZEN_ROTATION_RECEIVED_SCREEN_ROTATION; @@ -643,12 +649,12 @@ _tizen_output_transform_register(SDL_WindowData *wind) { if(!wind) return; - Ecore_Wl_Output *output = ecore_wl_window_output_find(wind->window); - wind->output_rotation = ecore_wl_output_transform_get(output) * 90; + Ecore_Wl2_Output *output = ecore_wl2_window_output_find(wind->window); + wind->output_rotation = ecore_wl2_output_transform_get(output) * 90; - ecore_event_handler_add(ECORE_WL_EVENT_OUTPUT_TRANSFORM, + ecore_event_handler_add(ECORE_WL2_EVENT_OUTPUT_TRANSFORM, _tizen_cb_output_transform, NULL); - ecore_event_handler_add(ECORE_WL_EVENT_IGNORE_OUTPUT_TRANSFORM, + ecore_event_handler_add(ECORE_WL2_EVENT_IGNORE_OUTPUT_TRANSFORM, _tizen_cb_ignore_output_transform, NULL); } @@ -676,8 +682,10 @@ Tizen_CreateWindow(_THIS, SDL_Window *window) { SDL_VideoData *data = _this->driverdata; SDL_WindowData *wind; - Ecore_Wl_Global *global; - Eina_Inlist *globals; + Ecore_Wl2_Global *global; + Eina_Iterator *globals; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + wind = calloc(1, sizeof * wind); if (!wind) { @@ -712,27 +720,34 @@ Tizen_CreateWindow(_THIS, SDL_Window *window) window->y = 0; } - if (!(globals = ecore_wl_globals_get())) + if (!(globals = ecore_wl2_display_globals_get(wl2_display))) { SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "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->window = ecore_wl2_window_new(wl2_display, NULL, + window->x, window->y, window->w, window->h); + if (!wind->window) { SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Failed to create wayland window"); return -1; } _tizen_output_transform_register(wind); - - wind->surface = ecore_wl_window_surface_create(wind->window); +#if 0 + wind->wl2_surface = ecore_wl2_surface_create(wind->window, EINA_FALSE); + if (!wind->wl2_surface) { + SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Failed to create wayland window surface"); + return -1; + } +#endif + wind->surface = ecore_wl2_window_surface_get(wind->window); if (!wind->surface) { SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Failed to create wayland window surface"); return -1; } - ecore_wl_window_type_set(wind->window, ECORE_WL_WINDOW_TYPE_UTILITY); + + ecore_wl2_window_type_set(wind->window, ECORE_WL2_WINDOW_TYPE_UTILITY); wind->rotation = 0; wind->rotation_supported = 0; @@ -754,7 +769,7 @@ Tizen_CreateWindow(_THIS, SDL_Window *window) } if (!_this->gl_config.alpha_size) { - ecore_wl_window_opaque_region_set(wind->window, window->x, window->y, window->w, window->h); + ecore_wl2_window_opaque_region_set(wind->window, window->x, window->y, window->w, window->h); } else { wl_surface_set_opaque_region(wind->surface, NULL); @@ -775,23 +790,24 @@ Tizen_CreateWindow(_THIS, SDL_Window *window) } #endif - wind->id = ecore_wl_window_id_get(wind->window); + wind->id = ecore_wl2_window_id_get(wind->window); eina_hash_add(data->windows, &wind->id, window); Tizen_InitKeyboard(_this); SDL_SetMouseFocus(window); if (window->flags & 0x00008000) { - ecore_wl_window_input_region_set(wind->window, -1, -1, 1, 1); - ecore_wl_window_focus_skip_set(wind->window, EINA_TRUE); + ecore_wl2_window_input_region_set(wind->window, -1, -1, 1, 1); + ecore_wl2_window_focus_skip_set(wind->window, EINA_TRUE); } - EINA_INLIST_FOREACH(globals, global) { + EINA_ITERATOR_FOREACH(globals, global) { if (!strcmp(global->interface, "tizen_policy_ext")) { wind->rotation_supported = 1; break; } } + eina_iterator_free(globals); // Add orientaiton hint cb _tizen_window_orientation_add_hint((void*)wind); SDL_AddHintCallback(SDL_HINT_TIZEN_INDICATOR_OPACITY, _tizen_indicator_opacity_hint_callback, data); @@ -830,12 +846,12 @@ Tizen_SetWindowSize(_THIS, SDL_Window *window) int rotation = (wind->output_rotation + wind->rotation) % 360; if(rotation == 90 || rotation == 270) { - ecore_wl_window_update_size(wind->window, window->h, window->w); + ecore_wl2_window_geometry_set(wind->window, window->y, window->x, window->h, window->w); wl_egl_window_resize(wind->egl_window, window->h, window->w, 0, 0); } else { - ecore_wl_window_update_size(wind->window, window->w, window->h); + ecore_wl2_window_geometry_set(wind->window, window->x, window->y, window->w, window->h); wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); } } @@ -865,7 +881,7 @@ Tizen_SetWindowPosition(_THIS, SDL_Window * window) } // TODO : consider to rotation status. - ecore_wl_window_position_set(wind->window, window->x, window->y); + ecore_wl2_window_position_set(wind->window, window->x, window->y); Tizen_chk_indicator(window); } @@ -883,7 +899,7 @@ Tizen_DestroyWindow(_THIS, SDL_Window *window) wl_egl_window_destroy(wind->egl_window); } #endif - ecore_wl_window_free(wind->window); + ecore_wl2_window_free(wind->window); SDL_free(wind); } @@ -894,12 +910,15 @@ Eina_Bool _tizen_cb_event_window_visibility_change(void *data, int type, void *event) { _THIS = data; - Ecore_Wl_Event_Window_Visibility_Change *ev; - Ecore_Wl_Window *ew; + Ecore_Wl2_Event_Window_Visibility_Change *ev; + Ecore_Wl2_Window *ew; SDL_Window *window; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + + ev = event; - ew = ecore_wl_window_find(ev->win); + ew = ecore_wl2_display_window_find(wl2_display, ev->win); window = Tizen_FindWindow(_this, ew); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0); @@ -911,12 +930,15 @@ Eina_Bool _tizen_cb_window_configure(void *data, int type EINA_UNUSED, void *event) { _THIS = data; - Ecore_Wl_Window *ew; + Ecore_Wl2_Window *ew; SDL_Window *window; SDL_WindowData *wind; - Ecore_Wl_Event_Window_Configure *ev; + Ecore_Wl2_Event_Window_Configure *ev; + + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + ev = event; - ew = ecore_wl_window_find(ev->win); + ew = ecore_wl2_display_window_find(wl2_display, ev->win); window = Tizen_FindWindow(_this, ew); wind = window->driverdata; @@ -931,21 +953,23 @@ 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; + Ecore_Wl2_Event_Window_Rotation *ev; + Ecore_Wl2_Window *ew; SDL_Window *window; SDL_WindowData *wind; + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + ev = event; if (!ev) { return ECORE_CALLBACK_PASS_ON; } - ew = ecore_wl_window_find(ev->win); + ew = ecore_wl2_display_window_find(wl2_display, ev->win); window = Tizen_FindWindow(_this, ew); wind = window->driverdata; - /* set ecore_wayland window rotation */ + /* set ecore_wl2 window rotation */ wind->rotation = ev->angle; wind->received_rotation = TIZEN_ROTATION_RECEIVED_WINDOW_ROATION; @@ -954,7 +978,7 @@ _tizen_cb_event_window_rotate(void *data, int type EINA_UNUSED, void *event) static Eina_Bool _tizen_cb_event_window_show(void *data, int type, void *event) { - Ecore_Wl_Event_Window_Show *e; + Ecore_Wl2_Event_Window_Show *e; uint32_t g_res_id = 0; e = event; @@ -980,13 +1004,13 @@ Tizen_InitWindow(_THIS) data->windows = eina_hash_int32_new(NULL); - ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE, + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_VISIBILITY_CHANGE, _tizen_cb_event_window_visibility_change,_this); - ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_ROTATE, + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_ROTATE, _tizen_cb_event_window_rotate,_this); - ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_CONFIGURE, + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, _tizen_cb_window_configure,_this); - ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_SHOW, + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW, _tizen_cb_event_window_show, _this); ecore_event_handler_add(ECORE_EVENT_KEY_UP, @@ -1000,14 +1024,14 @@ Tizen_InitWindow(_THIS) _tizen_cb_event_mouseup_change,_this); ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _tizen_cb_event_mousemove_change,_this); - ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, + ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, _tizen_cb_event_mouse_in,_this); - ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, + ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, _tizen_cb_event_mouse_out,_this); - ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, + ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, _tizen_cb_event_focus_in,_this); - ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, + ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, _tizen_cb_event_focus_out,_this); ecore_event_handler_add(ECORE_EVENT_JOYSTICK, diff --git a/src/video/tizen/SDL_tizenwindow.h b/src/video/tizen/SDL_tizenwindow.h index c2129b3..29dcadf 100755 --- a/src/video/tizen/SDL_tizenwindow.h +++ b/src/video/tizen/SDL_tizenwindow.h @@ -36,7 +36,8 @@ typedef struct { uint32_t g_res_id; /* Wayland window resource id */ uint32_t id; /* Ecore wayland window id */ - Ecore_Wl_Window *window; + Ecore_Wl2_Window *window; + Ecore_Wl2_Surface *wl2_surface; struct wl_surface *surface; struct wl_egl_window *egl_window; EGLSurface egl_surface; @@ -65,13 +66,13 @@ typedef enum { TIZEN_ROTATION_270 = 270 } tizen_wl_egl_window_rotation; -typedef enum { +enum tizen_rotation_received_type { TIZEN_ROTATION_RECEIVED_NONE = 0, TIZEN_ROTATION_RECEIVED_SCREEN_ROTATION = 1, TIZEN_ROTATION_RECEIVED_WINDOW_ROATION = 2 }; -extern SDL_Window* Tizen_FindWindow(_THIS, Ecore_Wl_Window *ewin); +extern SDL_Window* Tizen_FindWindow(_THIS, Ecore_Wl2_Window *ewin); extern void Tizen_SetWindowTitle(_THIS, SDL_Window * window); extern void Tizen_ShowWindow(_THIS, SDL_Window *window); extern void Tizen_HideWindow(_THIS, SDL_Window *window); diff --git a/src/video/tizen/indicator/Makefile b/src/video/tizen/indicator/Makefile index b49f766..e105330 100644 --- a/src/video/tizen/indicator/Makefile +++ b/src/video/tizen/indicator/Makefile @@ -1,6 +1,6 @@ CC = gcc -CFLAGS = -I. -g -fPIC -fPIE -Wall `pkg-config --cflags capi-appfw-application capi-system-system-settings elementary ecore-ipc ecore-wayland tizen-extension-client dlog` -LDFLAGS = -L/usr/lib -Wl,-rpath,/usr/lib -pie `pkg-config --libs capi-appfw-application capi-system-system-settings elementary ecore-ipc ecore-wayland tizen-extension-client dlog` +CFLAGS = -I. -g -fPIC -fPIE -Wall -DEFL_BETA_API_SUPPORT `pkg-config --cflags capi-appfw-application capi-system-system-settings elementary ecore-ipc ecore-wl2 tizen-extension-client dlog` +LDFLAGS = -L/usr/lib -Wl,-rpath,/usr/lib -pie -DEFL_BETA_API_SUPPORT `pkg-config --libs capi-appfw-application capi-system-system-settings elementary ecore-ipc ecore-wl2 tizen-extension-client dlog` NAME = sdl_indicator SRCS = $(wildcard *.c) diff --git a/src/video/tizen/indicator/SDL_tizenindicator.c b/src/video/tizen/indicator/SDL_tizenindicator.c index 51f5847..e81efe5 100644 --- a/src/video/tizen/indicator/SDL_tizenindicator.c +++ b/src/video/tizen/indicator/SDL_tizenindicator.c @@ -3,7 +3,10 @@ #include //for 'tizen_policy_set_transient_for' -#include +//#ifndef EFL_BETA_API_SUPPORT +//#define EFL_BETA_API_SUPPORT +//#endif +#include #include #include @@ -17,21 +20,24 @@ _tizen_set_transient_for (appdata_s *ad, uint32_t child_id, uint32_t parent_id) child_id : indicator resource id parent_id : SDL window resource id, */ - Eina_Inlist *globals; - Ecore_Wl_Global *global; + Eina_Iterator *globals; + Ecore_Wl2_Global *global; struct wl_registry *registry; if (!ad->tizen_policy) { - registry = ecore_wl_registry_get(); - globals = ecore_wl_globals_get(); + Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL); + + registry = ecore_wl2_display_registry_get(wl2_display); + globals = ecore_wl2_display_globals_get(wl2_display); if (!registry || !globals) return EINA_FALSE; - EINA_INLIST_FOREACH(globals, global) + EINA_ITERATOR_FOREACH(globals, global) { if (!strcmp(global->interface, "tizen_policy")) ad->tizen_policy = wl_registry_bind(registry, global->id, &tizen_policy_interface, 7); } + eina_iterator_free(globals); if (!ad->tizen_policy) return EINA_FALSE; } @@ -263,7 +269,7 @@ win_delete_request_cb(void *data, Evas_Object *obj, void *event_info) static Eina_Bool _window_show_cb(void *data, int type, void *event) { appdata_s *ad = data; - Ecore_Wl_Event_Window_Show *e; + Ecore_Wl2_Event_Window_Show *e; uint32_t g_res_id = -1; @@ -314,7 +320,7 @@ void init_info(appdata_s *ad) static void create_base_gui(appdata_s *ad) { - ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_SHOW, _window_show_cb, ad); + ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_SHOW, _window_show_cb, ad); ad->win = (Evas_Object *)elm_win_create("SDL_Indicator"); evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); -- 2.7.4