[Tizen] Add InsetsChangedSignal to WindowBaseEcoreWl2
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
index a77a163..f86954e 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.
@@ -24,6 +24,7 @@
 
 // INTERNAL HEADERS
 #include <dali/internal/input/common/key-impl.h>
+#include <dali/internal/system/common/time-service.h>
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/window-render-surface.h>
 #include <dali/internal/window-system/common/window-system.h>
 // 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
+
+#define START_DURATION_CHECK()                               \
+  uint32_t durationMilliSeconds = static_cast<uint32_t>(-1); \
+  uint32_t startTime, endTime;                               \
+  startTime = TimeService::GetMilliSeconds();
+
+#define FINISH_DURATION_CHECK(functionName)                                             \
+  endTime              = TimeService::GetMilliSeconds();                                \
+  durationMilliSeconds = endTime - startTime;                                           \
+  if(durationMilliSeconds > 0)                                                          \
+  {                                                                                     \
+    DALI_LOG_DEBUG_INFO("%s : duration [%u ms]\n", functionName, durationMilliSeconds); \
+  }
+
 #include <wayland-egl-tizen.h>
 
 namespace Dali
@@ -50,10 +69,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 +261,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
 /////////////////////////////////////////////////////////////////////////////////////////////////
@@ -382,6 +485,34 @@ static Eina_Bool EcoreEventMouseWheel(void* data, int type, void* event)
 }
 
 /**
+ * Called when a mouse in is received.
+ */
+static Eina_Bool EcoreEventMouseIn(void* data, int type, void* event)
+{
+  WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+  if(windowBase)
+  {
+    windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::IN);
+  }
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
+ * Called when a mouse out is received.
+ */
+static Eina_Bool EcoreEventMouseOut(void* data, int type, void* event)
+{
+  WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+  if(windowBase)
+  {
+    // When the mouse is out, the previous mouse must be canceled.
+    windowBase->OnMouseButtonCancel(data, type, event);
+    windowBase->OnMouseInOut(data, type, event, Dali::DevelWindow::MouseInOutEvent::Type::OUT);
+  }
+  return ECORE_CALLBACK_PASS_ON;
+}
+
+/**
  * Called when a detent rotation event is recevied.
  */
 static Eina_Bool EcoreEventDetentRotation(void* data, int type, void* event)
@@ -530,6 +661,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 +685,7 @@ static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
     windowBase->OnFontSizeChanged();
   }
 }
+#endif
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 // Window Redraw Request Event Callbacks
@@ -583,6 +716,42 @@ static Eina_Bool EcoreEventWindowAuxiliaryMessage(void* data, int type, void* ev
   return ECORE_CALLBACK_RENEW;
 }
 
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// Window is Moved/Resized By Server Callbacks
+/////////////////////////////////////////////////////////////////////////////////////////////////
+static Eina_Bool EcoreEventWindowMoveCompleted(void* data, int type, void* event)
+{
+  WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+  if(windowBase)
+  {
+    windowBase->OnMoveCompleted(event);
+  }
+  return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool EcoreEventWindowResizeCompleted(void* data, int type, void* event)
+{
+  WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+  if(windowBase)
+  {
+    windowBase->OnResizeCompleted(event);
+  }
+  return ECORE_CALLBACK_RENEW;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////
+// Conformant Change Callback
+/////////////////////////////////////////////////////////////////////////////////////////////////
+static Eina_Bool EcoreEventConformantChange(void* data, int type, void* event)
+{
+  WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+  if(windowBase)
+  {
+    windowBase->OnEcoreEventConformantChange(event);
+  }
+  return ECORE_CALLBACK_RENEW;
+}
+
 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
 {
   WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
@@ -607,6 +776,11 @@ static void TizenPolicyConformant(void* data, struct tizen_policy* tizenPolicy,
 
 static void TizenPolicyConformantArea(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
 {
+  WindowBaseEcoreWl2* windowBase = static_cast<WindowBaseEcoreWl2*>(data);
+  if(windowBase)
+  {
+    windowBase->TizenPolicyConformantArea(data, tizenPolicy, surface, conformantPart, state, x, y, w, h);
+  }
 }
 
 static void TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
@@ -707,8 +881,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 +897,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)
   {
@@ -799,6 +973,10 @@ void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool
   // Register Mouse wheel events
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, EcoreEventMouseWheel, this));
 
+  // Register Mouse IO events
+  mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, EcoreEventMouseIn, this));
+  mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, EcoreEventMouseOut, this));
+
   // Register Detent event
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_EVENT_DETENT_ROTATE, EcoreEventDetentRotation, this));
 
@@ -823,9 +1001,18 @@ 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));
 
+  // Register Conformant change event
+  mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, EcoreEventConformantChange, this));
+
+#if defined(VCONF_ENABLED)
   // Register Vconf notify - font name and size
   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
+
+  // Register Window is moved and resized done event.
+  mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_INTERACTIVE_MOVE_DONE, EcoreEventWindowMoveCompleted, this));
+  mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL2_EVENT_WINDOW_INTERACTIVE_RESIZE_DONE, EcoreEventWindowResizeCompleted, this));
 
   Ecore_Wl2_Display* display = ecore_wl2_connected_display_get(NULL);
   mDisplay                   = ecore_wl2_display_get(display);
@@ -842,6 +1029,9 @@ void WindowBaseEcoreWl2::Initialize(PositionSize positionSize, Any surface, bool
 
         wl_registry* registry = wl_display_get_registry(displayWrapper);
         wl_registry_add_listener(registry, &registryListener, this);
+
+        // To support ECORE_WL2_EVENT_CONFORMANT_CHANGE event handler
+        ecore_wl2_window_conformant_set(mEcoreWindow, true);
       }
 
       wl_proxy_wrapper_destroy(displayWrapper);
@@ -1033,7 +1223,6 @@ void WindowBaseEcoreWl2::OnConfiguration(void* data, int type, void* event)
       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);
     }
 
@@ -1047,6 +1236,8 @@ void WindowBaseEcoreWl2::OnMouseButtonDown(void* data, int type, void* event)
 
   if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
   {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_DOWN");
+
     Device::Class::Type    deviceClass;
     Device::Subclass::Type deviceSubclass;
 
@@ -1087,6 +1278,8 @@ void WindowBaseEcoreWl2::OnMouseButtonUp(void* data, int type, void* event)
 
   if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
   {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_UP");
+
     Device::Class::Type    deviceClass;
     Device::Subclass::Type deviceSubclass;
 
@@ -1114,6 +1307,8 @@ void WindowBaseEcoreWl2::OnMouseButtonMove(void* data, int type, void* event)
 
   if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
   {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_MOVE");
+
     Device::Class::Type    deviceClass;
     Device::Subclass::Type deviceSubclass;
 
@@ -1140,6 +1335,8 @@ void WindowBaseEcoreWl2::OnMouseButtonCancel(void* data, int type, void* event)
 
   if(touchEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
   {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_CANCEL");
+
     Integration::Point point;
     point.SetDeviceId(touchEvent->multi.device);
     point.SetState(PointState::INTERRUPTED);
@@ -1157,6 +1354,8 @@ void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
 
   if(mouseWheelEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
   {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_WHEEL");
+
     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z);
 
     Integration::WheelEvent wheelEvent(Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2(mouseWheelEvent->x, mouseWheelEvent->y), mouseWheelEvent->z, mouseWheelEvent->timestamp);
@@ -1165,6 +1364,28 @@ void WindowBaseEcoreWl2::OnMouseWheel(void* data, int type, void* event)
   }
 }
 
+void WindowBaseEcoreWl2::OnMouseInOut(void* data, int type, void* event, Dali::DevelWindow::MouseInOutEvent::Type action)
+{
+  Ecore_Event_Mouse_IO* mouseInOutEvent = static_cast<Ecore_Event_Mouse_IO*>(event);
+
+  if(mouseInOutEvent->window == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
+  {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_ON_MOUSE_IN_OUT");
+
+    DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseInOut: timestamp: %d, modifiers: %d, x: %d, y: %d\n", mouseInOutEvent->timestamp, mouseInOutEvent->modifiers, mouseInOutEvent->x, mouseInOutEvent->y);
+
+    Device::Class::Type    deviceClass;
+    Device::Subclass::Type deviceSubclass;
+
+    GetDeviceClass(ecore_device_class_get(mouseInOutEvent->dev), deviceClass);
+    GetDeviceSubclass(ecore_device_subclass_get(mouseInOutEvent->dev), deviceSubclass);
+
+    Dali::DevelWindow::MouseInOutEvent inOutEvent(action, mouseInOutEvent->modifiers, Vector2(mouseInOutEvent->x, mouseInOutEvent->y), mouseInOutEvent->timestamp, deviceClass, deviceSubclass);
+
+    mMouseInOutEventSignal.Emit(inOutEvent);
+  }
+}
+
 void WindowBaseEcoreWl2::OnDetentRotation(void* data, int type, void* event)
 {
   Ecore_Event_Detent_Rotate* detentEvent = static_cast<Ecore_Event_Detent_Rotate*>(event);
@@ -1184,13 +1405,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_BEGIN(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)
     {
@@ -1237,6 +1458,8 @@ void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
     Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass);
 
     mKeyEventSignal.Emit(keyEvent);
+
+    DALI_TRACE_END(gTraceFilter, "DALI_ON_KEY_DOWN");
   }
 }
 
@@ -1246,8 +1469,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)
@@ -1262,6 +1483,8 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
     std::string keyString("");
     std::string compose("");
 
+    DALI_TRACE_BEGIN(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)
     {
@@ -1308,6 +1531,8 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
     Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass);
 
     mKeyEventSignal.Emit(keyEvent);
+
+    DALI_TRACE_END(gTraceFilter, "DALI_ON_KEY_UP");
   }
 }
 
@@ -1372,6 +1597,106 @@ void WindowBaseEcoreWl2::OnEcoreEventWindowAuxiliaryMessage(void* event)
   }
 }
 
+void WindowBaseEcoreWl2::OnEcoreEventConformantChange(void* event)
+{
+  Ecore_Wl2_Event_Conformant_Change* ev = static_cast<Ecore_Wl2_Event_Conformant_Change*>(event);
+  if(ev && ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
+  {
+    WindowInsetsPartType partType = WindowInsetsPartType::STATUS_BAR;
+
+    int x = 0;
+    int y = 0;
+    int w = 0;
+    int h = 0;
+
+    switch (ev->part_type)
+    {
+      case ECORE_WL2_INDICATOR_PART:
+      {
+        partType = WindowInsetsPartType::STATUS_BAR;
+        ecore_wl2_window_indicator_geometry_get(mEcoreWindow, &x, &y, &w, &h);
+        break;
+      }
+      case ECORE_WL2_KEYBOARD_PART:
+      {
+        partType = WindowInsetsPartType::KEYBOARD;
+        ecore_wl2_window_keyboard_geometry_get(mEcoreWindow, &x, &y, &w, &h);
+        break;
+      }
+      case ECORE_WL2_CLIPBOARD_PART:
+      {
+        partType = WindowInsetsPartType::CLIPBOARD;
+        ecore_wl2_window_clipboard_geometry_get(mEcoreWindow, &x, &y, &w, &h);
+        break;
+      }
+      default:
+      {
+        break;
+      }
+    }
+
+    WindowInsetsPartState partState = WindowInsetsPartState::INVISIBLE;
+
+    int left = 0;
+    int right = 0;
+    int top = 0;
+    int bottom = 0;
+
+    // Insets are applied only if system UI(e.g. virtual keyboard) satisfies the following 2 conditions.
+    // 1. System UI fits to the window width or height.
+    // 2. System UI begins or ends from the edge of window.
+    // Otherwise, we should not resize window content because there would be empty space around system UI.
+    bool applyInsets = false;
+
+    // Zero insets are applied if state is invisible
+    if(!ev->state)
+    {
+      applyInsets = true;
+    }
+    else
+    {
+      partState = WindowInsetsPartState::VISIBLE;
+
+      int winX = mWindowPositionSize.x;
+      int winY = mWindowPositionSize.y;
+      int winW = mWindowPositionSize.width;
+      int winH = mWindowPositionSize.height;
+
+      if((x <= winX) && (x + w >= winX + winW))
+      {
+        if((y <= winY) && (y + h >= winY) && (y + h <= winY + winH))
+        {
+          top = y + h - winY;
+          applyInsets = true;
+        }
+        else if((y + h >= winY + winH) && (y >= winY) && (y <= winY + winH))
+        {
+          bottom = winY + winH - y;
+          applyInsets = true;
+        }
+      }
+      else if((y <= winY) && (y + h >= winY + winH))
+      {
+        if((x <= winX) && (x + w >= winX) && (x + w <= winX + winW))
+        {
+          left = x + w - winX;
+          applyInsets = true;
+        }
+        else if((x + w >= winX + winW) && (x >= winX) && (x <= winX + winW))
+        {
+          right = winX + winW - x;
+          applyInsets = true;
+        }
+      }
+    }
+
+    if(applyInsets)
+    {
+      mInsetsChangedSignal.Emit(partType, partState, Extents(left, right, top, bottom));
+    }
+  }
+}
+
 void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
 {
   Ecore_Wl2_Event_Seat_Keymap_Changed* changed = static_cast<Ecore_Wl2_Event_Seat_Keymap_Changed*>(event);
@@ -1383,6 +1708,32 @@ void WindowBaseEcoreWl2::KeymapChanged(void* data, int type, void* event)
   }
 }
 
+void WindowBaseEcoreWl2::OnMoveCompleted(void* event)
+{
+  Ecore_Wl2_Event_Window_Interactive_Move_Done* movedDoneEvent = static_cast<Ecore_Wl2_Event_Window_Interactive_Move_Done*>(event);
+  if(movedDoneEvent && movedDoneEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
+  {
+    Dali::PositionSize orgPositionSize(movedDoneEvent->x, movedDoneEvent->y, movedDoneEvent->w, movedDoneEvent->h);
+    Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize);
+    Dali::Int32Pair    newPosition(newPositionSize.x, newPositionSize.y);
+    DALI_LOG_RELEASE_INFO("window(%p) has been moved by server[%d, %d]\n", mEcoreWindow, newPositionSize.x, newPositionSize.y);
+    mMoveCompletedSignal.Emit(newPosition);
+  }
+}
+
+void WindowBaseEcoreWl2::OnResizeCompleted(void* event)
+{
+  Ecore_Wl2_Event_Window_Interactive_Resize_Done* resizedDoneEvent = static_cast<Ecore_Wl2_Event_Window_Interactive_Resize_Done*>(event);
+  if(resizedDoneEvent && resizedDoneEvent->win == static_cast<uint32_t>(ecore_wl2_window_id_get(mEcoreWindow)))
+  {
+    Dali::PositionSize orgPositionSize(resizedDoneEvent->x, resizedDoneEvent->y, resizedDoneEvent->w, resizedDoneEvent->h);
+    Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(orgPositionSize);
+    Dali::Uint16Pair   newSize(newPositionSize.width, newPositionSize.height);
+    DALI_LOG_RELEASE_INFO("window(%p) has been resized by server[%d, %d]\n", mEcoreWindow, newPositionSize.width, newPositionSize.height);
+    mResizeCompletedSignal.Emit(newSize);
+  }
+}
+
 void WindowBaseEcoreWl2::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
 {
   if(strcmp(interface, tizen_policy_interface.name) == 0)
@@ -1421,6 +1772,95 @@ void WindowBaseEcoreWl2::RegistryGlobalCallbackRemove(void* data, struct wl_regi
   mTizenDisplayPolicy = NULL;
 }
 
+void WindowBaseEcoreWl2::TizenPolicyConformantArea(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, uint32_t conformantPart, uint32_t state, int32_t x, int32_t y, int32_t w, int32_t h)
+{
+  int originalX, originalY, originalWidth, originalHeight;
+  bool changed = false;
+
+  if(!surface)
+  {
+    DALI_LOG_ERROR("Failed to get wayland surface in WindowBaseEcoreWl2::TizenPolicyConformantArea()\n");
+    return;
+  }
+
+  if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_INDICATOR)
+  {
+    ecore_wl2_window_indicator_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
+    if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
+    {
+      ecore_wl2_window_indicator_geometry_set(mEcoreWindow, x, y, w, h);
+      changed = true;
+    }
+
+    /**
+     * The given state is based on the visibility value of indicator.
+     * Thus we need to add 1 to it before comparing with indicator state.
+     */
+    Ecore_Wl2_Indicator_State indState =  ecore_wl2_window_indicator_state_get(mEcoreWindow);
+    if((state + 1) != indState)
+    {
+      ecore_wl2_window_indicator_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Indicator_State>(state + 1));
+      changed = true;
+    }
+  }
+  else if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_KEYBOARD)
+  {
+    ecore_wl2_window_keyboard_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
+    if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
+    {
+      ecore_wl2_window_keyboard_geometry_set(mEcoreWindow, x, y, w, h);
+      changed = true;
+    }
+
+    /**
+     * The given state is based on the visibility value of virtual keyboard window.
+     * Thus we need to add 1 to it before comparing with keyboard state.
+     */
+    Ecore_Wl2_Virtual_Keyboard_State kbdState = ecore_wl2_window_keyboard_state_get(mEcoreWindow);
+    if((state + 1) != (kbdState))
+    {
+      ecore_wl2_window_keyboard_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Virtual_Keyboard_State>(state + 1));
+      changed = true;
+    }
+  }
+  else if(conformantPart == TIZEN_POLICY_CONFORMANT_PART_CLIPBOARD)
+  {
+    ecore_wl2_window_clipboard_geometry_get(mEcoreWindow, &originalX, &originalY, &originalWidth, &originalHeight);
+    if((originalX != x) || (originalY != y) || (originalWidth != w) || (originalHeight != h))
+    {
+      ecore_wl2_window_clipboard_geometry_set(mEcoreWindow, x, y, w, h);
+      changed = true;
+    }
+
+    /**
+     * The given state is based on the visibility value of clipboard window.
+     * Thus we need to add 1 to it before comparing with clipboard state.
+     */
+    Ecore_Wl2_Clipboard_State clipState = ecore_wl2_window_clipboard_state_get(mEcoreWindow);
+    if((state + 1) != clipState)
+    {
+      ecore_wl2_window_clipboard_state_set(mEcoreWindow, static_cast<Ecore_Wl2_Clipboard_State>(state + 1));
+      changed = true;
+    }
+  }
+
+  if(changed)
+  {
+    Ecore_Wl2_Event_Conformant_Change *ev = static_cast<Ecore_Wl2_Event_Conformant_Change*>(calloc(1, sizeof(Ecore_Wl2_Event_Conformant_Change)));
+
+    if(!ev)
+    {
+      return;
+    }
+    ev->win = GetNativeWindowId();
+    ev->part_type = static_cast<Ecore_Wl2_Conformant_Part_Type>(conformantPart);
+    ev->state = state;
+    ecore_event_add(ECORE_WL2_EVENT_CONFORMANT_CHANGE, ev, NULL, NULL);
+  }
+
+  DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::TizenPolicyConformantArea: conformantPart = %u, state = %u, position = (%d, %d), size = (%d, %d)\n", conformantPart, state, x, y, w, h);
+}
+
 void WindowBaseEcoreWl2::TizenPolicyNotificationChangeDone(void* data, struct tizen_policy* tizenPolicy, struct wl_surface* surface, int32_t level, uint32_t state)
 {
   mNotificationLevel           = level;
@@ -1488,6 +1928,8 @@ std::string WindowBaseEcoreWl2::GetNativeWindowResourceId()
 EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
 {
   int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
+
+  START_DURATION_CHECK();
   if(totalAngle == 90 || totalAngle == 270)
   {
     mEglWindow = wl_egl_window_create(mWlSurface, height, width);
@@ -1496,6 +1938,7 @@ EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
   {
     mEglWindow = wl_egl_window_create(mWlSurface, width, height);
   }
+  FINISH_DURATION_CHECK("wl_egl_window_create");
 
   return static_cast<EGLNativeWindowType>(mEglWindow);
 }
@@ -1504,7 +1947,10 @@ void WindowBaseEcoreWl2::DestroyEglWindow()
 {
   if(mEglWindow != NULL)
   {
+    START_DURATION_CHECK();
     wl_egl_window_destroy(mEglWindow);
+    FINISH_DURATION_CHECK("wl_egl_window_destroy");
+
     mEglWindow = NULL;
   }
 }
@@ -1542,7 +1988,9 @@ void WindowBaseEcoreWl2::SetEglWindowRotation(int angle)
     }
   }
 
+  START_DURATION_CHECK();
   wl_egl_window_tizen_set_rotation(mEglWindow, rotation);
+  FINISH_DURATION_CHECK("wl_egl_window_tizen_set_rotation");
 }
 
 void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
@@ -1578,7 +2026,10 @@ void WindowBaseEcoreWl2::SetEglWindowBufferTransform(int angle)
     }
   }
 
+  DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_buffer_transform() with buffer Transform [%d]\n", bufferTransform);
+  START_DURATION_CHECK();
   wl_egl_window_tizen_set_buffer_transform(mEglWindow, bufferTransform);
+  FINISH_DURATION_CHECK("wl_egl_window_tizen_set_buffer_transform");
 }
 
 void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
@@ -1614,11 +2065,16 @@ void WindowBaseEcoreWl2::SetEglWindowTransform(int angle)
     }
   }
 
+  DALI_LOG_RELEASE_INFO("wl_egl_window_tizen_set_window_transform() with window Transform [%d]\n", windowTransform);
+  START_DURATION_CHECK();
   wl_egl_window_tizen_set_window_transform(mEglWindow, windowTransform);
+  FINISH_DURATION_CHECK("wl_egl_window_tizen_set_window_transform");
 }
 
 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);
+  START_DURATION_CHECK();
   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
@@ -1627,12 +2083,16 @@ void WindowBaseEcoreWl2::ResizeEglWindow(PositionSize positionSize)
     wl_egl_window_tizen_set_window_serial(mEglWindow, mMoveResizeSerial);
     mLastSubmittedMoveResizeSerial = mMoveResizeSerial;
   }
+  FINISH_DURATION_CHECK("wl_egl_window functions");
 }
 
 bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
 {
+  START_DURATION_CHECK();
   // Check capability
   wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
+  FINISH_DURATION_CHECK("wl_egl_window_tizen_get_capabilities");
+
   if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
   {
     mSupportedPreProtation = true;
@@ -1645,24 +2105,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;
@@ -1675,34 +2137,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;
   }
@@ -1714,9 +2175,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;
 }
 
@@ -1726,7 +2184,9 @@ void WindowBaseEcoreWl2::Move(PositionSize positionSize)
 
   mWindowPositionSize = newPositionSize;
   DALI_LOG_RELEASE_INFO("ecore_wl2_window_position_set x[%d], y[%d]\n", newPositionSize.x, newPositionSize.y);
+  START_DURATION_CHECK();
   ecore_wl2_window_position_set(mEcoreWindow, newPositionSize.x, newPositionSize.y);
+  FINISH_DURATION_CHECK("ecore_wl2_window_position_set");
 }
 
 void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
@@ -1735,7 +2195,9 @@ void WindowBaseEcoreWl2::Resize(PositionSize positionSize)
 
   mWindowPositionSize = newPositionSize;
   DALI_LOG_RELEASE_INFO("ecore_wl2_window_sync_geometry_set, x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
+  START_DURATION_CHECK();
   ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
+  FINISH_DURATION_CHECK("ecore_wl2_window_sync_geometry_set");
 }
 
 void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
@@ -1744,7 +2206,17 @@ void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
 
   mWindowPositionSize = newPositionSize;
   DALI_LOG_RELEASE_INFO("ecore_wl2_window_sync_geometry_set, x[%d], y[%d], w{%d], h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
+  START_DURATION_CHECK();
   ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
+  FINISH_DURATION_CHECK("ecore_wl2_window_sync_geometry_set");
+}
+
+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);
+  START_DURATION_CHECK();
+  ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan);
+  FINISH_DURATION_CHECK("ecore_wl2_window_layout_set");
 }
 
 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
@@ -1755,23 +2227,31 @@ void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& cl
 
 void WindowBaseEcoreWl2::Raise()
 {
+  START_DURATION_CHECK();
   // Use ecore_wl2_window_activate to prevent the window shown without rendering
   ecore_wl2_window_activate(mEcoreWindow);
+  FINISH_DURATION_CHECK("ecore_wl2_window_activate");
 }
 
 void WindowBaseEcoreWl2::Lower()
 {
+  START_DURATION_CHECK();
   ecore_wl2_window_lower(mEcoreWindow);
+  FINISH_DURATION_CHECK("ecore_wl2_window_lower");
 }
 
 void WindowBaseEcoreWl2::Activate()
 {
+  START_DURATION_CHECK();
   ecore_wl2_window_activate(mEcoreWindow);
+  FINISH_DURATION_CHECK("ecore_wl2_window_activate");
 }
 
 void WindowBaseEcoreWl2::Maximize(bool maximize)
 {
+  START_DURATION_CHECK();
   ecore_wl2_window_maximized_set(mEcoreWindow, maximize);
+  FINISH_DURATION_CHECK("ecore_wl2_window_maximized_set");
 }
 
 bool WindowBaseEcoreWl2::IsMaximized() const
@@ -1782,12 +2262,17 @@ bool WindowBaseEcoreWl2::IsMaximized() const
 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());
+  START_DURATION_CHECK();
   ecore_wl2_window_maximum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
+  FINISH_DURATION_CHECK("ecore_wl2_window_maximum_size_set");
+  ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
 }
 
 void WindowBaseEcoreWl2::Minimize(bool minimize)
 {
+  START_DURATION_CHECK();
   ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
+  FINISH_DURATION_CHECK("ecore_wl2_window_iconified_set");
 }
 
 bool WindowBaseEcoreWl2::IsMinimized() const
@@ -1798,7 +2283,10 @@ bool WindowBaseEcoreWl2::IsMinimized() const
 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());
+  START_DURATION_CHECK();
   ecore_wl2_window_minimum_size_set(mEcoreWindow, size.GetWidth(), size.GetHeight());
+  FINISH_DURATION_CHECK("ecore_wl2_window_minimum_size_set");
+  ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
 }
 
 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
@@ -1810,25 +2298,34 @@ void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
     rotations[i] = static_cast<int>(angles[i]);
     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::General, "%d ", rotations[i]);
   }
+
+  START_DURATION_CHECK();
   ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
+  FINISH_DURATION_CHECK("ecore_wl2_window_available_rotations_set");
 }
 
 void WindowBaseEcoreWl2::SetPreferredAngle(int angle)
 {
   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle);
+  START_DURATION_CHECK();
   ecore_wl2_window_preferred_rotation_set(mEcoreWindow, angle);
+  FINISH_DURATION_CHECK("ecore_wl2_window_preferred_rotation_set");
 }
 
 void WindowBaseEcoreWl2::SetAcceptFocus(bool accept)
 {
+  START_DURATION_CHECK();
   ecore_wl2_window_focus_skip_set(mEcoreWindow, !accept);
+  FINISH_DURATION_CHECK("ecore_wl2_window_focus_skip_set");
 }
 
 void WindowBaseEcoreWl2::Show()
 {
   if(!mVisible)
   {
+    START_DURATION_CHECK();
     ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
+    FINISH_DURATION_CHECK("ecore_wl2_window_geometry_set");
   }
   mVisible = true;
 
@@ -1895,7 +2392,9 @@ unsigned int WindowBaseEcoreWl2::AddAuxiliaryHint(const std::string& hint, const
 
   unsigned int id = mAuxiliaryHints.size();
 
+  START_DURATION_CHECK();
   ecore_wl2_window_aux_hint_add(mEcoreWindow, static_cast<int>(id), hint.c_str(), value.c_str());
+  FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_add");
 
   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::AddAuxiliaryHint: hint = %s, value = %s, id = %d\n", hint.c_str(), value.c_str(), id);
 
@@ -1912,7 +2411,9 @@ bool WindowBaseEcoreWl2::RemoveAuxiliaryHint(unsigned int id)
 
   mAuxiliaryHints[id - 1].second = std::string();
 
+  START_DURATION_CHECK();
   ecore_wl2_window_aux_hint_del(mEcoreWindow, static_cast<int>(id));
+  FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_del");
 
   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::RemoveAuxiliaryHint: id = %d, hint = %s\n", id, mAuxiliaryHints[id - 1].first.c_str());
 
@@ -1929,7 +2430,9 @@ bool WindowBaseEcoreWl2::SetAuxiliaryHintValue(unsigned int id, const std::strin
 
   mAuxiliaryHints[id - 1].second = value;
 
+  START_DURATION_CHECK();
   ecore_wl2_window_aux_hint_change(mEcoreWindow, static_cast<int>(id), value.c_str());
+  FINISH_DURATION_CHECK("ecore_wl2_window_aux_hint_change");
 
   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl2::SetAuxiliaryHintValue: id = %d, hint = %s, value = %s\n", id, mAuxiliaryHints[id - 1].first.c_str(), mAuxiliaryHints[id - 1].second.c_str());
 
@@ -1965,9 +2468,56 @@ unsigned int WindowBaseEcoreWl2::GetAuxiliaryHintId(const std::string& hint) con
   return 0;
 }
 
+Rect<int> WindowBaseEcoreWl2::RecalculateInputRect(const Rect<int>& rect)
+{
+  Rect<int> newRect;
+
+  if(mWindowRotationAngle == 90)
+  {
+    newRect.x      = rect.y;
+    newRect.y      = mWindowPositionSize.height - (rect.x + rect.width);
+    newRect.width  = rect.height;
+    newRect.height = rect.width;
+  }
+  else if(mWindowRotationAngle == 180)
+  {
+    newRect.x      = mWindowPositionSize.width - (rect.x + rect.width);
+    newRect.y      = mWindowPositionSize.height - (rect.y + rect.height);
+    newRect.width  = rect.width;
+    newRect.height = rect.height;
+  }
+  else if(mWindowRotationAngle == 270)
+  {
+    newRect.x      = mWindowPositionSize.width - (rect.y + rect.height);
+    newRect.y      = rect.x;
+    newRect.width  = rect.height;
+    newRect.height = rect.width;
+  }
+  else
+  {
+    newRect.x      = rect.x;
+    newRect.y      = rect.y;
+    newRect.width  = rect.width;
+    newRect.height = rect.height;
+  }
+  return newRect;
+}
+
 void WindowBaseEcoreWl2::SetInputRegion(const Rect<int>& inputRegion)
 {
-  ecore_wl2_window_input_region_set(mEcoreWindow, inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height);
+  Rect<int> convertRegion = RecalculateInputRect(inputRegion);
+
+  Eina_Rectangle rect;
+  rect.x = convertRegion.x;
+  rect.y = convertRegion.y;
+  rect.w = convertRegion.width;
+  rect.h = convertRegion.height;
+
+  DALI_LOG_RELEASE_INFO("%p, Set input rect (%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
+  START_DURATION_CHECK();
+  ecore_wl2_window_input_rect_set(mEcoreWindow, &rect);
+  FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_set");
+  ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
 }
 
 void WindowBaseEcoreWl2::SetType(Dali::WindowType type)
@@ -2004,13 +2554,21 @@ 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;
         break;
       }
     }
+
+    START_DURATION_CHECK();
     ecore_wl2_window_type_set(mEcoreWindow, windowType);
+    FINISH_DURATION_CHECK("ecore_wl2_window_type_set");
   }
 }
 
@@ -2021,6 +2579,7 @@ Dali::WindowType WindowBaseEcoreWl2::GetType() const
 
 Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::WindowNotificationLevel level)
 {
+  START_DURATION_CHECK();
   while(!mTizenPolicy)
   {
     wl_display_dispatch_queue(mDisplay, mEventQueue);
@@ -2076,6 +2635,7 @@ Dali::WindowOperationResult WindowBaseEcoreWl2::SetNotificationLevel(Dali::Windo
     wl_display_dispatch_queue(mDisplay, mEventQueue);
     count++;
   }
+  FINISH_DURATION_CHECK("ecore_wl2 & wl_display");
 
   if(!mNotificationLevelChangeDone)
   {
@@ -2265,6 +2825,7 @@ WindowScreenOffMode WindowBaseEcoreWl2::GetScreenOffMode() const
 
 Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
 {
+  START_DURATION_CHECK();
   while(!mTizenDisplayPolicy)
   {
     wl_display_dispatch_queue(mDisplay, mEventQueue);
@@ -2283,6 +2844,7 @@ Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
     wl_display_dispatch_queue(mDisplay, mEventQueue);
     count++;
   }
+  FINISH_DURATION_CHECK("ecore_wl2_display_flush");
 
   if(!mBrightnessChangeDone)
   {
@@ -2302,6 +2864,7 @@ Dali::WindowOperationResult WindowBaseEcoreWl2::SetBrightness(int brightness)
 
 int WindowBaseEcoreWl2::GetBrightness() const
 {
+  START_DURATION_CHECK();
   while(!mTizenDisplayPolicy)
   {
     wl_display_dispatch_queue(mDisplay, mEventQueue);
@@ -2315,6 +2878,7 @@ int WindowBaseEcoreWl2::GetBrightness() const
     wl_display_dispatch_queue(mDisplay, mEventQueue);
     count++;
   }
+  FINISH_DURATION_CHECK("ecore_wl2_display_flush");
 
   if(!mBrightnessChangeDone)
   {
@@ -2418,7 +2982,9 @@ bool WindowBaseEcoreWl2::GrabKeyList(const Dali::Vector<Dali::KEY>& key, const D
     keyList = eina_list_append(keyList, &info);
   }
 
+  START_DURATION_CHECK();
   Eina_List* grabList = ecore_wl2_window_keygrab_list_set(mEcoreWindow, keyList);
+  FINISH_DURATION_CHECK("ecore_wl2_window_keygrab_list_set");
 
   result.Resize(keyCount, true);
 
@@ -2476,7 +3042,9 @@ bool WindowBaseEcoreWl2::UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali:
     keyList         = eina_list_append(keyList, &info);
   }
 
+  START_DURATION_CHECK();
   Eina_List* ungrabList = ecore_wl2_window_keygrab_list_unset(mEcoreWindow, keyList);
+  FINISH_DURATION_CHECK("ecore_wl2_window_keygrab_list_unset");
 
   result.Resize(keyCount, true);
 
@@ -2525,9 +3093,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;
@@ -2537,8 +3105,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;
@@ -2559,12 +3131,16 @@ void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
 
 void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
 {
+  START_DURATION_CHECK();
   ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
+  FINISH_DURATION_CHECK("ecore_wl2_window_rotation_change_done_send");
 }
 
 void WindowBaseEcoreWl2::SetTransparency(bool transparent)
 {
+  START_DURATION_CHECK();
   ecore_wl2_window_alpha_set(mEcoreWindow, transparent);
+  FINISH_DURATION_CHECK("ecore_wl2_window_alpha_set");
 }
 
 void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
@@ -2575,6 +3151,7 @@ void WindowBaseEcoreWl2::CreateWindow(PositionSize positionSize)
     DALI_ASSERT_ALWAYS(0 && "Failed to get display");
   }
 
+  START_DURATION_CHECK();
   ecore_wl2_display_sync(display);
 
   mEcoreWindow = ecore_wl2_window_new(display, NULL, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
@@ -2586,9 +3163,7 @@ 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);
+  FINISH_DURATION_CHECK("ecore_wl2 functions");
 }
 
 void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
@@ -2599,7 +3174,10 @@ void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
     WindowBaseEcoreWl2* winBaseEcore2 = static_cast<WindowBaseEcoreWl2*>(parentWinBase);
     ecoreParent                       = winBaseEcore2->mEcoreWindow;
   }
+
+  START_DURATION_CHECK();
   ecore_wl2_window_transient_parent_set(mEcoreWindow, ecoreParent, belowParent);
+  FINISH_DURATION_CHECK("ecore_wl2_window_transient_parent_set");
 }
 
 int WindowBaseEcoreWl2::CreateFrameRenderedSyncFence()
@@ -2615,7 +3193,9 @@ int WindowBaseEcoreWl2::CreateFramePresentedSyncFence()
 void WindowBaseEcoreWl2::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
 {
   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetPositionSizeWithAngle, angle: %d, x: %d, y: %d, w: %d, h: %d\n", angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
+  START_DURATION_CHECK();
   ecore_wl2_window_rotation_geometry_set(mEcoreWindow, angle, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
+  FINISH_DURATION_CHECK("ecore_wl2_window_rotation_geometry_set");
 }
 
 void WindowBaseEcoreWl2::InitializeIme()
@@ -2645,6 +3225,7 @@ void WindowBaseEcoreWl2::InitializeIme()
     return;
   }
 
+  START_DURATION_CHECK();
   EINA_ITERATOR_FOREACH(globals, global)
   {
 #ifdef OVER_TIZEN_VERSION_7
@@ -2690,6 +3271,7 @@ void WindowBaseEcoreWl2::InitializeIme()
 #else
   wl_input_panel_surface_set_toplevel(mWlInputPanelSurface, mWlOutput, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
 #endif
+  FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_toplevel");
 }
 
 void WindowBaseEcoreWl2::ImeWindowReadyToRender()
@@ -2699,11 +3281,14 @@ void WindowBaseEcoreWl2::ImeWindowReadyToRender()
     DALI_LOG_ERROR("WindowBaseEcoreWl2::ImeWindowReadyToRender(), wayland input panel surface is null\n");
     return;
   }
+
+  START_DURATION_CHECK();
 #ifdef OVER_TIZEN_VERSION_7
   zwp_input_panel_surface_v1_set_ready(mWlInputPanelSurface, 1);
 #else
   wl_input_panel_surface_set_ready(mWlInputPanelSurface, 1);
 #endif
+  FINISH_DURATION_CHECK("zwp_input_panel_surface_v1_set_ready");
 }
 
 void WindowBaseEcoreWl2::RequestMoveToServer()
@@ -2722,7 +3307,9 @@ void WindowBaseEcoreWl2::RequestMoveToServer()
     return;
   }
 
+  START_DURATION_CHECK();
   ecore_wl2_window_move(mEcoreWindow, input);
+  FINISH_DURATION_CHECK("ecore_wl2_window_move");
   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::RequestMoveToServer, starts the window[%p] is moved by server\n", mEcoreWindow);
 }
 
@@ -2742,63 +3329,18 @@ 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);
+  START_DURATION_CHECK();
+  ecore_wl2_window_resize(mEcoreWindow, input, static_cast<int>(location));
+  FINISH_DURATION_CHECK("ecore_wl2_window_resize");
+  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)
 {
   DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::EnableFloatingMode, floating mode flag: [%p], enable [%d]\n", mEcoreWindow, enable);
+  START_DURATION_CHECK();
   if(enable == true)
   {
     ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_TRUE);
@@ -2807,6 +3349,7 @@ void WindowBaseEcoreWl2::EnableFloatingMode(bool enable)
   {
     ecore_wl2_window_floating_mode_set(mEcoreWindow, EINA_FALSE);
   }
+  FINISH_DURATION_CHECK("ecore_wl2_window_floating_mode_set");
 }
 
 bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
@@ -2816,25 +3359,35 @@ bool WindowBaseEcoreWl2::IsFloatingModeEnabled() const
 
 void WindowBaseEcoreWl2::IncludeInputRegion(const Rect<int>& inputRegion)
 {
+  Rect<int>      convertRegion = RecalculateInputRect(inputRegion);
   Eina_Rectangle rect;
-  rect.x = inputRegion.x;
-  rect.y = inputRegion.y;
-  rect.w = inputRegion.width;
-  rect.h = inputRegion.height;
 
+  rect.x = convertRegion.x;
+  rect.y = convertRegion.y;
+  rect.w = convertRegion.width;
+  rect.h = convertRegion.height;
+
+  DALI_LOG_RELEASE_INFO("%p, Add input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
+  START_DURATION_CHECK();
   ecore_wl2_window_input_rect_add(mEcoreWindow, &rect);
+  FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_add");
   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
 }
 
 void WindowBaseEcoreWl2::ExcludeInputRegion(const Rect<int>& inputRegion)
 {
+  Rect<int>      convertRegion = RecalculateInputRect(inputRegion);
   Eina_Rectangle rect;
-  rect.x = inputRegion.x;
-  rect.y = inputRegion.y;
-  rect.w = inputRegion.width;
-  rect.h = inputRegion.height;
 
+  rect.x = convertRegion.x;
+  rect.y = convertRegion.y;
+  rect.w = convertRegion.width;
+  rect.h = convertRegion.height;
+
+  DALI_LOG_RELEASE_INFO("%p, Subtract input_rect(%d, %d, %d x %d)\n", mEcoreWindow, rect.x, rect.y, rect.w, rect.h);
+  START_DURATION_CHECK();
   ecore_wl2_window_input_rect_subtract(mEcoreWindow, &rect);
+  FINISH_DURATION_CHECK("ecore_wl2_window_input_rect_subtract");
   ecore_wl2_window_commit(mEcoreWindow, EINA_TRUE);
 }