Remove empty line of trace log
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl2 / window-base-ecore-wl2.cpp
index 9bc72f5..903dc20 100644 (file)
 // 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,14 @@ namespace
 Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WINDOW_BASE");
 #endif
 
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+
 const uint32_t     MAX_TIZEN_CLIENT_VERSION = 7;
 const unsigned int PRIMARY_TOUCH_BUTTON_ID  = 1;
 
+#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
 {
@@ -530,6 +539,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 +563,7 @@ static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
     windowBase->OnFontSizeChanged();
   }
 }
+#endif
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 // Window Redraw Request Event Callbacks
@@ -725,8 +736,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)
   {
@@ -823,9 +836,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);
@@ -1033,7 +1048,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);
     }
 
@@ -1184,13 +1198,20 @@ 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("");
 
+#ifdef TRACE_ENABLED
+    std::ostringstream stream;
+    if(gTraceFilter->IsTraceEnabled())
+    {
+      stream << "DALI_ON_KEY_DOWN [" << keyName << "]";
+      DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str());
+    }
+#endif
+
     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
     if(keyEvent->compose)
     {
@@ -1237,6 +1258,13 @@ 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
   }
 }
 
@@ -1246,8 +1274,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 +1288,15 @@ 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 << "]" << std::endl;
+      DALI_TRACE_BEGIN(gTraceFilter, stream.str().c_str());
+    }
+#endif
+
     // Ensure key compose string is not NULL as keys like SHIFT or arrow have a null string.
     if(keyEvent->compose)
     {
@@ -1308,6 +1343,13 @@ 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
   }
 }
 
@@ -1578,6 +1620,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);
 }
 
@@ -1614,11 +1657,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
@@ -1675,9 +1720,6 @@ 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;
 }
 
@@ -1714,9 +1756,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;
 }
 
@@ -1779,6 +1818,12 @@ 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());
+}
+
 void WindowBaseEcoreWl2::Minimize(bool minimize)
 {
   ecore_wl2_window_iconified_set(mEcoreWindow, minimize);
@@ -1789,6 +1834,12 @@ 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());
+}
+
 void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
 {
   int rotations[4] = {0};
@@ -1992,6 +2043,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;
@@ -2513,9 +2569,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;
@@ -2525,8 +2581,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;