[Tizen] ecore-wl2: applying ecore-wl2 79/172979/2 accepted/tizen/unified/20180328.005944 submit/tizen/20180319.053649
authorWonsik, Jung <sidein@samsung.com>
Tue, 13 Feb 2018 07:24:35 +0000 (16:24 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Mon, 19 Mar 2018 06:56:13 +0000 (06:56 +0000)
this patch is for supporting ecore-wl2.
In additional, it can support both ecore-wl2 and ecore-wayland

Change-Id: Idb6edf805dfafe53a04e2fb59a2ae29b4b23b959

build/tizen/CMakeLists.txt
packaging/widget-viewer-dali.spec
widget_viewer_dali/internal/widget_view/widget_view_impl.cpp

index a27a930f792e7f5260de3be95519de3faff1e01d..361cb92e209efaa2e695e6cb771dd37fb3f8ff0d 100644 (file)
@@ -13,7 +13,17 @@ SET(IMAGE_DIR "${TZ_SYS_SHARE}/${PROJECT_NAME}/images")
 SET(LOCALE_DIR "${TZ_SYS_SHARE}/${PROJECT_NAME}/locale")
 SET(ROOT_SRC_DIR ${CMAKE_SOURCE_DIR}/../..)
 
+IF("${ENABLE_ECOREWL2}" STREQUAL "On")
+        OPTION(USE_ECOREWL2 "Use ecorewl2" ON)
+ENDIF()
+
+IF(USE_ECOREWL2)
+        ADD_DEFINITIONS("-DECORE_WL2")
+        ADD_DEFINITIONS("-DEFL_BETA_API_SUPPORT")
+ENDIF()
+
 INCLUDE(FindPkgConfig)
+IF(USE_ECOREWL2)
 pkg_check_modules(viewer_dali REQUIRED
        dlog
        widget_service
@@ -22,11 +32,26 @@ pkg_check_modules(viewer_dali REQUIRED
        dali-adaptor
        dali-toolkit
        cynara-client
-       ecore-wayland
+        ecore-wl2
        ecore-input
        tizen-remote-surface-client
        screen_connector_watcher
 )
+ELSE()
+pkg_check_modules(viewer_dali REQUIRED
+        dlog
+        widget_service
+        capi-system-info
+        dali-core
+        dali-adaptor
+        dali-toolkit
+        cynara-client
+        ecore-wayland
+        ecore-input
+        tizen-remote-surface-client
+        screen_connector_watcher
+)
+ENDIF()
 
 SET(BUILD_SOURCE
        ${ROOT_SRC_DIR}/widget_viewer_dali/public_api/widget_view/widget_view.cpp
index 0824b4ffe7ba683d4172ebe5a80f9f495525e7e8..2bd54cece9abd8487da0cfd63635c138dabf50b5 100644 (file)
@@ -1,4 +1,5 @@
-%bcond_with wayland
+%bcond_without wayland
+%bcond_with x
 
 Name:    libwidget_viewer_dali
 Summary: Library for developing the application
@@ -19,10 +20,15 @@ BuildRequires: pkgconfig(dali-core)
 BuildRequires: pkgconfig(dali-adaptor)
 BuildRequires: pkgconfig(dali-toolkit)
 BuildRequires: pkgconfig(cynara-client)
-BuildRequires: pkgconfig(ecore-wayland)
 BuildRequires: pkgconfig(wayland-tbm-client)
 BuildRequires: pkgconfig(screen_connector_watcher)
 
+%if 0%{?tizen_version_major} >= 5
+BuildRequires:  pkgconfig(ecore-wl2)
+%else
+BuildRequires:  pkgconfig(ecore-wayland)
+%endif
+
 %description
 API for creating a new instance of the widget and managing its life-cycle.
 
@@ -55,11 +61,20 @@ LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed"
 CXXFLAGS+=" -D_ARCH_ARM_"
 %endif
 
+%if 0%{?tizen_version_major} >= 5
+    export CFLAGS+=" -DECORE_WL2 -DEFL_BETA_API_SUPPORT "
+    export CXXFLAGS+=" -DECORE_WL2 -DEFL_BETA_API_SUPPORT "
+    %define ENABLE_ECOREWL2 On
+%else
+    %define ENABLE_ECOREWL2 Off
+%endif
+
 cd %{_builddir}/%{name}-%{version}/build/tizen
 
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 %cmake -DWIDGET_ENABLED=On \
           -DTZ_SYS_SHARE=/usr/share \
+       -DENABLE_ECOREWL2=%{ENABLE_ECOREWL2} \
        -DFULLVER=%{version} \
        -DMAJORVER=${MAJORVER} \
        .
index 674aa48eba0efc2dbd48758f75d71a36467ffbf1..f927aae426d673a4bca838b0b436a3316df89258 100644 (file)
 #include <dali/integration-api/debug.h>
 #include <dali/devel-api/images/texture-set-image.h>
 #include <string.h>
+#ifdef ECORE_WL2
+#include <Ecore_Wl2.h>
+#else
 #include <Ecore_Wayland.h>
+#endif
 #include <Ecore_Input.h>
 #include <widget_service.h>
 #include <widget_instance.h>
@@ -182,11 +186,31 @@ static void FindKeyCode( struct xkb_keymap* keyMap, xkb_keycode_t key, void* dat
 static bool GetKeyCode( std::string keyName, int32_t& keyCode )
 {
   xkb_keymap* keyMap = NULL;
-  Ecore_Wl_Input* ecoreWlInput = NULL;
   xkb_keysym_t sym = XKB_KEY_NoSymbol;
   KeyCodeMap foundKeyCode;
 
+#ifdef ECORE_WL2
+  Ecore_Wl2_Input* ecoreWlInput = NULL;
+
+  Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL);
+  ecoreWlInput = ecore_wl2_input_default_input_get(wl2_display);
+  if( !ecoreWlInput )
+  {
+    DALI_LOG_ERROR( "Failed to get Ecore_Wl2_Input in WidgetView\n" );
+    return false;
+  }
+
+  keyMap = ecore_wl2_input_keymap_get( ecoreWlInput );
+  if( !keyMap )
+  {
+    DALI_LOG_ERROR( "Failed to get keymap in WidgetView\n" );
+    return false;
+  }
+#else
+  Ecore_Wl_Input* ecoreWlInput = NULL;
+
   ecoreWlInput = ecore_wl_input_get();
+
   if( !ecoreWlInput )
   {
     DALI_LOG_ERROR( "Failed to get Ecore_Wl_Input in WidgetView\n" );
@@ -199,7 +223,7 @@ static bool GetKeyCode( std::string keyName, int32_t& keyCode )
     DALI_LOG_ERROR( "Failed to get keymap in WidgetView\n" );
     return false;
   }
-
+#endif
   sym = xkb_keysym_from_name( keyName.c_str(), XKB_KEYSYM_NO_FLAGS );
   if( sym == XKB_KEY_NoSymbol )
   {