[WRTjs][VD] Add a rect to restrict the size of window 13/291313/5
authorzhaosy <shiyusy.zhao@samsung.com>
Thu, 13 Apr 2023 07:14:24 +0000 (15:14 +0800)
committerBot Blink <blinkbot@samsung.com>
Fri, 14 Apr 2023 03:43:33 +0000 (03:43 +0000)
window is resized to 1920*1920 by efl in some rotation cases(IME is showing, rotate), so
1.Add a rect to restrict the size of window.
2.Resize webview in rotation, otherwise there is a black screen between app and IME.

Change-Id: Ie2fb060b8c1a59e2a84e33b3826ec4ddead2cdc8
Signed-off-by: zhaosy <shiyusy.zhao@samsung.com>
wrt/src/browser/tv/wrt_native_window_tv.cc
wrt/src/browser/tv/wrt_native_window_tv.h [changed mode: 0755->0644]
wrt/src/browser/wrt_native_window.cc
wrt/src/browser/wrt_native_window.h

index c6c5ea62588d4f555e382379b07317d90ec471f0..1649fc6b26cb0a6c94e19331118eaf91cf64e391 100644 (file)
@@ -365,6 +365,8 @@ void WRTNativeWindowTV::Initialize(content::WebContents* web_contents) {
   SetRuntimeVariables();
   SetProxyInfo();
   SetDiskCacheMode();
+
+  SetMaxWindowSizeRect();
 }
 
 void WRTNativeWindowTV::Finalize() {
@@ -482,6 +484,16 @@ void WRTNativeWindowTV::CreateMouseCursor(Evas_Object* window) {
   mouse_initialize = true;
 }
 
+void WRTNativeWindowTV::SetMaxWindowSizeRect() {
+  // window is resized to 1920*1920 by efl in some rotation cases(IME is
+  // showing, rotate). so add a rect to restrict the size of window.
+  window_size_rect_ =
+      evas_object_rectangle_add(evas_object_evas_get(top_window_));
+  evas_object_size_hint_min_set(window_size_rect_, predefined_screen_width,
+                                predefined_screen_height);
+  elm_win_resize_object_add(top_window_, window_size_rect_);
+}
+
 // static
 void WRTNativeWindowTV::SetGlobalResourceId(Evas_Object* top_window) {
   if (global_resource_id)
@@ -1553,10 +1565,17 @@ void WRTNativeWindowTV::DidRotation(int degree) {
   if (abs(origin_degree - degree) != 180 && rwhv)
     rwhv->ClearAllTilesResources();
 
-  int w, h;
-  evas_object_geometry_get(top_window_, nullptr, nullptr, &w, &h);
-  evas_object_resize(top_window_, w, h);
-  LOG(INFO) << "degree : " << degree << " (" << w << "x" << h << ")";
+  int screen_width = 1920, screen_height = 1080;
+  GetScreenResolution(screen_width, screen_height);
+  if (degree == 90 || degree == 270) {
+    evas_object_size_hint_min_set(window_size_rect_, screen_height,
+                                  screen_width);
+    evas_object_resize(view_evas(), screen_height, screen_width);
+  } else {
+    evas_object_size_hint_min_set(window_size_rect_, screen_width,
+                                  screen_height);
+    evas_object_resize(view_evas(), screen_width, screen_width);
+  }
 }
 
 void WRTNativeWindowTV::LowerWindow() {
old mode 100755 (executable)
new mode 100644 (file)
index 45c1b64..90947df
@@ -107,6 +107,7 @@ class WRTNativeWindowTV : public WRTNativeWindow {
   void SetInvisibleDelivery();
   void SetKeyboardFuncKey();
   void SetKeyEventChecker();
+  void SetMaxWindowSizeRect();
   void SetProxyInfo();
   void SetDiskCacheMode();
   void SetRuntimeVariables();
@@ -147,6 +148,7 @@ class WRTNativeWindowTV : public WRTNativeWindow {
   sensor_listener_h rotation_listener_;
 
   Evas_Object* top_window_;
+  Evas_Object* window_size_rect_;
 
   electron::WebContentsZoomController* zoom_controller_ = nullptr;
   double zoom_factor_ = 1.0;
index fca24b87b061c983c9dd483c8082cb3528a1fabc..d43ff97f3bb265daa18f39dde031da47b55cdbec 100644 (file)
@@ -103,8 +103,6 @@ const std::string kViewmodeTypeWindowed = "windowed";
 #endif
 
 Ecore_Event_Handler* visibility_handler_ = nullptr;
-int predefined_screen_width = 0;
-int predefined_screen_height = 0;
 
 void SetVisibilityCallback(Evas_Object* top_window) {
   LOG(INFO) << "Set callbacks for visibility change";
@@ -172,6 +170,9 @@ Evas_Object* WRTNativeWindow::window_ = nullptr;
 Evas_Object* WRTNativeWindow::layout_ = nullptr;
 Evas_Object* WRTNativeWindow::conformant_ = nullptr;
 
+int WRTNativeWindow::predefined_screen_width = 0;
+int WRTNativeWindow::predefined_screen_height = 0;
+
 // static
 WRTNativeWindow* WRTNativeWindow::GetMainNativeWindow() {
   return electron::WindowList::IsEmpty()
index fc91fbee6667329883c185690500f0b6103da8b0..4dfeecd117a98232682e63792451e1739e37dd0c 100644 (file)
@@ -172,6 +172,9 @@ class WRTNativeWindow : public electron::NativeWindow {
   bool is_enabled_ = true;
   content::WebContents* web_contents_;
 
+  static int predefined_screen_width;
+  static int predefined_screen_height;
+
  private:
   static void OnHWBackKey(void*, Evas_Object*, void*);
   static void OnHWMoreKey(void*, Evas_Object*, void*);