[wayland][tizen v3.0] ecore wayland function integration
authoryh106.jung <yh106.jung@samsung.com>
Thu, 21 May 2015 10:23:50 +0000 (19:23 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
This patch is based on [WAYLAND_BRINGUP] Wayland window fuctions
integration(http://165.213.202.130/gerrit/79542)

1. ecore_x_window_size_get -> ecore_wl_screen_size_get
2. ecore_x_window_resize -> ecore_wl_window_resize
3. ecore_x_window_hide -> ecore_wl_window_hide
4. ecore_x_window_show -> ecore_wl_window_show
5. ecore_x_window_move -> ecore_wl_window_move

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=12693
Reviewed by: Antonio Gomes, Hyunhak Kim, Jaesik Chang

Change-Id: Ic55f136a883710c5cc36f42d03712f3f28238dc8
Signed-off-by: yh106.jung <yh106.jung@samsung.com>
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/ewk/efl_integration/browser/javascript_modal_dialog_efl.cc
tizen_src/ewk/efl_integration/context_menu_controller_efl.cc
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_webview_app/app.c
tizen_src/ewk/efl_webview_app/mini_browser.c

index ac0c81f..0c9bb95 100644 (file)
@@ -518,10 +518,17 @@ RenderWidgetHost* RenderWidgetHostViewEfl::GetRenderWidgetHost() const {
   return host_;
 }
 
+#if defined(USE_WAYLAND)
+Ecore_Wl_Window* RenderWidgetHostViewEfl::GetEcoreWlWindow() const {
+  const Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
+  return ecore_evas_wayland_window_get(ee);
+}
+#else
 Ecore_X_Window RenderWidgetHostViewEfl::GetEcoreXWindow() const {
-  Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
+  const Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_);
   return ecore_evas_gl_x11_window_get(ee);
 }
+#endif
 
 void RenderWidgetHostViewEfl::SetSize(const gfx::Size& size) {
   // This is a hack. See WebContentsView::SizeContents
@@ -529,11 +536,10 @@ void RenderWidgetHostViewEfl::SetSize(const gfx::Size& size) {
   int height = std::min(size.height(), EFL_MAX_HEIGHT);
   if (popup_type_ != blink::WebPopupTypeNone) {
     // We're a popup, honor the size request.
-    // TODO: Webview TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
-    ecore_x_window_resize(GetEcoreXWindow(), width, height);
+#if defined(USE_WAYLAND)
+    ecore_wl_window_resize(GetEcoreWlWindow(), width, height, 0);
 #else
-    NOTIMPLEMENTED();
+    ecore_x_window_resize(GetEcoreXWindow(), width, height);
 #endif
   }
 
@@ -618,6 +624,29 @@ bool RenderWidgetHostViewEfl::HasFocus() const {
 }
 
 void RenderWidgetHostViewEfl::MovePluginContainer(const WebPluginGeometry& move) {
+#if defined(USE_WAYLAND)
+  Ecore_Wl_Window* surface_window = nullptr;
+  PluginWindowToWidgetMap::const_iterator i = plugin_window_to_widget_map_.find(move.window);
+
+  if (i != plugin_window_to_widget_map_.end())
+    surface_window = i->second;
+
+  if (!surface_window)
+    return;
+
+  if (!move.visible) {
+    ecore_wl_window_hide(surface_window);
+    return;
+  }
+
+  ecore_wl_window_show(surface_window);
+
+  if (!move.rects_valid)
+    return;
+
+  ecore_wl_window_move(surface_window, move.window_rect.x(), move.window_rect.y());
+  ecore_wl_window_resize(surface_window, move.window_rect.width(), move.window_rect.height(), 0);
+#else
   Ecore_X_Window surface_window = 0;
   PluginWindowToWidgetMap::const_iterator i = plugin_window_to_widget_map_.find(move.window);
 
@@ -628,31 +657,17 @@ void RenderWidgetHostViewEfl::MovePluginContainer(const WebPluginGeometry& move)
     return;
 
   if (!move.visible) {
-    // TODO: Webview TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
     ecore_x_window_hide(surface_window);
-#else
-    NOTIMPLEMENTED();
-#endif
     return;
   }
 
-  // TODO: Webview TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
   ecore_x_window_show(surface_window);
-#else
-  NOTIMPLEMENTED();
-#endif
 
   if (!move.rects_valid)
     return;
 
-  // TODO: Webview TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
   ecore_x_window_move(surface_window, move.window_rect.x(), move.window_rect.y());
   ecore_x_window_resize(surface_window, move.window_rect.width(), move.window_rect.height());
-#else
-  NOTIMPLEMENTED();
 #endif
 }
 
index a61c208..fd795fc 100644 (file)
@@ -256,7 +256,11 @@ class RenderWidgetHostViewEfl
   static void EvasObjectImagePixelsGetCallback(void*, Evas_Object*);
   void initializeProgram();
 
+#if defined(USE_WAYLAND)
+  Ecore_Wl_Window* GetEcoreWlWindow() const;
+#else
   Ecore_X_Window GetEcoreXWindow() const;
+#endif
 
   void PaintTextureToSurface(GLuint texture_id);
 
@@ -270,7 +274,11 @@ class RenderWidgetHostViewEfl
   bool evas_gl_initialized_;
   float device_scale_factor_;
 
+#if defined(USE_WAYLAND)
+  typedef std::map<gfx::PluginWindowHandle, Ecore_Wl_Window*> PluginWindowToWidgetMap;
+#else
   typedef std::map<gfx::PluginWindowHandle, Ecore_X_Window> PluginWindowToWidgetMap;
+#endif
   PluginWindowToWidgetMap plugin_window_to_widget_map_;
 
   bool magnifier_;
index 566de31..df56088 100644 (file)
@@ -208,11 +208,11 @@ bool JavaScriptModalDialogEfl::ShowJavaScriptDialog() {
   evas_object_show(popup_);
   evas_object_focus_set(popup_, true);
 
-  int width, height;
-#if !defined(WAYLAND_BRINGUP)
-  ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
+  int width = 0, height = 0;
+#if defined(USE_WAYLAND)
+  ecore_wl_screen_size_get(&width, &height);
 #else
-  NOTIMPLEMENTED();
+  ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
 #endif
   evas_object_resize(popup_, width, height);
   evas_object_move(popup_, 0, 0);
@@ -244,11 +244,11 @@ void JavaScriptModalDialogEfl::javascriptPopupResizeCallback(void *data, Evas *e
     return;
 
   int popupHeight;
-  int width, height;
-#if !defined(WAYLAND_BRINGUP)
-  ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
+  int width = 0, height = 0;
+#if defined(USE_WAYLAND)
+  ecore_wl_screen_size_get(&width, &height);
 #else
-  NOTIMPLEMENTED();
+  ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
 #endif
   evas_object_geometry_get(obj, 0, 0, 0, &popupHeight);
 
index c612230..c86a377 100644 (file)
@@ -282,14 +282,6 @@ bool ContextMenuControllerEfl::CreateContextMenu() {
       }
     }
 
-#if !defined(WAYLAND_BRINGUP)
-    int width = 0;
-    int height = 0;
-    ecore_x_screen_size_get(ecore_x_default_screen_get(), &width, &height);
-#else
-  NOTIMPLEMENTED();
-#endif
-
     evas_object_size_hint_weight_set(popup_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
     static Elm_Genlist_Item_Class _context_menu_list_item;
index 432001b..3692a32 100644 (file)
@@ -554,15 +554,15 @@ void EWebView::SetOrientation(int orientation) {
 
     int width = 0;
     int height = 0;
-    // TODO: Webview and Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
+#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);
     }
-#else
-    NOTIMPLEMENTED();
 #endif
     if (context_menu_)
       context_menu_->SetPopupSize(width, height);
index d6cd871..a6dcdc8 100644 (file)
@@ -429,8 +429,9 @@ int main(int argc, char** argv)
   if (use_fullscreen) {
     // FIXME: this is wrong with dual screen configuration (desktop).
     // We should use XineramaQueryScreens for that setup.
-    // TODO: Webview and Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
+#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
     ecore_evas_size_base_set(ee, width, height);
index 716bdbc..77a6428 100755 (executable)
@@ -291,14 +291,15 @@ static Evas_Object* _create_main_window(void *data)
 {
   Evas_Object *window = elm_win_add(NULL, "ChromiumEfl", ELM_WIN_BASIC);
   if (window) {
-    int width, height;
+    int width = 0, height = 0;
     elm_win_title_set(window, "ChromiumEfl");
     evas_object_size_hint_weight_set(window, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
     evas_object_size_hint_align_set(window, EVAS_HINT_FILL, EVAS_HINT_FILL);
     elm_win_borderless_set(window, EINA_TRUE);
     elm_win_conformant_set(window, EINA_TRUE);
-    // TODO: Webview and Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
+#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
     evas_object_resize(window, width, height);
@@ -763,23 +764,22 @@ 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.
+  ecore_wl_screen_size_get(width, height);
+#else
   switch (*changed_ang) {
     case APP_DEVICE_ORIENTATION_0:
-      // TODO: Webview and Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
       ecore_x_window_size_get(ecore_x_window_root_first_get(), width, height);
-#endif
       break;
     case APP_DEVICE_ORIENTATION_90:
     case APP_DEVICE_ORIENTATION_270:
-      // TODO: Webview and Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
       ecore_x_window_size_get(ecore_x_window_root_first_get(), height, width);
-#endif
       break;
     default:
       return;
   }
+#endif
 }
 
 void __load_started_cb(void *data, Evas_Object *obj, void *event_info)
@@ -1154,9 +1154,10 @@ void hide_imf_panel(app_data* data)
   #if defined(OS_TIZEN_TV)
 /* On SIP close, Toolbar bring back to original position*/
   if (is_imf_shown) {
-    int width, height;
-    // TODO: Webview and Rendering TG will implement following for Wayland.
-#if !defined(WAYLAND_BRINGUP)
+    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
     //evas_object_resize(data->webview, width, height - TOOL_BOX_HEIGHT);