[NextBrowser] Rotation support with rotation angles disabled 46/325346/2
authorsaurabh.t3 <saurabh.t3@samsung.com>
Mon, 9 Jun 2025 12:22:28 +0000 (17:52 +0530)
committerNehal Kumar <nehal.kumar@samsung.com>
Mon, 9 Jun 2025 12:59:27 +0000 (18:29 +0530)
Change-Id: I127e5b431e05625ecd57d3bc3085e8412064b780
Signed-off-by: saurabh.t3 <saurabh.t3@samsung.com>
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.cc
tizen_src/chromium_impl/ui/ozone/platform/efl/efl_window.h

index 7dccb921f998d196bc7ab0a0b42628dce273ebd5..0cf993d5b584cfc88d67993c37e0325278829ff4 100644 (file)
@@ -75,6 +75,29 @@ bool g_evas_init = false;
 
 }  // namespace
 
+#ifdef SAMSUNG_NEXT_BROWSER
+int getRotationDegreeByVconf()
+{
+  int orienatation = -1;
+  if (vconf_get_int("db/sysman/rotation_state", &orienatation)) {
+    LOG(WARNING) << "fail to get Orientation";
+    return -1;
+  }
+  LOG(INFO) << "retval = " << orienatation;
+
+  int rotation = -1;
+  if(orienatation == 1)
+   rotation = 0;
+  else if(orienatation == 2)
+   rotation = 90;
+  else if(orienatation == 0)
+   rotation = 270;
+  LOG(INFO) << "rotation : " << rotation;
+
+  return rotation;
+}
+#endif
+
 Ecore_Evas* prepared_ee = nullptr;
 Evas_Object* prepared_elm_win = nullptr;
 
@@ -105,6 +128,9 @@ Ecore_Evas* EflWindow::CreateElmObject(const gfx::Rect& bounds) {
   prepared_elm_win = elm_win_add(NULL, "EFL_WINDOW", ELM_WIN_BASIC);
   elm_win_autodel_set(prepared_elm_win, EINA_TRUE);
   evas_object_resize(prepared_elm_win, bounds.width(), bounds.height());
+#ifdef SAMSUNG_NEXT_BROWSER
+  elm_win_aux_hint_add(prepared_elm_win, "wm.policy.win.screencontrol.transform", "disable");
+#endif
   return ecore_evas_ecore_evas_get(evas_object_evas_get(prepared_elm_win));
 }
 
@@ -426,9 +452,10 @@ uint32_t EflWindow::DispatchEventToDelegate(const PlatformEvent& event) {
 void EflWindow::OnEcoreEvasResize(Ecore_Evas* ee) {
   int width, height;
   ecore_evas_geometry_get(ee, NULL, NULL, &width, &height);
-
+#ifndef SAMSUNG_NEXT_BROWSER
   EflWindow* efl_window = EflWindowManager::GetWindowFromMap(ee);
   efl_window->SetBoundsInPixels(gfx::Rect(width, height));
+#endif
 }
 #endif
 
@@ -469,7 +496,10 @@ void EflWindow::Initialize(const PlatformWindowInitProperties& properties) {
       return;
     }
   }
-
+#ifdef SAMSUNG_NEXT_BROWSER
+  ecore_evas_aux_hint_add(ee_ , "wm.policy.win.user.geometry", "1");
+  vconf_notify_key_changed("db/sysman/rotation_state", vconf_rotation_changed_cb, this);
+#endif
   evas_ = ecore_evas_get(ee_);
 
 #if !BUILDFLAG(IS_TIZEN)
@@ -714,5 +744,49 @@ void EflWindow::SetEventsOverlayForOffscreen(Evas_Object* events_overlay,
   EnsureIMContextEfl(ime_window);
 #endif
 }
+#ifdef SAMSUNG_NEXT_BROWSER
+void EflWindow::SetTransformHint(int rotation)
+{
+  aura::WindowTreeHostPlatform* host = static_cast<aura::WindowTreeHostPlatform*>(delegate_);
+  if(rotation == 90 || rotation == 270)
+  {
+    LOG(INFO) << "SetDisplayTransformHint to OVERLAY_TRANSFORM_ROTATE_270";
+    host->SetDisplayTransformHint(gfx::OVERLAY_TRANSFORM_ROTATE_CLOCKWISE_270);
+  }
+  else
+  {
+    LOG(INFO) << "SetDisplayTransformHint to OVERLAY_TRANSFORM_NONE";
+    host->SetDisplayTransformHint(gfx::OVERLAY_TRANSFORM_NONE);
+  }
+}
 
+void EflWindow::HandleRotation(int rotation)
+{
+  LOG(INFO) << "rotation : " << rotation;
+  int w = 1920;
+  int h = 1080;
+  if(rotation == 90 || rotation == 270)
+  {
+    std::swap(w,h);
+  }
+
+  aura::WindowTreeHostPlatform* host = static_cast<aura::WindowTreeHostPlatform*>(delegate_);
+  evas_object_resize(native_view(), w, h);
+  SetTransformHint(rotation);
+  bounds_ = gfx::Rect(0,0,w,h);
+  delegate_->OnBoundsChanged({false});
+  host->UpdateCompositorScaleAndSize(gfx::Size(1920,1080));
+}
+
+void EflWindow::vconf_rotation_changed_cb(keynode_t* keynodeName, void* data)
+{
+  EflWindow* win = static_cast<EflWindow*>(data);
+  int rotation = getRotationDegreeByVconf();
+  if(!win || rotation == -1)
+  {
+    return;
+  }
+  win->HandleRotation(rotation);
+}
+#endif
 }  // namespace ui
index 8eaa0421e47376ef0006eba30bf7cd3bd59a0fcf..1af2d8529399d357e759dbe43e6c5bfcccfc9065 100644 (file)
 #include <Ecore_Wl2.h>
 #endif
 
+#ifdef SAMSUNG_NEXT_BROWSER
+#include <vconf.h>
+#endif
+
 namespace ui {
 
 class EflEventHandler;
@@ -110,7 +114,11 @@ class EflWindow : public PlatformWindow, public PlatformEventDispatcher {
 #endif
   bool IsFullscreen();
   Evas_Object* CreateOverlay();
-
+#ifdef SAMSUNG_NEXT_BROWSER
+  void SetTransformHint(int rotation);
+  void HandleRotation(int rotation);
+  static void vconf_rotation_changed_cb(keynode_t* keynodeName, void* data);
+#endif
   // Stores current state of this window.
   PlatformWindowState state_ = PlatformWindowState::kUnknown;