Add Window::SetLayout method
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / ecore-wl / window-base-ecore-wl.cpp
index 3a07b04..fb8bf7f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
 #include <dali/internal/input/common/key-impl.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/public-api/object/any.h>
+
+#if defined(VCONF_ENABLED)
 #include <vconf-keys.h>
 #include <vconf.h>
+#endif
 
 namespace Dali
 {
@@ -50,7 +52,9 @@ Debug::Filter* gWindowBaseLogFilter = Debug::Filter::New(Debug::NoLogging, 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
 
 // DBUS accessibility
 const char* BUS       = "org.enlightenment.wm-screen-reader";
@@ -417,6 +421,7 @@ static Eina_Bool EcoreEventDataReceive(void* data, int type, void* event)
 // Font Callbacks
 /////////////////////////////////////////////////////////////////////////////////////////////////
 
+#if defined(VCONF_ENABLED)
 /**
  * Called when a font name is changed.
  */
@@ -440,22 +445,7 @@ static void VconfNotifyFontSizeChanged(keynode_t* node, void* data)
     windowBase->OnFontSizeChanged();
   }
 }
-
-/////////////////////////////////////////////////////////////////////////////////////////////////
-// ElDBus Accessibility Callbacks
-/////////////////////////////////////////////////////////////////////////////////////////////////
-
-#ifdef DALI_ELDBUS_AVAILABLE
-// Callback for Ecore ElDBus accessibility events.
-static void EcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message)
-{
-  WindowBaseEcoreWl* windowBase = static_cast<WindowBaseEcoreWl*>(context);
-  if(windowBase)
-  {
-    windowBase->OnEcoreElDBusAccessibilityNotification(context, message);
-  }
-}
-#endif // DALI_ELDBUS_AVAILABLE
+#endif
 
 static void RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
 {
@@ -582,26 +572,16 @@ WindowBaseEcoreWl::WindowBaseEcoreWl(Dali::PositionSize positionSize, Any surfac
   mWindowRotationAngle(0),
   mScreenRotationAngle(0),
   mSupportedPreProtation(0)
-#ifdef DALI_ELDBUS_AVAILABLE
-  ,
-  mSystemConnection(NULL)
-#endif
 {
   Initialize(positionSize, surface, isTransparent);
 }
 
 WindowBaseEcoreWl::~WindowBaseEcoreWl()
 {
-#ifdef DALI_ELDBUS_AVAILABLE
-  // Close down ElDBus connections.
-  if(mSystemConnection)
-  {
-    eldbus_connection_unref(mSystemConnection);
-  }
-#endif // DALI_ELDBUS_AVAILABLE
-
+#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)
   {
@@ -626,8 +606,6 @@ WindowBaseEcoreWl::~WindowBaseEcoreWl()
   if(mOwnSurface)
   {
     ecore_wl_window_free(mEcoreWindow);
-
-    WindowSystem::Shutdown();
   }
 }
 
@@ -643,8 +621,6 @@ void WindowBaseEcoreWl::Initialize(PositionSize positionSize, Any surface, bool
   else
   {
     // we own the surface about to created
-    WindowSystem::Initialize();
-
     mOwnSurface = true;
     CreateWindow(positionSize);
   }
@@ -682,11 +658,11 @@ void WindowBaseEcoreWl::Initialize(PositionSize positionSize, Any surface, bool
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL_EVENT_DATA_SOURCE_SEND, EcoreEventDataSend, this));
   mEcoreEventHandler.PushBack(ecore_event_handler_add(ECORE_WL_EVENT_SELECTION_DATA_READY, EcoreEventDataReceive, 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);
-
-  InitializeEcoreElDBus();
+  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
 
   mDisplay = ecore_wl_display_get();
 
@@ -1098,21 +1074,6 @@ void WindowBaseEcoreWl::OnFontSizeChanged()
   mStyleChangedSignal.Emit(StyleChange::DEFAULT_FONT_SIZE_CHANGE);
 }
 
-void WindowBaseEcoreWl::OnEcoreElDBusAccessibilityNotification(void* context, const Eldbus_Message* message)
-{
-#ifdef DALI_ELDBUS_AVAILABLE
-  AccessibilityInfo info;
-
-  // The string defines the arg-list's respective types.
-  if(!eldbus_message_arguments_get(message, "iiiiiiu", &info.gestureValue, &info.startX, &info.startY, &info.endX, &info.endY, &info.state, &info.eventTime))
-  {
-    DALI_LOG_ERROR("OnEcoreElDBusAccessibilityNotification: Error getting arguments\n");
-  }
-
-  mAccessibilitySignal.Emit(info);
-#endif
-}
-
 void WindowBaseEcoreWl::RegistryGlobalCallback(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
 {
   if(strcmp(interface, tizen_policy_interface.name) == 0)
@@ -1188,6 +1149,11 @@ int WindowBaseEcoreWl::GetNativeWindowId()
   return ecore_wl_window_id_get(mEcoreWindow);
 }
 
+std::string WindowBaseEcoreWl::GetNativeWindowResourceId()
+{
+  return std::string();
+}
+
 EGLNativeWindowType WindowBaseEcoreWl::CreateEglWindow(int width, int height)
 {
   mEglWindow = wl_egl_window_create(mWlSurface, width, height);
@@ -1346,6 +1312,10 @@ void WindowBaseEcoreWl::MoveResize(PositionSize positionSize)
   ecore_wl_window_update_size(mEcoreWindow, positionSize.width, positionSize.height);
 }
 
+void WindowBaseEcoreWl::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+}
+
 void WindowBaseEcoreWl::SetClass(const std::string& name, const std::string& className)
 {
   ecore_wl_window_title_set(mEcoreWindow, name.c_str());
@@ -1368,6 +1338,32 @@ void WindowBaseEcoreWl::Activate()
   ecore_wl_window_activate(mEcoreWindow);
 }
 
+void WindowBaseEcoreWl::Maximize(bool maximize)
+{
+}
+
+bool WindowBaseEcoreWl::IsMaximized() const
+{
+  return false;
+}
+
+void WindowBaseEcoreWl::SetMaximumSize(Dali::Window::WindowSize size)
+{
+}
+
+void WindowBaseEcoreWl::Minimize(bool minimize)
+{
+}
+
+bool WindowBaseEcoreWl::IsMinimized() const
+{
+  return false;
+}
+
+void WindowBaseEcoreWl::SetMimimumSize(Dali::Window::WindowSize size)
+{
+}
+
 void WindowBaseEcoreWl::SetAvailableAnlges(const std::vector<int>& angles)
 {
   int rotations[4] = {0};
@@ -1565,7 +1561,12 @@ void WindowBaseEcoreWl::SetType(Dali::WindowType type)
   ecore_wl_window_type_set(mEcoreWindow, windowType);
 }
 
-bool WindowBaseEcoreWl::SetNotificationLevel(Dali::WindowNotificationLevel level)
+Dali::WindowType WindowBaseEcoreWl::GetType() const
+{
+  return Dali::WindowType::NORMAL;
+}
+
+Dali::WindowOperationResult WindowBaseEcoreWl::SetNotificationLevel(Dali::WindowNotificationLevel level)
 {
   while(!mTizenPolicy)
   {
@@ -1626,17 +1627,17 @@ bool WindowBaseEcoreWl::SetNotificationLevel(Dali::WindowNotificationLevel level
   if(!mNotificationLevelChangeDone)
   {
     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Level change is failed [%d, %d]\n", level, mNotificationChangeState);
-    return false;
+    return Dali::WindowOperationResult::UNKNOWN_ERROR;
   }
   else if(mNotificationChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
   {
     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Permission denied! [%d]\n", level);
-    return false;
+    return Dali::WindowOperationResult::PERMISSION_DENIED;
   }
 
   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetNotificationLevel: Level is changed [%d]\n", mNotificationLevel);
 
-  return true;
+  return Dali::WindowOperationResult::SUCCEED;
 }
 
 Dali::WindowNotificationLevel WindowBaseEcoreWl::GetNotificationLevel() const
@@ -1713,7 +1714,7 @@ void WindowBaseEcoreWl::SetOpaqueState(bool opaque)
   tizen_policy_set_opaque_state(mTizenPolicy, ecore_wl_window_surface_get(mEcoreWindow), (opaque ? 1 : 0));
 }
 
-bool WindowBaseEcoreWl::SetScreenOffMode(WindowScreenOffMode screenOffMode)
+Dali::WindowOperationResult WindowBaseEcoreWl::SetScreenOffMode(WindowScreenOffMode screenOffMode)
 {
   while(!mTizenPolicy)
   {
@@ -1753,17 +1754,17 @@ bool WindowBaseEcoreWl::SetScreenOffMode(WindowScreenOffMode screenOffMode)
   if(!mScreenOffModeChangeDone)
   {
     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Screen mode change is failed [%d, %d]\n", screenOffMode, mScreenOffModeChangeState);
-    return false;
+    return Dali::WindowOperationResult::UNKNOWN_ERROR;
   }
   else if(mScreenOffModeChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
   {
     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Permission denied! [%d]\n", screenOffMode);
-    return false;
+    return Dali::WindowOperationResult::PERMISSION_DENIED;
   }
 
   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetScreenOffMode: Screen mode is changed [%d]\n", mScreenOffMode);
 
-  return true;
+  return Dali::WindowOperationResult::SUCCEED;
 }
 
 WindowScreenOffMode WindowBaseEcoreWl::GetScreenOffMode() const
@@ -1809,7 +1810,7 @@ WindowScreenOffMode WindowBaseEcoreWl::GetScreenOffMode() const
   return screenMode;
 }
 
-bool WindowBaseEcoreWl::SetBrightness(int brightness)
+Dali::WindowOperationResult WindowBaseEcoreWl::SetBrightness(int brightness)
 {
   while(!mTizenDisplayPolicy)
   {
@@ -1833,17 +1834,17 @@ bool WindowBaseEcoreWl::SetBrightness(int brightness)
   if(!mBrightnessChangeDone)
   {
     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Brightness change is failed [%d, %d]\n", brightness, mBrightnessChangeState);
-    return false;
+    return Dali::WindowOperationResult::UNKNOWN_ERROR;
   }
   else if(mBrightnessChangeState == TIZEN_POLICY_ERROR_STATE_PERMISSION_DENIED)
   {
     DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Permission denied! [%d]\n", brightness);
-    return false;
+    return Dali::WindowOperationResult::PERMISSION_DENIED;
   }
 
   DALI_LOG_INFO(gWindowBaseLogFilter, Debug::Verbose, "WindowBaseEcoreWl::SetBrightness: Brightness is changed [%d]\n", mBrightness);
 
-  return true;
+  return Dali::WindowOperationResult::SUCCEED;
 }
 
 int WindowBaseEcoreWl::GetBrightness() const
@@ -2069,9 +2070,9 @@ void WindowBaseEcoreWl::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVer
   dpiVertical   = int(yres + 0.5f);
 }
 
-int WindowBaseEcoreWl::GetOrientation() const
+int WindowBaseEcoreWl::GetWindowRotationAngle() const
 {
-  int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
+  int orientation = mWindowRotationAngle;
   if(mSupportedPreProtation)
   {
     orientation = 0;
@@ -2112,38 +2113,6 @@ void WindowBaseEcoreWl::SetTransparency(bool transparent)
   ecore_wl_window_alpha_set(mEcoreWindow, transparent);
 }
 
-void WindowBaseEcoreWl::InitializeEcoreElDBus()
-{
-#ifdef DALI_ELDBUS_AVAILABLE
-  Eldbus_Object* object;
-  Eldbus_Proxy*  manager;
-
-  if(!(mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM)))
-  {
-    DALI_LOG_ERROR("Unable to get system bus\n");
-  }
-
-  object = eldbus_object_get(mSystemConnection, BUS, PATH);
-  if(!object)
-  {
-    DALI_LOG_ERROR("Getting object failed\n");
-    return;
-  }
-
-  manager = eldbus_proxy_get(object, INTERFACE);
-  if(!manager)
-  {
-    DALI_LOG_ERROR("Getting proxy failed\n");
-    return;
-  }
-
-  if(!eldbus_proxy_signal_handler_add(manager, "GestureDetected", EcoreElDBusAccessibilityNotification, this))
-  {
-    DALI_LOG_ERROR("No signal handler returned\n");
-  }
-#endif
-}
-
 void WindowBaseEcoreWl::CreateWindow(PositionSize positionSize)
 {
   mEcoreWindow = ecore_wl_window_new(0, positionSize.x, positionSize.y, positionSize.width, positionSize.height, ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW);
@@ -2154,7 +2123,7 @@ void WindowBaseEcoreWl::CreateWindow(PositionSize positionSize)
   }
 }
 
-void WindowBaseEcoreWl::SetParent(WindowBase* parentWinBase)
+void WindowBaseEcoreWl::SetParent(WindowBase* parentWinBase, bool belowParent)
 {
   Ecore_Wl_Window* ecoreParent = NULL;
   if(parentWinBase)
@@ -2175,6 +2144,43 @@ int WindowBaseEcoreWl::CreateFramePresentedSyncFence()
   return -1;
 }
 
+void WindowBaseEcoreWl::SetPositionSizeWithAngle(PositionSize positionSize, int angle)
+{
+}
+
+void WindowBaseEcoreWl::InitializeIme()
+{
+}
+
+void WindowBaseEcoreWl::ImeWindowReadyToRender()
+{
+}
+
+void WindowBaseEcoreWl::RequestMoveToServer()
+{
+}
+
+void WindowBaseEcoreWl::RequestResizeToServer(WindowResizeDirection direction)
+{
+}
+
+void WindowBaseEcoreWl::EnableFloatingMode(bool enable)
+{
+}
+
+bool WindowBaseEcoreWl::IsFloatingModeEnabled() const
+{
+  return false;
+}
+
+void WindowBaseEcoreWl::IncludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
+void WindowBaseEcoreWl::ExcludeInputRegion(const Rect<int>& inputRegion)
+{
+}
+
 } // namespace Adaptor
 
 } // namespace Internal