Add Window::SetLayout method
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
index e9fc0ba..f7993df 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 // EXTERNAL_HEADERS
 #include <Ecore_Input.h>
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
 #include <dali/public-api/adaptor-framework/window-enumerations.h>
 #include <dali/public-api/events/mouse-button.h>
 #include <dali/public-api/object/any.h>
+
+#if defined(VCONF_ENABLED)
 #include <vconf-keys.h>
 #include <vconf.h>
+#endif
+
 #include <wayland-egl-tizen.h>
 
 namespace Dali
@@ -50,10 +55,31 @@ namespace
 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
 #endif
 
-const uint32_t     MAX_TIZEN_CLIENT_VERSION = 7;
-const unsigned int PRIMARY_TOUCH_BUTTON_ID  = 1;
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
 
+/**
+ * @brief Enumeration of location for window resized by display server.
+ */
+enum class ResizeLocation
+{
+  INVALID      = 0,  ///< Invalid value
+  TOP_LEFT     = 5,  ///< Start resizing window to the top-left edge.
+  LEFT         = 4,  ///< Start resizing window to the left side.
+  BOTTOM_LEFT  = 6,  ///< Start resizing window to the bottom-left edge.
+  BOTTOM       = 2,  ///< Start resizing window to the bottom side.
+  BOTTOM_RIGHT = 10, ///< Start resizing window to the bottom-right edge.
+  RIGHT        = 8,  ///< Start resizing window to the right side.
+  TOP_RIGHT    = 9,  ///< Start resizing window to the top-right edge.
+  TOP          = 1   ///< Start resizing window to the top side.
+};
+
+const uint32_t       MAX_TIZEN_CLIENT_VERSION = 7;
+const unsigned int   PRIMARY_TOUCH_BUTTON_ID  = 1;
+const ResizeLocation RESIZE_LOCATIONS[]       = {ResizeLocation::TOP_LEFT, ResizeLocation::LEFT, ResizeLocation::BOTTOM_LEFT, ResizeLocation::BOTTOM, ResizeLocation::BOTTOM_RIGHT, ResizeLocation::RIGHT, ResizeLocation::TOP_RIGHT, ResizeLocation::TOP, ResizeLocation::INVALID};
+
+#if defined(VCONF_ENABLED)
 const char* DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
+#endif
 
 struct KeyCodeMap
 {
@@ -221,6 +247,69 @@ void FindKeyCode(struct xkb_keymap* keyMap, xkb_keycode_t key, void* data)
   }
 }
 
+/**
+ * Return the recalculated window resizing location according to the current orientation.
+ */
+ResizeLocation RecalculateLocationToCurrentOrientation(WindowResizeDirection direction, int windowRotationAngle)
+{
+  int index = 8;
+  switch(direction)
+  {
+    case WindowResizeDirection::TOP_LEFT:
+    {
+      index = 0;
+      break;
+    }
+    case WindowResizeDirection::LEFT:
+    {
+      index = 1;
+      break;
+    }
+    case WindowResizeDirection::BOTTOM_LEFT:
+    {
+      index = 2;
+      break;
+    }
+    case WindowResizeDirection::BOTTOM:
+    {
+      index = 3;
+      break;
+    }
+    case WindowResizeDirection::BOTTOM_RIGHT:
+    {
+      index = 4;
+      break;
+    }
+    case WindowResizeDirection::RIGHT:
+    {
+      index = 5;
+      break;
+    }
+    case WindowResizeDirection::TOP_RIGHT:
+    {
+      index = 6;
+      break;
+    }
+    case WindowResizeDirection::TOP:
+    {
+      index = 7;
+      break;
+    }
+    default:
+    {
+      index = 8;
+      break;
+    }
+  }
+
+  if(index != 8 && windowRotationAngle != 0)
+  {
+    index = (index + (windowRotationAngle / 90) * 2) % 8;
+  }
+
+  return RESIZE_LOCATIONS[index];
+}
+
 /////////////////////////////////////////////////////////////////////////////////////////////////
 // Window Callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////
@@ -530,6 +619,7 @@ static Eina_Bool EcoreEventSeatKeymapChanged(void* data, int type, void* event)
 // Font Callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////
 
+#if defined(VCONF_ENABLED)
 /**
  * Called when a font name is changed.
  */
@@ -553,6 +643,7 @@ static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
     windowBase->OnFontSizeChanged();
   }
 }
+#endif
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 // Window Redraw Request Event Callbacks
@@ -707,8 +798,6 @@ WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surf
   mWindowRotationAngle(0),
   mScreenRotationAngle(0),
   mSupportedPreProtation(0),
-  mScreenWidth(0),
-  mScreenHeight(0),
   mNotificationChangeState(0),
   mScreenOffModeChangeState(0),
   mBrightnessChangeState(0),
@@ -725,8 +814,10 @@ WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surf
 
 WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
 {
+#if defined(VCONF_ENABLED)
   vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged);
   vconf_ignore_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged);
+#endif
 
   for(Dali::Vector<Ecore_Event_Handler*>::Iterator iter = mEcoreEventHandler.Begin(), endIter = mEcoreEventHandler.End(); iter != endIter; ++iter)
   {
@@ -751,8 +842,6 @@ WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
   if(mOwnSurface)
   {
     ecore_wl2_window_free(mEcoreWindow);
-
-    WindowSystem::Shutdown();
   }
 }
 
@@ -768,8 +857,6 @@ void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool
   else
   {
     // we own the surface about to created
-    WindowSystem::Initialize();
-
     mOwnSurface = true;
     CreateWindow(positionSize);
   }
@@ -823,9 +910,11 @@ void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool
   // Register Window auxiliary event
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_AUX_MESSAGE, EcoreEventWindowAuxiliaryMessage, this));
 
+#if defined(VCONF_ENABLED)
   // Register Vconf notify - font name and size
-  vconf_notify_key_changed(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
-  vconf_notify_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
+  vconf_notify_key_changed_for_ui_thread(DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, this);
+  vconf_notify_key_changed_for_ui_thread(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, this);
+#endif
 
   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
   mDisplay                   = ecore_wl2_display_get(display);
@@ -999,8 +1088,8 @@ void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
     // Note: To comply with the wayland protocol, Dali should make an ack_configure
     // by calling ecore_wl2_window_commit
 
-    int tempWidth  = static_cast<int>(ev->w);
-    int tempHeight = static_cast<int>(ev->h);
+    int tempWidth  = ev->w;
+    int tempHeight = ev->h;
 
     // Initialize with previous size for skip resize when new size is 0.
     // When window is just moved or window is resized by client application,
@@ -1024,17 +1113,20 @@ void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
 
     if(windowMoved || windowResized)
     {
-      mWindowPositionSize.x = ev->x;
-      mWindowPositionSize.y = ev->y;
-      mWindowPositionSize.width = newWidth;
+      mWindowPositionSize.x      = ev->x;
+      mWindowPositionSize.y      = ev->y;
+      mWindowPositionSize.width  = newWidth;
       mWindowPositionSize.height = newHeight;
       DALI_LOG_RELEASE_INFO("Update position & resize signal by server, current angle [%d] x[%d] y[%d] w[%d] h[%d]\n", mWindowRotationAngle, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
 
+      ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
+
       Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
-      DALI_LOG_RELEASE_INFO("emit signal to update window's position and size, x[%d] y[%d] w[%d] h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
       mUpdatePositionSizeSignal.Emit(newPositionSize);
     }
 
+    mMaximizeChangedSignal.Emit(static_cast<bool>(ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED));
+
     ecore_wl2_window_commit(mEcoreWindow, EINA_FALSE);
   }
 }
@@ -1182,13 +1274,13 @@ void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
 
   if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
   {
-    DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyDown\n");
-
     std::string keyName(keyEvent->keyname);
     std::string logicalKey("");
     std::string keyString("");
     std::string compose("");
 
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_DOWN");
+
     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
     if(keyEvent->compose)
     {
@@ -1244,8 +1336,6 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
 
   if(keyEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
   {
-    DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp\n");
-
 #if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
     // Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
     if(keyEvent->event_flags & ECORE_EVENT_FLAG_CANCEL)
@@ -1260,6 +1350,8 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
     std::string keyString("");
     std::string compose("");
 
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_KEY_UP");
+
     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
     if(keyEvent->compose)
     {
@@ -1349,7 +1441,7 @@ void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
   Ecore_Wl2_Event_Aux_Message* message = static_cast<Ecore_Wl2_Event_Aux_Message*>(event);
   if(message)
   {
-    DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
+    DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, key:%s, value:%s \n", message->key, message->val);
     std::string           key(message->key);
     std::string           value(message->val);
     Dali::Property::Array options;
@@ -1360,7 +1452,7 @@ void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
       void*      data;
       EINA_LIST_FOREACH(message->options, l, data)
       {
-        DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
+        DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage, option: %s\n", (char*)data);
         std::string option(static_cast<char*>(data));
         options.Add(option);
       }
@@ -1576,6 +1668,7 @@ void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
     }
   }
 
+  DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform);
   wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
 }
 
@@ -1612,11 +1705,13 @@ void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
     }
   }
 
+  DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform);
   wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
 }
 
 void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
 {
+  DALI_LOG_RELEASE_INFO("wl_egl_window_resize(), (%d, %d) [%d x %d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height);
   wl_egl_window_resize(mEglWindow, positionSize.width, positionSize.height, positionSize.x, positionSize.y);
 
   // Note: Both "Resize" and "MoveResize" cases can reach here, but only "MoveResize" needs to submit serial number
@@ -1643,24 +1738,26 @@ bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
 {
   PositionSize newPositionSize;
+  int32_t      screenWidth, screenHeight;
+  WindowSystem::GetScreenSize(screenWidth, screenHeight);
 
   if(mWindowRotationAngle == 90)
   {
     newPositionSize.x      = positionSize.y;
-    newPositionSize.y      = mScreenHeight - (positionSize.x + positionSize.width);
+    newPositionSize.y      = screenHeight - (positionSize.x + positionSize.width);
     newPositionSize.width  = positionSize.height;
     newPositionSize.height = positionSize.width;
   }
   else if(mWindowRotationAngle == 180)
   {
-    newPositionSize.x      = mScreenWidth - (positionSize.x + positionSize.width);
-    newPositionSize.y      = mScreenHeight - (positionSize.y + positionSize.height);
+    newPositionSize.x      = screenWidth - (positionSize.x + positionSize.width);
+    newPositionSize.y      = screenHeight - (positionSize.y + positionSize.height);
     newPositionSize.width  = positionSize.width;
     newPositionSize.height = positionSize.height;
   }
   else if(mWindowRotationAngle == 270)
   {
-    newPositionSize.x      = mScreenWidth - (positionSize.y + positionSize.height);
+    newPositionSize.x      = screenWidth - (positionSize.y + positionSize.height);
     newPositionSize.y      = positionSize.x;
     newPositionSize.width  = positionSize.height;
     newPositionSize.height = positionSize.width;
@@ -1673,34 +1770,33 @@ PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize po
     newPositionSize.height = positionSize.height;
   }
 
-  DALI_LOG_RELEASE_INFO("input coord x[%d], y[%d], w{%d], h[%d], screen w[%d], h[%d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height, mScreenWidth, mScreenHeight);
-  DALI_LOG_RELEASE_INFO("recalc coord x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
-
   return newPositionSize;
 }
 
 PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
 {
   PositionSize newPositionSize;
+  int32_t      screenWidth, screenHeight;
+  WindowSystem::GetScreenSize(screenWidth, screenHeight);
 
   if(mWindowRotationAngle == 90)
   {
-    newPositionSize.x      = mScreenHeight - (positionSize.y + positionSize.height);
+    newPositionSize.x      = screenHeight - (positionSize.y + positionSize.height);
     newPositionSize.y      = positionSize.x;
     newPositionSize.width  = positionSize.height;
     newPositionSize.height = positionSize.width;
   }
   else if(mWindowRotationAngle == 180)
   {
-    newPositionSize.x      = mScreenWidth - (positionSize.x + positionSize.width);
-    newPositionSize.y      = mScreenHeight - (positionSize.y + positionSize.height);
+    newPositionSize.x      = screenWidth - (positionSize.x + positionSize.width);
+    newPositionSize.y      = screenHeight - (positionSize.y + positionSize.height);
     newPositionSize.width  = positionSize.width;
     newPositionSize.height = positionSize.height;
   }
   else if(mWindowRotationAngle == 270)
   {
     newPositionSize.x      = positionSize.y;
-    newPositionSize.y      = mScreenWidth - (positionSize.x + positionSize.width);
+    newPositionSize.y      = screenWidth - (positionSize.x + positionSize.width);
     newPositionSize.width  = positionSize.height;
     newPositionSize.height = positionSize.width;
   }
@@ -1712,9 +1808,6 @@ PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(Pos
     newPositionSize.height = positionSize.height;
   }
 
-  DALI_LOG_RELEASE_INFO("input coord x[%d], y[%d], w{%d], h[%d], screen w[%d], h[%d]\n", positionSize.x, positionSize.y, positionSize.width, positionSize.height, mScreenWidth, mScreenHeight);
-  DALI_LOG_RELEASE_INFO("recalc by current orientation coord x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
-
   return newPositionSize;
 }
 
@@ -1745,6 +1838,12 @@ void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
   ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
 }
 
+void WindowBaseEcoreWl2::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+  DALI_LOG_RELEASE_INFO("ecore_wl2_window_layout_set, numCols[%d], numRows[%d], column[%d], row[%d], colSpan[%d], rowSpan[%d]\n", numCols, numRows, column, row, colSpan, rowSpan);
+  ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan);
+}
+
 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
 {
   ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
@@ -1777,6 +1876,13 @@ bool WindowBaseEcoreWl2::IsMaximized() const
   return ecore_wl2_window_maximized_get(mEcoreWindow);
 }
 
+void WindowBaseEcoreWl2::SetMaximumSize(Dali::Window::WindowSize size)
+{
+  DALI_LOG_RELEASE_INFO("ecore_wl2_window_maximum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
+  ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
+  ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
+}
+
 void WindowBaseEcoreWl2::Minimize(bool minimize)
 {
   ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
@@ -1787,6 +1893,13 @@ bool WindowBaseEcoreWl2::IsMinimized() const
   return ecore_wl2_window_iconified_get(mEcoreWindow);
 }
 
+void WindowBaseEcoreWl2::SetMimimumSize(Dali::Window::WindowSize size)
+{
+  DALI_LOG_RELEASE_INFO("ecore_wl2_window_minimum_size_set, width: %d, height: %d\n", size.GetWidth(), size.GetHeight());
+  ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
+  ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
+}
+
 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
 {
   int rotations[4] = {0};
@@ -1794,7 +1907,7 @@ void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
   for(std::size_t i = 0; i < angles.size(); ++i)
   {
     rotations[i] = static_cast<int>(angles[i]);
-    DALI_LOG_RELEASE_INFO("%d ", rotations[i]);
+    DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
   }
   ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
 }
@@ -1953,7 +2066,15 @@ unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) con
 
 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
 {
-  ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+  DALI_LOG_RELEASE_INFO("%p, Set input rect (%d, %d, %d x %d)\n", mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+  Eina_Rectangle rect;
+  rect.x = inputRegion.x;
+  rect.y = inputRegion.y;
+  rect.w = inputRegion.width;
+  rect.h = inputRegion.height;
+
+  ecore_wl2_window_input_rect_set(mEcoreWindow, &rect);
+  ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
 }
 
 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
@@ -1990,6 +2111,11 @@ void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
         windowType = ECORE_WL2_WINDOW_TYPE_NONE;
         break;
       }
+      case Dali::WindowType::DESKTOP:
+      {
+        windowType = ECORE_WL2_WINDOW_TYPE_DESKTOP;
+        break;
+      }
       default:
       {
         windowType = ECORE_WL2_WINDOW_TYPE_TOPLEVEL;
@@ -2511,9 +2637,9 @@ void WindowBaseEcoreWl2::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVe
   dpiVertical   = int(yres + 0.5f);
 }
 
-int WindowBaseEcoreWl2::GetOrientation() const
+int WindowBaseEcoreWl2::GetWindowRotationAngle() const
 {
-  int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
+  int orientation = mWindowRotationAngle;
   if(mSupportedPreProtation)
   {
     orientation = 0;
@@ -2523,8 +2649,12 @@ int WindowBaseEcoreWl2::GetOrientation() const
 
 int WindowBaseEcoreWl2::GetScreenRotationAngle()
 {
-  int transform = 0;
-
+  if(mSupportedPreProtation)
+  {
+    DALI_LOG_RELEASE_INFO("Support PreRotation and return 0\n");
+    return 0;
+  }
+  int transform;
   if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
   {
     transform = 0;
@@ -2572,9 +2702,6 @@ void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
 
   // Set default type
   ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
-
-  // Get Screen width, height
-  ecore_wl2_display_screen_size_get(display, &mScreenWidth, &mScreenHeight);
 }
 
 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
@@ -2728,58 +2855,10 @@ void WindowBaseEcoreWl2::RequestResizeToServer(WindowResizeDirection direction)
     return;
   }
 
-  int location = 0;
-  switch(direction)
-  {
-    case WindowResizeDirection::TOP_LEFT:
-    {
-      location = 5;
-      break;
-    }
-    case WindowResizeDirection::TOP:
-    {
-      location = 1;
-      break;
-    }
-    case WindowResizeDirection::TOP_RIGHT:
-    {
-      location = 9;
-      break;
-    }
-    case WindowResizeDirection::LEFT:
-    {
-      location = 4;
-      break;
-    }
-    case WindowResizeDirection::RIGHT:
-    {
-      location = 8;
-      break;
-    }
-    case WindowResizeDirection::BOTTOM_LEFT:
-    {
-      location = 6;
-      break;
-    }
-    case WindowResizeDirection::BOTTOM:
-    {
-      location = 2;
-      break;
-    }
-    case WindowResizeDirection::BOTTOM_RIGHT:
-    {
-      location = 10;
-      break;
-    }
-    default:
-    {
-      location = 0;
-      break;
-    }
-  }
+  ResizeLocation location = RecalculateLocationToCurrentOrientation(direction, mWindowRotationAngle);
 
-  ecore_wl2_window_resize(mEcoreWindow, input, location);
-  DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, mode:%d\n", mEcoreWindow, location);
+  ecore_wl2_window_resize(mEcoreWindow, input, static_cast<int>(location));
+  DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestResizeToServer, starts the window[%p] is resized by server, direction:%d oriention:%d mode:%d\n", mEcoreWindow, direction, mWindowRotationAngle, location);
 }
 
 void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
@@ -2808,6 +2887,7 @@ void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
   rect.w = inputRegion.width;
   rect.h = inputRegion.height;
 
+  DALI_LOG_RELEASE_INFO("%p, Add input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
   ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
 }
@@ -2820,6 +2900,7 @@ void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
   rect.w = inputRegion.width;
   rect.h = inputRegion.height;
 
+  DALI_LOG_RELEASE_INFO("%p, Subtract input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
   ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
 }