[M67 Dev][Tizen] Upgrade ecore-wayland with ecore-wl2 05/186905/1
authorChandan Padhi <c.padhi@samsung.com>
Mon, 13 Aug 2018 11:53:56 +0000 (04:53 -0700)
committerChandan Padhi <c.padhi@samsung.com>
Thu, 16 Aug 2018 06:33:38 +0000 (23:33 -0700)
The ecore-wayland has been upgraded by ecore-wl2 since tizen 5.0.
This patch applies the API changes.

Reference: https://review.tizen.org/gerrit/#/c/177221/

Change-Id: I94dc46561cf8624fc1defc60f28f378480eb3b97
Signed-off-by: Chandan Padhi <c.padhi@samsung.com>
12 files changed:
packaging/chromium-efl.spec
tizen_src/build/BUILD.gn
tizen_src/build/config/BUILD.gn
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.cc
tizen_src/chromium_impl/content/browser/renderer_host/render_widget_host_view_efl.h
tizen_src/chromium_impl/efl/init.cc
tizen_src/chromium_impl/ui/ozone/surface_factory_efl.cc
tizen_src/ecore_wrapper/ecore_x_wayland_wrapper.h
tizen_src/ewk/efl_integration/browser/javascript_modal_dialog_efl.cc
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/public/ewk_main.cc
tizen_src/ewk/efl_webview_app/mini_browser.c

index 6d17629..85d8225 100644 (file)
@@ -97,7 +97,11 @@ BuildRequires: python-accel-aarch64-cross-aarch64
 %endif
 
 %if "%{?_with_wayland}" == "1"
+%if %{tizen_version} >= 50
+BuildRequires: pkgconfig(ecore-wl2)
+%else
 BuildRequires: pkgconfig(ecore-wayland)
+%endif
 BuildRequires: pkgconfig(wayland-egl)
 %else
 BuildRequires: pkgconfig(ecore-x)
index b6be37b..e6758ca 100644 (file)
@@ -57,20 +57,32 @@ config("ecore-x-public") {
 
 config("ecore-wayland") {
   if (is_tizen && use_wayland) {
-    ldflags = [ "-lecore_wayland" ]
+    if (tizen_version >= 50) {
+      ldflags = [ "-lecore_wl2" ]
+    } else {
+      ldflags = [ "-lecore_wayland" ]
+    }
   }
 }
 
 tizen_pkg_config("libecore-wayland") {
   packages = []
   if (is_tizen && use_wayland) {
-    packages = [ "ecore-wayland" ]
+    if (tizen_version >= 50) {
+      packages = [ "ecore-wl2" ]
+    } else {
+      packages = [ "ecore-wayland" ]
+    }
   }
 }
 
 config("ecore-wayland-public") {
   if (is_tizen && use_wayland) {
-    cflags = [ "-ecore-wayland" ]
+    if (tizen_version >= 50) {
+      cflags = [ "-ecore-wl2" ]
+    } else {
+      cflags = [ "-ecore-wayland" ]
+    }
   }
 }
 
index a46ac68..3ea8de3 100644 (file)
@@ -31,6 +31,9 @@ config("tizen_feature_flags") {
 
   if (use_efl) {
     defines += [ "USE_EFL" ]
+    if (tizen_version >= 50) {
+      defines += [ "EFL_BETA_API_SUPPORT" ]
+    }
   }
   if (tizen_tbm_support) {
     defines += [ "TIZEN_TBM_SUPPORT" ]
index ab25eff..83b44cd 100644 (file)
@@ -539,16 +539,23 @@ void RenderWidgetHostViewEfl::InitAsFullscreen(RenderWidgetHostView*) {
 }
 
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+Ecore_Wl2_Window* RenderWidgetHostViewEfl::GetEcoreWlWindow() const {
+  const Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
+  return ecore_evas_wayland2_window_get(ee);
+}
+#else
 Ecore_Wl_Window* RenderWidgetHostViewEfl::GetEcoreWlWindow() const {
   const Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
   return ecore_evas_wayland_window_get(ee);
 }
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
 Ecore_X_Window RenderWidgetHostViewEfl::GetEcoreXWindow() const {
   const Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
   return ecore_evas_gl_x11_window_get(ee);
 }
-#endif
+#endif  // USE_WAYLAND
 
 void RenderWidgetHostViewEfl::SetSize(const gfx::Size& size) {
   // This is a hack. See WebContentsView::SizeContents
@@ -641,7 +648,11 @@ void RenderWidgetHostViewEfl::UpdateCursor(const WebCursor& webcursor) {
   if (is_loading_) {
 // Setting native Loading cursor
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+    ecore_wl2_window_cursor_from_name_set(GetEcoreWlWindow(), "watch");
+#else
     ecore_wl_window_cursor_from_name_set(GetEcoreWlWindow(), "watch");
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
     ecore_x_window_cursor_set(GetEcoreXWindow(),
                               ecore_x_cursor_shape_get(ECORE_X_CURSOR_CLOCK));
@@ -651,8 +662,13 @@ void RenderWidgetHostViewEfl::UpdateCursor(const WebCursor& webcursor) {
     webcursor.GetCursorInfo(&cursor_info);
 
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+    ecore_wl2_window_cursor_from_name_set(GetEcoreWlWindow(),
+                                          GetCursorName(cursor_info.type));
+#else
     ecore_wl_window_cursor_from_name_set(GetEcoreWlWindow(),
                                          GetCursorName(cursor_info.type));
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
     int cursor_type = GetCursorType(cursor_info.type);
     ecore_x_window_cursor_set(GetEcoreXWindow(),
index 67b1eab..a43505f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "base/containers/id_map.h"
 #include "base/format_macros.h"
+#include "chromium_impl/build/tizen_version.h"
 #include "components/viz/common/frame_sinks/copy_output_request.h"
 #include "components/viz/common/frame_sinks/copy_output_result.h"
 #include "components/viz/common/quads/compositor_frame.h"
@@ -292,7 +293,11 @@ class CONTENT_EXPORT RenderWidgetHostViewEfl
   EdgeEffect& EnsureEdgeEffect();
 
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+  Ecore_Wl2_Window* GetEcoreWlWindow() const;
+#else
   Ecore_Wl_Window* GetEcoreWlWindow() const;
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
   Ecore_X_Window GetEcoreXWindow() const;
 #endif
index c5d2a44..e7f6e89 100644 (file)
@@ -12,6 +12,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/message_loop/message_pump_ecore.h"
 #include "cc/base/switches.h"
+#include "chromium_impl/build/tizen_version.h"
 #include "content/common/paths_efl.h"
 #include "content/public/common/content_switches.h"
 #include "gpu/config/gpu_switches.h"
@@ -43,7 +44,15 @@ int Initialize(int argc, const char* argv[]) {
 
     ecore_init();
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+    Ecore_Wl2_Display* _ecore_wl2_display = NULL;
+    if (!ecore_wl2_init())
+      return EINA_FALSE;
+    if (!_ecore_wl2_display)
+      _ecore_wl2_display = ecore_wl2_display_connect(NULL);
+#else
     ecore_wl_init(NULL);
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
     ecore_x_init(NULL);
 #endif
index 78f37b5..1e0bf95 100644 (file)
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 #include "ui/ozone/surface_factory_efl.h"
+#include "chromium_impl/build/tizen_version.h"
 
 #include "ecore_x_wayland_wrapper.h"
 
@@ -38,7 +39,12 @@ class GLOzoneEGLEfl : public GLOzoneEGL {
  protected:
   intptr_t GetNativeDisplay() override {
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+    Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(NULL);
+    return reinterpret_cast<intptr_t>(ecore_wl2_display_get(wl2_display));
+#else
     return reinterpret_cast<intptr_t>(ecore_wl_display_get());
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
     return reinterpret_cast<intptr_t>(ecore_x_display_get());
 #endif
index 9315159..58dce79 100644 (file)
@@ -4,9 +4,14 @@
 
 #ifndef ECORE_X_WAYLAND_WRAPPER_H_
 #define ECORE_X_WAYLAND_WRAPPER_H_
+#include "chromium_impl/build/tizen_version.h"
 
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+#include <Ecore_Wl2.h>
+#else
 #include <Ecore_Wayland.h>
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
 #include <Ecore_X.h>
 #endif
index ffbf699..a664e22 100644 (file)
@@ -210,11 +210,8 @@ bool JavaScriptModalDialogEfl::ShowJavaScriptDialog() {
   evas_object_show(popup_);
 
   int width = 0, height = 0;
-#if defined(USE_WAYLAND)
-  ecore_wl_screen_size_get(&width, &height);
-#else
-  ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
-#endif
+  const Ecore_Evas* ee = ecore_evas_ecore_evas_get(web_view_->GetEvas());
+  ecore_evas_screen_geometry_get(ee, nullptr, nullptr, &width, &height);
   evas_object_resize(popup_, width, height);
   evas_object_move(popup_, 0, 0);
   return true;
@@ -247,7 +244,12 @@ void JavaScriptModalDialogEfl::javascriptPopupResizeCallback(void *data, Evas *e
   int popupHeight;
   int width = 0, height = 0;
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+  Ecore_Wl2_Display* wl2_display = ecore_wl2_connected_display_get(NULL);
+  ecore_wl2_display_screen_size_get(wl2_display, &width, &height);
+#else
   ecore_wl_screen_size_get(&width, &height);
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
   ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
 #endif
index 0c5b1fc..05a69ad 100644 (file)
@@ -482,17 +482,12 @@ void EWebView::SetOrientation(int orientation) {
 
     int width = 0;
     int height = 0;
-#if defined(USE_WAYLAND)
-    // Screen orientation is already considered in ecore_wl_screen_size_get
-    // function.
-    ecore_wl_screen_size_get(&width, &height);
-#else
-    if (orientation == 0 || orientation == 180) {
-      ecore_x_screen_size_get(ecore_x_default_screen_get(), &width, &height);
-    } else {
-      ecore_x_screen_size_get(ecore_x_default_screen_get(), &height, &width);
-    }
-#endif
+    const Ecore_Evas* ee =
+        ecore_evas_ecore_evas_get(evas_object_evas_get(evas_object_));
+    ecore_evas_screen_geometry_get(ee, nullptr, nullptr, &width, &height);
+    if (orientation == 90 || orientation == 270)
+      std::swap(width, height);
+
     if (context_menu_)
       context_menu_->SetPopupSize(width, height);
     if (inputPicker_)
index d5b6afc..3a2886d 100644 (file)
@@ -55,6 +55,9 @@ extern std::string g_homeDirectory;
  * @brief   the log domain identifier that is used with EINA's macros
  */
 int _ewk_log_dom = -1;
+#if defined(USE_WAYLAND) && TIZEN_VERSION_AT_LEAST(5, 0, 0)
+Ecore_Wl2_Display* _ecore_wl2_display = NULL;
+#endif
 
 int ewk_init(void)
 {
@@ -91,10 +94,18 @@ int ewk_init(void)
   }
 
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+  if (!ecore_wl2_init()) {
+#else
   if (!ecore_wl_init(0)) {
-      CRITICAL("could not init ecore_wl.");
-      goto error_ecore_wl;
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
+    ERR("could not init ecore_wl.");
+    goto error_ecore_wl;
   }
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+  if (!_ecore_wl2_display)
+    _ecore_wl2_display = ecore_wl2_display_connect(NULL);
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
   if (!ecore_x_init(0)) {
       CRITICAL("could not init ecore_x.");
@@ -124,7 +135,15 @@ int ewk_init(void)
 
 error_edje:
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+  if (_ecore_wl2_display) {
+    ecore_wl2_display_disconnect(_ecore_wl2_display);
+    _ecore_wl2_display = NULL;
+    ecore_wl2_shutdown();
+  }
+#else
   ecore_wl_shutdown();
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 error_ecore_wl:
 #else
   ecore_x_shutdown();
@@ -155,7 +174,15 @@ int ewk_shutdown(void)
 
   edje_shutdown();
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+  if (_ecore_wl2_display) {
+    ecore_wl2_display_disconnect(_ecore_wl2_display);
+    _ecore_wl2_display = NULL;
+    ecore_wl2_shutdown();
+  }
+#else
   ecore_wl_shutdown();
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
   ecore_x_shutdown();
 #endif
index c74df04..fe6a958 100644 (file)
@@ -306,7 +306,12 @@ static Evas_Object* _create_main_window(void *data)
     elm_win_borderless_set(window, EINA_TRUE);
     elm_win_conformant_set(window, EINA_TRUE);
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+    Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL);
+    ecore_wl2_display_screen_size_get(wl2_display, &width, &height);
+#else
     ecore_wl_screen_size_get(&width, &height);
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
     ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
 #endif
@@ -777,8 +782,13 @@ int main(int argc, char** argv)
 void get_main_window_size(int *changed_ang, int *width, int *height)
 {
 #if defined(USE_WAYLAND)
-  // Screen orientation is already considered in ecore_wl_screen_size_get function.
+  // Screen orientation is already considered in ecore_wl*_display_screen_size_get function.
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+  Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL);
+  ecore_wl2_display_screen_size_get(wl2_display, width, height);
+#else
   ecore_wl_screen_size_get(width, height);
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
   switch (*changed_ang) {
     case APP_DEVICE_ORIENTATION_0:
@@ -1169,7 +1179,12 @@ void hide_imf_panel(app_data* data)
     if (is_imf_shown) {
       int width = 0, height = 0;
 #if defined(USE_WAYLAND)
+#if TIZEN_VERSION_AT_LEAST(5, 0, 0)
+      Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL);
+      ecore_wl2_display_screen_size_get(wl2_display, &width, &height);
+#else
       ecore_wl_screen_size_get(&width, &height);
+#endif  // TIZEN_VERSION_AT_LEAST(5, 0, 0)
 #else
       ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
 #endif