[WRTjs] Preferred rotation app is showing abnormal 11/315311/3
authorzhaosy <shiyusy.zhao@samsung.com>
Mon, 29 Jul 2024 12:49:02 +0000 (20:49 +0800)
committerBot Blink <blinkbot@samsung.com>
Thu, 1 Aug 2024 04:11:13 +0000 (04:11 +0000)
Issue:
1. When app is launched, rotation_degree is equal preferred rotation degree,
   but this degree is fail to pass to engine, because RenderWidgetHostViewAura
   is not created at this time.
2. Window Manager send Rotation callback, but rotation_degree is the same as
   Rotation callback degree, so OnRotation is not called, then page is not updated,
    and engine still has a default degree 0.

Solution:
1. Should not set rotation_degree to preferred rotation degree at first,
   this value can't pass to engine, and will cause Rotation callback can't trigger.
2. Notice window manager preferred rotation is done in WillDraw, otherwise,
   need to wait 10s(Window Manager time out), then app can show

Change-Id: I0a548fac85db03f16a72224b6370f7be7fd7ecfa
Signed-off-by: zhaosy <shiyusy.zhao@samsung.com>
wrt/src/browser/api/wrt_api_web_contents.cc
wrt/src/browser/wrt_native_window.cc

index 2fc03d30b16d49d697058745acca67005995939f..d7dbc62dff2f92d6d681ecac8e9b6a8effd0d42e 100644 (file)
@@ -1,5 +1,6 @@
 #include "wrt/src/browser/api/wrt_api_web_contents.h"
 
+#include <Ecore_Wl2.h>
 #include <Elementary.h>
 
 #include "base/bind.h"
@@ -116,8 +117,14 @@ void WebContents::WillDraw(int new_rotation, gfx::Size frame_data_output_size) {
     frame_output_size_.set_width(frame_data_output_size.width());
     auto* ee = WRTNativeWindow::GetPlatformCanvas();
     if (EINA_TRUE == ecore_evas_wm_rotation_manual_rotation_done_get(ee)) {
-      LOG(INFO) << "finalize window rotation done";
+      LOG(INFO) << "finalize window manual rotation done";
       ecore_evas_wm_rotation_manual_rotation_done(ee);
+    } else if (ecore_evas_wm_rotation_preferred_rotation_get(ee) > 0) {
+      LOG(INFO) << "finalize window preferred rotation done";
+      Ecore_Wl2_Window* wl_win = ecore_evas_wayland2_window_get(ee);
+      ecore_wl2_window_rotation_change_done_send(
+          wl_win, new_rotation, frame_data_output_size.width(),
+          frame_data_output_size.height());
     }
   }
 
index dd7fbac48c98c1f025f74bea88116b8578d583b8..e9a10110900022bdd472f3041895d1a6cc7a9b3a 100644 (file)
@@ -433,7 +433,7 @@ void WRTNativeWindow::InitRotation() {
 
 // static
 void WRTNativeWindow::SetRotationState(bool is_auto, int degree) {
-  rotation_degree = native_window_delegate->SetRotationState(is_auto, degree);
+  native_window_delegate->SetRotationState(is_auto, degree);
 }
 
 // static