Add Window::SetLayout method
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
index 162af6c..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.
@@ -842,8 +842,6 @@ WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
   if(mOwnSurface)
   {
     ecore_wl2_window_free(mEcoreWindow);
-
-    WindowSystem::Shutdown();
   }
 }
 
@@ -859,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);
   }
@@ -1283,14 +1279,7 @@ void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event)
     std::string keyString("");
     std::string compose("");
 
-#ifdef TRACE_ENABLED
-    std::ostringstream stream;
-    if(gTraceFilter->IsTraceEnabled())
-    {
-      stream << "DALI_ON_KEY_DOWN [" << keyName << "]";
-      DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str());
-    }
-#endif
+    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)
@@ -1338,13 +1327,6 @@ 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);
-
-#ifdef TRACE_ENABLED
-    if(gTraceFilter->IsTraceEnabled())
-    {
-      DALI_TRACE_END(gTraceFilter, stream.str().c_str());
-    }
-#endif
   }
 }
 
@@ -1368,14 +1350,7 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event)
     std::string keyString("");
     std::string compose("");
 
-#ifdef TRACE_ENABLED
-    std::ostringstream stream;
-    if(gTraceFilter->IsTraceEnabled())
-    {
-      stream << "DALI_ON_KEY_UP [" << keyName << "]";
-      DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str());
-    }
-#endif
+    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)
@@ -1423,13 +1398,6 @@ 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);
-
-#ifdef TRACE_ENABLED
-    if(gTraceFilter->IsTraceEnabled())
-    {
-      DALI_TRACE_END(gTraceFilter, stream.str().c_str());
-    }
-#endif
   }
 }
 
@@ -1870,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());
@@ -1906,6 +1880,7 @@ 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)
@@ -1922,6 +1897,7 @@ 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)
@@ -2090,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)
@@ -2903,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);
 }
@@ -2915,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);
 }