[dali_2.2.34] Merge branch 'devel/master' 68/295468/1
authorDavid Steele <david.steele@samsung.com>
Fri, 7 Jul 2023 11:01:23 +0000 (12:01 +0100)
committerDavid Steele <david.steele@samsung.com>
Fri, 7 Jul 2023 11:01:23 +0000 (12:01 +0100)
Change-Id: I90584d7ee306dfefdcb2ccff2bfd38f4d4f349a5

126 files changed:
dali/devel-api/adaptor-framework/accessibility.h
dali/devel-api/adaptor-framework/image-loading.h
dali/devel-api/adaptor-framework/offscreen-application.cpp
dali/devel-api/adaptor-framework/offscreen-application.h
dali/devel-api/adaptor-framework/web-engine/web-engine-console-message.h [changed mode: 0755->0644]
dali/devel-api/adaptor-framework/web-engine/web-engine-settings.h [changed mode: 0755->0644]
dali/internal/adaptor/android/android-framework-impl.h
dali/internal/adaptor/android/framework-android-interface.h [new file with mode: 0644]
dali/internal/adaptor/android/framework-android.cpp
dali/internal/adaptor/android/framework-android.h [new file with mode: 0644]
dali/internal/adaptor/android/framework-factory-android.cpp [new file with mode: 0644]
dali/internal/adaptor/android/framework-factory-android.h [new file with mode: 0644]
dali/internal/adaptor/androidjni/framework-androidjni.cpp
dali/internal/adaptor/androidjni/framework-androidjni.h [new file with mode: 0644]
dali/internal/adaptor/androidjni/framework-factory-androidjni.cpp [new file with mode: 0644]
dali/internal/adaptor/androidjni/framework-factory-androidjni.h [new file with mode: 0644]
dali/internal/adaptor/common/adaptor-impl.cpp
dali/internal/adaptor/common/adaptor-impl.h
dali/internal/adaptor/common/application-impl.cpp
dali/internal/adaptor/common/application-impl.h
dali/internal/adaptor/common/framework-factory.h [new file with mode: 0644]
dali/internal/adaptor/common/framework.cpp [new file with mode: 0644]
dali/internal/adaptor/common/framework.h
dali/internal/adaptor/file.list
dali/internal/adaptor/glib/framework-factory-glib.cpp [new file with mode: 0644]
dali/internal/adaptor/glib/framework-factory-glib.h [new file with mode: 0644]
dali/internal/adaptor/glib/framework-glib.cpp
dali/internal/adaptor/glib/framework-glib.h [new file with mode: 0644]
dali/internal/adaptor/libuv/framework-factory-libuv.cpp [new file with mode: 0644]
dali/internal/adaptor/libuv/framework-factory-libuv.h [new file with mode: 0644]
dali/internal/adaptor/libuv/framework-libuv.cpp
dali/internal/adaptor/libuv/framework-libuv.h [new file with mode: 0644]
dali/internal/adaptor/macos/framework-factory-mac.h [new file with mode: 0644]
dali/internal/adaptor/macos/framework-factory-mac.mm [new file with mode: 0644]
dali/internal/adaptor/macos/framework-mac.h [new file with mode: 0644]
dali/internal/adaptor/macos/framework-mac.mm
dali/internal/adaptor/tizen-wayland/framework-factory-tizen.cpp [new file with mode: 0644]
dali/internal/adaptor/tizen-wayland/framework-factory-tizen.h [new file with mode: 0644]
dali/internal/adaptor/tizen-wayland/framework-tizen.cpp
dali/internal/adaptor/tizen-wayland/framework-tizen.h [new file with mode: 0644]
dali/internal/adaptor/ubuntu/framework-factory-ubuntu.cpp [new file with mode: 0644]
dali/internal/adaptor/ubuntu/framework-factory-ubuntu.h [new file with mode: 0644]
dali/internal/adaptor/ubuntu/framework-ubuntu.cpp
dali/internal/adaptor/ubuntu/framework-ubuntu.h [new file with mode: 0644]
dali/internal/adaptor/windows/framework-factory-win.cpp [new file with mode: 0644]
dali/internal/adaptor/windows/framework-factory-win.h [new file with mode: 0644]
dali/internal/adaptor/windows/framework-win.cpp
dali/internal/adaptor/windows/framework-win.h [new file with mode: 0644]
dali/internal/offscreen/common/offscreen-application-impl.cpp
dali/internal/offscreen/common/offscreen-application-impl.h
dali/internal/system/android/callback-manager-android.cpp
dali/internal/system/android/callback-manager-android.h
dali/internal/system/android/file-descriptor-monitor-android.cpp
dali/internal/system/android/file-descriptor-monitor-android.h [new file with mode: 0644]
dali/internal/system/android/system-factory-android.cpp [new file with mode: 0644]
dali/internal/system/android/system-factory-android.h [new file with mode: 0644]
dali/internal/system/android/system-settings-android.cpp
dali/internal/system/android/timer-impl-android.cpp
dali/internal/system/android/timer-impl-android.h [new file with mode: 0644]
dali/internal/system/common/callback-manager.h
dali/internal/system/common/file-descriptor-monitor.h
dali/internal/system/common/system-factory.h [new file with mode: 0644]
dali/internal/system/common/system-settings.h
dali/internal/system/common/timer-impl.h
dali/internal/system/common/timer-interface.h
dali/internal/system/common/trigger-event.cpp
dali/internal/system/common/trigger-event.h
dali/internal/system/file.list
dali/internal/system/glib/callback-manager-glib.cpp
dali/internal/system/glib/callback-manager-glib.h
dali/internal/system/glib/file-descriptor-monitor-glib.cpp
dali/internal/system/glib/file-descriptor-monitor-glib.h [new file with mode: 0644]
dali/internal/system/glib/system-factory-glib.cpp [new file with mode: 0644]
dali/internal/system/glib/system-factory-glib.h [new file with mode: 0644]
dali/internal/system/glib/timer-impl-glib.cpp
dali/internal/system/glib/timer-impl-glib.h [new file with mode: 0644]
dali/internal/system/libuv/callback-manager-libuv.cpp
dali/internal/system/libuv/callback-manager-libuv.h
dali/internal/system/libuv/file-descriptor-monitor-libuv.cpp
dali/internal/system/libuv/file-descriptor-monitor-libuv.h [new file with mode: 0644]
dali/internal/system/libuv/system-factory-libuv.cpp [new file with mode: 0644]
dali/internal/system/libuv/system-factory-libuv.h [new file with mode: 0644]
dali/internal/system/libuv/timer-impl-libuv.cpp
dali/internal/system/libuv/timer-impl-libuv.h [new file with mode: 0644]
dali/internal/system/linux/callback-manager-ecore.cpp
dali/internal/system/linux/callback-manager-ecore.h
dali/internal/system/linux/file-descriptor-monitor-ecore.cpp
dali/internal/system/linux/file-descriptor-monitor-ecore.h [new file with mode: 0644]
dali/internal/system/linux/system-factory-ecore.cpp [new file with mode: 0644]
dali/internal/system/linux/system-factory-ecore.h [new file with mode: 0644]
dali/internal/system/linux/timer-impl-ecore.cpp
dali/internal/system/linux/timer-impl-ecore.h [new file with mode: 0644]
dali/internal/system/macos/callback-manager-mac.h
dali/internal/system/macos/callback-manager-mac.mm
dali/internal/system/macos/file-descriptor-monitor-macos.cpp
dali/internal/system/macos/file-descriptor-monitor-macos.h [new file with mode: 0644]
dali/internal/system/macos/system-factory-mac.cpp [new file with mode: 0644]
dali/internal/system/macos/system-factory-mac.h [new file with mode: 0644]
dali/internal/system/macos/system-settings-mac.cpp [new file with mode: 0644]
dali/internal/system/macos/timer-impl-mac.cpp
dali/internal/system/macos/timer-impl-mac.h [new file with mode: 0644]
dali/internal/system/tizen-wayland/system-settings-tizen.cpp
dali/internal/system/ubuntu-x11/system-settings-x.cpp
dali/internal/system/windows/callback-manager-win.cpp
dali/internal/system/windows/callback-manager-win.h
dali/internal/system/windows/file-descriptor-monitor-windows.cpp
dali/internal/system/windows/file-descriptor-monitor-windows.h [new file with mode: 0644]
dali/internal/system/windows/system-factory-win.cpp [new file with mode: 0644]
dali/internal/system/windows/system-factory-win.h [new file with mode: 0644]
dali/internal/system/windows/system-settings-win.cpp
dali/internal/system/windows/timer-impl-win.cpp
dali/internal/system/windows/timer-impl-win.h [new file with mode: 0644]
dali/internal/text/text-abstraction/plugin/font-face-cache-item.cpp
dali/internal/window-system/common/window-render-surface.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-system-ecore-wl2.cpp
dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp
dali/internal/window-system/x11/window-system-x.cpp
dali/public-api/adaptor-framework/timer.cpp
dali/public-api/adaptor-framework/timer.h
dali/public-api/dali-adaptor-version.cpp
packaging/dali-adaptor.spec
third-party/file.list
third-party/macos-platform/environment.cpp [deleted file]
third-party/macos-platform/extern-definitions.h
third-party/windows-platform/environment.cpp [deleted file]
third-party/windows-platform/extern-definitions.h

index c424fde40be4bf4475eb9c467e49504769e8e6a7..7a8cb07d4e859556eacf72e5176e0c0e1ffe0ff9 100644 (file)
@@ -18,6 +18,7 @@
  */\r
 \r
 // EXTERNAL INCLUDES\r
+#include <cstdint>\r
 #include <string>\r
 #include <unordered_map>\r
 #include <vector>\r
@@ -350,8 +351,8 @@ enum class WindowEvent
  */\r
 enum class WindowRestoreType\r
 {\r
-  RESTORE_FROM_ICONIFY,  // The Window is Deiconified.\r
-  RESTORE_FROM_MAXIMIZE  // The Window is Unmaximized.\r
+  RESTORE_FROM_ICONIFY, // The Window is Deiconified.\r
+  RESTORE_FROM_MAXIMIZE // The Window is Unmaximized.\r
 };\r
 \r
 /**\r
@@ -512,11 +513,11 @@ enum class AtspiEvent
   MAX_COUNT\r
 };\r
 \r
-using AtspiInterfaces   = EnumBitSet<AtspiInterface, AtspiInterface::MAX_COUNT>;\r
-using AtspiEvents       = EnumBitSet<AtspiEvent, AtspiEvent::MAX_COUNT>;\r
-using ReadingInfoTypes  = EnumBitSet<ReadingInfoType, ReadingInfoType::MAX_COUNT>;\r
-using States            = EnumBitSet<State, State::MAX_COUNT>;\r
-using Attributes        = std::unordered_map<std::string, std::string>;\r
+using AtspiInterfaces  = EnumBitSet<AtspiInterface, AtspiInterface::MAX_COUNT>;\r
+using AtspiEvents      = EnumBitSet<AtspiEvent, AtspiEvent::MAX_COUNT>;\r
+using ReadingInfoTypes = EnumBitSet<ReadingInfoType, ReadingInfoType::MAX_COUNT>;\r
+using States           = EnumBitSet<State, State::MAX_COUNT>;\r
+using Attributes       = std::unordered_map<std::string, std::string>;\r
 \r
 namespace Internal\r
 {\r
index 365b38d820f6167b1335213c5e80f7c338c6a33f..c920c0c1aa76167de922718c354efa3a78b6b8e7 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_IMAGE_LOADING_H
 
 /*
- * 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.
@@ -19,6 +19,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/images/image-operations.h>
 #include <string>
 
index 30d2c9691ead5fe4153c90614ad0bcf001dd61cb..0ad671325beefb3dfe5c1c4061358de5af765855 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 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.
@@ -50,14 +50,14 @@ OffscreenApplication& OffscreenApplication::operator=(const OffscreenApplication
 
 OffscreenApplication::~OffscreenApplication() = default;
 
-void OffscreenApplication::Start()
+void OffscreenApplication::MainLoop()
 {
-  Internal::GetImplementation(*this).Start();
+  Internal::GetImplementation(*this).MainLoop();
 }
 
-void OffscreenApplication::Stop()
+void OffscreenApplication::Quit()
 {
-  Internal::GetImplementation(*this).Stop();
+  Internal::GetImplementation(*this).Quit();
 }
 
 Dali::OffscreenWindow OffscreenApplication::GetWindow()
index d03d99b5486f82624d0ce31e7f86f4cb5e4f2bb5..d7b6249b4738e9b7c8af79bb47b61faa86210e12 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_OFFSCREEN_APPLICATION_H
 
 /*
- * Copyright (c) 2020 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.
@@ -104,14 +104,14 @@ public:
 
 public:
   /**
-   * @brief Starts the OffscreenApplication (rendering, event handling, etc)
+   * @brief This starts the application.
    */
-  void Start();
+  void MainLoop();
 
   /**
-   * @brief Stops the OffscreenApplication
+   * @brief This quits the application.
    */
-  void Stop();
+  void Quit();
 
   /**
    * @brief Get the default OffscreenWindow handle
old mode 100755 (executable)
new mode 100644 (file)
index 1456e43..5141d7f
@@ -2,7 +2,7 @@
 #define DALI_WEB_ENGINE_CONSOLE_MESSAGE_H
 
 /*
- * 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.
@@ -19,6 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <cstdint>
 #include <string>
 
 namespace Dali
old mode 100755 (executable)
new mode 100644 (file)
index ae7bc99..faee431
@@ -2,7 +2,7 @@
 #define DALI_WEB_ENGINE_SETTINGS_H
 
 /*
- * 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.
@@ -19,6 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <cstdint>
 
 namespace Dali
 {
@@ -82,7 +83,7 @@ public:
    * @param[in] enabled if true, to enable cache builder
    *        otherwise to disable
    */
-  virtual void EnableCacheBuilder( bool enabled ) = 0;
+  virtual void EnableCacheBuilder(bool enabled) = 0;
 
   /**
    * @brief Used/Unused scrollbar thumb focus notifications
@@ -90,7 +91,7 @@ public:
    * @param[in] used if true, to use scrollbar thumb focus notifications
    *          otherwise to unused
    */
-  virtual void UseScrollbarThumbFocusNotifications( bool used ) = 0;
+  virtual void UseScrollbarThumbFocusNotifications(bool used) = 0;
 
   /**
    * @brief Enable/Disable do not track
@@ -98,7 +99,7 @@ public:
    * @param[in] enabled if true, to enable do not track
    *        otherwise to disable
    */
-  virtual void EnableDoNotTrack( bool enabled ) = 0;
+  virtual void EnableDoNotTrack(bool enabled) = 0;
 
   /**
    * @brief Allow/Disallow file access from external url
@@ -136,7 +137,7 @@ public:
    * @param[in] enabled if true, to enable auto fitting
    *       otherwise to disable
    */
-  virtual void EnableAutoFitting( bool enabled ) = 0;
+  virtual void EnableAutoFitting(bool enabled) = 0;
 
   /**
    * @brief Check if plugins are enabled or not.
@@ -151,7 +152,7 @@ public:
    * @param[in] enabled if true, to enable plugins
    *       otherwise to disable
    */
-  virtual void EnablePlugins( bool enabled ) = 0;
+  virtual void EnablePlugins(bool enabled) = 0;
 
   /**
    * @brief Check if private browsing is enabled or not.
@@ -166,7 +167,7 @@ public:
    * @param[in] enabled if true, to enable private browsing
    *       otherwise to disable
    */
-  virtual void EnablePrivateBrowsing( bool enabled ) = 0;
+  virtual void EnablePrivateBrowsing(bool enabled) = 0;
 
   /**
    * @brief Check if link magnifier is enabled or not.
@@ -181,7 +182,7 @@ public:
    * @param[in] enabled if true, to enable link magnifier
    *        otherwise to disable
    */
-  virtual void EnableLinkMagnifier( bool enabled ) = 0;
+  virtual void EnableLinkMagnifier(bool enabled) = 0;
 
   /**
    * @brief Check if uses keypad without user action is used or not.
@@ -196,7 +197,7 @@ public:
    * @param[in] used if true, to use keypad without user action
    *       otherwise to unused
    */
-  virtual void UseKeypadWithoutUserAction( bool used ) = 0;
+  virtual void UseKeypadWithoutUserAction(bool used) = 0;
 
   /**
    * @brief Check if autofill password form is enabled or not.
@@ -211,7 +212,7 @@ public:
    * @param[in] enabled if true, to enable autofill_password_form
    *       otherwise to disable
    */
-  virtual void EnableAutofillPasswordForm( bool enabled ) = 0;
+  virtual void EnableAutofillPasswordForm(bool enabled) = 0;
 
   /**
    * @brief check if form candidate data is enabled or not.
@@ -226,7 +227,7 @@ public:
    * @param[in] enabled if true, to enable form candidate data
    *        otherwise to disable
    */
-  virtual void EnableFormCandidateData( bool enabled ) = 0;
+  virtual void EnableFormCandidateData(bool enabled) = 0;
 
   /**
    * @brief check if text selection is enabled or not.
@@ -241,7 +242,7 @@ public:
    * @param[in] enabled if true, to enable text selection
    *        otherwise to disable
    */
-  virtual void EnableTextSelection( bool enabled ) = 0;
+  virtual void EnableTextSelection(bool enabled) = 0;
 
   /**
    * @brief check if text autosizing is enabled or not.
@@ -256,14 +257,14 @@ public:
    * @param[in] enabled if true, to enable text autosizing
    *        otherwise to disable
    */
-  virtual void EnableTextAutosizing( bool enabled ) = 0;
+  virtual void EnableTextAutosizing(bool enabled) = 0;
 
   /**
    * @brief check if arrow scroll is enabled or not.
    *
    * @return true if enabled, false is disabled.
    */
-   virtual bool IsArrowScrollEnabled() const = 0;
+  virtual bool IsArrowScrollEnabled() const = 0;
 
   /**
    * @brief Enable/Disable arrow scroll
@@ -271,7 +272,7 @@ public:
    * @param[in] enable if true, to enable arrow scroll
    *        otherwise to disable
    */
-  virtual void EnableArrowScroll( bool enable ) = 0;
+  virtual void EnableArrowScroll(bool enable) = 0;
 
   /**
    * @brief check if clipboard is enabled or not.
@@ -286,7 +287,7 @@ public:
    * @param[in] enabled if true, to enable clipboard
    *          otherwise to disable
    */
-  virtual void EnableClipboard( bool enabled ) = 0;
+  virtual void EnableClipboard(bool enabled) = 0;
 
   /**
    * @brief check if ime panel is enabled or not.
@@ -301,7 +302,7 @@ public:
    * @param[in] enabled if true, to enable ime panel
    *          otherwise to disable
    */
-  virtual void EnableImePanel( bool enabled ) = 0;
+  virtual void EnableImePanel(bool enabled) = 0;
 
   /**
    * @brief Allow if the scripts can open new windows.
index 8dae6be209029d8eb20ff39ff0701aed30ac8eb7..a925eca11f7a271efbc2ae50b8c322696582cbf4 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTEGRATION_ANDROID_FRAMEWORK_IMPL_H
 
 /*
- * 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.
@@ -22,7 +22,7 @@
 #include <dali/integration-api/adaptor-framework/android/android-framework.h>
 
 // INTERNAL INCLUDES
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/android/framework-android.h>
 
 namespace Dali
 {
@@ -154,7 +154,7 @@ public:
   /**
    * @brief Sets an internal framework.
    */
-  void SetFramework(Framework* framework)
+  void SetFramework(FrameworkAndroidInterface* framework)
   {
     mFramework = framework;
   }
@@ -164,7 +164,7 @@ public:
    *
    * @return a pointer to the internal framework
    */
-  Framework* GetFramework()
+  FrameworkAndroidInterface* GetFramework()
   {
     return mFramework;
   }
@@ -183,7 +183,7 @@ public:
 private:
   AndroidFramework(Dali::Integration::AndroidFramework* androidFramework);
   Dali::Integration::AndroidFramework* mAndroidFramework;
-  Framework*                           mFramework;
+  FrameworkAndroidInterface*           mFramework;
 
   android_app*    mNativeApplication;
   ANativeWindow*  mWindow;
@@ -197,7 +197,7 @@ public:
   {
     return *androidFramework.mImpl;
   }
-  static Framework& GetFramework(Dali::Integration::AndroidFramework& androidFramework)
+  static FrameworkAndroidInterface& GetFramework(Dali::Integration::AndroidFramework& androidFramework)
   {
     return *androidFramework.mImpl->mFramework;
   }
diff --git a/dali/internal/adaptor/android/framework-android-interface.h b/dali/internal/adaptor/android/framework-android-interface.h
new file mode 100644 (file)
index 0000000..3e9b31f
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_INTERFACE_H
+#define DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_INTERFACE_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkAndroid interface class
+ */
+class FrameworkAndroidInterface
+{
+public:
+  /**
+   * Called by the App framework when an application lifecycle event occurs.
+   * @param[in] type The type of event occurred.
+   * @param[in] data The data of event occurred.
+   */
+  virtual bool AppStatusHandler(int type, void* data) = 0;
+
+  /**
+   * Called by the adaptor when an idle callback is added.
+   * @param[in] timeout The timeout of the callback.
+   * @param[in] data The data of of the callback.
+   * @param[in] callback The callback.
+   * @return The callback id.
+   */
+  virtual unsigned int AddIdle(int timeout, void* data, bool (*callback)(void* data)) = 0;
+
+  /**
+   * Called by the adaptor when an idle callback is removed.
+   * @param[in] id The callback id.
+   */
+  virtual void RemoveIdle(unsigned int id) = 0;
+
+protected:
+  /**
+   * Destructor
+   */
+  virtual ~FrameworkAndroidInterface() = default;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_INTERFACE_H
index 8151ba84f7e2243ec3a031c6a085f2f7a6dde1c5..e08b03d55964bdff2dc1c62e0ca1bd48646563c4 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.
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/android/framework-android.h>
 
 // EXTERNAL INCLUDES
 #include <android_native_app_glue.h>
@@ -35,7 +34,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/android/android-framework-impl.h>
-#include <dali/internal/system/common/callback-manager.h>
 
 namespace Dali
 {
@@ -110,7 +108,7 @@ void RemoveAllConstraints(const Dali::WindowContainer& windows)
 /**
  * Impl to hide android data members
  */
-struct Framework::Impl
+struct FrameworkAndroid::Impl
 {
   struct IdleCallback
   {
@@ -142,12 +140,8 @@ struct Framework::Impl
 
   // Constructor
 
-  Impl(Framework* framework)
-  : mAbortCallBack(nullptr),
-    mCallbackManager(CallbackManager::New()),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED"),
-    mFinishRequested(false),
+  Impl(FrameworkAndroid* framework)
+  : mFinishRequested(false),
     mIdleId(0),
     mIdleReadPipe(-1),
     mIdleWritePipe(-1)
@@ -159,25 +153,6 @@ struct Framework::Impl
   ~Impl()
   {
     AndroidFramework::GetImplementation(AndroidFramework::Get()).SetFramework(nullptr);
-
-    delete mAbortCallBack;
-    mAbortCallBack = nullptr;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-    mCallbackManager = nullptr;
-  }
-
-  std::string GetLanguage() const
-  {
-    return mLanguage;
-  }
-
-  std::string GetRegion() const
-  {
-    return mRegion;
   }
 
   void OnIdle()
@@ -271,11 +246,7 @@ struct Framework::Impl
   }
 
   // Data
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  std::string      mLanguage;
-  std::string      mRegion;
-  bool             mFinishRequested;
+  bool mFinishRequested;
 
   int                               mIdleReadPipe;
   int                               mIdleWritePipe;
@@ -288,7 +259,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_INIT_WINDOW event is processed.
    */
-  static void NativeWindowCreated(Framework* framework, ANativeWindow* window)
+  static void NativeWindowCreated(FrameworkAndroid* framework, ANativeWindow* window)
   {
     if(framework)
     {
@@ -299,7 +270,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_DESTROY event is processed.
    */
-  static void NativeWindowDestroyed(Framework* framework, ANativeWindow* window)
+  static void NativeWindowDestroyed(FrameworkAndroid* framework, ANativeWindow* window)
   {
     if(framework)
     {
@@ -310,7 +281,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_INIT_WINDOW event is processed.
    */
-  static void NativeAppPaused(Framework* framework)
+  static void NativeAppPaused(FrameworkAndroid* framework)
   {
     if(framework)
     {
@@ -321,7 +292,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_TERM_WINDOW event is processed.
    */
-  static void NativeAppResumed(Framework* framework)
+  static void NativeAppResumed(FrameworkAndroid* framework)
   {
     if(framework)
     {
@@ -332,7 +303,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application input touch event is processed.
    */
-  static void NativeAppTouchEvent(Framework* framework, Dali::TouchPoint& touchPoint, int64_t timeStamp)
+  static void NativeAppTouchEvent(FrameworkAndroid* framework, Dali::TouchPoint& touchPoint, int64_t timeStamp)
   {
     Dali::Adaptor::Get().FeedTouchPoint(touchPoint, timeStamp);
   }
@@ -340,7 +311,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application input key event is processed.
    */
-  static void NativeAppKeyEvent(Framework* framework, Dali::KeyEvent& keyEvent)
+  static void NativeAppKeyEvent(FrameworkAndroid* framework, Dali::KeyEvent& keyEvent)
   {
     Dali::Adaptor::Get().FeedKeyEvent(keyEvent);
   }
@@ -348,7 +319,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_DESTROY event is processed.
    */
-  static void NativeAppDestroyed(Framework* framework)
+  static void NativeAppDestroyed(FrameworkAndroid* framework)
   {
     if(framework)
     {
@@ -373,7 +344,7 @@ struct Framework::Impl
 
   static void HandleAppCmd(struct android_app* app, int32_t cmd)
   {
-    Framework* framework = AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework();
+    FrameworkAndroid* framework = static_cast<FrameworkAndroid*>(AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework());
     switch(cmd)
     {
       case APP_CMD_SAVE_STATE:
@@ -389,29 +360,29 @@ struct Framework::Impl
       case APP_CMD_INIT_WINDOW:
         // The window is being shown, get it ready.
         AndroidFramework::Get().SetApplicationWindow(app->window);
-        Dali::Internal::Adaptor::Framework::Impl::NativeWindowCreated(framework, app->window);
-        Dali::Internal::Adaptor::Framework::Impl::NativeAppResumed(framework);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeWindowCreated(framework, app->window);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppResumed(framework);
         break;
       case APP_CMD_TERM_WINDOW:
         // The window is being hidden or closed, clean it up.
         AndroidFramework::Get().SetApplicationWindow(nullptr);
-        Dali::Internal::Adaptor::Framework::Impl::NativeAppPaused(framework);
-        Dali::Internal::Adaptor::Framework::Impl::NativeWindowDestroyed(framework, app->window);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppPaused(framework);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeWindowDestroyed(framework, app->window);
         break;
       case APP_CMD_GAINED_FOCUS:
         break;
       case APP_CMD_LOST_FOCUS:
         break;
       case APP_CMD_DESTROY:
-        Dali::Internal::Adaptor::Framework::Impl::NativeAppPaused(framework);
-        Dali::Internal::Adaptor::Framework::Impl::NativeAppDestroyed(framework);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppPaused(framework);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppDestroyed(framework);
         break;
     }
   }
 
   static int32_t HandleAppInput(struct android_app* app, AInputEvent* event)
   {
-    Framework* framework = AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework();
+    FrameworkAndroid* framework = static_cast<FrameworkAndroid*>(AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework());
 
     if(AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION)
     {
@@ -441,7 +412,7 @@ struct Framework::Impl
       }
 
       Dali::TouchPoint point(deviceId, state, x, y);
-      Dali::Internal::Adaptor::Framework::Impl::NativeAppTouchEvent(framework, point, timeStamp);
+      Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppTouchEvent(framework, point, timeStamp);
       return 1;
     }
     else if(AInputEvent_getType(event) == AINPUT_EVENT_TYPE_KEY)
@@ -471,7 +442,7 @@ struct Framework::Impl
           break;
       }
       Dali::KeyEvent keyEvent = Dali::DevelKeyEvent::New(keyName, "", "", keyCode, 0, timeStamp, state, "", "", Device::Class::NONE, Device::Subclass::NONE);
-      Dali::Internal::Adaptor::Framework::Impl::NativeAppKeyEvent(framework, keyEvent);
+      Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppKeyEvent(framework, keyEvent);
       return 1;
     }
 
@@ -480,7 +451,7 @@ struct Framework::Impl
 
   static void HandleAppIdle(struct android_app* app, struct android_poll_source* source)
   {
-    Framework* framework = AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework();
+    FrameworkAndroid* framework = static_cast<FrameworkAndroid*>(AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework());
     if(framework && framework->mImpl)
     {
       framework->mImpl->OnIdle();
@@ -488,23 +459,15 @@ struct Framework::Impl
   }
 };
 
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
+FrameworkAndroid::FrameworkAndroid(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mInitialised(false),
-  mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
   mImpl(NULL)
 {
   mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkAndroid::~FrameworkAndroid()
 {
   if(mRunning)
   {
@@ -515,11 +478,11 @@ Framework::~Framework()
   mImpl = nullptr;
 }
 
-void Framework::Run()
+void FrameworkAndroid::Run()
 {
   struct android_app* app = AndroidFramework::Get().GetNativeApplication();
-  app->onAppCmd           = Framework::Impl::HandleAppCmd;
-  app->onInputEvent       = Framework::Impl::HandleAppInput;
+  app->onAppCmd           = FrameworkAndroid::Impl::HandleAppCmd;
+  app->onInputEvent       = FrameworkAndroid::Impl::HandleAppInput;
 
   struct android_poll_source* source;
   struct android_poll_source  idlePollSource;
@@ -606,7 +569,7 @@ void Framework::Run()
   mRunning = false;
 }
 
-unsigned int Framework::AddIdle(int timeout, void* data, bool (*callback)(void* data))
+unsigned int FrameworkAndroid::AddIdle(int timeout, void* data, bool (*callback)(void* data))
 {
   if(mImpl)
   {
@@ -615,7 +578,8 @@ unsigned int Framework::AddIdle(int timeout, void* data, bool (*callback)(void*
 
   return 0;
 }
-void Framework::RemoveIdle(unsigned int id)
+
+void FrameworkAndroid::RemoveIdle(unsigned int id)
 {
   if(mImpl)
   {
@@ -623,7 +587,7 @@ void Framework::RemoveIdle(unsigned int id)
   }
 }
 
-void Framework::Quit()
+void FrameworkAndroid::Quit()
 {
   struct android_app* app = AndroidFramework::Get().GetNativeApplication();
   if(app && !app->destroyRequested && !mImpl->mFinishRequested)
@@ -633,60 +597,7 @@ void Framework::Quit()
   }
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-  mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
-  return mBundleId;
-}
-
-std::string Framework::GetResourcePath()
-{
-  return DALI_DATA_RO_DIR;
-}
-
-std::string Framework::GetDataPath()
-{
-  return "";
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-  mBundleId = id;
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void* data)
+bool FrameworkAndroid::AppStatusHandler(int type, void* data)
 {
   Dali::Adaptor* adaptor = nullptr;
   switch(type)
@@ -757,18 +668,47 @@ bool Framework::AppStatusHandler(int type, void* data)
   return true;
 }
 
-void Framework::InitThreads()
+/**
+ * Impl for Pre-Initailized using UI Thread.
+ */
+struct UIThreadLoader::Impl
+{
+  // Constructor
+
+  Impl(void *data)
+  {
+  }
+
+  ~Impl()
+  {
+  }
+
+  void Run(Runner runner)
+  {
+  }
+
+private:
+  // Undefined
+  Impl(const Impl& impl);
+  Impl& operator=(const Impl& impl);
+};
+
+/**
+ * UI Thread loader to support Pre-Initailized using UI Thread.
+ */
+UIThreadLoader::UIThreadLoader(int* argc, char*** argv)
+: mArgc(argc),
+  mArgv(argv),
+  mImpl(nullptr)
 {
 }
 
-std::string Framework::GetLanguage() const
+UIThreadLoader::~UIThreadLoader()
 {
-  return mImpl->GetLanguage();
 }
 
-std::string Framework::GetRegion() const
+void UIThreadLoader::Run(Runner runner)
 {
-  return mImpl->GetRegion();
 }
 
 } // namespace Adaptor
diff --git a/dali/internal/adaptor/android/framework-android.h b/dali/internal/adaptor/android/framework-android.h
new file mode 100644 (file)
index 0000000..3290fcd
--- /dev/null
@@ -0,0 +1,91 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/android/framework-android-interface.h>
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkAndroid class provides an Framework Android implementation.
+ */
+class FrameworkAndroid : public Framework, public FrameworkAndroidInterface
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkAndroid(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkAndroid();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::AppStatusHandler()
+   */
+  bool AppStatusHandler(int type, void* data) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::AddIdle()
+   */
+  unsigned int AddIdle(int timeout, void* data, bool (*callback)(void* data)) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::RemoveIdle()
+   */
+  void RemoveIdle(unsigned int id) override;
+
+private:
+  // Undefined
+  FrameworkAndroid(const FrameworkAndroid&) = delete;
+  FrameworkAndroid& operator=(FrameworkAndroid&) = delete;
+
+private:
+  bool mInitialised;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_H
diff --git a/dali/internal/adaptor/android/framework-factory-android.cpp b/dali/internal/adaptor/android/framework-factory-android.cpp
new file mode 100644 (file)
index 0000000..29acd0b
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/android/framework-factory-android.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/android/framework-android.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryAndroid::CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkAndroid>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+FrameworkFactory* GetFrameworkFactory()
+{
+  static std::unique_ptr<FrameworkFactory> frameworkFactory = nullptr;
+
+  if(!frameworkFactory)
+  {
+    frameworkFactory = Utils::MakeUnique<FrameworkFactoryAndroid>();
+  }
+  return frameworkFactory.get();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/android/framework-factory-android.h b/dali/internal/adaptor/android/framework-factory-android.h
new file mode 100644 (file)
index 0000000..4b3b9e6
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryAndroid : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(FrameworkBackend frameworkType, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_FACTORY_H
index 649d28152b7033a4d4e17676709d26944f0706ee..4fd36c1d1f46a02062369cc895b9d2b458d0901d 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.
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/androidjni/framework-androidjni.h>
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/application-devel.h>
@@ -28,7 +27,6 @@
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/android/android-framework-impl.h>
 #include <dali/internal/adaptor/common/application-impl.h>
-#include <dali/internal/system/common/callback-manager.h>
 
 using namespace Dali;
 
@@ -41,15 +39,11 @@ namespace Adaptor
 /**
  * Impl to hide android data members
  */
-struct Framework::Impl
+struct FrameworkAndroidJni::Impl
 {
   // Constructor
 
-  Impl(Framework* framework)
-  : mAbortCallBack(nullptr),
-    mCallbackManager(CallbackManager::New()),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED")
+  Impl(FrameworkAndroidJni* framework)
   {
     AndroidFramework::GetImplementation(AndroidFramework::Get()).SetFramework(framework);
   }
@@ -57,50 +51,18 @@ struct Framework::Impl
   ~Impl()
   {
     AndroidFramework::GetImplementation(AndroidFramework::Get()).SetFramework(nullptr);
-
-    delete mAbortCallBack;
-    mAbortCallBack = nullptr;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-    mCallbackManager = nullptr;
-  }
-
-  std::string GetLanguage() const
-  {
-    return mLanguage;
-  }
-
-  std::string GetRegion() const
-  {
-    return mRegion;
   }
-
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  std::string      mLanguage;
-  std::string      mRegion;
 };
 
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
+FrameworkAndroidJni::FrameworkAndroidJni(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mInitialised(false),
-  mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
   mImpl(NULL)
 {
   mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkAndroidJni::~FrameworkAndroidJni()
 {
   if(mRunning)
   {
@@ -111,13 +73,13 @@ Framework::~Framework()
   mImpl = nullptr;
 }
 
-void Framework::Run()
+void FrameworkAndroidJni::Run()
 {
   AndroidFramework::GetImplementation(AndroidFramework::Get()).SetFramework(this);
   mRunning = true;
 }
 
-unsigned int Framework::AddIdle(int timeout, void* data, bool (*callback)(void* data))
+unsigned int FrameworkAndroidJni::AddIdle(int timeout, void* data, bool (*callback)(void* data))
 {
   JNIEnv* env    = nullptr;
   JavaVM* javaVM = AndroidFramework::Get().GetJVM();
@@ -145,7 +107,7 @@ unsigned int Framework::AddIdle(int timeout, void* data, bool (*callback)(void*
   return static_cast<unsigned int>(id);
 }
 
-void Framework::RemoveIdle(unsigned int id)
+void FrameworkAndroidJni::RemoveIdle(unsigned int id)
 {
   JNIEnv* env    = nullptr;
   JavaVM* javaVM = AndroidFramework::Get().GetJVM();
@@ -172,65 +134,12 @@ void Framework::RemoveIdle(unsigned int id)
   env->CallStaticVoidMethod(clazz, removeIdle, static_cast<jint>(id));
 }
 
-void Framework::Quit()
+void FrameworkAndroidJni::Quit()
 {
   DALI_LOG_ERROR("Quit does nothing for DaliView!");
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-  mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
-  return mBundleId;
-}
-
-std::string Framework::GetResourcePath()
-{
-  return DALI_DATA_RO_DIR;
-}
-
-std::string Framework::GetDataPath()
-{
-  return "";
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-  mBundleId = id;
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void* data)
+bool FrameworkAndroidJni::AppStatusHandler(int type, void* data)
 {
   Dali::Adaptor* adaptor = nullptr;
   switch(type)
@@ -272,7 +181,6 @@ bool Framework::AppStatusHandler(int type, void* data)
     case APP_DESTROYED:
       mObserver.OnTerminate();
       mRunning     = false;
-      mPaused      = false;
       mInitialised = false;
       break;
 
@@ -283,18 +191,47 @@ bool Framework::AppStatusHandler(int type, void* data)
   return true;
 }
 
-void Framework::InitThreads()
+/**
+ * Impl for Pre-Initailized using UI Thread.
+ */
+struct UIThreadLoader::Impl
+{
+  // Constructor
+
+  Impl(void *data)
+  {
+  }
+
+  ~Impl()
+  {
+  }
+
+  void Run(Runner runner)
+  {
+  }
+
+private:
+  // Undefined
+  Impl(const Impl& impl);
+  Impl& operator=(const Impl& impl);
+};
+
+/**
+ * UI Thread loader to support Pre-Initailized using UI Thread.
+ */
+UIThreadLoader::UIThreadLoader(int* argc, char*** argv)
+: mArgc(argc),
+  mArgv(argv),
+  mImpl(nullptr)
 {
 }
 
-std::string Framework::GetLanguage() const
+UIThreadLoader::~UIThreadLoader()
 {
-  return mImpl->GetLanguage();
 }
 
-std::string Framework::GetRegion() const
+void UIThreadLoader::Run(Runner runner)
 {
-  return mImpl->GetRegion();
 }
 
 } // namespace Adaptor
diff --git a/dali/internal/adaptor/androidjni/framework-androidjni.h b/dali/internal/adaptor/androidjni/framework-androidjni.h
new file mode 100644 (file)
index 0000000..7ee94dd
--- /dev/null
@@ -0,0 +1,91 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/android/framework-android-interface.h>
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkAndroidJni class provides an Framework Android JNI implementation.
+ */
+class FrameworkAndroidJni : public Framework, public FrameworkAndroidInterface
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkAndroidJni(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkAndroidJni();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::AppStatusHandler()
+   */
+  bool AppStatusHandler(int type, void* data) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::AddIdle()
+   */
+  unsigned int AddIdle(int timeout, void* data, bool (*callback)(void* data)) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::RemoveIdle()
+   */
+  void RemoveIdle(unsigned int id) override;
+
+private:
+  // Undefined
+  FrameworkAndroidJni(const FrameworkAndroidJni&) = delete;
+  FrameworkAndroidJni& operator=(FrameworkAndroidJni&) = delete;
+
+private:
+  bool mInitialised;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_H
diff --git a/dali/internal/adaptor/androidjni/framework-factory-androidjni.cpp b/dali/internal/adaptor/androidjni/framework-factory-androidjni.cpp
new file mode 100644 (file)
index 0000000..d4dd93c
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/androidjni/framework-factory-androidjni.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/androidjni/framework-androidjni.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryAndroidJni::CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkAndroidJni>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+FrameworkFactory* GetFrameworkFactory()
+{
+  static std::unique_ptr<FrameworkFactory> frameworkFactory = nullptr;
+
+  if(!frameworkFactory)
+  {
+    frameworkFactory = Utils::MakeUnique<FrameworkFactoryAndroidJni>();
+  }
+  return frameworkFactory.get();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/androidjni/framework-factory-androidjni.h b/dali/internal/adaptor/androidjni/framework-factory-androidjni.h
new file mode 100644 (file)
index 0000000..782ed97
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryAndroidJni : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(FrameworkBackend frameworkType, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_FACTORY_H
index 8d4d271e02d8e41cf376da682083e0dc43b955dd..3fc83d077a937c7abf3b4deff666956b7cddce34 100644 (file)
@@ -62,6 +62,7 @@
 #include <dali/internal/graphics/gles/gl-proxy-implementation.h>
 #include <dali/internal/system/common/callback-manager.h>
 #include <dali/internal/system/common/object-profiler.h>
+#include <dali/internal/system/common/system-factory.h>
 #include <dali/internal/window-system/common/display-connection.h>
 #include <dali/internal/window-system/common/display-utils.h> // For Utils::MakeUnique
 #include <dali/internal/window-system/common/event-handler.h>
@@ -162,7 +163,7 @@ void Adaptor::Initialize(GraphicsFactory& graphicsFactory)
   mEnvironmentOptions->CreateTraceManager(mPerformanceInterface);
   mEnvironmentOptions->InstallTraceFunction(); // install tracing for main thread
 
-  mCallbackManager = CallbackManager::New();
+  mCallbackManager = Dali::Internal::Adaptor::GetSystemFactory()->CreateCallbackManager();
 
   Dali::Internal::Adaptor::SceneHolder* defaultWindow = mWindows.front();
 
@@ -365,7 +366,9 @@ Adaptor::~Adaptor()
 
   delete mDisplayConnection;
   delete mPlatformAbstraction;
-  delete mCallbackManager;
+
+  mCallbackManager.reset();
+
   delete mPerformanceInterface;
 
   mGraphics->Destroy();
index 1f68c22d980c6f1905b88bb2a35ca8614ad14c4f..e058047294d3a5bc508700f902a9f0999a481cee 100644 (file)
@@ -689,26 +689,26 @@ private:                                          // Data
 
   TizenPlatform::TizenPlatformAbstraction* mPlatformAbstraction; ///< Platform abstraction
 
-  CallbackManager*            mCallbackManager;                       ///< Used to install callbacks
-  bool                        mNotificationOnIdleInstalled;           ///< whether the idle handler is installed to send an notification event
-  TriggerEventInterface*      mNotificationTrigger;                   ///< Notification event trigger
-  FeedbackPluginProxy*        mDaliFeedbackPlugin;                    ///< Used to access feedback support
-  FeedbackController*         mFeedbackController;                    ///< Plays feedback effects for Dali-Toolkit UI Controls.
-  Dali::TtsPlayer             mTtsPlayers[Dali::TtsPlayer::MODE_NUM]; ///< Provides TTS support
-  ObserverContainer           mObservers;                             ///< A list of adaptor observer pointers
-  EnvironmentOptions*         mEnvironmentOptions;                    ///< environment options
-  PerformanceInterface*       mPerformanceInterface;                  ///< Performance interface
-  KernelTrace                 mKernelTracer;                          ///< Kernel tracer
-  SystemTrace                 mSystemTracer;                          ///< System tracer
-  ObjectProfiler*             mObjectProfiler;                        ///< Tracks object lifetime for profiling
-  Dali::Timer                 mMemoryPoolTimer;                       ///< Logs memory pool capacity
-  SlotDelegate<Adaptor>       mMemoryPoolTimerSlotDelegate;
-  SocketFactory               mSocketFactory;               ///< Socket factory
-  Mutex                       mMutex;                       ///< Mutex
-  ThreadMode                  mThreadMode;                  ///< The thread mode
-  const bool                  mEnvironmentOptionsOwned : 1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
-  bool                        mUseRemoteSurface : 1;        ///< whether the remoteSurface is used or not
-  Dali::LayoutDirection::Type mRootLayoutDirection;         ///< LayoutDirection of window
+  std::unique_ptr<CallbackManager> mCallbackManager;                       ///< Used to install callbacks
+  bool                             mNotificationOnIdleInstalled;           ///< whether the idle handler is installed to send an notification event
+  TriggerEventInterface*           mNotificationTrigger;                   ///< Notification event trigger
+  FeedbackPluginProxy*             mDaliFeedbackPlugin;                    ///< Used to access feedback support
+  FeedbackController*              mFeedbackController;                    ///< Plays feedback effects for Dali-Toolkit UI Controls.
+  Dali::TtsPlayer                  mTtsPlayers[Dali::TtsPlayer::MODE_NUM]; ///< Provides TTS support
+  ObserverContainer                mObservers;                             ///< A list of adaptor observer pointers
+  EnvironmentOptions*              mEnvironmentOptions;                    ///< environment options
+  PerformanceInterface*            mPerformanceInterface;                  ///< Performance interface
+  KernelTrace                      mKernelTracer;                          ///< Kernel tracer
+  SystemTrace                      mSystemTracer;                          ///< System tracer
+  ObjectProfiler*                  mObjectProfiler;                        ///< Tracks object lifetime for profiling
+  Dali::Timer                      mMemoryPoolTimer;                       ///< Logs memory pool capacity
+  SlotDelegate<Adaptor>            mMemoryPoolTimerSlotDelegate;
+  SocketFactory                    mSocketFactory;               ///< Socket factory
+  Mutex                            mMutex;                       ///< Mutex
+  ThreadMode                       mThreadMode;                  ///< The thread mode
+  const bool                       mEnvironmentOptionsOwned : 1; ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
+  bool                             mUseRemoteSurface : 1;        ///< whether the remoteSurface is used or not
+  Dali::LayoutDirection::Type      mRootLayoutDirection;         ///< LayoutDirection of window
 
   std::unique_ptr<Integration::AddOnManager> mAddOnManager; ///< Pointer to the addon manager
 
index d6afc6d91b71ba9ccf7effbc8adc704b475eb2b6..9bad3be00722d5fa0ed04e640913b03c587b9b55 100644 (file)
 #include <dali/devel-api/atspi-interfaces/accessible.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/adaptor/common/framework-factory.h>
 #include <dali/internal/adaptor/common/framework.h>
 #include <dali/internal/adaptor/common/lifecycle-controller-impl.h>
 #include <dali/internal/system/common/command-line-options.h>
 #include <dali/internal/system/common/environment-variables.h>
+#include <dali/internal/system/common/system-settings.h>
 #include <dali/internal/window-system/common/render-surface-factory.h>
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/window-render-surface.h>
@@ -79,11 +81,35 @@ void Application::PreInitialize(int* argc, char** argv[])
 {
   if(!gPreInitializedApplication)
   {
+    char* retEnv = std::getenv("TIZEN_UI_THREAD");
+    bool isUseUIThread = false;
+    if(retEnv)
+    {
+      std::string uiThreadEnv = retEnv;
+      std::string enabledString = "true";
+      if(uiThreadEnv == enabledString)
+      {
+        isUseUIThread = true;
+      }
+    }
+
     Dali::TextAbstraction::FontClientPreInitialize();
     WindowData windowData;
-    gPreInitializedApplication                  = new Application(argc, argv, "", Framework::NORMAL, false, windowData);
+    gPreInitializedApplication                  = new Application(argc, argv, "", Framework::NORMAL, isUseUIThread, windowData);
     gPreInitializedApplication->mLaunchpadState = Launchpad::PRE_INITIALIZED;
-    gPreInitializedApplication->CreateWindow(); // Only create window
+    if(isUseUIThread)
+    {
+      DALI_LOG_RELEASE_INFO("PRE_INITIALIZED with UI Threading");
+      gPreInitializedApplication->mUIThreadLoader = new UIThreadLoader(argc, argv);
+      gPreInitializedApplication->mUIThreadLoader->Run([&](){gPreInitializedApplication->CreateWindow();});
+    }
+    else
+    {
+      DALI_LOG_RELEASE_INFO("Only PRE_INITIALIZED");
+      gPreInitializedApplication->CreateWindow(); // Only create window
+    }
+
+
   }
 }
 
@@ -109,7 +135,9 @@ Application::Application(int* argc, char** argv[], const std::string& stylesheet
   mLaunchpadState(Launchpad::NONE),
   mDefaultWindowType(windowData.GetWindowType()),
   mUseUiThread(useUiThread),
-  mSlotDelegate(this)
+  mIsSystemInitialized(false),
+  mSlotDelegate(this),
+  mUIThreadLoader(nullptr)
 {
   // Set mName from command-line args
   if(argc && (*argc > 0))
@@ -124,8 +152,9 @@ Application::Application(int* argc, char** argv[], const std::string& stylesheet
   }
 
   mCommandLineOptions = new CommandLineOptions(argc, argv);
-  mFramework          = new Framework(*this, *this, argc, argv, applicationType, mUseUiThread);
-  mUseRemoteSurface   = (applicationType == Framework::WATCH);
+  mFramework          = Dali::Internal::Adaptor::GetFrameworkFactory()->CreateFramework(FrameworkBackend::DEFAULT, *this, *this, argc, argv, applicationType, mUseUiThread);
+
+  mUseRemoteSurface = (applicationType == Framework::WATCH);
 }
 
 Application::~Application()
@@ -140,7 +169,6 @@ Application::~Application()
   mMainWindow.Reset();
 
   delete mCommandLineOptions;
-  delete mFramework;
 
   // Application is created in Main thread whether UI Threading is enabled or not.
   // But some resources are created in Main thread or UI thread.
@@ -149,7 +177,17 @@ Application::~Application()
   {
     delete mAdaptor;
     delete mAdaptorBuilder;
-    WindowSystem::Shutdown();
+    if(mIsSystemInitialized)
+    {
+      WindowSystem::Shutdown();
+    }
+  }
+  else
+  {
+    if(mUIThreadLoader)
+    {
+      delete mUIThreadLoader;
+    }
   }
 }
 
@@ -210,7 +248,10 @@ void Application::CreateWindow()
   windowData.SetTransparency(mMainWindowMode);
   windowData.SetWindowType(mDefaultWindowType);
 
+  DALI_LOG_RELEASE_INFO("Create Default Window");
+
   WindowSystem::Initialize();
+  mIsSystemInitialized = true;
 
   if(mLaunchpadState != Launchpad::PRE_INITIALIZED)
   {
@@ -311,6 +352,7 @@ void Application::OnInit()
   // If an application was pre-initialized, a window was made in advance
   if(mLaunchpadState == Launchpad::NONE)
   {
+    DALI_LOG_RELEASE_INFO("default Window is created in standalone");
     CreateWindow();
   }
 
@@ -553,12 +595,12 @@ Dali::Window Application::GetWindow()
 
 std::string Application::GetResourcePath()
 {
-  return Internal::Adaptor::Framework::GetResourcePath();
+  return SystemSettings::GetResourcePath();
 }
 
 std::string Application::GetDataPath()
 {
-  return Internal::Adaptor::Framework::GetDataPath();
+  return SystemSettings::GetDataPath();
 }
 
 void Application::SetStyleSheet(const std::string& stylesheet)
index 6eeb016742c6bcbd714a967399fe3adb3211e081..914664a9f4c3bb9e04d7240215770bac7c6e993a 100644 (file)
@@ -520,7 +520,7 @@ private:
   LowMemorySignalType                mTaskLowMemorySignal;
   DeviceOrientationChangedSignalType mTaskDeviceOrientationChangedSignal;
 
-  Framework* mFramework;
+  std::unique_ptr<Framework> mFramework;
 
   CommandLineOptions* mCommandLineOptions;
 
@@ -540,9 +540,11 @@ private:
   WindowType       mDefaultWindowType; ///< Default window's type. It is used when Application is created.
   bool             mUseRemoteSurface;
   bool             mUseUiThread;
+  bool             mIsSystemInitialized;
 
   SlotDelegate<Application> mSlotDelegate;
 
+  UIThreadLoader* mUIThreadLoader;
   static ApplicationPtr gPreInitializedApplication;
 };
 
diff --git a/dali/internal/adaptor/common/framework-factory.h b/dali/internal/adaptor/common/framework-factory.h
new file mode 100644 (file)
index 0000000..885cdb1
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+enum class FrameworkBackend
+{
+  DEFAULT,
+  GLIB
+};
+
+class FrameworkFactory
+{
+public:
+  FrameworkFactory()          = default;
+  virtual ~FrameworkFactory() = default;
+
+  virtual std::unique_ptr<Framework> CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) = 0;
+  virtual FrameworkBackend           GetFrameworkBackend() const
+  {
+    return FrameworkBackend::DEFAULT;
+  }
+};
+
+extern FrameworkFactory* GetFrameworkFactory();
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_FACTORY_H
diff --git a/dali/internal/adaptor/common/framework.cpp b/dali/internal/adaptor/common/framework.cpp
new file mode 100644 (file)
index 0000000..b53319d
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace
+{
+constexpr auto NOT_SUPPORTED = "NOT_SUPPORTED";
+} // namespace
+
+Framework::Framework(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: mObserver(observer),
+  mTaskObserver(taskObserver),
+  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
+  mArgc(argc),
+  mArgv(argv),
+  mAbortCallBack(),
+  mRunning(false)
+{
+}
+
+Framework::~Framework()
+{
+}
+
+std::string Framework::GetLanguage() const
+{
+  return NOT_SUPPORTED;
+}
+
+std::string Framework::GetRegion() const
+{
+  return NOT_SUPPORTED;
+}
+
+bool Framework::IsMainLoopRunning()
+{
+  return mRunning;
+}
+
+void Framework::AddAbortCallback(CallbackBase* callback)
+{
+  mAbortCallBack = std::unique_ptr<CallbackBase>(callback);
+}
+
+void Framework::AbortCallback()
+{
+  // if an abort call back has been installed run it.
+  if(mAbortCallBack)
+  {
+    CallbackBase::Execute(*mAbortCallBack);
+  }
+  else
+  {
+    Quit();
+  }
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index cf8760f4b14dffdd20468f7b4a684687a50b2a6b..0f64fc52e1f9be8f85c839490784668e8c98f11b 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_FRAMEWORK_H
-#define DALI_INTERNAL_FRAMEWORK_H
+#ifndef DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_H
 
 /*
- * 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.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/signals/callback.h>
+#include <functional>
 #include <string>
 #ifdef APPCORE_WATCH_AVAILABLE
 #include <dali/public-api/watch/watch-application.h>
@@ -45,7 +46,6 @@ namespace Adaptor
  * The class is also used to register callbacks with the TIZEN platform so that
  * we know when any of the application lifecycle events occur.  This includes events
  * like when our application is to be initialised, terminated, paused, resumed etc.
- *
  */
 class Framework
 {
@@ -276,18 +276,28 @@ public:
   /**
    * Destructor
    */
-  ~Framework();
+  virtual ~Framework();
 
 public:
   /**
    * Runs the main loop of framework
    */
-  void Run();
+  virtual void Run() = 0;
 
   /**
    * Quits the main loop
    */
-  void Quit();
+  virtual void Quit() = 0;
+
+  /**
+   * Gets system language.
+   */
+  virtual std::string GetLanguage() const;
+
+  /**
+   * Gets system region.
+   */
+  virtual std::string GetRegion() const;
 
   /**
    * Checks whether the main loop of the framework is running.
@@ -303,16 +313,6 @@ public:
    */
   void AddAbortCallback(CallbackBase* callback);
 
-  /**
-   * Gets bundle name which was passed in app_reset callback.
-   */
-  std::string GetBundleName() const;
-
-  /**
-   * Gets bundle id which was passed in app_reset callback.
-   */
-  std::string GetBundleId() const;
-
   /**
    * Sets a command line options.
    * This is used in case of the preinitialized application.
@@ -325,100 +325,58 @@ public:
     mArgv = argv;
   }
 
+private:
   /**
-   *  Gets the path at which application resources are stored.
-   */
-  static std::string GetResourcePath();
-
-  /**
-   *  Gets the path at which application data are stored.
-   */
-  static std::string GetDataPath();
-
-  /**
-   * Sets system language.
-   */
-  void SetLanguage(const std::string& language);
-
-  /**
-   * Sets system region.
-   */
-  void SetRegion(const std::string& region);
-
-  /**
-   * Gets system language.
-   */
-  std::string GetLanguage() const;
-
-  /**
-   * Gets system region.
-   */
-  std::string GetRegion() const;
-
-  /**
-   * Called by the App framework when an application lifecycle event occurs.
-   * @param[in] type The type of event occurred.
-   * @param[in] data The data of event occurred.
-   */
-  bool AppStatusHandler(int type, void* data);
-
-  /**
-   * Called by the adaptor when an idle callback is added.
-   * @param[in] timeout The timeout of the callback.
-   * @param[in] data The data of of the callback.
-   * @param[in] callback The callback.
-   * @return The callback id.
-   */
-  unsigned int AddIdle(int timeout, void* data, bool (*callback)(void* data));
-
-  /**
-   * Called by the adaptor when an idle callback is removed.
-   * @param[in] id The callback id.
+   * Called if the application is aborted.
    */
-  void RemoveIdle(unsigned int id);
+  void AbortCallback();
 
 private:
   // Undefined
-  Framework(const Framework&);
-  Framework& operator=(Framework&);
+  Framework(const Framework&) = delete;
+  Framework& operator=(Framework&) = delete;
+
+protected:
+  Observer&                     mObserver;
+  TaskObserver&                 mTaskObserver;
+  AbortHandler                  mAbortHandler;
+  int*                          mArgc;
+  char***                       mArgv;
+  std::unique_ptr<CallbackBase> mAbortCallBack;
+  bool                          mRunning;
+};
 
-private:
-  /**
-   * Called when the application is created.
-   */
-  bool Create();
+class UIThreadLoader
+{
+public:
+  using Runner = std::function<void()>;
 
   /**
-   * Called app_reset callback was called with bundle.
+   * Constructor
+   * @param[in] argc A pointer to the number of arguments.
+   * @param[in] argv A pointer the the argument list.
    */
-  void SetBundleName(const std::string& name);
+  UIThreadLoader(int* argc, char*** argv);
 
   /**
-   * Called app_reset callback was called with bundle.
+   * Destructor
    */
-  void SetBundleId(const std::string& id);
+  ~UIThreadLoader();
 
+public:
   /**
-   * Called if the application is aborted.
+   * Runs the main loop of framework
    */
-  void AbortCallback();
+  void Run(Runner runner);
 
-  /**
-   * Called for initializing on specified backend. (X11 or Wayland)
-   */
-  void InitThreads();
+private:
+  // Undefined
+  UIThreadLoader(const UIThreadLoader&) = delete;
+  UIThreadLoader& operator=(UIThreadLoader&) = delete;
 
 private:
-  Observer&     mObserver;
-  TaskObserver& mTaskObserver;
-  bool          mInitialised;
-  bool          mPaused;
-  bool          mRunning;
-  int*          mArgc;
-  char***       mArgv;
-  std::string   mBundleName;
-  std::string   mBundleId;
-  AbortHandler  mAbortHandler;
+  int*    mArgc;
+  char*** mArgv;
 
 private: // impl members
   struct Impl;
@@ -431,4 +389,4 @@ private: // impl members
 
 } // namespace Dali
 
-#endif // DALI_INTERNAL_FRAMEWORK_H
+#endif // DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_H
index 3dae4b5b570fb190724590c3a2f254a896cdd1af..95b6f5870c8557f0e0b7ce91bee05d217b40e1c4 100644 (file)
@@ -7,24 +7,29 @@ SET( adaptor_adaptor_common_src_files
     ${adaptor_adaptor_dir}/common/adaptor-builder-impl.cpp
     ${adaptor_adaptor_dir}/common/application-impl.cpp
     ${adaptor_adaptor_dir}/common/combined-update-render-controller.cpp
+    ${adaptor_adaptor_dir}/common/framework.cpp
     ${adaptor_adaptor_dir}/common/system-cache-path.cpp
 )
 
 # module: adaptor, backend: tizen-wayland
 SET( adaptor_adaptor_tizen_wayland_src_files
+    ${adaptor_adaptor_dir}/glib/framework-glib.cpp
     ${adaptor_adaptor_dir}/tizen-wayland/adaptor-impl-tizen.cpp
+    ${adaptor_adaptor_dir}/tizen-wayland/framework-factory-tizen.cpp
     ${adaptor_adaptor_dir}/tizen-wayland/framework-tizen.cpp
 )
 
 # module: adaptor, backend: libuv-x11
 SET( adaptor_adaptor_libuv_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/libuv/framework-factory-libuv.cpp
     ${adaptor_adaptor_dir}/libuv/framework-libuv.cpp
 )
 
 # module: adaptor, backend: glib-x11
 SET( adaptor_adaptor_glib_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/glib/framework-factory-glib.cpp
     ${adaptor_adaptor_dir}/glib/framework-glib.cpp
 )
 
@@ -37,6 +42,8 @@ SET( adaptor_adaptor_tizen_wearable_src_files
 # module: adaptor, backend: ubuntu
 SET( adaptor_adaptor_ubuntu_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/glib/framework-glib.cpp
+    ${adaptor_adaptor_dir}/ubuntu/framework-factory-ubuntu.cpp
     ${adaptor_adaptor_dir}/ubuntu/framework-ubuntu.cpp
 )
 
@@ -44,6 +51,7 @@ SET( adaptor_adaptor_ubuntu_src_files
 SET( adaptor_adaptor_android_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
     ${adaptor_adaptor_dir}/android/android-framework-impl.cpp
+    ${adaptor_adaptor_dir}/android/framework-factory-android.cpp
     ${adaptor_adaptor_dir}/android/framework-android.cpp
 )
 
@@ -51,12 +59,14 @@ SET( adaptor_adaptor_android_src_files
 SET( adaptor_adaptor_androidjni_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
     ${adaptor_adaptor_dir}/android/android-framework-impl.cpp
+    ${adaptor_adaptor_dir}/androidjni/framework-factory-androidjni.cpp
     ${adaptor_adaptor_dir}/androidjni/framework-androidjni.cpp
 )
 
 # module: adaptor, backend: windows
 SET( adaptor_adaptor_windows_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/windows/framework-factory-win.cpp
     ${adaptor_adaptor_dir}/windows/framework-win.cpp
 )
 
@@ -68,5 +78,6 @@ SET( adaptor_adaptor_component_application_src_files
 # module: adaptor, backend: macos
 SET( adaptor_adaptor_macos_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/macos/framework-factory-mac.mm
     ${adaptor_adaptor_dir}/macos/framework-mac.mm
 )
diff --git a/dali/internal/adaptor/glib/framework-factory-glib.cpp b/dali/internal/adaptor/glib/framework-factory-glib.cpp
new file mode 100644 (file)
index 0000000..baf5954
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/glib/framework-factory-glib.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/glib/framework-glib.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryGlib::CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkGlib>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+FrameworkFactory* GetFrameworkFactory()
+{
+  static std::unique_ptr<FrameworkFactory> frameworkFactory = nullptr;
+
+  if(!frameworkFactory)
+  {
+    frameworkFactory = Utils::MakeUnique<FrameworkFactoryGlib>();
+  }
+  return frameworkFactory.get();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/glib/framework-factory-glib.h b/dali/internal/adaptor/glib/framework-factory-glib.h
new file mode 100644 (file)
index 0000000..5969b3b
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryGlib : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(FrameworkBackend frameworkType, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_FACTORY_H
index 9b2842f1d451414da6d51fefe0f524f92100402a..5123131d4dce8499da5b6498fed125227ad7921f 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.
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/glib/framework-glib.h>
 
 // EXTERNAL INCLUDES
 #include <glib.h>
 #include <cstdio>
 #include <cstring>
 
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
-
 namespace Dali
 {
 namespace Internal
@@ -47,30 +42,17 @@ GMainContext* GetMainLoopContext()
 /**
  * Impl to hide GLib data members
  */
-struct Framework::Impl
+struct FrameworkGlib::Impl
 {
   // Constructor
   Impl(void* data)
-  : mAbortCallBack(nullptr),
-    mCallbackManager(nullptr),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED")
   {
-    mCallbackManager = CallbackManager::New();
-
-    // In future, may need to change this to have own context or use Tizen context
-    gMainLoop = mMainLoop = g_main_loop_new(nullptr, false);
+    GMainContext* context = g_main_context_new();
+    gMainLoop = mMainLoop = g_main_loop_new(context, false);
   }
 
   ~Impl()
   {
-    delete mAbortCallBack;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-
     g_main_loop_unref(mMainLoop);
     gMainLoop = nullptr;
   }
@@ -86,35 +68,22 @@ struct Framework::Impl
   }
 
   // Data
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  GMainLoop*       mMainLoop{nullptr};
-  GMainContext*    mContext{nullptr};
-
-  std::string mLanguage;
-  std::string mRegion;
+  GMainLoop*    mMainLoop{nullptr};
+  GMainContext* mContext{nullptr};
 
 private:
   Impl(const Impl& impl) = delete;
   Impl& operator=(const Impl& impl) = delete;
 };
 
-Framework::Framework(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
-  mInitialised(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
+FrameworkGlib::FrameworkGlib(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mImpl(NULL)
 {
   mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkGlib::~FrameworkGlib()
 {
   if(mRunning)
   {
@@ -124,7 +93,7 @@ Framework::~Framework()
   delete mImpl;
 }
 
-void Framework::Run()
+void FrameworkGlib::Run()
 {
   mRunning = true;
   mObserver.OnInit();
@@ -133,100 +102,12 @@ void Framework::Run()
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkGlib::Quit()
 {
   mObserver.OnTerminate();
   mImpl->Quit();
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-}
-
-std::string Framework::GetBundleId() const
-{
-  return "";
-}
-
-std::string Framework::GetResourcePath()
-{
-  // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path.
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string resourcePath;
-  if(value != NULL)
-  {
-    resourcePath = value;
-  }
-
-  if(resourcePath.back() != '/')
-  {
-    resourcePath += "/";
-  }
-
-  return resourcePath;
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void* bundleData)
-{
-  return true;
-}
-
-std::string Framework::GetLanguage() const
-{
-  return mImpl->mLanguage;
-}
-
-std::string Framework::GetRegion() const
-{
-  return mImpl->mRegion;
-}
-
-std::string Framework::GetDataPath()
-{
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string dataPath;
-  if(value != NULL)
-  {
-    dataPath = value;
-  }
-
-  return dataPath;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
diff --git a/dali/internal/adaptor/glib/framework-glib.h b/dali/internal/adaptor/glib/framework-glib.h
new file mode 100644 (file)
index 0000000..da44e6c
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkGlib class provides an Framework Glib implementation.
+ */
+class FrameworkGlib : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkGlib(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkGlib();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+private:
+  // Undefined
+  FrameworkGlib(const FrameworkGlib&) = delete;
+  FrameworkGlib& operator=(FrameworkGlib&) = delete;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_H
diff --git a/dali/internal/adaptor/libuv/framework-factory-libuv.cpp b/dali/internal/adaptor/libuv/framework-factory-libuv.cpp
new file mode 100644 (file)
index 0000000..b608d45
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/libuv/framework-factory-libuv.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/libuv/framework-libuv.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryLibuv::CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkLibuv>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+FrameworkFactory* GetFrameworkFactory()
+{
+  static std::unique_ptr<FrameworkFactory> frameworkFactory = nullptr;
+
+  if(!frameworkFactory)
+  {
+    frameworkFactory = Utils::MakeUnique<FrameworkFactoryLibuv>();
+  }
+  return frameworkFactory.get();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/libuv/framework-factory-libuv.h b/dali/internal/adaptor/libuv/framework-factory-libuv.h
new file mode 100644 (file)
index 0000000..2b4d0ae
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryLibuv : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(FrameworkBackend frameworkType, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_FACTORY_H
index ec8bf42473e6ebdf722b208eb7b2cb20dad48ea0..cc32e058afb7186d955aa8687d6981e2a5d8f8fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 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.
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/libuv/framework-libuv.h>
 
 // EXTERNAL INCLUDES
 #include <X11/Xlib.h>
 #include <cstdio>
 #include <cstring>
 
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
-
 namespace Dali
 {
 namespace Internal
@@ -48,31 +42,19 @@ uv_loop_t* GetUVMainLoop()
 /**
  * Impl to hide LibUV data members
  */
-struct Framework::Impl
+struct FrameworkLibuv::Impl
 {
   // Constructor
   Impl(void* data)
-  : mAbortCallBack(nullptr),
-    mCallbackManager(nullptr),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED")
   {
-    mCallbackManager = CallbackManager::New();
-    mMainLoop        = new uv_loop_t;
-    gUVLoop          = mMainLoop; // "There can be only one!"
+    mMainLoop = new uv_loop_t;
+    gUVLoop   = mMainLoop; // "There can be only one!"
 
     uv_loop_init(mMainLoop);
   }
 
   ~Impl()
   {
-    delete mAbortCallBack;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-
     delete mMainLoop;
   }
 
@@ -88,35 +70,21 @@ struct Framework::Impl
   }
 
   // Data
-
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  uv_loop_t*       mMainLoop;
-
-  std::string mLanguage;
-  std::string mRegion;
+  uv_loop_t* mMainLoop;
 
 private:
   Impl(const Impl& impl) = delete;
   Impl& operator=(const Impl& impl) = delete;
 };
 
-Framework::Framework(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
-  mInitialised(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
+FrameworkLibuv::FrameworkLibuv(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mImpl(NULL)
 {
   mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkLibuv::~FrameworkLibuv()
 {
   if(mRunning)
   {
@@ -126,7 +94,7 @@ Framework::~Framework()
   delete mImpl;
 }
 
-void Framework::Run()
+void FrameworkLibuv::Run()
 {
   mRunning = true;
   mObserver.OnInit();
@@ -135,98 +103,53 @@ void Framework::Run()
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkLibuv::Quit()
 {
   mObserver.OnTerminate();
   mImpl->Quit();
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-}
-
-std::string Framework::GetBundleId() const
+/**
+ * Impl for Pre-Initailized using UI Thread.
+ */
+struct UIThreadLoader::Impl
 {
-  return "";
-}
+  // Constructor
 
-std::string Framework::GetResourcePath()
-{
-  // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path.
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string resourcePath;
-  if(value != NULL)
+  Impl(void *data)
   {
-    resourcePath = value;
   }
 
-  if(resourcePath.back() != '/')
+  ~Impl()
   {
-    resourcePath += "/";
   }
 
-  return resourcePath;
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
+  void Run(Runner runner)
   {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
   }
-}
 
-bool Framework::AppStatusHandler(int type, void* bundleData)
-{
-  return true;
-}
+private:
+  // Undefined
+  Impl(const Impl& impl);
+  Impl& operator=(const Impl& impl);
+};
 
-std::string Framework::GetLanguage() const
+/**
+ * UI Thread loader to support Pre-Initailized using UI Thread.
+ */
+UIThreadLoader::UIThreadLoader(int* argc, char*** argv)
+: mArgc(argc),
+  mArgv(argv),
+  mImpl(nullptr)
 {
-  return mImpl->mLanguage;
 }
 
-std::string Framework::GetRegion() const
+UIThreadLoader::~UIThreadLoader()
 {
-  return mImpl->mRegion;
 }
 
-std::string Framework::GetDataPath()
+void UIThreadLoader::Run(Runner runner)
 {
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string dataPath;
-  if(value != NULL)
-  {
-    dataPath = value;
-  }
-
-  return dataPath;
 }
 
 } // namespace Adaptor
diff --git a/dali/internal/adaptor/libuv/framework-libuv.h b/dali/internal/adaptor/libuv/framework-libuv.h
new file mode 100644 (file)
index 0000000..837bb10
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkLibuv class provides an Framework Libuv implementation.
+ */
+class FrameworkLibuv : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Framework()
+   */
+  FrameworkLibuv(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkLibuv();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+private:
+  // Undefined
+  FrameworkLibuv(const FrameworkLibuv&) = delete;
+  FrameworkLibuv& operator=(FrameworkLibuv&) = delete;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_H
diff --git a/dali/internal/adaptor/macos/framework-factory-mac.h b/dali/internal/adaptor/macos/framework-factory-mac.h
new file mode 100644 (file)
index 0000000..1778d70
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_MAC_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_MAC_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryMac : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(FrameworkBackend frameworkType, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_MAC_FRAMEWORK_FACTORY_H
diff --git a/dali/internal/adaptor/macos/framework-factory-mac.mm b/dali/internal/adaptor/macos/framework-factory-mac.mm
new file mode 100644 (file)
index 0000000..8deb80e
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/macos/framework-factory-mac.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/macos/framework-mac.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryMac::CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkMac>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+FrameworkFactory* GetFrameworkFactory()
+{
+  static std::unique_ptr<FrameworkFactory> frameworkFactory = nullptr;
+
+  if(!frameworkFactory)
+  {
+    frameworkFactory = Utils::MakeUnique<FrameworkFactoryMac>();
+  }
+  return frameworkFactory.get();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/macos/framework-mac.h b/dali/internal/adaptor/macos/framework-mac.h
new file mode 100644 (file)
index 0000000..5cde983
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef DALI_INTERNAL_ADAPTOR_MACOS_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_MACOS_FRAMEWORK_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkMac class provides an Framework Mac implementation.
+ */
+class FrameworkMac : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkMac(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkMac();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+  /**
+   * Called by the App framework when an application lifecycle event occurs.
+   * @param[in] type The type of event occurred.
+   * @param[in] data The data of event occurred.
+   */
+  bool AppStatusHandler(int type, void* data);
+
+private:
+  // Undefined
+  FrameworkMac(const FrameworkMac&) = delete;
+  FrameworkMac& operator=(FrameworkMac&) = delete;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_MACOS_FRAMEWORK_H
index b9c1439efb7fc80ffd793e894ca3a4c02534d8f4..8f88f547a1fd765ad1df483aeb2d3152c6acf0f6 100644 (file)
@@ -1,5 +1,5 @@
 ï»¿/*
- * Copyright (c) 2020 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.
@@ -12,7 +12,6 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 #import <Cocoa/Cocoa.h>
 #include "extern-definitions.h"
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/macos/framework-mac.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
-
 namespace Dali
 {
 
@@ -53,102 +49,28 @@ enum
 
 } // Unnamed namespace
 
-/**
- * Impl to hide WindowsSystem data members
- */
-struct Framework::Impl
-{
-  // Constructor
-
-  Impl(void* data)
-  : mAbortCallBack( nullptr ),
-    mLanguage( "NOT_SUPPORTED" ),
-    mRegion( "NOT_SUPPORTED" )
-  {
-  }
-
-  ~Impl()
-  {
-    delete mAbortCallBack;
-  }
-
-  std::string GetLanguage() const
-  {
-    return mLanguage;
-  }
-
-  std::string GetRegion() const
-  {
-    return mRegion;
-  }
-
-  void SetAbortCallback( CallbackBase *base )
-  {
-    mAbortCallBack = base;
-  }
-
-  bool ExecuteCallback()
-  {
-    if( nullptr != mAbortCallBack )
-    {
-      CallbackBase::Execute( *mAbortCallBack );
-      return true;
-    }
-
-    return false;
-  }
-
-private:
-  // Undefined
-  Impl( const Impl& impl ) = delete;
-
-  // Undefined
-  Impl& operator=( const Impl& impl ) = delete;
-
-private:
-  // Data
-  CallbackBase* mAbortCallBack;
-  std::string mLanguage;
-  std::string mRegion;
-};
-
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
-  mInitialised(false),
-  mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler( MakeCallback( this, &Framework::AbortCallback ) ),
-  mImpl(NULL)
+FrameworkMac::FrameworkMac(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread)
 {
-    InitThreads();
-    mImpl = new Impl(this);
+  // ensures the NSApp global object is initialized
+  [NSApplication sharedApplication];
 
-    // ensures the NSApp global object is initialized
-    [NSApplication sharedApplication];
+  // this is needed for applications without a bundle
+  [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
 
-    // this is needed for applications without a bundle
-    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
-
-    // make sure we can become the key window
-    [NSApp activateIgnoringOtherApps:YES];
+  // make sure we can become the key window
+  [NSApp activateIgnoringOtherApps:YES];
 }
 
-Framework::~Framework()
+FrameworkMac::~FrameworkMac()
 {
   if (mRunning)
   {
     Quit();
   }
-
-  delete mImpl;
 }
 
-void Framework::Run()
+void FrameworkMac::Run()
 {
   mRunning = true;
   AppStatusHandler(APP_CREATE, nullptr);
@@ -156,82 +78,17 @@ void Framework::Run()
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkMac::Quit()
 {
   AppStatusHandler(APP_TERMINATE, nullptr);
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback( CallbackBase* callback )
-{
-  mImpl->SetAbortCallback( callback );
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-  mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
-  return mBundleId;
-}
-
-std::string Framework::GetResourcePath()
-{
-  // "DALI_APPLICATION_PACKAGE" is used by macOS specifically to get the already configured Application package path.
-  const char* macEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
-  char* value = getenv( macEnvironmentVariable );
-
-  std::string resourcePath;
-  if ( value != NULL )
-  {
-    resourcePath = value;
-  }
-
-  if( resourcePath.back() != '/' )
-  {
-    resourcePath+="/";
-  }
-
-  return resourcePath;
-}
-
-std::string Framework::GetDataPath()
-{
-  return app_get_data_path();
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-  mBundleId = id;
-}
-
-void Framework::AbortCallback( )
-{
-  // if an abort call back has been installed run it.
-  if( false == mImpl->ExecuteCallback() )
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void *)
+bool FrameworkMac::AppStatusHandler(int type, void *)
 {
   switch (type)
   {
     case APP_CREATE:
     {
-      mInitialised = true;
       mObserver.OnInit();
       break;
     }
@@ -263,18 +120,47 @@ bool Framework::AppStatusHandler(int type, void *)
   return true;
 }
 
-void Framework::InitThreads()
+/**
+ * Impl for Pre-Initailized using UI Thread.
+ */
+struct UIThreadLoader::Impl
+{
+  // Constructor
+
+  Impl(void *data)
+  {
+  }
+
+  ~Impl()
+  {
+  }
+
+  void Run(Runner runner)
+  {
+  }
+
+private:
+  // Undefined
+  Impl(const Impl& impl);
+  Impl& operator=(const Impl& impl);
+};
+
+/**
+ * UI Thread loader to support Pre-Initailized using UI Thread.
+ */
+UIThreadLoader::UIThreadLoader(int* argc, char*** argv)
+: mArgc(argc),
+  mArgv(argv),
+  mImpl(nullptr)
 {
 }
 
-std::string Framework::GetLanguage() const
+UIThreadLoader::~UIThreadLoader()
 {
-  return mImpl->GetLanguage();
 }
 
-std::string Framework::GetRegion() const
+void UIThreadLoader::Run(Runner runner)
 {
-  return mImpl->GetRegion();
 }
 
 } // namespace Adaptor
diff --git a/dali/internal/adaptor/tizen-wayland/framework-factory-tizen.cpp b/dali/internal/adaptor/tizen-wayland/framework-factory-tizen.cpp
new file mode 100644 (file)
index 0000000..d466db1
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/tizen-wayland/framework-factory-tizen.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/glib/framework-glib.h>
+#include <dali/internal/adaptor/tizen-wayland/framework-tizen.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryTizen::CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  mBackend = backend;
+  if(mBackend == FrameworkBackend::GLIB)
+  {
+    return Utils::MakeUnique<FrameworkGlib>(observer, taskObserver, argc, argv, type, useUiThread);
+  }
+  else
+  {
+    return Utils::MakeUnique<FrameworkTizen>(observer, taskObserver, argc, argv, type, useUiThread);
+  }
+}
+
+FrameworkFactory* GetFrameworkFactory()
+{
+  static std::unique_ptr<FrameworkFactory> frameworkFactory = nullptr;
+
+  if(!frameworkFactory)
+  {
+    frameworkFactory = Utils::MakeUnique<FrameworkFactoryTizen>();
+  }
+  return frameworkFactory.get();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/tizen-wayland/framework-factory-tizen.h b/dali/internal/adaptor/tizen-wayland/framework-factory-tizen.h
new file mode 100644 (file)
index 0000000..68879fb
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryTizen : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(FrameworkBackend frameworkType, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+
+  FrameworkBackend GetFrameworkBackend() const override
+  {
+    return mBackend;
+  }
+
+private:
+  FrameworkBackend mBackend;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_FACTORY_H
index d379c5151aec480f0de076b29877203bde6221f4..ec679e3e5ce8ac26471a3c4f9cf440ea19550e5e 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.
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/tizen-wayland/framework-tizen.h>
 
 // EXTERNAL INCLUDES
 #include <app_common.h>
@@ -30,6 +29,7 @@
 #include <widget_base.h>
 #include <app_core_ui_base.hh>
 #include <app_event_internal.hh>
+#include <app_core_ui_thread_base.hh>
 
 // CONDITIONAL INCLUDES
 #ifdef APPCORE_WATCH_AVAILABLE
 #include <Eldbus.h>
 #endif // DALI_ELDBUS_AVAILABLE
 
-#if defined(TIZEN_PLATFORM_CONFIG_SUPPORTED) && TIZEN_PLATFORM_CONFIG_SUPPORTED
-#include <tzplatform_config.h>
-#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
-
 #ifdef COMPONENT_APPLICATION_SUPPORT
 #include <component_based_app_base.h>
 #endif
@@ -51,7 +47,6 @@
 #include <dali/integration-api/trace.h>
 
 // INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
 #include <dali/internal/system/linux/dali-ecore.h>
 
 using namespace tizen_cpp;
@@ -249,7 +244,7 @@ DeviceStatus::Orientation::Status GetOrientationStatus(app_device_orientation_e
 /**
  * Impl to hide EFL data members
  */
-struct Framework::Impl
+struct FrameworkTizen::Impl
 {
   class UiAppContext : public AppCoreUiBase
   {
@@ -257,7 +252,7 @@ struct Framework::Impl
     class Task : public AppCoreTaskBase
     {
     public:
-      explicit Task(Framework* framework)
+      explicit Task(FrameworkTizen* framework)
       : mFramework(framework),
         mNewBatteryStatus(Dali::DeviceStatus::Battery::Status::NORMAL),
         mNewMemoryStatus(Dali::DeviceStatus::Memory::NORMAL),
@@ -328,10 +323,9 @@ struct Framework::Impl
         mNewMemoryStatus = AppCore::GetMemoryStatus(static_cast<app_event_low_memory_status_e>(state));
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnMemoryLow(task->mNewMemoryStatus);
             return G_SOURCE_REMOVE;
           });
@@ -346,10 +340,9 @@ struct Framework::Impl
         mNewDeviceOrientationStatus = AppCore::GetOrientationStatus(static_cast<app_device_orientation_e>(state));
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnDeviceOrientationChanged(task->mNewDeviceOrientationStatus);
             return G_SOURCE_REMOVE;
           });
@@ -364,10 +357,9 @@ struct Framework::Impl
         mNewBatteryStatus = AppCore::GetBatteryStatus(static_cast<app_event_low_battery_status_e>(state));
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnBatteryLow(task->mNewBatteryStatus);
             return G_SOURCE_REMOVE;
           });
@@ -382,10 +374,9 @@ struct Framework::Impl
         mFramework->SetLanguage(mNewLanguage);
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnLanguageChanged();
             return G_SOURCE_REMOVE;
           });
@@ -401,10 +392,9 @@ struct Framework::Impl
         mFramework->SetRegion(mNewRegion);
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnRegionChanged();
             return G_SOURCE_REMOVE;
           });
@@ -439,7 +429,7 @@ struct Framework::Impl
       }
 
     private:
-      Framework*                              mFramework;
+      FrameworkTizen*                         mFramework;
       std::string                             mNewLanguage;
       std::string                             mNewRegion;
       Dali::DeviceStatus::Battery::Status     mNewBatteryStatus;
@@ -447,7 +437,7 @@ struct Framework::Impl
       Dali::DeviceStatus::Orientation::Status mNewDeviceOrientationStatus;
     };
 
-    explicit UiAppContext(unsigned int hint, Framework* framework)
+    explicit UiAppContext(unsigned int hint, FrameworkTizen* framework)
     : AppCoreUiBase(hint),
       mFramework(framework),
       mUseUiThread(false)
@@ -606,8 +596,8 @@ struct Framework::Impl
       auto*     framework = context->mFramework;
       Observer* observer  = &framework->mObserver;
 
-      char* lang = nullptr;
-      auto appEventReturn = app_event_get_language(event_info, &lang);
+      char* lang           = nullptr;
+      auto  appEventReturn = app_event_get_language(event_info, &lang);
       if(appEventReturn == APP_ERROR_NONE && lang)
       {
         framework->SetLanguage(std::string(lang));
@@ -626,8 +616,8 @@ struct Framework::Impl
       auto*     framework = context->mFramework;
       Observer* observer  = &framework->mObserver;
 
-      char* region = nullptr;
-      auto appEventReturn = app_event_get_region_format(event_info, &region);
+      char* region         = nullptr;
+      auto  appEventReturn = app_event_get_region_format(event_info, &region);
       if(appEventReturn == APP_ERROR_NONE && region)
       {
         framework->SetRegion(std::string(region));
@@ -647,7 +637,7 @@ struct Framework::Impl
       Observer* observer  = &framework->mObserver;
 
       app_event_low_battery_status_e status;
-      auto appEventReturn = app_event_get_low_battery_status(event_info, &status);
+      auto                           appEventReturn = app_event_get_low_battery_status(event_info, &status);
       if(appEventReturn == APP_ERROR_NONE)
       {
         Dali::DeviceStatus::Battery::Status result = AppCore::GetBatteryStatus(status);
@@ -666,7 +656,7 @@ struct Framework::Impl
       Observer* observer  = &framework->mObserver;
 
       app_event_low_memory_status_e status;
-      auto appEventReturn = app_event_get_low_memory_status(event_info, &status);
+      auto                          appEventReturn = app_event_get_low_memory_status(event_info, &status);
       if(appEventReturn == APP_ERROR_NONE)
       {
         Dali::DeviceStatus::Memory::Status result = AppCore::GetMemoryStatus(status);
@@ -685,7 +675,7 @@ struct Framework::Impl
       Observer* observer  = &framework->mObserver;
 
       app_device_orientation_e status;
-      auto appEventReturn = app_event_get_device_orientation(event_info, &status);
+      auto                     appEventReturn = app_event_get_device_orientation(event_info, &status);
       if(appEventReturn == APP_ERROR_NONE)
       {
         Dali::DeviceStatus::Orientation::Status result = AppCore::GetOrientationStatus(status);
@@ -697,7 +687,7 @@ struct Framework::Impl
       }
     }
 
-    void ProcessBundle(Framework* framework, bundle* bundleData)
+    void ProcessBundle(FrameworkTizen* framework, bundle* bundleData)
     {
       if(bundleData == nullptr)
       {
@@ -720,7 +710,7 @@ struct Framework::Impl
     }
 
   private:
-    Framework*                mFramework;
+    FrameworkTizen*           mFramework;
     std::shared_ptr<AppEvent> mLanguageChanged;
     std::shared_ptr<AppEvent> mDeviceOrientationChanged;
     std::shared_ptr<AppEvent> mRegionFormatChanged;
@@ -731,16 +721,14 @@ struct Framework::Impl
 
   // Constructor
   Impl(void* data, Type type, bool useUiThread)
-  : mAbortCallBack(NULL),
-    mCallbackManager(NULL),
-    handlers{nullptr, nullptr, nullptr, nullptr, nullptr},
+  : handlers{nullptr, nullptr, nullptr, nullptr, nullptr},
     mUseUiThread(useUiThread)
 #ifdef APPCORE_WATCH_AVAILABLE
     ,
     mWatchCallback()
 #endif
   {
-    mFramework = static_cast<Framework*>(data);
+    mFramework = static_cast<FrameworkTizen*>(data);
 
 #ifndef APPCORE_WATCH_AVAILABLE
     if(type == WATCH)
@@ -749,17 +737,10 @@ struct Framework::Impl
     }
 #endif
     mApplicationType = type;
-    mCallbackManager = CallbackManager::New();
   }
 
   ~Impl()
   {
-    delete mAbortCallBack;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
   }
 
   int AppMain()
@@ -866,13 +847,11 @@ struct Framework::Impl
   }
 
   // Data
-  Type             mApplicationType;
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  std::string      mLanguage{};
-  std::string      mRegion{};
+  Type        mApplicationType;
+  std::string mLanguage{};
+  std::string mRegion{};
 
-  Framework*                    mFramework;
+  FrameworkTizen*               mFramework;
   AppCore::AppEventHandlerPtr   handlers[5];
   std::unique_ptr<UiAppContext> mUiAppContext{nullptr};
   bool                          mUseUiThread{false};
@@ -880,7 +859,7 @@ struct Framework::Impl
   watch_app_lifecycle_callback_s mWatchCallback;
 #endif
 
-  static void ProcessBundle(Framework* framework, bundle* bundleData)
+  static void ProcessBundle(FrameworkTizen* framework, bundle* bundleData)
   {
     if(bundleData == NULL)
     {
@@ -946,8 +925,8 @@ struct Framework::Impl
 
   static void AppLanguageChanged(AppCore::AppEventInfoPtr event, void* data)
   {
-    Framework* framework = static_cast<Framework*>(data);
-    Observer*  observer  = &framework->mObserver;
+    FrameworkTizen* framework = static_cast<FrameworkTizen*>(data);
+    Observer*       observer  = &framework->mObserver;
 
     if(event && event->value)
     {
@@ -962,8 +941,8 @@ struct Framework::Impl
 
   static void AppRegionChanged(AppCore::AppEventInfoPtr event, void* data)
   {
-    Framework* framework = static_cast<Framework*>(data);
-    Observer*  observer  = &framework->mObserver;
+    FrameworkTizen* framework = static_cast<FrameworkTizen*>(data);
+    Observer*       observer  = &framework->mObserver;
 
     if(event && event->value)
     {
@@ -978,7 +957,7 @@ struct Framework::Impl
 
   static void AppBatteryLow(AppCore::AppEventInfoPtr event, void* data)
   {
-    Observer*                           observer = &static_cast<Framework*>(data)->mObserver;
+    Observer*                           observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     int                                 status   = *static_cast<int*>(event->value);
     Dali::DeviceStatus::Battery::Status result   = Dali::DeviceStatus::Battery::Status::NORMAL;
 
@@ -1003,7 +982,7 @@ struct Framework::Impl
 
   static void AppMemoryLow(AppCore::AppEventInfoPtr event, void* data)
   {
-    Observer*                          observer = &static_cast<Framework*>(data)->mObserver;
+    Observer*                          observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     int                                status   = *static_cast<int*>(event->value);
     Dali::DeviceStatus::Memory::Status result   = Dali::DeviceStatus::Memory::Status::NORMAL;
 
@@ -1033,7 +1012,7 @@ struct Framework::Impl
 
   static void AppDeviceOrientationChanged(AppCore::AppEventInfoPtr event, void* data)
   {
-    Observer*                               observer = &static_cast<Framework*>(data)->mObserver;
+    Observer*                               observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     int                                     status   = *static_cast<int*>(event->value);
     Dali::DeviceStatus::Orientation::Status result   = Dali::DeviceStatus::Orientation::Status::ORIENTATION_0;
 
@@ -1121,12 +1100,12 @@ struct Framework::Impl
   static int WidgetAppCreate(void* data)
   {
     widget_base_on_create();
-    return static_cast<int>(static_cast<Framework*>(data)->Create());
+    return static_cast<int>(static_cast<FrameworkTizen*>(data)->Create());
   }
 
   static int WidgetAppTerminate(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     observer->OnTerminate();
 
     widget_base_on_terminate();
@@ -1167,12 +1146,12 @@ struct Framework::Impl
 #ifdef APPCORE_WATCH_AVAILABLE
   static bool WatchAppCreate(int width, int height, void* data)
   {
-    return static_cast<Framework*>(data)->Create();
+    return static_cast<FrameworkTizen*>(data)->Create();
   }
 
   static void WatchAppTimeTick(watch_time_h time, void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     WatchTime curTime(time);
 
     observer->OnTimeTick(curTime);
@@ -1180,7 +1159,7 @@ struct Framework::Impl
 
   static void WatchAppAmbientTick(watch_time_h time, void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     WatchTime curTime(time);
 
     observer->OnAmbientTick(curTime);
@@ -1188,16 +1167,16 @@ struct Framework::Impl
 
   static void WatchAppAmbientChanged(bool ambient, void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
 
     observer->OnAmbientChanged(ambient);
   }
 
   static void WatchAppControl(app_control_h app_control, void* data)
   {
-    Framework* framework  = static_cast<Framework*>(data);
-    Observer*  observer   = &framework->mObserver;
-    bundle*    bundleData = NULL;
+    FrameworkTizen* framework  = static_cast<FrameworkTizen*>(data);
+    Observer*       observer   = &framework->mObserver;
+    bundle*         bundleData = NULL;
 
     app_control_to_bundle(app_control, &bundleData);
     ProcessBundle(framework, bundleData);
@@ -1208,21 +1187,21 @@ struct Framework::Impl
 
   static void WatchAppTerminate(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
 
     observer->OnTerminate();
   }
 
   static void WatchAppPause(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
 
     observer->OnPause();
   }
 
   static void WatchAppResume(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
 
     observer->OnResume();
   }
@@ -1277,8 +1256,8 @@ struct Framework::Impl
 
   static void* ComponentAppCreate(void* data)
   {
-    Framework* framework = static_cast<Framework*>(data);
-    Observer*  observer  = &framework->mObserver;
+    FrameworkTizen* framework = static_cast<FrameworkTizen*>(data);
+    Observer*       observer  = &framework->mObserver;
     observer->OnInit();
 
     return Dali::AnyCast<void*>(observer->OnCreate());
@@ -1286,7 +1265,7 @@ struct Framework::Impl
 
   static void ComponentAppTerminate(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     observer->OnTerminate();
   }
 
@@ -1316,17 +1295,12 @@ private:
   Impl& operator=(const Impl& impl);
 };
 
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
+FrameworkTizen::FrameworkTizen(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mInitialised(false),
   mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
   mBundleName(""),
   mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
   mImpl(NULL)
 {
   if(mArgc == nullptr || mArgv == nullptr)
@@ -1343,12 +1317,10 @@ Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& tas
     set_last_result(TIZEN_ERROR_NOT_SUPPORTED);
   }
 
-  InitThreads();
-
   mImpl = new Impl(this, type, useUiThread);
 }
 
-Framework::~Framework()
+FrameworkTizen::~FrameworkTizen()
 {
   if(mRunning)
   {
@@ -1358,14 +1330,14 @@ Framework::~Framework()
   delete mImpl;
 }
 
-bool Framework::Create()
+bool FrameworkTizen::Create()
 {
   mInitialised = true;
   mObserver.OnInit();
   return true;
 }
 
-void Framework::Run()
+void FrameworkTizen::Run()
 {
   mRunning = true;
   int ret;
@@ -1380,118 +1352,124 @@ void Framework::Run()
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkTizen::Quit()
 {
   mImpl->AppExit();
 }
 
-bool Framework::IsMainLoopRunning()
+std::string FrameworkTizen::GetBundleName() const
 {
-  return mRunning;
+  return mBundleName;
 }
 
-void Framework::AddAbortCallback(CallbackBase* callback)
+void FrameworkTizen::SetBundleName(const std::string& name)
 {
-  mImpl->mAbortCallBack = callback;
+  mBundleName = name;
 }
 
-std::string Framework::GetBundleName() const
+std::string FrameworkTizen::GetBundleId() const
 {
-  return mBundleName;
+  return mBundleId;
 }
 
-void Framework::SetBundleName(const std::string& name)
+void FrameworkTizen::SetBundleId(const std::string& id)
 {
-  mBundleName = name;
+  mBundleId = id;
 }
 
-std::string Framework::GetBundleId() const
+void FrameworkTizen::SetLanguage(const std::string& language)
 {
-  return mBundleId;
+  mImpl->SetLanguage(language);
 }
 
-std::string Framework::GetResourcePath()
+void FrameworkTizen::SetRegion(const std::string& region)
 {
-  std::string resourcePath = "";
-#if defined(TIZEN_PLATFORM_CONFIG_SUPPORTED) && TIZEN_PLATFORM_CONFIG_SUPPORTED
-  char* app_rsc_path = app_get_resource_path();
-  if(app_rsc_path)
-  {
-    resourcePath = app_rsc_path;
-    free(app_rsc_path);
-  }
-#else // For backwards compatibility with older Tizen versions
-
-  // "DALI_APPLICATION_PACKAGE" is used to get the already configured Application package path.
-  const char* environmentVariable = "DALI_APPLICATION_PACKAGE";
-  char*       value               = getenv(environmentVariable);
-  if(value != NULL)
-  {
-    resourcePath = value;
-  }
-
-  if(resourcePath.back() != '/')
-  {
-    resourcePath += "/";
-  }
-
-#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
-
-  return resourcePath;
+  mImpl->SetRegion(region);
 }
 
-std::string Framework::GetDataPath()
+std::string FrameworkTizen::GetLanguage() const
 {
-  std::string result;
-  char*       dataPath = app_get_data_path();
-  if(dataPath)
-  {
-    result = dataPath;
-    free(dataPath);
-  }
-  return result;
+  return mImpl->GetLanguage();
 }
 
-void Framework::SetBundleId(const std::string& id)
+std::string FrameworkTizen::GetRegion() const
 {
-  mBundleId = id;
+  return mImpl->GetRegion();
 }
 
-void Framework::AbortCallback()
+/**
+ * Impl for Pre-Initailized using UI Thread.
+ */
+struct UIThreadLoader::Impl
 {
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
+  // Constructor
+  Impl(void *data)
   {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
+    mUIThreadLoader = static_cast<UIThreadLoader*>(data);
+    mAppCoreUiThreadBase = new AppCoreUiThreadBase();
+    print_log(DLOG_INFO, "DALI", "%s: %s(%d) > Create mAppCoreUiThreadBase(%p)", __MODULE__, __func__, __LINE__, mAppCoreUiThreadBase);
   }
-  else
+
+  // Destructor
+  ~Impl()
   {
-    Quit();
+    if(mAppCoreUiThreadBase)
+    {
+      mAppCoreUiThreadBase->Exit();
+      delete mAppCoreUiThreadBase;
+    }
   }
-}
 
-void Framework::InitThreads()
-{
-}
+  /**
+   * Runs to work create window in UI thread when application is pre-initialized.
+   */
+  void Run(Runner runner)
+  {
+    mAppCoreUiThreadBase->Post(runner);
+    mAppCoreUiThreadBase->Run(*(mUIThreadLoader->mArgc), *(mUIThreadLoader->mArgv));
+  }
 
-void Framework::SetLanguage(const std::string& language)
-{
-  mImpl->SetLanguage(language);
-}
+private:
+  // Undefined
+  Impl(const Impl& impl);
+  Impl& operator=(const Impl& impl);
 
-void Framework::SetRegion(const std::string& region)
+  // Data
+  AppCoreUiThreadBase* mAppCoreUiThreadBase;
+  UIThreadLoader*      mUIThreadLoader;
+};
+
+/**
+ * UI Thread loader to support Pre-Initailized using UI Thread.
+ */
+UIThreadLoader::UIThreadLoader(int* argc, char*** argv)
+: mArgc(argc),
+  mArgv(argv),
+  mImpl(nullptr)
 {
-  mImpl->SetRegion(region);
+  if(mArgc == nullptr || mArgv == nullptr)
+  {
+    mArgc = const_cast<int*>(&gTizenDummyArgc);
+    mArgv = const_cast<char***>(reinterpret_cast<const char***>(&gTizenDummyArgv));
+  }
+
+  mImpl = new Impl(this);
 }
 
-std::string Framework::GetLanguage() const
+UIThreadLoader::~UIThreadLoader()
 {
-  return mImpl->GetLanguage();
+  if(mImpl)
+  {
+    delete mImpl;
+  }
 }
 
-std::string Framework::GetRegion() const
+/**
+ * Runs to work create window in UI thread when application is pre-initialized.
+ */
+void UIThreadLoader::Run(Runner runner)
 {
-  return mImpl->GetRegion();
+  mImpl->Run(runner);
 }
 
 } // namespace Adaptor
diff --git a/dali/internal/adaptor/tizen-wayland/framework-tizen.h b/dali/internal/adaptor/tizen-wayland/framework-tizen.h
new file mode 100644 (file)
index 0000000..c6c182a
--- /dev/null
@@ -0,0 +1,124 @@
+#ifndef DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkTizen class provides an Framework Tizen implementation.
+ */
+class FrameworkTizen : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkTizen(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkTizen();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+  /**
+   * Gets bundle name which was passed in app_reset callback.
+   */
+  std::string GetBundleName() const;
+
+  /**
+   * Gets bundle id which was passed in app_reset callback.
+   */
+  std::string GetBundleId() const;
+
+  /**
+   * Sets system language.
+   */
+  void SetLanguage(const std::string& language);
+
+  /**
+   * Sets system region.
+   */
+  void SetRegion(const std::string& region);
+
+  /**
+   * Gets system language.
+   */
+  std::string GetLanguage() const override;
+
+  /**
+   * Gets system region.
+   */
+  std::string GetRegion() const override;
+
+private:
+  // Undefined
+  FrameworkTizen(const FrameworkTizen&) = delete;
+  FrameworkTizen& operator=(FrameworkTizen&) = delete;
+
+private:
+  /**
+   * Called when the application is created.
+   */
+  bool Create();
+
+  /**
+   * Called app_reset callback was called with bundle.
+   */
+  void SetBundleName(const std::string& name);
+
+  /**
+   * Called app_reset callback was called with bundle.
+   */
+  void SetBundleId(const std::string& id);
+
+private:
+  bool        mInitialised;
+  bool        mPaused;
+  std::string mBundleName;
+  std::string mBundleId;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_H
diff --git a/dali/internal/adaptor/ubuntu/framework-factory-ubuntu.cpp b/dali/internal/adaptor/ubuntu/framework-factory-ubuntu.cpp
new file mode 100644 (file)
index 0000000..ae2c084
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/ubuntu/framework-factory-ubuntu.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/ubuntu/framework-ubuntu.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryUbuntu::CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkUbuntu>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+FrameworkFactory* GetFrameworkFactory()
+{
+  static std::unique_ptr<FrameworkFactory> frameworkFactory = nullptr;
+
+  if(!frameworkFactory)
+  {
+    frameworkFactory = Utils::MakeUnique<FrameworkFactoryUbuntu>();
+  }
+  return frameworkFactory.get();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/ubuntu/framework-factory-ubuntu.h b/dali/internal/adaptor/ubuntu/framework-factory-ubuntu.h
new file mode 100644 (file)
index 0000000..f7d6b2a
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryUbuntu : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(FrameworkBackend frameworkType, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_FACTORY_H
index 60529c5c3ef139d05895e005e8d1e65020429e77..7ad9005aac122da561cba34ef9bc60aa0b36647e 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.
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/ubuntu/framework-ubuntu.h>
 
 // EXTERNAL INCLUDES
 #include <X11/Xlib.h>
+
+// INTERNAL INCLUDES
 #include <dali/internal/system/linux/dali-ecore.h>
 #include <dali/internal/system/linux/dali-efreet.h>
 #include <dali/internal/system/linux/dali-elementary.h>
 
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
-
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-namespace
-{
-/// Application Status Enum
-enum
-{
-  APP_CREATE,
-  APP_TERMINATE,
-  APP_PAUSE,
-  APP_RESUME,
-  APP_RESET,
-  APP_LANGUAGE_CHANGE,
-};
-
-} // Unnamed namespace
-
-/**
- * Impl to hide EFL data members
- */
-struct Framework::Impl
-{
-  // Constructor
-
-  Impl(void* data)
-  : mAbortCallBack(NULL),
-    mCallbackManager(CallbackManager::New()),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED")
-  {
-  }
-
-  ~Impl()
-  {
-    delete mAbortCallBack;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-  }
-
-  std::string GetLanguage() const
-  {
-    return mLanguage;
-  }
-
-  std::string GetRegion() const
-  {
-    return mRegion;
-  }
-
-  // Data
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  std::string      mLanguage;
-  std::string      mRegion;
-
-  // Static methods
-
-  /**
-   * Called by AppCore on application creation.
-   */
-  static bool AppCreate(void* data)
-  {
-    return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);
-  }
-
-  /**
-   * Called by AppCore when the application should terminate.
-   */
-  static void AppTerminate(void* data)
-  {
-    static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);
-  }
-
-  /**
-   * Called by AppCore when the application is paused.
-   */
-  static void AppPause(void* data)
-  {
-    static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);
-  }
-
-  /**
-   * Called by AppCore when the application is resumed.
-   */
-  static void AppResume(void* data)
-  {
-    static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);
-  }
-
-  /**
-   * Called by AppCore when the language changes on the device.
-   */
-  static void AppLanguageChange(void* data)
-  {
-    static_cast<Framework*>(data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
-  }
-};
-
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
-  mInitialised(false),
-  mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
-  mImpl(NULL)
+FrameworkUbuntu::FrameworkUbuntu(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread)
 {
   InitThreads();
-  mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkUbuntu::~FrameworkUbuntu()
 {
   if(mRunning)
   {
     Quit();
   }
-
-  delete mImpl;
 }
 
-void Framework::Run()
+void FrameworkUbuntu::Run()
 {
   mRunning = true;
 
   efreet_cache_disable();
   elm_init(mArgc ? *mArgc : 0, mArgv ? *mArgv : nullptr);
 
-  Impl::AppCreate(this);
+  mObserver.OnInit();
 
   elm_run();
 
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkUbuntu::Quit()
 {
-  Impl::AppTerminate(this);
+  mObserver.OnTerminate();
 
   elm_exit();
 }
 
-bool Framework::IsMainLoopRunning()
+void FrameworkUbuntu::InitThreads()
 {
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-  mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
-  return mBundleId;
-}
-
-std::string Framework::GetResourcePath()
-{
-  // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path.
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string resourcePath;
-  if(value != NULL)
-  {
-    resourcePath = value;
-  }
-
-  if(resourcePath.back() != '/')
-  {
-    resourcePath += "/";
-  }
-
-  return resourcePath;
+  XInitThreads();
 }
 
-std::string Framework::GetDataPath()
+/**
+ * Impl for Pre-Initailized using UI Thread.
+ */
+struct UIThreadLoader::Impl
 {
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string dataPath;
-  if(value != NULL)
+  // Constructor
+  Impl(void *data)
   {
-    dataPath = value;
   }
 
-  return dataPath;
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-  mBundleId = id;
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
+  ~Impl()
   {
-    Quit();
   }
-}
 
-bool Framework::AppStatusHandler(int type, void* bundleData)
-{
-  switch(type)
+  void Run(Runner runner)
   {
-    case APP_CREATE:
-    {
-      mInitialised = true;
-
-      mObserver.OnInit();
-      break;
-    }
-
-    case APP_RESET:
-      mObserver.OnReset();
-      break;
-
-    case APP_RESUME:
-      mObserver.OnResume();
-      break;
-
-    case APP_TERMINATE:
-      mObserver.OnTerminate();
-      break;
-
-    case APP_PAUSE:
-      mObserver.OnPause();
-      break;
-
-    case APP_LANGUAGE_CHANGE:
-      mObserver.OnLanguageChanged();
-      break;
-
-    default:
-      break;
   }
 
-  return true;
-}
+private:
+  // Undefined
+  Impl(const Impl& impl);
+  Impl& operator=(const Impl& impl);
+};
 
-void Framework::InitThreads()
+/**
+ * UI Thread loader to support Pre-Initailized using UI Thread.
+ */
+UIThreadLoader::UIThreadLoader(int* argc, char*** argv)
+: mArgc(argc),
+  mArgv(argv),
+  mImpl(nullptr)
 {
-  XInitThreads();
 }
 
-std::string Framework::GetLanguage() const
+UIThreadLoader::~UIThreadLoader()
 {
-  return mImpl->GetLanguage();
 }
 
-std::string Framework::GetRegion() const
+void UIThreadLoader::Run(Runner runner)
 {
-  return mImpl->GetRegion();
 }
 
 } // namespace Adaptor
diff --git a/dali/internal/adaptor/ubuntu/framework-ubuntu.h b/dali/internal/adaptor/ubuntu/framework-ubuntu.h
new file mode 100644 (file)
index 0000000..cb34089
--- /dev/null
@@ -0,0 +1,74 @@
+#ifndef DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkUbuntu class provides an Framework Ubuntu implementation.
+ */
+class FrameworkUbuntu : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkUbuntu(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkUbuntu();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+private:
+  // Undefined
+  FrameworkUbuntu(const FrameworkUbuntu&) = delete;
+  FrameworkUbuntu& operator=(FrameworkUbuntu&) = delete;
+
+private:
+  /**
+   * Called for initializing on specified backend. (X11 or Wayland)
+   */
+  void InitThreads();
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_H
diff --git a/dali/internal/adaptor/windows/framework-factory-win.cpp b/dali/internal/adaptor/windows/framework-factory-win.cpp
new file mode 100644 (file)
index 0000000..e94a561
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/windows/framework-factory-win.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/windows/framework-win.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryWin::CreateFramework(FrameworkBackend backend, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkWin>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+FrameworkFactory* GetFrameworkFactory()
+{
+  static std::unique_ptr<FrameworkFactory> frameworkFactory = nullptr;
+
+  if(!frameworkFactory)
+  {
+    frameworkFactory = Utils::MakeUnique<FrameworkFactoryWin>();
+  }
+  return frameworkFactory.get();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/windows/framework-factory-win.h b/dali/internal/adaptor/windows/framework-factory-win.h
new file mode 100644 (file)
index 0000000..039e3fa
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryWin : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(FrameworkBackend frameworkType, Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_FACTORY_H
index 0623baf59586ee09085303a5f9398d0b55a38957..bc2c31e15ba45d5c3112d09430bcbc36b7a3780f 100644 (file)
@@ -1,5 +1,5 @@
 ï»¿/*\r
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
- *\r
  */\r
 \r
 // CLASS HEADER\r
-#include <dali/internal/adaptor/common/framework.h>\r
+#include <dali/internal/adaptor/windows/framework-win.h>\r
 \r
 // EXTERNAL INCLUDES\r
 #include <dali/integration-api/debug.h>\r
@@ -32,95 +31,18 @@ namespace Internal
 {\r
 namespace Adaptor\r
 {\r
-namespace\r
-{\r
-/// Application Status Enum\r
-enum\r
-{\r
-  APP_CREATE,\r
-  APP_TERMINATE,\r
-  APP_PAUSE,\r
-  APP_RESUME,\r
-  APP_RESET,\r
-  APP_LANGUAGE_CHANGE,\r
-};\r
-\r
-} // Unnamed namespace\r
 /**\r
  * Impl to hide WindowsSystem data members\r
  */\r
-struct Framework::Impl\r
+struct FrameworkWin::Impl\r
 {\r
   // Constructor\r
-\r
   Impl(void* data)\r
-  : mAbortCallBack(NULL),\r
-    mCallbackManager(CallbackManager::New()),\r
-    mLanguage("NOT_SUPPORTED"),\r
-    mRegion("NOT_SUPPORTED")\r
   {\r
   }\r
 \r
   ~Impl()\r
   {\r
-    delete mAbortCallBack;\r
-\r
-    // we're quiting the main loop so\r
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called\r
-    // to delete our abort handler\r
-    delete mCallbackManager;\r
-  }\r
-\r
-  std::string GetLanguage() const\r
-  {\r
-    return mLanguage;\r
-  }\r
-\r
-  std::string GetRegion() const\r
-  {\r
-    return mRegion;\r
-  }\r
-\r
-  // Static methods\r
-\r
-  /**\r
-   * Called by AppCore on application creation.\r
-   */\r
-  static bool AppCreate(void* data)\r
-  {\r
-    return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);\r
-  }\r
-\r
-  /**\r
-   * Called by AppCore when the application should terminate.\r
-   */\r
-  static void AppTerminate(void* data)\r
-  {\r
-    static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);\r
-  }\r
-\r
-  /**\r
-   * Called by AppCore when the application is paused.\r
-   */\r
-  static void AppPause(void* data)\r
-  {\r
-    static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);\r
-  }\r
-\r
-  /**\r
-   * Called by AppCore when the application is resumed.\r
-   */\r
-  static void AppResume(void* data)\r
-  {\r
-    static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);\r
-  }\r
-\r
-  /**\r
-   * Called by AppCore when the language changes on the device.\r
-   */\r
-  static void AppLanguageChange(void* data)\r
-  {\r
-    static_cast<Framework*>(data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);\r
   }\r
 \r
   void Run()\r
@@ -138,8 +60,6 @@ struct Framework::Impl
       TranslateMessage(&nMsg);\r
       DispatchMessage(&nMsg);\r
 \r
-      mCallbackManager->ClearIdleCallbacks();\r
-\r
       if(WM_CLOSE == nMsg.message)\r
       {\r
         break;\r
@@ -147,61 +67,22 @@ struct Framework::Impl
     }\r
   }\r
 \r
-  void Quit()\r
-  {\r
-  }\r
-\r
-  void SetCallbackBase(CallbackBase* base)\r
-  {\r
-    mAbortCallBack = base;\r
-  }\r
-\r
-  bool ExcuteCallback()\r
-  {\r
-    if(NULL != mAbortCallBack)\r
-    {\r
-      CallbackBase::Execute(*mAbortCallBack);\r
-      return true;\r
-    }\r
-    else\r
-    {\r
-      return false;\r
-    }\r
-  }\r
-\r
 private:\r
   // Undefined\r
   Impl(const Impl& impl) = delete;\r
 \r
   // Undefined\r
   Impl& operator=(const Impl& impl) = delete;\r
-\r
-private:\r
-  // Data\r
-  CallbackBase*    mAbortCallBack;\r
-  CallbackManager* mCallbackManager;\r
-  std::string      mLanguage;\r
-  std::string      mRegion;\r
 };\r
 \r
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)\r
-: mObserver(observer),\r
-  mTaskObserver(taskObserver),\r
-  mInitialised(false),\r
-  mPaused(false),\r
-  mRunning(false),\r
-  mArgc(argc),\r
-  mArgv(argv),\r
-  mBundleName(""),\r
-  mBundleId(""),\r
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),\r
+FrameworkWin::FrameworkWin(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)\r
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),\r
   mImpl(NULL)\r
 {\r
-  InitThreads();\r
   mImpl = new Impl(this);\r
 }\r
 \r
-Framework::~Framework()\r
+FrameworkWin::~FrameworkWin()\r
 {\r
   if(mRunning)\r
   {\r
@@ -211,142 +92,63 @@ Framework::~Framework()
   delete mImpl;\r
 }\r
 \r
-void Framework::Run()\r
+void FrameworkWin::Run()\r
 {\r
   mRunning = true;\r
 \r
-  Impl::AppCreate(this);\r
+  mObserver.OnInit();\r
   mImpl->Run();\r
   mRunning = false;\r
 }\r
 \r
-void Framework::Quit()\r
+void FrameworkWin::Quit()\r
 {\r
-  Impl::AppTerminate(this);\r
+  mObserver.OnTerminate();\r
 }\r
 \r
-bool Framework::IsMainLoopRunning()\r
-{\r
-  return mRunning;\r
-}\r
-\r
-void Framework::AddAbortCallback(CallbackBase* callback)\r
-{\r
-  mImpl->SetCallbackBase(callback);\r
-}\r
-\r
-std::string Framework::GetBundleName() const\r
-{\r
-  return mBundleName;\r
-}\r
-\r
-void Framework::SetBundleName(const std::string& name)\r
-{\r
-  mBundleName = name;\r
-}\r
-\r
-std::string Framework::GetBundleId() const\r
-{\r
-  return mBundleId;\r
-}\r
-\r
-std::string Framework::GetResourcePath()\r
+/**\r
+ * Impl for Pre-Initailized using UI Thread.\r
+ */\r
+struct UIThreadLoader::Impl\r
 {\r
-  // "DALI_APPLICATION_PACKAGE" is used by Windows specifically to get the already configured Application package path.\r
-  const char* winEnvironmentVariable = "DALI_APPLICATION_PACKAGE";\r
-  char*       value                  = getenv(winEnvironmentVariable);\r
-\r
-  std::string resourcePath;\r
-  if(value != NULL)\r
-  {\r
-    resourcePath = value;\r
-  }\r
-\r
-  if(resourcePath.back() != '/')\r
+  // Constructor\r
+  Impl(void *data)\r
   {\r
-    resourcePath += "/";\r
   }\r
 \r
-  return resourcePath;\r
-}\r
-\r
-std::string Framework::GetDataPath()\r
-{\r
-  std::string result = app_get_data_path();\r
-  return result;\r
-}\r
-\r
-void Framework::SetBundleId(const std::string& id)\r
-{\r
-  mBundleId = id;\r
-}\r
-\r
-void Framework::AbortCallback()\r
-{\r
-  // if an abort call back has been installed run it.\r
-  if(false == mImpl->ExcuteCallback())\r
+  ~Impl()\r
   {\r
-    Quit();\r
   }\r
-}\r
 \r
-bool Framework::AppStatusHandler(int type, void* bundleData)\r
-{\r
-  switch(type)\r
+  /**\r
+   * Runs the main loop of framework\r
+   */\r
+  void Run(Runner runner)\r
   {\r
-    case APP_CREATE:\r
-    {\r
-      mInitialised = true;\r
-\r
-      mObserver.OnInit();\r
-      break;\r
-    }\r
-    case APP_RESET:\r
-    {\r
-      mObserver.OnReset();\r
-      break;\r
-    }\r
-    case APP_RESUME:\r
-    {\r
-      mObserver.OnResume();\r
-      break;\r
-    }\r
-    case APP_TERMINATE:\r
-    {\r
-      mObserver.OnTerminate();\r
-      break;\r
-    }\r
-    case APP_PAUSE:\r
-    {\r
-      mObserver.OnPause();\r
-      break;\r
-    }\r
-    case APP_LANGUAGE_CHANGE:\r
-    {\r
-      mObserver.OnLanguageChanged();\r
-      break;\r
-    }\r
-    default:\r
-    {\r
-      break;\r
-    }\r
   }\r
 \r
-  return true;\r
-}\r
+private:\r
+  // Undefined\r
+  Impl(const Impl& impl);\r
+  Impl& operator=(const Impl& impl);\r
+};\r
 \r
-void Framework::InitThreads()\r
+/**\r
+ * UI Thread loader to support Pre-Initailized using UI Thread.\r
+ */\r
+UIThreadLoader::UIThreadLoader(int* argc, char*** argv)\r
+: mArgc(argc),\r
+  mArgv(argv),\r
+  mImpl(nullptr)\r
 {\r
 }\r
 \r
-std::string Framework::GetLanguage() const\r
+UIThreadLoader::~UIThreadLoader()\r
 {\r
-  return mImpl->GetLanguage();\r
 }\r
 \r
-std::string Framework::GetRegion() const\r
+void UIThreadLoader::Run(Runner runner)\r
 {\r
-  return mImpl->GetRegion();\r
 }\r
 \r
 } // namespace Adaptor\r
diff --git a/dali/internal/adaptor/windows/framework-win.h b/dali/internal/adaptor/windows/framework-win.h
new file mode 100644 (file)
index 0000000..5ddd6d7
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkWin class provides an Framework Windows implementation.
+ */
+class FrameworkWin : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkWin(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkWin();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+private:
+  // Undefined
+  FrameworkWin(const FrameworkWin&) = delete;
+  FrameworkWin& operator=(FrameworkWin&) = delete;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_H
index 6e6ee054ef904d638c10e9e9b66ef3a567580a3e..394b63732fb4b523f4cd6c898ea10f3c62df9ff8 100644 (file)
 #include <dali/internal/offscreen/common/offscreen-application-impl.h>
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
 #include <dali/devel-api/adaptor-framework/environment-variable.h>
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <dali/integration-api/adaptor-framework/native-render-surface.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/adaptor/common/framework-factory.h>
 #include <dali/internal/adaptor/common/thread-controller-interface.h>
 #include <dali/internal/offscreen/common/offscreen-window-impl.h>
 #include <dali/internal/system/common/environment-variables.h>
@@ -45,7 +47,11 @@ OffscreenApplication::OffscreenApplication(uint16_t width, uint16_t height, Dali
   // Disable partial update
   EnvironmentVariable::SetEnvironmentVariable(DALI_ENV_DISABLE_PARTIAL_UPDATE, "1");
 
-  Dali::Internal::Adaptor::WindowSystem::Initialize();
+  // Disable ATSPI
+  Dali::Accessibility::Bridge::DisableAutoInit();
+
+  // Now we assume separated main loop for the offscreen application
+  mFramework = Internal::Adaptor::GetFrameworkFactory()->CreateFramework(Internal::Adaptor::FrameworkBackend::GLIB, *this, *this, nullptr, nullptr, Adaptor::Framework::NORMAL, false);
 
   // Generate a default window
   IntrusivePtr<Internal::OffscreenWindow> impl = Internal::OffscreenWindow::New(width, height, surface, isTranslucent);
@@ -59,36 +65,56 @@ OffscreenApplication::OffscreenApplication(uint16_t width, uint16_t height, Dali
 
 OffscreenApplication::~OffscreenApplication()
 {
-  Dali::Internal::Adaptor::WindowSystem::Shutdown();
 }
 
-void OffscreenApplication::Start()
+void OffscreenApplication::MainLoop()
+{
+  mFramework->Run();
+}
+
+void OffscreenApplication::Quit()
+{
+  // Actually quit the application.
+  // Force a call to Quit even if adaptor is not running.
+  Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).AddIdle(MakeCallback(this, &OffscreenApplication::QuitFromMainLoop), false, true);
+}
+
+Dali::OffscreenWindow OffscreenApplication::GetWindow()
+{
+  return mDefaultWindow;
+}
+
+void OffscreenApplication::RenderOnce()
+{
+  mAdaptor->RenderOnce();
+}
+
+void OffscreenApplication::OnInit()
 {
   // Start the adaptor
   mAdaptor->Start();
 
-  Dali::OffscreenApplication handle(this);
   mInitSignal.Emit();
+
   mAdaptor->NotifySceneCreated();
 }
 
-void OffscreenApplication::Stop()
+void OffscreenApplication::OnTerminate()
 {
+  mTerminateSignal.Emit();
+
   // Stop the adaptor
   mAdaptor->Stop();
 
-  Dali::OffscreenApplication handle(this);
-  mTerminateSignal.Emit();
+  mDefaultWindow.Reset();
 }
 
-Dali::OffscreenWindow OffscreenApplication::GetWindow()
+void OffscreenApplication::QuitFromMainLoop()
 {
-  return mDefaultWindow;
-}
+  mAdaptor->Stop();
 
-void OffscreenApplication::RenderOnce()
-{
-  mAdaptor->RenderOnce();
+  mFramework->Quit();
+  // This will trigger OnTerminate(), below, after the main loop has completed.
 }
 
 } // namespace Internal
index 6a868ca6325bbe5f274e55b566ae6a969c8ae07d..48dc0e325959cda21f5ce31a02e3d99f758a3225 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali/devel-api/adaptor-framework/offscreen-application.h>
 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
+#include <dali/internal/adaptor/common/framework.h>
 
 namespace Dali
 {
@@ -37,7 +38,7 @@ namespace Internal
 /**
  * Implementation of the OffscreenApplication class.
  */
-class OffscreenApplication : public BaseObject
+class OffscreenApplication : public BaseObject, public Adaptor::Framework::Observer, public Adaptor::Framework::TaskObserver
 {
 public:
   using OffscreenApplicationSignalType = Dali::OffscreenApplication::OffscreenApplicationSignalType;
@@ -59,14 +60,14 @@ public:
   virtual ~OffscreenApplication();
 
   /**
-   * @copydoc Dali::OffscreenApplication::Start()
+   * @copydoc Dali::OffscreenApplication::MainLoop()
    */
-  void Start();
+  void MainLoop();
 
   /**
-   * @copydoc Dali::OffscreenApplication::Stop()
+   * @copydoc Dali::OffscreenApplication::Quit()
    */
-  void Stop();
+  void Quit();
 
   /**
    * @copydoc Dali::OffscreenApplication::GetDefaultWindow()
@@ -95,6 +96,17 @@ public: // Signals
     return mTerminateSignal;
   }
 
+public: // From Framework::Observer
+  /**
+   * Called when the framework is initialised.
+   */
+  void OnInit() override;
+
+  /**
+   * Called when the framework is terminated.
+   */
+  void OnTerminate() override;
+
 private:
   /**
    * Private constructor
@@ -106,6 +118,11 @@ private:
    */
   OffscreenApplication(uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent, Dali::OffscreenApplication::RenderMode renderMode);
 
+  /**
+   * Quits from the main loop
+   */
+  void QuitFromMainLoop();
+
   // Undefined
   OffscreenApplication(const OffscreenApplication&) = delete;
   OffscreenApplication& operator=(OffscreenApplication&) = delete;
@@ -116,6 +133,8 @@ private:
   std::unique_ptr<Dali::Adaptor> mAdaptor;
   Dali::OffscreenWindow          mDefaultWindow;
 
+  std::unique_ptr<Internal::Adaptor::Framework> mFramework;
+
   OffscreenApplicationSignalType mInitSignal;
   OffscreenApplicationSignalType mTerminateSignal;
 };
index 2d45b435d736c048636af4d2e98ece0b81db2637..116db5e9d56249708db70f74ffd5746ba8ed8df0 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.
@@ -228,12 +228,6 @@ void AndroidCallbackManager::RemoveAllCallbacks()
   mCallbackContainer.clear();
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new AndroidCallbackManager;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index fceaabc1267f2e241c7cad1500284309ba6c3440..310c3cc57dfa488f546ee8dac40f25e32aecb270 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_ANDROID_CALLBACK_MANAGER_H__
-#define __DALI_ANDROID_CALLBACK_MANAGER_H__
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_CALLBACK_MANAGER_H
 
 /*
- * 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.
@@ -39,77 +39,82 @@ class AndroidCallbackManager : public CallbackManager
 {
 public:
   /**
-     * @brief constructor
-     */
+   * @brief constructor
+   */
   AndroidCallbackManager();
 
   /**
-     * @brief destructor
-     */
+   * @brief destructor
+   */
   ~AndroidCallbackManager() = default;
 
   /**
-     * @copydoc CallbackManager::AddIdleCallback()
-     */
+   * @copydoc CallbackManager::AddIdleCallback()
+   */
   bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleCallback()
+   */
   void RemoveIdleCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   bool ProcessIdle() override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   void ClearIdleCallbacks() override;
 
   /**
-     * @copydoc CallbackManager::AddIdleEntererCallback()
-     */
+   * @copydoc CallbackManager::AddIdleEntererCallback()
+   */
   bool AddIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleEntererCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleEntererCallback()
+   */
   void RemoveIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::Start()
-     */
+   * @copydoc CallbackManager::Start()
+   */
   void Start() override;
 
   /**
-     * @copydoc CallbackManager::Stop()
-     */
+   * @copydoc CallbackManager::Stop()
+   */
   void Stop() override;
 
 private:
   /**
-     * @brief Remove all idle call backs that are pending
-     * Called by Stop()
-     * Always called from the main thread
-     */
+   * @brief Remove all idle call backs that are pending
+   * Called by Stop()
+   * Always called from the main thread
+   */
   void RemoveAllCallbacks();
 
   /**
-     * @brief Removes a single call back from the container
-     * Always called from main thread
-     * @param callbackData callback data
-     */
+   * @brief Removes a single call back from the container
+   * Always called from main thread
+   * @param callbackData callback data
+   */
   void RemoveCallbackFromContainer(CallbackData* callbackData);
 
   /**
-     * @brief Remove a standard call back from ecore
-     * Always called from main thread
-     * @param callbackData callback data
-     */
+   * @brief Remove a standard call back from ecore
+   * Always called from main thread
+   * @param callbackData callback data
+   */
   void RemoveStandardCallback(CallbackData* callbackData);
 
+  // Undefined
+  AndroidCallbackManager(const AndroidCallbackManager&) = delete;
+  AndroidCallbackManager& operator=(AndroidCallbackManager&) = delete;
+
+private:
   typedef std::list<CallbackData*> CallbackList;
 
   bool         mRunning;           ///< flag is set to true if when running
@@ -122,4 +127,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_ANDROID_CALLBACK_MANAGER_H__
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_CALLBACK_MANAGER_H
index 6f4c464503837de1245548890e74a687b64dcd91..f857afcc327195a7ac69574ce2594e7dc2d2982d 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/android/file-descriptor-monitor-android.h>
 
 // EXTERNAL INCLUDES
 #include <looper.h>
@@ -33,7 +33,7 @@ namespace Adaptor
 /**
  * Using Impl to hide away Android specific members
  */
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorAndroid::Impl
 {
   // Construction
   Impl(int fileDescriptor, CallbackBase* callback, int eventBitmask)
@@ -85,7 +85,8 @@ struct FileDescriptorMonitor::Impl
   }
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorAndroid::FileDescriptorMonitorAndroid(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   mImpl = new Impl(fileDescriptor, callback, eventBitmask);
 
@@ -111,7 +112,7 @@ FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* c
   }
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorAndroid::~FileDescriptorMonitorAndroid()
 {
   if(mImpl->mFileDescriptor)
   {
diff --git a/dali/internal/system/android/file-descriptor-monitor-android.h b/dali/internal/system/android/file-descriptor-monitor-android.h
new file mode 100644 (file)
index 0000000..0e13eee
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorAndroid class provides an FileDescriptorMonitor Android implementation.
+ */
+class FileDescriptorMonitorAndroid : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorAndroid(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorAndroid();
+
+private:
+  // Undefined
+  FileDescriptorMonitorAndroid(const FileDescriptorMonitorAndroid& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorAndroid& operator=(const FileDescriptorMonitorAndroid& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/android/system-factory-android.cpp b/dali/internal/system/android/system-factory-android.cpp
new file mode 100644 (file)
index 0000000..a5787a6
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/android/system-factory-android.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/android/callback-manager-android.h>
+#include <dali/internal/system/android/file-descriptor-monitor-android.h>
+#include <dali/internal/system/android/timer-impl-android.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryAndroid::CreateCallbackManager()
+{
+  return Utils::MakeUnique<AndroidCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryAndroid::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorAndroid>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryAndroid::CreateTimer(uint32_t milliSec)
+{
+  return TimerAndroid::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryAndroid>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/android/system-factory-android.h b/dali/internal/system/android/system-factory-android.h
new file mode 100644 (file)
index 0000000..255b7f3
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryAndroid : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_SYSTEM_FACTORY_H
index bdeadae8b37b611b7f6bc74ade25d925b55e0bf5..877308a9228eaec66aab0eeedc8b98dc5c491d7c 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.
@@ -15,9 +15,7 @@
  *
  */
 
-// EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
+// CLASS HEADER
 #include <dali/internal/system/common/system-settings.h>
 
 namespace Dali
@@ -26,16 +24,20 @@ namespace Internal
 {
 namespace Adaptor
 {
-int GetElmAccessActionOver()
+namespace SystemSettings
+{
+std::string GetResourcePath()
 {
-  return 0;
+  return DALI_DATA_RO_DIR;
 }
 
-int GetLongPressTime(int defaultTime)
+std::string GetDataPath()
 {
-  return defaultTime;
+  return "";
 }
 
+} // namespace SystemSettings
+
 } // namespace Adaptor
 
 } // namespace Internal
index 333228deaddcad87bd4b8a9e5435093904580008..6e9aee45d478dfdc6e46a734e1badfc747cbe7bf 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/android/timer-impl-android.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/adaptor-framework/android/android-framework.h>
@@ -36,7 +36,7 @@ namespace Adaptor
 namespace
 {
 // Copied from x server
-static unsigned int GetCurrentMilliSeconds()
+static uint32_t GetCurrentMilliSeconds()
 {
   struct timeval tv;
 
@@ -73,9 +73,9 @@ static unsigned int GetCurrentMilliSeconds()
 
 } // namespace
 
-struct Timer::Impl
+struct TimerAndroid::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mInterval(milliSec),
     mStartTimestamp(0),
     mPauseTimestamp(0),
@@ -84,25 +84,25 @@ struct Timer::Impl
   {
   }
 
-  unsigned int mInterval;
-  unsigned int mStartTimestamp;
-  unsigned int mPauseTimestamp;
-  bool         mRunning;
-  unsigned int mId;
+  uint32_t mInterval;
+  uint32_t mStartTimestamp;
+  uint32_t mPauseTimestamp;
+  bool     mRunning;
+  uint32_t mId;
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerAndroidPtr TimerAndroid::New(uint32_t milliSec)
 {
-  TimerPtr timer(new Timer(milliSec));
+  TimerAndroidPtr timer(new TimerAndroid(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerAndroid::TimerAndroid(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerAndroid::~TimerAndroid()
 {
   Stop();
   delete mImpl;
@@ -110,7 +110,7 @@ Timer::~Timer()
 
 bool TimerCallback(void* data)
 {
-  Timer* timer = static_cast<Timer*>(data);
+  TimerAndroid* timer = static_cast<TimerAndroid*>(data);
   if(timer->IsRunning())
   {
     return timer->Tick();
@@ -119,7 +119,7 @@ bool TimerCallback(void* data)
   return false;
 }
 
-void Timer::Start()
+void TimerAndroid::Start()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
@@ -134,7 +134,7 @@ void Timer::Start()
   mImpl->mStartTimestamp = GetCurrentMilliSeconds();
 }
 
-void Timer::Stop()
+void TimerAndroid::Stop()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
@@ -149,7 +149,7 @@ void Timer::Stop()
   ResetTimerData();
 }
 
-void Timer::Pause()
+void TimerAndroid::Pause()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
@@ -162,15 +162,15 @@ void Timer::Pause()
   }
 }
 
-void Timer::Resume()
+void TimerAndroid::Resume()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
 
   if(mImpl->mRunning && mImpl->mId == 0)
   {
-    unsigned int newInterval = 0;
-    unsigned int runningTime = mImpl->mPauseTimestamp - mImpl->mStartTimestamp;
+    uint32_t newInterval = 0;
+    uint32_t runningTime = mImpl->mPauseTimestamp - mImpl->mStartTimestamp;
     if(mImpl->mInterval > runningTime)
     {
       newInterval = mImpl->mInterval - runningTime;
@@ -182,7 +182,7 @@ void Timer::Resume()
   }
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerAndroid::SetInterval(uint32_t interval, bool restart)
 {
   // stop existing timer
   Stop();
@@ -195,12 +195,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerAndroid::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerAndroid::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -231,18 +231,13 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-void Timer::ResetTimerData()
+void TimerAndroid::ResetTimerData()
 {
   mImpl->mRunning = false;
   mImpl->mId      = 0;
 }
 
-bool Timer::IsRunning() const
+bool TimerAndroid::IsRunning() const
 {
   return mImpl->mRunning;
 }
diff --git a/dali/internal/system/android/timer-impl-android.h b/dali/internal/system/android/timer-impl-android.h
new file mode 100644 (file)
index 0000000..e72c8b6
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_TIMER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerAndroid;
+
+typedef IntrusivePtr<TimerAndroid> TimerAndroidPtr;
+
+/**
+ * @brief TimerAndroid class provides an Timer Android implementation.
+ */
+class TimerAndroid : public Timer
+{
+public:
+  static TimerAndroidPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerAndroid(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerAndroid();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerAndroid(const TimerAndroid&) = delete;
+  TimerAndroid& operator=(const TimerAndroid&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_ANDROID_TIMER_H
index 2a26eb487fe9539a4112e23013955e58c87ed40e..4749be1adc94f93c336cb11a6c4e429957bc537f 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_CALLBACK_MANAGER_H
-#define DALI_INTERNAL_CALLBACK_MANAGER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_CALLBACK_MANAGER_H
 
 /*
- * 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.
@@ -36,11 +36,6 @@ namespace Adaptor
 class CallbackManager
 {
 public:
-  /**
-     * Create a new call back interface
-     */
-  static CallbackManager* New();
-
   /**
      * Virtual destructor
      */
@@ -152,4 +147,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_INTERNAL_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_CALLBACK_MANAGER_H
index a22f07aefcd26a5a771df59f62db69652af739c6..6e9df8f41bb43dca8da48b37c0c0e3a1a47adab2 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_FILE_DESCRIPTOR_MONITOR_H
-#define DALI_INTERNAL_FILE_DESCRIPTOR_MONITOR_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_FILE_DESCRIPTOR_MONITOR_H
 
 /*
- * 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.
 
 namespace Dali
 {
-namespace Integration
-{
-class Core;
-}
-
 namespace Internal
 {
 namespace Adaptor
@@ -83,12 +78,14 @@ public:
    * readable or writable even when it isn’t. The developer should check for handle EAGAIN or equivalent
    * when reading from or write to the fd.
    */
-  FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+  FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+  {
+  }
 
   /**
    * Destructor
    */
-  ~FileDescriptorMonitor();
+  virtual ~FileDescriptorMonitor() = default;
 
 private:
   // Undefined
@@ -96,10 +93,6 @@ private:
 
   // Undefined
   FileDescriptorMonitor& operator=(const FileDescriptorMonitor& fileDescriptorMonitor);
-
-private:
-  struct Impl;
-  Impl* mImpl;
 };
 
 } // namespace Adaptor
@@ -108,4 +101,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_INTERNAL_FILE_DESCRIPTOR_MONITOR_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/common/system-factory.h b/dali/internal/system/common/system-factory.h
new file mode 100644 (file)
index 0000000..62c4c45
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// EXTERNAL INCLUDES
+#include <memory>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class CallbackManager;
+class FileDescriptorMonitor;
+
+class SystemFactory
+{
+public:
+  SystemFactory()          = default;
+  virtual ~SystemFactory() = default;
+
+  virtual std::unique_ptr<CallbackManager>       CreateCallbackManager()                                                                   = 0;
+  virtual std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) = 0;
+  virtual TimerPtr                               CreateTimer(uint32_t milliSec)                                                            = 0;
+};
+
+extern std::unique_ptr<SystemFactory> GetSystemFactory();
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_SYSTEM_FACTORY_H
index 1fd4ea85f2dcb95c0f9836044b5605c49e6e9f0c..4150ec6cc240a6aa71bd7f452ebc663d334f836e 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SYSTEM_SETTINGS_H
 
 /*
- * 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.
  *
  */
 
+// EXTERNAL INCLUDES
+#include <string>
+
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-// Get SYSTEM_SETTINGS_KEY_TAP_AND_HOLD_DELAY from system setting if available
-int GetLongPressTime(int defaultTime);
+namespace SystemSettings
+{
+/**
+ *  Gets the path at which application resources are stored.
+ */
+std::string GetResourcePath();
+
+/**
+ *  Gets the path at which application data are stored.
+ */
+std::string GetDataPath();
 
-// Get ELM_ACCESS_ACTION_OVER from Elementary if available
-int GetElmAccessActionOver();
+} // namespace SystemSettings
 
 } // namespace Adaptor
 
index ab86d83469a4b603ed156a012549a6af6a5ac530..395d4ff9253dec9e71c8a08a67358412271d0721 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_TIMER_H
-#define DALI_INTERNAL_TIMER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_H
 
 /*
- * 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.
@@ -24,7 +24,6 @@
 // INTERNAL INCLUDES
 #include <dali/internal/system/common/timer-interface.h>
 #include <dali/public-api/adaptor-framework/timer.h>
-#include <dali/public-api/dali-adaptor-common.h>
 
 namespace Dali
 {
@@ -42,79 +41,29 @@ typedef IntrusivePtr<Timer> TimerPtr;
 class Timer : public BaseObject, public TimerInterface
 {
 public:
-  static TimerPtr New(unsigned int milliSec);
-
   /**
    * Constructor
-   * @param[in]  milliSec  Interval in milliseconds.
    */
-  Timer(unsigned int milliSec);
+  Timer() = default;
 
   /**
    * Destructor.
    */
-  virtual ~Timer();
-
-public:
-  /**
-   * @copydoc Dali::Timer::Start()
-   */
-  void Start() override;
-
-  /**
-   * @copydoc Dali::Timer::Stop()
-   */
-  void Stop() override;
-
-  /**
-   * @copydoc Dali::Timer::Pause()
-   */
-  void Pause() override;
-
-  /**
-   * @copydoc Dali::Timer::Resume()
-   */
-  void Resume() override;
-
-  /**
-   * @copydoc Dali::Timer::SetInterval()
-   */
-  void SetInterval(unsigned int interval, bool restart) override;
-
-  /**
-   * @copydoc Dali::Timer::GetInterval()
-   */
-  unsigned int GetInterval() const override;
-
-  /**
-   * @copydoc Dali::Timer::IsRunning()
-   */
-  bool IsRunning() const override;
-
-  /**
-   * Tick
-   */
-  bool Tick();
+  virtual ~Timer() = default;
 
 public: // Signals
-  Dali::Timer::TimerSignalType& TickSignal();
+  Dali::Timer::TimerSignalType& TickSignal()
+  {
+    return mTickSignal;
+  }
 
 private: // Implementation
   // not implemented
-  Timer(const Timer&);
-  Timer& operator=(const Timer&);
+  Timer(const Timer&) = delete;
+  Timer& operator=(const Timer&) = delete;
 
-  /**
-   * Resets any stored timer data.
-   */
-  void ResetTimerData();
-
-private: // Data
+protected: // Data
   Dali::Timer::TimerSignalType mTickSignal;
-
-  // To hide away implementation details
-  struct Impl;
-  Impl* mImpl;
 };
 
 inline Timer& GetImplementation(Dali::Timer& timer)
@@ -141,4 +90,4 @@ inline const Timer& GetImplementation(const Dali::Timer& timer)
 
 } // namespace Dali
 
-#endif // DALI_INTERNAL_TIMER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_H
index c6106cb6b99198d29cd8e0642b16dac38d18a1be..2a876583b2916ce650649c436c947bddc364135d 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_ADAPTOR_BASE_TIMER_INTERFACE_H
-#define DALI_INTERNAL_ADAPTOR_BASE_TIMER_INTERFACE_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_INTERFACE_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_INTERFACE_H
 
 /*
- * 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.
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstdint>
+
 namespace Dali
 {
 namespace Internal
@@ -53,12 +56,12 @@ public:
   /**
    * @copydoc Dali::Timer::SetInterval()
    */
-  virtual void SetInterval(unsigned int intervalInMilliseconds, bool restart) = 0;
+  virtual void SetInterval(uint32_t intervalInMilliseconds, bool restart) = 0;
 
   /**
    * @copydoc Dali::Timer::GetInterval()
    */
-  virtual unsigned int GetInterval() const = 0;
+  virtual uint32_t GetInterval() const = 0;
 
   /**
    * @copydoc Dali::Timer::IsRunning()
@@ -78,4 +81,4 @@ protected:
 } // namespace Internal
 } // namespace Dali
 
-#endif // DALI_INTERNAL_ADAPTOR_BASE_TIMER_INTERFACE_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_INTERFACE_H
index 8f769af4791c9ea57244d423ff046e9bbeea50f2..281168965466311e6e2d50ceddf6c4b65c9b6772 100644 (file)
@@ -25,8 +25,8 @@
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
-
 #include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/common/system-factory.h>
 
 namespace Dali
 {
@@ -35,7 +35,7 @@ namespace Internal
 namespace Adaptor
 {
 TriggerEvent::TriggerEvent(CallbackBase* callback, TriggerEventInterface::Options options)
-: mFileDescriptorMonitor(NULL),
+: mFileDescriptorMonitor(),
   mCallback(callback),
   mFileDescriptor(-1),
   mOptions(options)
@@ -45,7 +45,7 @@ TriggerEvent::TriggerEvent(CallbackBase* callback, TriggerEventInterface::Option
   if(mFileDescriptor >= 0)
   {
     // Now Monitor the created event file descriptor
-    mFileDescriptorMonitor = new FileDescriptorMonitor(mFileDescriptor, MakeCallback(this, &TriggerEvent::Triggered), FileDescriptorMonitor::FD_READABLE);
+    mFileDescriptorMonitor = Dali::Internal::Adaptor::GetSystemFactory()->CreateFileDescriptorMonitor(mFileDescriptor, MakeCallback(this, &TriggerEvent::Triggered), FileDescriptorMonitor::FD_READABLE);
   }
   else
   {
@@ -55,7 +55,6 @@ TriggerEvent::TriggerEvent(CallbackBase* callback, TriggerEventInterface::Option
 
 TriggerEvent::~TriggerEvent()
 {
-  delete mFileDescriptorMonitor;
   delete mCallback;
 
   if(mFileDescriptor >= 0)
index 51221a519bffb0d1605c559cb90ae0e9487194c1..8dd324254576cf928f4936b6412946b7add57d8a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_TRIGGER_EVENT_H
 
 /*
- * 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.
@@ -20,6 +20,7 @@
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/signals/callback.h>
+#include <memory>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/adaptor-framework/trigger-event-interface.h>
@@ -81,10 +82,10 @@ private:
   struct Source;
 
 private:
-  FileDescriptorMonitor*         mFileDescriptorMonitor;
-  CallbackBase*                  mCallback;
-  int                            mFileDescriptor;
-  TriggerEventInterface::Options mOptions;
+  std::unique_ptr<FileDescriptorMonitor> mFileDescriptorMonitor;
+  CallbackBase*                          mCallback;
+  int                                    mFileDescriptor;
+  TriggerEventInterface::Options         mOptions;
 };
 
 } // namespace Adaptor
index d366736b6e627d2a65e6fef316e1f14f5684b77d..898d7030787f569eebece1f987d89e171ab60a4b 100644 (file)
@@ -31,10 +31,14 @@ SET( adaptor_system_linux_src_files
     ${adaptor_system_dir}/common/shared-file.cpp
     ${adaptor_system_dir}/common/trigger-event.cpp
     ${adaptor_system_dir}/common/trigger-event-factory.cpp
+    ${adaptor_system_dir}/common/time-service.cpp
+    ${adaptor_system_dir}/generic/shared-file-operations-generic.cpp
+    ${adaptor_system_dir}/glib/callback-manager-glib.cpp
+    ${adaptor_system_dir}/glib/file-descriptor-monitor-glib.cpp
+    ${adaptor_system_dir}/glib/timer-impl-glib.cpp
     ${adaptor_system_dir}/linux/callback-manager-ecore.cpp
     ${adaptor_system_dir}/linux/file-descriptor-monitor-ecore.cpp
-    ${adaptor_system_dir}/generic/shared-file-operations-generic.cpp
-    ${adaptor_system_dir}/common/time-service.cpp
+    ${adaptor_system_dir}/linux/system-factory-ecore.cpp
     ${adaptor_system_dir}/linux/timer-impl-ecore.cpp
 )
 
@@ -77,6 +81,7 @@ SET( adaptor_system_libuv_src_files
     ${adaptor_system_dir}/generic/shared-file-operations-generic.cpp
     ${adaptor_system_dir}/libuv/callback-manager-libuv.cpp
     ${adaptor_system_dir}/libuv/file-descriptor-monitor-libuv.cpp
+    ${adaptor_system_dir}/linuv/system-factory-libuv.cpp
     ${adaptor_system_dir}/libuv/timer-impl-libuv.cpp
     ${adaptor_system_dir}/ubuntu-x11/logging-x.cpp
     ${adaptor_system_dir}/ubuntu-x11/system-settings-x.cpp
@@ -93,6 +98,7 @@ SET( adaptor_system_glib_src_files
     ${adaptor_system_dir}/generic/shared-file-operations-generic.cpp
     ${adaptor_system_dir}/glib/callback-manager-glib.cpp
     ${adaptor_system_dir}/glib/file-descriptor-monitor-glib.cpp
+    ${adaptor_system_dir}/glib/system-factory-glib.cpp
     ${adaptor_system_dir}/glib/timer-impl-glib.cpp
     ${adaptor_system_dir}/ubuntu-x11/logging-x.cpp
     ${adaptor_system_dir}/ubuntu-x11/system-settings-x.cpp
@@ -109,6 +115,7 @@ SET( adaptor_system_android_src_files
     ${adaptor_system_dir}/android/file-descriptor-monitor-android.cpp
     ${adaptor_system_dir}/android/logging-android.cpp
     ${adaptor_system_dir}/android/shared-file-operations-android.cpp
+    ${adaptor_system_dir}/android/system-factory-android.cpp
     ${adaptor_system_dir}/android/system-settings-android.cpp
     ${adaptor_system_dir}/android/timer-impl-android.cpp
     ${adaptor_system_dir}/common/time-service.cpp
@@ -119,6 +126,7 @@ SET( adaptor_system_android_src_files
 SET( adaptor_system_windows_src_files
     ${adaptor_system_dir}/windows/callback-manager-win.cpp
     ${adaptor_system_dir}/windows/file-descriptor-monitor-windows.cpp
+    ${adaptor_system_dir}/windows/system-factory-win.cpp
     ${adaptor_system_dir}/windows/system-settings-win.cpp
     ${adaptor_system_dir}/windows/timer-impl-win.cpp
     ${adaptor_system_dir}/windows/trigger-event.cpp
@@ -133,6 +141,8 @@ SET( adaptor_system_windows_src_files
 SET( adaptor_system_macos_src_files
     ${adaptor_system_dir}/ubuntu-x11/logging-x.cpp
     ${adaptor_system_dir}/macos/file-descriptor-monitor-macos.cpp
+    ${adaptor_system_dir}/macos/system-factory-mac.cpp
+    ${adaptor_system_dir}/macos/system-settings-mac.cpp
     ${adaptor_system_dir}/macos/timer-impl-mac.cpp
     ${adaptor_system_dir}/common/shared-file.cpp
     ${adaptor_system_dir}/common/trigger-event-factory.cpp
index f6724da2c4235da408e37242719471cc77d10048..1dcb5891c38874076ad0a7eb8820f230c96aea72 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.
@@ -35,14 +35,14 @@ extern GMainContext* GetMainLoopContext();
 /**
  * Structure contains the callback function and control options
  */
-struct CallbackData
+struct GlibCallbackData
 {
   typedef gboolean (*CallbackFunction)(gpointer userData);
 
   /**
    * Constructor
    */
-  CallbackData(CallbackBase* callback, bool hasReturnValue)
+  GlibCallbackData(CallbackBase* callback, bool hasReturnValue)
   : mCallback(callback),
     mHasReturnValue(hasReturnValue)
   {
@@ -58,15 +58,15 @@ struct CallbackData
     {
       mSource = g_idle_source_new();
       g_source_set_priority(mSource, G_PRIORITY_HIGH_IDLE);
-      g_source_set_callback(mSource, &CallbackData::IdleCallback, this, nullptr); // No destroyNotify
-      guint id = g_source_attach(mSource, context);
+      g_source_set_callback(mSource, &GlibCallbackData::IdleCallback, this, nullptr); // No destroyNotify
+      g_source_attach(mSource, context);
     }
   }
 
   /**
    * Destructor
    */
-  ~CallbackData()
+  ~GlibCallbackData()
   {
     g_source_destroy(mSource);
     g_source_unref(mSource);
@@ -78,8 +78,8 @@ struct CallbackData
 
   static gboolean IdleCallback(gpointer userData)
   {
-    gboolean      retValue     = G_SOURCE_REMOVE;
-    CallbackData* callbackData = static_cast<CallbackData*>(userData);
+    gboolean          retValue     = G_SOURCE_REMOVE;
+    GlibCallbackData* callbackData = static_cast<GlibCallbackData*>(userData);
 
     if(callbackData->mHasReturnValue)
     {
@@ -139,7 +139,7 @@ void GlibCallbackManager::Stop()
 
   for(CallbackList::iterator iter = mCallbackContainer.begin(); iter != mCallbackContainer.end(); ++iter)
   {
-    CallbackData* data = (*iter);
+    GlibCallbackData* data = (*iter);
 
     delete data;
   }
@@ -153,7 +153,7 @@ bool GlibCallbackManager::AddIdleCallback(CallbackBase* callback, bool hasReturn
     return false;
   }
 
-  CallbackData* callbackData = new CallbackData(callback, hasReturnValue);
+  GlibCallbackData* callbackData = new GlibCallbackData(callback, hasReturnValue);
 
   // To inform the manager a callback has finished, we get it to call RemoveCallbackFromContainer
   callbackData->mRemoveFromContainerFunction = MakeCallback(this, &GlibCallbackManager::RemoveCallbackFromContainer);
@@ -174,7 +174,7 @@ void GlibCallbackManager::RemoveIdleCallback(CallbackBase* callback)
       it != endIt;
       ++it)
   {
-    CallbackData* data = *it;
+    GlibCallbackData* data = *it;
 
     if(data->mCallback == callback)
     {
@@ -204,7 +204,7 @@ bool GlibCallbackManager::AddIdleEntererCallback(CallbackBase* callback)
     return false;
   }
 
-  CallbackData* callbackData = new CallbackData(callback, true);
+  GlibCallbackData* callbackData = new GlibCallbackData(callback, true);
 
   // To inform the manager a callback has finished, we get it to call RemoveCallbackFromContainer
   callbackData->mRemoveFromContainerFunction = MakeCallback(this, &GlibCallbackManager::RemoveCallbackFromContainer);
@@ -223,17 +223,11 @@ void GlibCallbackManager::RemoveIdleEntererCallback(CallbackBase* callback)
   RemoveIdleCallback(callback);
 }
 
-void GlibCallbackManager::RemoveCallbackFromContainer(CallbackData* callbackData)
+void GlibCallbackManager::RemoveCallbackFromContainer(GlibCallbackData* callbackData)
 {
   mCallbackContainer.remove(callbackData);
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new GlibCallbackManager;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index de2becfa0dce7cabf3155c1290693d2819c93845..4d0c865fd3dfaa1146a8d3be8a047a747b040531 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_ADAPTOR_GLIB_CALLBACK_MANAGER_H
-#define DALI_ADAPTOR_GLIB_CALLBACK_MANAGER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_CALLBACK_MANAGER_H
 
 /*
- * 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.
@@ -30,7 +30,7 @@ namespace Internal
 {
 namespace Adaptor
 {
-struct CallbackData;
+struct GlibCallbackData;
 
 /**
  * @brief Glib callback manager used to install call backs in the applications main loop.
@@ -95,9 +95,14 @@ private:
    * Always called from main thread
    * @param callbackData callback data
    */
-  void RemoveCallbackFromContainer(CallbackData* callbackData);
+  void RemoveCallbackFromContainer(GlibCallbackData* callbackData);
 
-  typedef std::list<CallbackData*> CallbackList; ///< list of callbacks installed
+  // Undefined
+  GlibCallbackManager(const GlibCallbackManager&) = delete;
+  GlibCallbackManager& operator=(GlibCallbackManager&) = delete;
+
+private:
+  typedef std::list<GlibCallbackData*> CallbackList; ///< list of callbacks installed
 
   bool         mRunning;           ///< flag is set to true if when running
   CallbackList mCallbackContainer; ///< container of live callbacks
@@ -109,4 +114,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_ADAPTOR_GLIB_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_CALLBACK_MANAGER_H
index c8b7589d0c17d4c5eb3c1ec73b7a4e6c48cefb1c..572641ff8f5b24fb33a9896365b4f2eda07e2286 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/glib/file-descriptor-monitor-glib.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -34,7 +34,7 @@ extern GMainContext* GetMainLoopContext();
 /**
  * Using Impl to hide away framework specific members
  */
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorGlib::Impl
 {
 public:
   // Constructor
@@ -62,7 +62,7 @@ public:
   {
     if(userData)
     {
-      FileDescriptorMonitor::Impl* impl = static_cast<FileDescriptorMonitor::Impl*>(userData);
+      FileDescriptorMonitorGlib::Impl* impl = static_cast<FileDescriptorMonitorGlib::Impl*>(userData);
 
       // filter the events that have occured based on what we are monitoring
       int eventType = FileDescriptorMonitor::FD_NO_EVENT;
@@ -91,7 +91,8 @@ public:
   GSource*      mPollSource;
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorGlib::FileDescriptorMonitorGlib(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   if(fileDescriptor < 1)
   {
@@ -114,7 +115,7 @@ FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* c
   mImpl = new Impl(fileDescriptor, callback, static_cast<GIOCondition>(events));
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorGlib::~FileDescriptorMonitorGlib()
 {
   delete mImpl;
 }
diff --git a/dali/internal/system/glib/file-descriptor-monitor-glib.h b/dali/internal/system/glib/file-descriptor-monitor-glib.h
new file mode 100644 (file)
index 0000000..c30ab83
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorGlib class provides an FileDescriptorMonitor Glib implementation.
+ */
+class FileDescriptorMonitorGlib : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorGlib(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorGlib();
+
+private:
+  // Undefined
+  FileDescriptorMonitorGlib(const FileDescriptorMonitorGlib& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorGlib& operator=(const FileDescriptorMonitorGlib& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/glib/system-factory-glib.cpp b/dali/internal/system/glib/system-factory-glib.cpp
new file mode 100644 (file)
index 0000000..540cc6c
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/glib/system-factory-glib.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/glib/callback-manager-glib.h>
+#include <dali/internal/system/glib/file-descriptor-monitor-glib.h>
+#include <dali/internal/system/glib/timer-impl-glib.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryGlib::CreateCallbackManager()
+{
+  return Utils::MakeUnique<GlibCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryGlib::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorGlib>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryGlib::CreateTimer(uint32_t milliSec)
+{
+  return TimerGlib::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryGlib>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/glib/system-factory-glib.h b/dali/internal/system/glib/system-factory-glib.h
new file mode 100644 (file)
index 0000000..0d163e7
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryGlib : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_SYSTEM_FACTORY_H
index 32771798ec26b3f8993dba23ddb12f02c90ab561..2fc64ef66c233fcbfbc19807c37b8bff16f139aa 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/glib/timer-impl-glib.h>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -34,7 +34,7 @@ namespace
 {
 gboolean TimerSourceFunc(gpointer userData)
 {
-  Timer* timer = static_cast<Timer*>(userData);
+  TimerGlib* timer = static_cast<TimerGlib*>(userData);
 
   bool keepRunning = timer->Tick();
   return keepRunning ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
@@ -42,39 +42,39 @@ gboolean TimerSourceFunc(gpointer userData)
 
 } // unnamed namespace
 
-struct Timer::Impl
+struct TimerGlib::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mInterval(milliSec)
   {
   }
 
-  GSource*     mTimerHandle{nullptr};
-  unsigned int mInterval{0};
-  uint32_t     mStartTimestamp{0};
-  uint32_t     mPauseTimestamp{0};
-  bool         mRunning{false};
-  bool         mRestartAfterExpiry{false}; // Restart at full interval after pause/resume/expiry
+  GSource* mTimerHandle{nullptr};
+  uint32_t mInterval{0};
+  uint32_t mStartTimestamp{0};
+  uint32_t mPauseTimestamp{0};
+  bool     mRunning{false};
+  bool     mRestartAfterExpiry{false}; // Restart at full interval after pause/resume/expiry
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerGlibPtr TimerGlib::New(uint32_t milliSec)
 {
-  TimerPtr timer(new Timer(milliSec));
+  TimerGlibPtr timer(new TimerGlib(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerGlib::TimerGlib(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerGlib::~TimerGlib()
 {
   Stop();
   delete mImpl;
 }
 
-void Timer::Start()
+void TimerGlib::Start()
 {
   if(mImpl->mRunning && mImpl->mTimerHandle)
   {
@@ -89,7 +89,7 @@ void Timer::Start()
   mImpl->mStartTimestamp = TimeService::GetMilliSeconds();
 }
 
-void Timer::Stop()
+void TimerGlib::Stop()
 {
   if(mImpl->mTimerHandle != nullptr)
   {
@@ -104,7 +104,7 @@ void Timer::Stop()
   ResetTimerData();
 }
 
-void Timer::Pause()
+void TimerGlib::Pause()
 {
   if(mImpl->mRunning)
   {
@@ -115,7 +115,7 @@ void Timer::Pause()
   }
 }
 
-void Timer::Resume()
+void TimerGlib::Resume()
 {
   if(mImpl->mRunning && mImpl->mTimerHandle == nullptr)
   {
@@ -137,7 +137,7 @@ void Timer::Resume()
   }
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerGlib::SetInterval(uint32_t interval, bool restart)
 {
   // stop existing timer
   Stop();
@@ -150,12 +150,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerGlib::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerGlib::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -195,12 +195,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-void Timer::ResetTimerData()
+void TimerGlib::ResetTimerData()
 {
   mImpl->mRunning = false;
   if(mImpl->mTimerHandle)
@@ -210,7 +205,7 @@ void Timer::ResetTimerData()
   mImpl->mTimerHandle = nullptr;
 }
 
-bool Timer::IsRunning() const
+bool TimerGlib::IsRunning() const
 {
   return mImpl->mRunning;
 }
diff --git a/dali/internal/system/glib/timer-impl-glib.h b/dali/internal/system/glib/timer-impl-glib.h
new file mode 100644 (file)
index 0000000..1689d15
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_TIMER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerGlib;
+
+typedef IntrusivePtr<TimerGlib> TimerGlibPtr;
+
+/**
+ * @brief TimerGlib class provides an Timer Glib implementation.
+ */
+class TimerGlib : public Timer
+{
+public:
+  static TimerGlibPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerGlib(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerGlib();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerGlib(const TimerGlib&) = delete;
+  TimerGlib& operator=(const TimerGlib&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_GLIB_TIMER_H
index 072c1aa99f75e4db17d12b5794d07781cd5aeed0..72326f9d950680c5d9fed5135d6361312a26b51c 100644 (file)
@@ -236,12 +236,6 @@ void UvCallbackManager::RemoveCallbackFromContainer(CallbackData* callbackData)
   mCallbackContainer.remove(callbackData);
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new UvCallbackManager;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index e07c6e2701392a1328e7d9ddacbde9fb51cede07..b7ff410ab3dbba51052cf7a5e71930055c733e83 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __DALI_UV_CALLBACK_MANAGER_H__
-#define __DALI_UV_CALLBACK_MANAGER_H__
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_CALLBACK_MANAGER_H
 
 /*
  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
@@ -97,6 +97,11 @@ private:
      */
   void RemoveCallbackFromContainer(CallbackData* callbackData);
 
+  // Undefined
+  UvCallbackManager(const UvCallbackManager&) = delete;
+  UvCallbackManager& operator=(UvCallbackManager&) = delete;
+
+private:
   typedef std::list<CallbackData*> CallbackList; ///< list of callbacks installed
 
   bool         mRunning;           ///< flag is set to true if when running
@@ -109,4 +114,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_UV_CALLBACK_MANAGER_H__
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_CALLBACK_MANAGER_H
index a946dc4d2171e39fce6e68e43bd6bf094ecaaa3e..54da49b956380879c3e31aefd6d323675f44127e 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/libuv/file-descriptor-monitor-libuv.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -42,7 +42,7 @@ void FreeHandleCallback(uv_handle_t* handle)
 /**
  * Using Impl to hide away UV specific members
  */
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorLibuv::Impl
 {
 public:
   // Constructor
@@ -79,7 +79,7 @@ public:
   {
     if(handle->data)
     {
-      FileDescriptorMonitor::Impl* impl = static_cast<FileDescriptorMonitor::Impl*>(handle->data);
+      FileDescriptorMonitorLibuv::Impl* impl = static_cast<FileDescriptorMonitorLibuv::Impl*>(handle->data);
 
       if(status < 0)
       {
@@ -114,7 +114,8 @@ public:
   uv_poll_t*    pollHandle;
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorLibuv::FileDescriptorMonitorLibuv(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   if(fileDescriptor < 1)
   {
@@ -137,7 +138,7 @@ FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* c
   mImpl = new Impl(fileDescriptor, callback, static_cast<uv_poll_event>(events));
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorLibuv::~FileDescriptorMonitorLibuv()
 {
   delete mImpl;
 }
diff --git a/dali/internal/system/libuv/file-descriptor-monitor-libuv.h b/dali/internal/system/libuv/file-descriptor-monitor-libuv.h
new file mode 100644 (file)
index 0000000..1cc6750
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorLibuv class provides an FileDescriptorMonitor Libuv implementation.
+ */
+class FileDescriptorMonitorLibuv : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorLibuv(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorLibuv();
+
+private:
+  // Undefined
+  FileDescriptorMonitorLibuv(const FileDescriptorMonitorLibuv& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorLibuv& operator=(const FileDescriptorMonitorLibuv& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/libuv/system-factory-libuv.cpp b/dali/internal/system/libuv/system-factory-libuv.cpp
new file mode 100644 (file)
index 0000000..6aa6d9d
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/libuv/system-factory-libuv.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/libuv/callback-manager-libuv.h>
+#include <dali/internal/system/libuv/file-descriptor-monitor-libuv.h>
+#include <dali/internal/system/libuv/timer-impl-libuv.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryLibuv::CreateCallbackManager()
+{
+  return Utils::MakeUnique<UvCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryLibuv::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorLibuv>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryLibuv::CreateTimer(uint32_t milliSec)
+{
+  return TimerLibuv::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryLibuv>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/libuv/system-factory-libuv.h b/dali/internal/system/libuv/system-factory-libuv.h
new file mode 100644 (file)
index 0000000..e93ce2f
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryLibuv : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_SYSTEM_FACTORY_H
index 7a47119f8e9dd5671cf2c6bb0c85e0b090803569..00b3a62a2e8efc3497b3d57464723724812e1542 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/libuv/timer-impl-libuv.h>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -36,7 +36,7 @@ namespace
 {
 void TimerSourceFunc(uv_timer_t* handle)
 {
-  Timer* timer = static_cast<Timer*>(handle->data);
+  TimerLibuv* timer = static_cast<TimerLibuv*>(handle->data);
 
   bool keepRunning = timer->Tick();
   if(!keepRunning)
@@ -54,9 +54,9 @@ void FreeHandleCallback(uv_handle_t* handle)
 /**
  * Struct to hide away libuv implementation details
  */
-struct Timer::Impl
+struct TimerLibuv::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mTimerHandle(NULL),
     mInterval(milliSec),
     mRunning(false)
@@ -117,24 +117,24 @@ struct Timer::Impl
     uv_timer_start(mTimerHandle, TimerSourceFunc, mInterval, mInterval);
   }
 
-  uv_timer_t*  mTimerHandle;
-  unsigned int mInterval;
-  bool         mRunning;
+  uv_timer_t* mTimerHandle;
+  uint32_t    mInterval;
+  bool        mRunning;
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerLibuvPtr TimerLibuv::New(uint32_t milliSec)
 {
   DALI_LOG_ERROR(" new timer\n");
-  TimerPtr timer(new Timer(milliSec));
+  TimerLibuvPtr timer(new TimerLibuv(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerLibuv::TimerLibuv(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerLibuv::~TimerLibuv()
 {
   // stop timers
   Stop();
@@ -142,27 +142,27 @@ Timer::~Timer()
   delete mImpl;
 }
 
-void Timer::Start()
+void TimerLibuv::Start()
 {
   mImpl->Start(this);
 }
 
-void Timer::Stop()
+void TimerLibuv::Stop()
 {
   mImpl->Stop();
 }
 
-void Timer::Pause()
+void TimerLibuv::Pause()
 {
   mImpl->Pause();
 }
 
-void Timer::Resume()
+void TimerLibuv::Resume()
 {
   mImpl->Resume();
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerLibuv::SetInterval(uint32_t interval, bool restart)
 {
   // stop existing timer
   Stop();
@@ -176,12 +176,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerLibuv::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerLibuv::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -212,12 +212,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerLibuv::IsRunning() const
 {
   return mImpl->mRunning;
 }
diff --git a/dali/internal/system/libuv/timer-impl-libuv.h b/dali/internal/system/libuv/timer-impl-libuv.h
new file mode 100644 (file)
index 0000000..8fbb316
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_TIMER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerLibuv;
+
+typedef IntrusivePtr<TimerLibuv> TimerLibuvPtr;
+
+/**
+ * @brief TimerLibuv class provides an Timer Libuv implementation.
+ */
+class TimerLibuv : public Timer
+{
+public:
+  static TimerLibuvPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerLibuv(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerLibuv();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerLibuv(const TimerLibuv&) = delete;
+  TimerLibuv& operator=(const TimerLibuv&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_TIMER_H
index 3c2e478ea61bdb690eaed469c679e92f746fa43f..367b186ea5d2cb34a8d7969316a742c5d1e9b75a 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.
@@ -34,12 +34,12 @@ namespace Adaptor
 /**
  * Structure contains the callback function and control options
  */
-struct CallbackData
+struct EcoreCallbackData
 {
   /**
    * Constructor
    */
-  CallbackData(CallbackBase* callback, bool hasReturnValue)
+  EcoreCallbackData(CallbackBase* callback, bool hasReturnValue)
   : mCallback(callback),
     mRemoveFromContainerFunction(NULL),
     mIdler(NULL),
@@ -50,7 +50,7 @@ struct CallbackData
   /**
    * Destructor
    */
-  ~CallbackData()
+  ~EcoreCallbackData()
   {
     delete mCallback;
     delete mRemoveFromContainerFunction;
@@ -70,8 +70,8 @@ namespace
  */
 Eina_Bool IdleCallback(void* data)
 {
-  Eina_Bool     ret          = ECORE_CALLBACK_CANCEL; // CALLBACK Cancel will delete the idler so we don't need to call ecore_idler_del
-  CallbackData* callbackData = static_cast<CallbackData*>(data);
+  Eina_Bool          ret          = ECORE_CALLBACK_CANCEL; // CALLBACK Cancel will delete the idler so we don't need to call ecore_idler_del
+  EcoreCallbackData* callbackData = static_cast<EcoreCallbackData*>(data);
 
   if(callbackData->mHasReturnValue)
   {
@@ -137,7 +137,7 @@ bool EcoreCallbackManager::AddIdleCallback(CallbackBase* callback, bool hasRetur
     return false;
   }
 
-  CallbackData* callbackData = new CallbackData(callback, hasReturnValue);
+  EcoreCallbackData* callbackData = new EcoreCallbackData(callback, hasReturnValue);
 
   callbackData->mRemoveFromContainerFunction = MakeCallback(this, &EcoreCallbackManager::RemoveCallbackFromContainer);
 
@@ -159,7 +159,7 @@ void EcoreCallbackManager::RemoveIdleCallback(CallbackBase* callback)
       it != endIt;
       ++it)
   {
-    CallbackData* data = *it;
+    EcoreCallbackData* data = *it;
 
     if(data->mCallback == callback)
     {
@@ -194,7 +194,7 @@ bool EcoreCallbackManager::AddIdleEntererCallback(CallbackBase* callback)
     return false;
   }
 
-  CallbackData* callbackData = new CallbackData(callback, true);
+  EcoreCallbackData* callbackData = new EcoreCallbackData(callback, true);
 
   callbackData->mRemoveFromContainerFunction = MakeCallback(this, &EcoreCallbackManager::RemoveCallbackFromContainer);
 
@@ -216,7 +216,7 @@ void EcoreCallbackManager::RemoveIdleEntererCallback(CallbackBase* callback)
       it != endIt;
       ++it)
   {
-    CallbackData* data = *it;
+    EcoreCallbackData* data = *it;
 
     if(data->mCallback == callback)
     {
@@ -233,7 +233,7 @@ void EcoreCallbackManager::RemoveIdleEntererCallback(CallbackBase* callback)
   }
 }
 
-void EcoreCallbackManager::RemoveCallbackFromContainer(CallbackData* callbackData)
+void EcoreCallbackManager::RemoveCallbackFromContainer(EcoreCallbackData* callbackData)
 {
   mCallbackContainer.remove(callbackData);
 }
@@ -243,7 +243,7 @@ void EcoreCallbackManager::RemoveAllCallbacks()
   // always called from main thread
   for(CallbackList::iterator iter = mCallbackContainer.begin(); iter != mCallbackContainer.end(); ++iter)
   {
-    CallbackData* data = (*iter);
+    EcoreCallbackData* data = (*iter);
 
     if(data->mIdler)
     {
@@ -259,12 +259,6 @@ void EcoreCallbackManager::RemoveAllCallbacks()
   mCallbackContainer.clear();
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new EcoreCallbackManager;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index a76d5ce060cd13e4cb16f86072f519a44129f2bd..c756f51692d3f417e79c02b031eab9f8367293bb 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_ECORE_CALLBACK_MANAGER_H
-#define DALI_ECORE_CALLBACK_MANAGER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_CALLBACK_MANAGER_H
 
 /*
- * 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.
@@ -30,7 +30,7 @@ namespace Internal
 {
 namespace Adaptor
 {
-struct CallbackData;
+struct EcoreCallbackData;
 
 /**
  * Ecore interface to install call backs in the applications main loop.
@@ -39,80 +39,85 @@ class EcoreCallbackManager : public CallbackManager
 {
 public:
   /**
-     * @brief constructor
-     */
+   * @brief constructor
+   */
   EcoreCallbackManager();
 
   /**
-     * @brief destructor
-     */
+   * @brief destructor
+   */
   ~EcoreCallbackManager()
   {
   }
 
   /**
-     * @copydoc CallbackManager::AddIdleCallback()
-     */
+   * @copydoc CallbackManager::AddIdleCallback()
+   */
   bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleCallback()
+   */
   void RemoveIdleCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   bool ProcessIdle() override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   void ClearIdleCallbacks() override;
 
   /**
-     * @copydoc CallbackManager::AddIdleEntererCallback()
-     */
+   * @copydoc CallbackManager::AddIdleEntererCallback()
+   */
   bool AddIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleEntererCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleEntererCallback()
+   */
   void RemoveIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::Start()
-     */
+   * @copydoc CallbackManager::Start()
+   */
   void Start() override;
 
   /**
-     * @copydoc CallbackManager::Stop()
-     */
+   * @copydoc CallbackManager::Stop()
+   */
   void Stop() override;
 
 private:
   /**
-     * @brief Remove all idle call backs that are pending
-     * Called by Stop()
-     * Always called from the main thread
-     */
+   * @brief Remove all idle call backs that are pending
+   * Called by Stop()
+   * Always called from the main thread
+   */
   void RemoveAllCallbacks();
 
   /**
-     * @brief Removes a single call back from the container
-     * Always called from main thread
-     * @param callbackData callback data
-     */
-  void RemoveCallbackFromContainer(CallbackData* callbackData);
+   * @brief Removes a single call back from the container
+   * Always called from main thread
+   * @param callbackData callback data
+   */
+  void RemoveCallbackFromContainer(EcoreCallbackData* callbackData);
 
   /**
-     * @brief Remove a standard call back from ecore
-     * Always called from main thread
-     * @param callbackData callback data
-     */
-  void RemoveStandardCallback(CallbackData* callbackData);
+   * @brief Remove a standard call back from ecore
+   * Always called from main thread
+   * @param callbackData callback data
+   */
+  void RemoveStandardCallback(EcoreCallbackData* callbackData);
 
-  typedef std::list<CallbackData*> CallbackList;
+  // Undefined
+  EcoreCallbackManager(const EcoreCallbackManager&) = delete;
+  EcoreCallbackManager& operator=(EcoreCallbackManager&) = delete;
+
+private:
+  typedef std::list<EcoreCallbackData*> CallbackList;
 
   bool         mRunning;           ///< flag is set to true if when running
   CallbackList mCallbackContainer; ///< container of live idle callbacks
@@ -124,4 +129,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_ECORE_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_CALLBACK_MANAGER_H
index f121abed52bb4130c45e2adef16d9dbbb6d4a5af..5d47dd81808e2023a2734c63fd6c377728d01755 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/linux/file-descriptor-monitor-ecore.h>
 
 // EXTERNAL INCLUDES
 #include <dali/internal/system/linux/dali-ecore.h>
@@ -33,7 +33,7 @@ namespace Adaptor
 /**
  * Using Impl to hide away EFL specific members
  */
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorEcore::Impl
 {
   // Construction
   Impl(int fileDescriptor, CallbackBase* callback, int eventsToMonitor)
@@ -101,7 +101,8 @@ struct FileDescriptorMonitor::Impl
   }
 };
 
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorEcore::FileDescriptorMonitorEcore(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   mImpl = new Impl(fileDescriptor, callback, eventBitmask);
 
@@ -124,7 +125,7 @@ FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* c
   mImpl->mHandler         = ecore_main_fd_handler_add(fileDescriptor, static_cast<Ecore_Fd_Handler_Flags>(events), &Impl::EventDispatch, mImpl, NULL, NULL);
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorEcore::~FileDescriptorMonitorEcore()
 {
   if(mImpl->mHandler)
   {
diff --git a/dali/internal/system/linux/file-descriptor-monitor-ecore.h b/dali/internal/system/linux/file-descriptor-monitor-ecore.h
new file mode 100644 (file)
index 0000000..88f6eb1
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorEcore class provides an FileDescriptorMonitor Ecore implementation.
+ */
+class FileDescriptorMonitorEcore : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorEcore(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorEcore();
+
+private:
+  // Undefined
+  FileDescriptorMonitorEcore(const FileDescriptorMonitorEcore& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorEcore& operator=(const FileDescriptorMonitorEcore& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/linux/system-factory-ecore.cpp b/dali/internal/system/linux/system-factory-ecore.cpp
new file mode 100644 (file)
index 0000000..8a4b40b
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/linux/system-factory-ecore.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/common/framework-factory.h>
+#include <dali/internal/system/glib/callback-manager-glib.h>
+#include <dali/internal/system/glib/file-descriptor-monitor-glib.h>
+#include <dali/internal/system/glib/timer-impl-glib.h>
+#include <dali/internal/system/linux/callback-manager-ecore.h>
+#include <dali/internal/system/linux/file-descriptor-monitor-ecore.h>
+#include <dali/internal/system/linux/timer-impl-ecore.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryEcore::CreateCallbackManager()
+{
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::GLIB)
+  {
+    return Utils::MakeUnique<GlibCallbackManager>();
+  }
+  else
+  {
+    return Utils::MakeUnique<EcoreCallbackManager>();
+  }
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryEcore::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::GLIB)
+  {
+    return Utils::MakeUnique<FileDescriptorMonitorGlib>(fileDescriptor, callback, eventBitmask);
+  }
+  else
+  {
+    return Utils::MakeUnique<FileDescriptorMonitorEcore>(fileDescriptor, callback, eventBitmask);
+  }
+}
+
+TimerPtr SystemFactoryEcore::CreateTimer(uint32_t milliSec)
+{
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::GLIB)
+  {
+    return TimerGlib::New(milliSec);
+  }
+  else
+  {
+    return TimerEcore::New(milliSec);
+  }
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryEcore>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/linux/system-factory-ecore.h b/dali/internal/system/linux/system-factory-ecore.h
new file mode 100644 (file)
index 0000000..e4a108d
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryEcore : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_SYSTEM_FACTORY_H
index b06945a33faacc4664466b0072ee2ee7a734b2c8..2878778a961eaf07917a2fe7617df8e5618905b5 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/linux/timer-impl-ecore.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/common/adaptor-impl.h>
@@ -35,7 +35,7 @@ namespace
 {
 Eina_Bool TimerSourceFunc(void* data)
 {
-  Timer* timer = static_cast<Timer*>(data);
+  TimerEcore* timer = static_cast<TimerEcore*>(data);
 
   bool keepRunning = timer->Tick();
 
@@ -46,36 +46,36 @@ Eina_Bool TimerSourceFunc(void* data)
 /**
  * Struct to hide away Ecore implementation details
  */
-struct Timer::Impl
+struct TimerEcore::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mId(NULL),
     mInterval(milliSec)
   {
   }
 
   Ecore_Timer* mId;
-  unsigned int mInterval;
+  uint32_t     mInterval;
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerEcorePtr TimerEcore::New(uint32_t milliSec)
 {
-  TimerPtr timer(new Timer(milliSec));
+  TimerEcorePtr timer(new TimerEcore(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerEcore::TimerEcore(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerEcore::~TimerEcore()
 {
   ResetTimerData();
   delete mImpl;
 }
 
-void Timer::Start()
+void TimerEcore::Start()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
@@ -88,7 +88,7 @@ void Timer::Start()
   mImpl->mId      = ecore_timer_add(interval, reinterpret_cast<Ecore_Task_Cb>(TimerSourceFunc), this);
 }
 
-void Timer::Stop()
+void TimerEcore::Stop()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
@@ -96,7 +96,7 @@ void Timer::Stop()
   ResetTimerData();
 }
 
-void Timer::Pause()
+void TimerEcore::Pause()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
@@ -107,7 +107,7 @@ void Timer::Pause()
   }
 }
 
-void Timer::Resume()
+void TimerEcore::Resume()
 {
   // Timer should be used in the event thread
   DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
@@ -118,7 +118,7 @@ void Timer::Resume()
   }
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerEcore::SetInterval(uint32_t interval, bool restart)
 {
   // stop existing timer
   Stop();
@@ -131,12 +131,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerEcore::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerEcore::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -167,12 +167,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-void Timer::ResetTimerData()
+void TimerEcore::ResetTimerData()
 {
   if(mImpl->mId != NULL)
   {
@@ -181,7 +176,7 @@ void Timer::ResetTimerData()
   }
 }
 
-bool Timer::IsRunning() const
+bool TimerEcore::IsRunning() const
 {
   return mImpl->mId != NULL;
 }
diff --git a/dali/internal/system/linux/timer-impl-ecore.h b/dali/internal/system/linux/timer-impl-ecore.h
new file mode 100644 (file)
index 0000000..1da916c
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_TIMER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerEcore;
+
+typedef IntrusivePtr<TimerEcore> TimerEcorePtr;
+
+/**
+ * @brief TimerEcore class provides an Timer Ecore implementation.
+ */
+class TimerEcore : public Timer
+{
+public:
+  static TimerEcorePtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerEcore(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerEcore();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerEcore(const TimerEcore&) = delete;
+  TimerEcore& operator=(const TimerEcore&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_TIMER_H
index b454af6fccb6854b351408595473ed4ffc036b23..4b14b2035ac4469728188393f14670ad660e1bcc 100644 (file)
@@ -1,7 +1,7 @@
 #pragma once
 
 /*
- * 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/system/common/callback-manager.h>
+// EXTERNAL INCLUDES
 #include <memory>
 
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/callback-manager.h>
+
 namespace Dali::Internal::Adaptor
 {
 /**
@@ -28,10 +31,18 @@ namespace Dali::Internal::Adaptor
 class CocoaCallbackManager : public CallbackManager
 {
 public:
+  /**
+   * @brief constructor
+   */
   CocoaCallbackManager();
 
   /**
-     * @copydoc CallbackManager::AddIdleCallback()
+   * @brief destructor
+   */
+  ~CocoaCallbackManager();
+
+  /**
+   * @copydoc CallbackManager::AddIdleCallback()
    */
   bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
 
@@ -70,8 +81,14 @@ public:
    */
   void Stop() override;
 
+  /// Implementation structure
   struct Impl;
 
+private:
+  // Undefined
+  CocoaCallbackManager(const CocoaCallbackManager&) = delete;
+  CocoaCallbackManager& operator=(CocoaCallbackManager&) = delete;
+
 private:
   std::unique_ptr<Impl> mImpl;
   bool                  mRunning;
index 7e892c4f94823d19dff0f864b02a7d46754cdc80..99a4c1119b235bfcab0e0f01c9e19853ef936636 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 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.
@@ -234,18 +234,14 @@ bool CocoaCallbackManager::Impl::AddIdleCallback(
   return false;
 }
 
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
-  return new CocoaCallbackManager;
-}
-
 CocoaCallbackManager::CocoaCallbackManager()
   : mImpl(std::make_unique<CocoaCallbackManager::Impl>())
   , mRunning(false)
 {
 }
 
+CocoaCallbackManager::~CocoaCallbackManager() = default;
+
 bool CocoaCallbackManager::AddIdleCallback(CallbackBase *callback, bool hasReturnValue)
 {
   return mRunning && mImpl->AddIdleCallback(callback, hasReturnValue);
index 983a39f04329b7612bb670d0049455e12b042c88..acd90da6b8dc971dc5db74392b5a69114e5f426b 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.
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/macos/file-descriptor-monitor-macos.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
 namespace Dali::Internal::Adaptor
 {
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorMac::FileDescriptorMonitorMac(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   DALI_LOG_WARNING("Implementation missing for macOS");
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorMac::~FileDescriptorMonitorMac()
 {
 }
 
diff --git a/dali/internal/system/macos/file-descriptor-monitor-macos.h b/dali/internal/system/macos/file-descriptor-monitor-macos.h
new file mode 100644 (file)
index 0000000..bf98191
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorMac class provides an FileDescriptorMonitor Mac implementation.
+ */
+class FileDescriptorMonitorMac : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorMac(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorMac();
+
+private:
+  // Undefined
+  FileDescriptorMonitorMac(const FileDescriptorMonitorMac& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorMac& operator=(const FileDescriptorMonitorMac& fileDescriptorMonitor) = delete;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/macos/system-factory-mac.cpp b/dali/internal/system/macos/system-factory-mac.cpp
new file mode 100644 (file)
index 0000000..294c29f
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/macos/system-factory-mac.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/macos/callback-manager-mac.h>
+#include <dali/internal/system/macos/file-descriptor-monitor-macos.h>
+#include <dali/internal/system/macos/timer-impl-mac.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryMac::CreateCallbackManager()
+{
+  return Utils::MakeUnique<CocoaCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryMac::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorMac>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryMac::CreateTimer(uint32_t milliSec)
+{
+  return TimerMac::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryMac>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/macos/system-factory-mac.h b/dali/internal/system/macos/system-factory-mac.h
new file mode 100644 (file)
index 0000000..665bfc8
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryMac : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_SYSTEM_FACTORY_H
diff --git a/dali/internal/system/macos/system-settings-mac.cpp b/dali/internal/system/macos/system-settings-mac.cpp
new file mode 100644 (file)
index 0000000..98c59ea
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/common/system-settings.h>
+
+// EXTERNAL INCLUDES
+#include <stdlib.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace SystemSettings
+{
+std::string GetResourcePath()
+{
+  // "DALI_APPLICATION_PACKAGE" is used by macOS specifically to get the already configured Application package path.
+  const char* macEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
+  char*       value                  = getenv(macEnvironmentVariable);
+  std::string resourcePath;
+  if(value != NULL)
+  {
+    resourcePath = value;
+  }
+
+  if(resourcePath.back() != '/')
+  {
+    resourcePath += "/";
+  }
+
+  return resourcePath;
+}
+
+std::string GetDataPath()
+{
+  const char* macEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
+  char*       value                  = getenv(macEnvironmentVariable);
+  std::string dataPath;
+  if(value != NULL)
+  {
+    dataPath = value;
+  }
+
+  return dataPath;
+}
+
+} // namespace SystemSettings
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index f6544ee1bfac31de80c403105b4a792178173cc1..b93c4ec179b36f773e1d67462664b3996e87d560 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.
@@ -16,7 +16,9 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/macos/timer-impl-mac.h>
+
+// EXTERNAL INCLUDES
 #include "extern-definitions.h"
 
 namespace Dali::Internal::Adaptor
@@ -24,9 +26,9 @@ namespace Dali::Internal::Adaptor
 /**
  * Struct to hide away macOS implementation details
  */
-struct Timer::Impl
+struct TimerMac::Impl
 {
-  Impl(Timer* parent, unsigned int milliSec)
+  Impl(TimerMac* parent, uint32_t milliSec)
   : mTimer(CreateTimer(parent, milliSec))
   {
   }
@@ -40,9 +42,9 @@ struct Timer::Impl
 
   void Start();
   void Stop();
-  void Reset(Timer* parent, unsigned int milliSec);
+  void Reset(TimerMac* parent, uint32_t milliSec);
 
-  unsigned int GetInterval() const noexcept
+  uint32_t GetInterval() const noexcept
   {
     return CFRunLoopTimerGetInterval(mTimer.get()) * 1000.0;
   }
@@ -53,18 +55,18 @@ struct Timer::Impl
   }
 
 private:
-  CFRef<CFRunLoopTimerRef> CreateTimer(Timer* parent, unsigned int milliSec);
+  CFRef<CFRunLoopTimerRef> CreateTimer(TimerMac* parent, uint32_t milliSec);
 
   CFRef<CFRunLoopTimerRef> mTimer;
 };
 
-void Timer::Impl::TimerProc(CFRunLoopTimerRef timer, void* info)
+void TimerMac::Impl::TimerProc(CFRunLoopTimerRef timer, void* info)
 {
-  auto* pTimer = static_cast<Timer*>(info);
+  auto* pTimer = static_cast<TimerMac*>(info);
   pTimer->Tick();
 }
 
-void Timer::Impl::Start()
+void TimerMac::Impl::Start()
 {
   if(!IsRunning())
   {
@@ -73,7 +75,7 @@ void Timer::Impl::Start()
   }
 }
 
-void Timer::Impl::Stop()
+void TimerMac::Impl::Stop()
 {
   if(IsRunning())
   {
@@ -96,7 +98,7 @@ void Timer::Impl::Stop()
   }
 }
 
-void Timer::Impl::Reset(Timer* parent, unsigned int milliSec)
+void TimerMac::Impl::Reset(TimerMac* parent, uint32_t milliSec)
 {
   Stop();
   mTimer = CreateTimer(parent, milliSec);
@@ -104,7 +106,7 @@ void Timer::Impl::Reset(Timer* parent, unsigned int milliSec)
 }
 
 CFRef<CFRunLoopTimerRef>
-Timer::Impl::CreateTimer(Timer* parent, unsigned int milliSec)
+TimerMac::Impl::CreateTimer(TimerMac* parent, uint32_t milliSec)
 {
   const auto            interval = static_cast<CFAbsoluteTime>(milliSec) / 1000;
   const auto            fireDate = CFAbsoluteTimeGetCurrent() + interval;
@@ -126,17 +128,17 @@ Timer::Impl::CreateTimer(Timer* parent, unsigned int milliSec)
     &context));
 }
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerMacPtr TimerMac::New(uint32_t milliSec)
 {
-  return new Timer(milliSec);
+  return new TimerMac(milliSec);
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerMac::TimerMac(uint32_t milliSec)
 : mImpl(new Impl(this, milliSec))
 {
 }
 
-Timer::~Timer()
+TimerMac::~TimerMac()
 {
   // stop timers
   Stop();
@@ -145,35 +147,35 @@ Timer::~Timer()
   mImpl = NULL;
 }
 
-void Timer::Start()
+void TimerMac::Start()
 {
   mImpl->Start();
 }
 
-void Timer::Stop()
+void TimerMac::Stop()
 {
   mImpl->Stop();
 }
 
-void Timer::Pause()
+void TimerMac::Pause()
 {
 }
 
-void Timer::Resume()
+void TimerMac::Resume()
 {
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerMac::SetInterval(uint32_t interval, bool restart)
 {
   mImpl->Reset(this, interval);
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerMac::GetInterval() const
 {
   return mImpl->GetInterval();
 }
 
-bool Timer::Tick()
+bool TimerMac::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -204,12 +206,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerMac::IsRunning() const
 {
   return mImpl->IsRunning();
 }
diff --git a/dali/internal/system/macos/timer-impl-mac.h b/dali/internal/system/macos/timer-impl-mac.h
new file mode 100644 (file)
index 0000000..534ff26
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_TIMER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerMac;
+
+typedef IntrusivePtr<TimerMac> TimerMacPtr;
+
+/**
+ * @brief TimerMac class provides an Timer Mac implementation.
+ */
+class TimerMac : public Timer
+{
+public:
+  static TimerMacPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerMac(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerMac();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerMac(const TimerMac&) = delete;
+  TimerMac& operator=(const TimerMac&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_MACOS_TIMER_H
index ea151a32602c51c9983b611d1139eecd38e5b5f6..1e9d53d9ff6bbfe66a369ee558be93501995f19c 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.
  *
  */
 
+// CLASS HEADER
+#include <dali/internal/system/common/system-settings.h>
+
 // EXTERNAL INCLUDES
-#include <system_settings.h>
+#include <app_common.h>
 
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/system-settings.h>
+#if defined(TIZEN_PLATFORM_CONFIG_SUPPORTED) && TIZEN_PLATFORM_CONFIG_SUPPORTED
+#include <tzplatform_config.h>
+#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
 
 namespace Dali
 {
@@ -27,16 +31,52 @@ namespace Internal
 {
 namespace Adaptor
 {
-int GetLongPressTime(int defaultTime)
+namespace SystemSettings
 {
-  return defaultTime;
+std::string GetResourcePath()
+{
+  std::string resourcePath = "";
+#if defined(TIZEN_PLATFORM_CONFIG_SUPPORTED) && TIZEN_PLATFORM_CONFIG_SUPPORTED
+  char* app_rsc_path = app_get_resource_path();
+  if(app_rsc_path)
+  {
+    resourcePath = app_rsc_path;
+    free(app_rsc_path);
+  }
+#else // For backwards compatibility with older Tizen versions
+
+  // "DALI_APPLICATION_PACKAGE" is used to get the already configured Application package path.
+  const char* environmentVariable = "DALI_APPLICATION_PACKAGE";
+  char*       value               = getenv(environmentVariable);
+  if(value != NULL)
+  {
+    resourcePath = value;
+  }
+
+  if(resourcePath.back() != '/')
+  {
+    resourcePath += "/";
+  }
+
+#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
+
+  return resourcePath;
 }
 
-int GetElmAccessActionOver()
+std::string GetDataPath()
 {
-  return 0;
+  std::string result;
+  char*       dataPath = app_get_data_path();
+  if(dataPath)
+  {
+    result = dataPath;
+    free(dataPath);
+  }
+  return result;
 }
 
+} // namespace SystemSettings
+
 } // namespace Adaptor
 
 } // namespace Internal
index bfaca6ab69526b473309bfcb89b7ea8b21882767..bd37ba8b39835b31b5e2743aeed30e32d7dc22cb 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.
  *
  */
 
-// INTERNAL INCLUDES
+// CLASS HEADER
 #include <dali/internal/system/common/system-settings.h>
 
+// EXTERNAL INCLUDES
+#include <stdlib.h>
+
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-int GetElmAccessActionOver()
+namespace SystemSettings
+{
+std::string GetResourcePath()
 {
-  return 0;
+  // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path.
+  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
+  char*       value                     = getenv(ubuntuEnvironmentVariable);
+  std::string resourcePath;
+  if(value != NULL)
+  {
+    resourcePath = value;
+  }
+
+  if(resourcePath.back() != '/')
+  {
+    resourcePath += "/";
+  }
+
+  return resourcePath;
 }
 
-int GetLongPressTime(int defaultTime)
+std::string GetDataPath()
 {
-  return defaultTime;
+  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
+  char*       value                     = getenv(ubuntuEnvironmentVariable);
+  std::string dataPath;
+  if(value != NULL)
+  {
+    dataPath = value;
+  }
+
+  return dataPath;
 }
 
+} // namespace SystemSettings
+
 } // namespace Adaptor
 
 } // namespace Internal
index b37e1ad28c987369c8932b32ab0b3a26e695d869..7871819f270e2356a82afc0edab75fbb3a0092f0 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.\r
  *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -101,12 +101,6 @@ void WinCallbackManager::RemoveIdleEntererCallback(CallbackBase* callback)
 {\r
 }\r
 \r
-// Creates a concrete interface for CallbackManager\r
-CallbackManager* CallbackManager::New()\r
-{\r
-  return new WinCallbackManager;\r
-}\r
-\r
 } // namespace Adaptor\r
 \r
 } // namespace Internal\r
index 3915ec459725bad5fe456e3c6d9f15f05df8a61d..b64842553dff83e8eb1c6f0f31bf709dbde5704b 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_WIN_CALLBACK_MANAGER_H
-#define DALI_WIN_CALLBACK_MANAGER_H
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_CALLBACK_MANAGER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_CALLBACK_MANAGER_H
 
 /*
- * 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.
@@ -38,73 +38,78 @@ class WinCallbackManager : public CallbackManager
 {
 public:
   /**
-     * @brief constructor
-     */
+   * @brief constructor
+   */
   WinCallbackManager();
 
   /**
-     * @brief destructor
-     */
+   * @brief destructor
+   */
   ~WinCallbackManager()
   {
   }
 
   /**
-     * @copydoc CallbackManager::AddIdleCallback()
-     */
+   * @copydoc CallbackManager::AddIdleCallback()
+   */
   bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
 
   /**
-     * @copydoc CallbackManager::RemoveIdleCallback()
-     */
+   * @copydoc CallbackManager::RemoveIdleCallback()
+   */
   void RemoveIdleCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::ProcessIdle()
-     */
+   * @copydoc CallbackManager::ProcessIdle()
+   */
   bool ProcessIdle() override;
 
   /**
-     * @copydoc CallbackManager::ClearIdleCallbacks()
-     */
+   * @copydoc CallbackManager::ClearIdleCallbacks()
+   */
   void ClearIdleCallbacks() override;
 
   /**
-    * @brief Adds a @p callback to be run when entering an idle state.
-    * @note Must be called from the main thread only.
-    *
-    * A callback of the following type should be used:
-    * @code
-    *   bool MyFunction();
-    * @endcode
-    * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
-    *
-    * @param[in] callback custom callback function.
-    *
-    * @return true on success
-    */
+   * @brief Adds a @p callback to be run when entering an idle state.
+   * @note Must be called from the main thread only.
+   *
+   * A callback of the following type should be used:
+   * @code
+   *   bool MyFunction();
+   * @endcode
+   * This callback will be called repeatedly as long as it returns true. A return of 0 deletes this callback.
+   *
+   * @param[in] callback custom callback function.
+   *
+   * @return true on success
+   */
   bool AddIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-    * @brief Removes a previously added the idle enterer callback.
-    * @note Must be called from main thread only.
-    *
-    * Does nothing if the @p callback doesn't exist.
-    *
-    * @param[in] callback The callback to be removed.
-    */
+   * @brief Removes a previously added the idle enterer callback.
+   * @note Must be called from main thread only.
+   *
+   * Does nothing if the @p callback doesn't exist.
+   *
+   * @param[in] callback The callback to be removed.
+   */
   void RemoveIdleEntererCallback(CallbackBase* callback) override;
 
   /**
-     * @copydoc CallbackManager::Start()
-     */
+   * @copydoc CallbackManager::Start()
+   */
   void Start() override;
 
   /**
-     * @copydoc CallbackManager::Stop()
-     */
+   * @copydoc CallbackManager::Stop()
+   */
   void Stop() override;
 
+private:
+  // Undefined
+  WinCallbackManager(const WinCallbackManager&) = delete;
+  WinCallbackManager& operator=(WinCallbackManager&) = delete;
+
 private:
   std::set<CallbackBase*> mCallbacks;
   bool                    mRunning; ///< flag is set to true if when running
@@ -116,4 +121,4 @@ private:
 
 } // namespace Dali
 
-#endif // DALI_WIN_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_CALLBACK_MANAGER_H
index d937daa5f295993112b5637fc792c62e9dc26886..eee61f2729224c1b218f15822743ecd1aa83823f 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/windows/file-descriptor-monitor-windows.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
@@ -27,12 +27,13 @@ namespace Internal
 {
 namespace Adaptor
 {
-FileDescriptorMonitor::FileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+FileDescriptorMonitorWin::FileDescriptorMonitorWin(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+: FileDescriptorMonitor(fileDescriptor, callback, eventBitmask)
 {
   DALI_LOG_WARNING("Implementation missing for MS Windows");
 }
 
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorWin::~FileDescriptorMonitorWin()
 {
 }
 
diff --git a/dali/internal/system/windows/file-descriptor-monitor-windows.h b/dali/internal/system/windows/file-descriptor-monitor-windows.h
new file mode 100644 (file)
index 0000000..4867262
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_FILE_DESCRIPTOR_MONITOR_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_FILE_DESCRIPTOR_MONITOR_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/signals/callback.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/file-descriptor-monitor.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * @brief FileDescriptorMonitorWin class provides an FileDescriptorMonitor Windows implementation.
+ */
+class FileDescriptorMonitorWin : public FileDescriptorMonitor
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::FileDescriptorMonitor()
+   */
+  FileDescriptorMonitorWin(int fileDescriptor, CallbackBase* callback, int eventBitmask);
+
+  /**
+   * Destructor
+   */
+  ~FileDescriptorMonitorWin();
+
+private:
+  // Undefined
+  FileDescriptorMonitorWin(const FileDescriptorMonitorWin& fileDescriptorMonitor) = delete;
+
+  // Undefined
+  FileDescriptorMonitorWin& operator=(const FileDescriptorMonitorWin& fileDescriptorMonitor) = delete;
+
+private:
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_FILE_DESCRIPTOR_MONITOR_H
diff --git a/dali/internal/system/windows/system-factory-win.cpp b/dali/internal/system/windows/system-factory-win.cpp
new file mode 100644 (file)
index 0000000..244dcc4
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/windows/system-factory-win.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/system/windows/callback-manager-win.h>
+#include <dali/internal/system/windows/file-descriptor-monitor-windows.h>
+#include <dali/internal/system/windows/timer-impl-win.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<CallbackManager> SystemFactoryWin::CreateCallbackManager()
+{
+  return Utils::MakeUnique<WinCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryWin::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+  return Utils::MakeUnique<FileDescriptorMonitorWin>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryWin::CreateTimer(uint32_t milliSec)
+{
+  return TimerWin::New(milliSec);
+}
+
+std::unique_ptr<SystemFactory> GetSystemFactory()
+{
+  return Utils::MakeUnique<SystemFactoryWin>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/system/windows/system-factory-win.h b/dali/internal/system/windows/system-factory-win.h
new file mode 100644 (file)
index 0000000..aa805b5
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_SYSTEM_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_SYSTEM_FACTORY_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class SystemFactoryWin : public SystemFactory
+{
+public:
+  std::unique_ptr<CallbackManager>       CreateCallbackManager() override;
+  std::unique_ptr<FileDescriptorMonitor> CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask) override;
+  TimerPtr                               CreateTimer(uint32_t milliSec) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_SYSTEM_FACTORY_H
index c4d82b34d85da7869188b9be26342900d501e2d4..6dd6ab76bc99da720484f5022309b58de6d7a288 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.
  *
  */
 
-// INTERNAL INCLUDES
+// CLASS HEADER
 #include <dali/internal/system/common/system-settings.h>
 
+// EXTERNAL INCLUDES
+#include <stdlib.h>
+
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-int GetLongPressTime(int defaultTime)
+namespace SystemSettings
+{
+std::string GetResourcePath()
 {
-  return defaultTime;
+  // "DALI_APPLICATION_PACKAGE" is used by Windows specifically to get the already configured Application package path.
+  const char* winEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
+  char*       value                  = getenv(winEnvironmentVariable);
+  std::string resourcePath;
+  if(value != NULL)
+  {
+    resourcePath = value;
+  }
+
+  if(resourcePath.back() != '/')
+  {
+    resourcePath += "/";
+  }
+
+  return resourcePath;
 }
 
-int GetElmAccessActionOver()
+std::string GetDataPath()
 {
-  return 0;
+  const char* winEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
+  char*       value                  = getenv(winEnvironmentVariable);
+  std::string dataPath;
+  if(value != NULL)
+  {
+    dataPath = value;
+  }
+
+  return dataPath;
 }
 
+} // namespace SystemSettings
+
 } // namespace Adaptor
 
 } // namespace Internal
index 8462ab284b934b95da25b92636395f485279f8d9..776efc51ec22dec501a7889feeab5a6472a0cfae 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.
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include <dali/internal/system/common/timer-impl.h>
+#include <dali/internal/system/windows/timer-impl-win.h>
 
 // INTERNAL INCLUDES
 #include <dali/internal/window-system/windows/platform-implement-win.h>
@@ -32,7 +32,7 @@ namespace
 {
 bool TimerSourceFunc(void* data)
 {
-  Timer* timer = static_cast<Timer*>(data);
+  TimerWin* timer = static_cast<TimerWin*>(data);
   return timer->Tick();
 }
 } // namespace
@@ -40,9 +40,9 @@ bool TimerSourceFunc(void* data)
 /**
  * Struct to hide away Windows implementation details
  */
-struct Timer::Impl
+struct TimerWin::Impl
 {
-  Impl(unsigned int milliSec)
+  Impl(uint32_t milliSec)
   : mId(-1),
     mInterval(milliSec)
   {
@@ -50,21 +50,21 @@ struct Timer::Impl
 
   intptr_t mId;
 
-  unsigned int mInterval;
+  uint32_t mInterval;
 };
 
-TimerPtr Timer::New(unsigned int milliSec)
+TimerWinPtr TimerWin::New(uint32_t milliSec)
 {
-  TimerPtr timer(new Timer(milliSec));
+  TimerWinPtr timer(new TimerWin(milliSec));
   return timer;
 }
 
-Timer::Timer(unsigned int milliSec)
+TimerWin::TimerWin(uint32_t milliSec)
 : mImpl(new Impl(milliSec))
 {
 }
 
-Timer::~Timer()
+TimerWin::~TimerWin()
 {
   // stop timers
   Stop();
@@ -73,7 +73,7 @@ Timer::~Timer()
   mImpl = NULL;
 }
 
-void Timer::Start()
+void TimerWin::Start()
 {
   if(0 > mImpl->mId)
   {
@@ -81,7 +81,7 @@ void Timer::Start()
   }
 }
 
-void Timer::Stop()
+void TimerWin::Stop()
 {
   if(0 <= mImpl->mId)
   {
@@ -90,15 +90,15 @@ void Timer::Stop()
   }
 }
 
-void Timer::Pause()
+void TimerWin::Pause()
 {
 }
 
-void Timer::Resume()
+void TimerWin::Resume()
 {
 }
 
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerWin::SetInterval(uint32_t interval, bool restart)
 {
   if(true == restart)
   {
@@ -114,12 +114,12 @@ void Timer::SetInterval(unsigned int interval, bool restart)
   }
 }
 
-unsigned int Timer::GetInterval() const
+uint32_t TimerWin::GetInterval() const
 {
   return mImpl->mInterval;
 }
 
-bool Timer::Tick()
+bool TimerWin::Tick()
 {
   // Guard against destruction during signal emission
   Dali::Timer handle(this);
@@ -150,12 +150,7 @@ bool Timer::Tick()
   return retVal;
 }
 
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
-  return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerWin::IsRunning() const
 {
   return 0 <= mImpl->mId;
 }
diff --git a/dali/internal/system/windows/timer-impl-win.h b/dali/internal/system/windows/timer-impl-win.h
new file mode 100644 (file)
index 0000000..56b738f
--- /dev/null
@@ -0,0 +1,116 @@
+#ifndef DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_TIMER_H
+#define DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_TIMER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/timer-impl.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class TimerWin;
+
+typedef IntrusivePtr<TimerWin> TimerWinPtr;
+
+/**
+ * @brief TimerWin class provides an Timer Windows implementation.
+ */
+class TimerWin : public Timer
+{
+public:
+  static TimerWinPtr New(uint32_t milliSec);
+
+  /**
+   * Constructor
+   * @param[in]  milliSec  Interval in milliseconds.
+   */
+  TimerWin(uint32_t milliSec);
+
+  /**
+   * Destructor.
+   */
+  virtual ~TimerWin();
+
+public:
+  /**
+   * @copydoc Dali::Timer::Start()
+   */
+  void Start() override;
+
+  /**
+   * @copydoc Dali::Timer::Stop()
+   */
+  void Stop() override;
+
+  /**
+   * @copydoc Dali::Timer::Pause()
+   */
+  void Pause() override;
+
+  /**
+   * @copydoc Dali::Timer::Resume()
+   */
+  void Resume() override;
+
+  /**
+   * @copydoc Dali::Timer::SetInterval()
+   */
+  void SetInterval(uint32_t interval, bool restart) override;
+
+  /**
+   * @copydoc Dali::Timer::GetInterval()
+   */
+  uint32_t GetInterval() const override;
+
+  /**
+   * @copydoc Dali::Timer::IsRunning()
+   */
+  bool IsRunning() const override;
+
+  /**
+   * Tick
+   */
+  bool Tick();
+
+private: // Implementation
+  // not implemented
+  TimerWin(const TimerWin&) = delete;
+  TimerWin& operator=(const TimerWin&) = delete;
+
+  /**
+   * Resets any stored timer data.
+   */
+  void ResetTimerData();
+
+private: // Data
+  // To hide away implementation details
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_WINDOWS_TIMER_H
index 7c7041161934bcbe702df69c65fb1a177e91ec05..c1d4bc80dedded7b298e127ec4548b5608cc0b0c 100644 (file)
@@ -312,6 +312,7 @@ bool FontFaceCacheItem::GetGlyphMetrics(GlyphInfo& glyphInfo, unsigned int dpiVe
         glyphInfo.xBearing += static_cast<float>(metrics.vertBearingX) * FROM_266;
         glyphInfo.yBearing += static_cast<float>(metrics.vertBearingY) * FROM_266;
       }
+      glyphInfo.advance = round(glyphInfo.advance);
 
       const bool isEmboldeningRequired = glyphInfo.isBoldRequired && !(glyphData.mStyleFlags & FT_STYLE_FLAG_BOLD);
       if(isEmboldeningRequired)
index 1f9dcfcbe6a87ac64c81b03101550ea7973057c4..e6e45566c1985f51d978982fd1121777addef592 100644 (file)
@@ -30,6 +30,7 @@
 #include <dali/internal/graphics/gles/egl-graphics.h>
 #include <dali/internal/graphics/gles/egl-implementation.h>
 #include <dali/internal/system/common/environment-variables.h>
+#include <dali/internal/system/common/system-factory.h>
 #include <dali/internal/window-system/common/window-base.h>
 #include <dali/internal/window-system/common/window-factory.h>
 #include <dali/internal/window-system/common/window-system.h>
@@ -763,9 +764,7 @@ void WindowRenderSurface::ProcessFrameCallback()
   {
     if(!iter->fileDescriptorMonitor)
     {
-      iter->fileDescriptorMonitor = std::unique_ptr<FileDescriptorMonitor>(new FileDescriptorMonitor(iter->fileDescriptor,
-                                                                                                     MakeCallback(this, &WindowRenderSurface::OnFileDescriptorEventDispatched),
-                                                                                                     FileDescriptorMonitor::FD_READABLE));
+      iter->fileDescriptorMonitor = Dali::Internal::Adaptor::GetSystemFactory()->CreateFileDescriptorMonitor(iter->fileDescriptor, MakeCallback(this, &WindowRenderSurface::OnFileDescriptorEventDispatched), FileDescriptorMonitor::FD_READABLE);
 
       DALI_LOG_RELEASE_INFO("WindowRenderSurface::ProcessFrameCallback: Add handler [%d]\n", iter->fileDescriptor);
     }
index 4b3eb66bddaeea4025c93430a20772af18dca97b..96f2d205590a88cf29690af0df1f71e00989c7ec 100644 (file)
  *
  */
 
+// EXTERNAL_HEADERS
+#include <Ecore_Wl2.h>
+#include <dali/integration-api/debug.h>
+
 // INTERNAL HEADERS
 #include <dali/devel-api/adaptor-framework/keyboard.h>
+#include <dali/internal/adaptor/common/framework-factory.h>
 #include <dali/internal/system/common/time-service.h>
 #include <dali/internal/window-system/common/window-system.h>
 
-// EXTERNAL_HEADERS
-#include <Ecore_Wl2.h>
-#include <dali/integration-api/debug.h>
-
 #define START_DURATION_CHECK()                               \
   uint32_t durationMilliSeconds = static_cast<uint32_t>(-1); \
   uint32_t startTime, endTime;                               \
@@ -53,27 +54,39 @@ static int32_t gScreenHeight = 0;
 
 void Initialize()
 {
-  ecore_wl2_init();
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::DEFAULT)
+  {
+    ecore_wl2_init();
+  }
 }
 
 void Shutdown()
 {
-  ecore_wl2_shutdown();
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::DEFAULT)
+  {
+    ecore_wl2_shutdown();
+  }
 }
 
 void GetScreenSize(int32_t& width, int32_t& height)
 {
-  if(gScreenWidth == 0 || gScreenHeight == 0)
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::DEFAULT)
   {
-    Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
-    if(display)
+    if(gScreenWidth == 0 || gScreenHeight == 0)
     {
-      START_DURATION_CHECK();
-      ecore_wl2_display_screen_size_get(display, &gScreenWidth, &gScreenHeight);
-      FINISH_DURATION_CHECK("ecore_wl2_display_screen_size_get");
-
-      DALI_ASSERT_ALWAYS((gScreenWidth > 0) && "screen width is 0");
-      DALI_ASSERT_ALWAYS((gScreenHeight > 0) && "screen height is 0");
+      Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
+      if(display)
+      {
+        START_DURATION_CHECK();
+        ecore_wl2_display_screen_size_get(display, &gScreenWidth, &gScreenHeight);
+        FINISH_DURATION_CHECK("ecore_wl2_display_screen_size_get");
+
+        DALI_ASSERT_ALWAYS((gScreenWidth > 0) && "screen width is 0");
+        DALI_ASSERT_ALWAYS((gScreenHeight > 0) && "screen height is 0");
+      }
     }
   }
   width  = gScreenWidth;
@@ -82,30 +95,44 @@ void GetScreenSize(int32_t& width, int32_t& height)
 
 void UpdateScreenSize()
 {
-  Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
-  if(display)
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::DEFAULT)
   {
-    START_DURATION_CHECK();
-    ecore_wl2_display_screen_size_get(display, &gScreenWidth, &gScreenHeight);
-    FINISH_DURATION_CHECK("ecore_wl2_display_screen_size_get");
+    Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
+    if(display)
+    {
+      START_DURATION_CHECK();
+      ecore_wl2_display_screen_size_get(display, &gScreenWidth, &gScreenHeight);
+      FINISH_DURATION_CHECK("ecore_wl2_display_screen_size_get");
+    }
   }
 }
 
 bool SetKeyboardRepeatInfo(float rate, float delay)
 {
-  Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(ecore_wl2_connected_display_get(NULL));
-  return ecore_wl2_input_keyboard_repeat_set(input, static_cast<double>(rate), static_cast<double>(delay));
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::DEFAULT)
+  {
+    Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(ecore_wl2_connected_display_get(NULL));
+    return ecore_wl2_input_keyboard_repeat_set(input, static_cast<double>(rate), static_cast<double>(delay));
+  }
+  return false;
 }
 
 bool GetKeyboardRepeatInfo(float& rate, float& delay)
 {
-  Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(ecore_wl2_connected_display_get(NULL));
-  double           rateVal, delayVal;
-  bool             ret = ecore_wl2_input_keyboard_repeat_get(input, &rateVal, &delayVal);
-  rate                 = static_cast<float>(rateVal);
-  delay                = static_cast<float>(delayVal);
+  auto backend = Dali::Internal::Adaptor::GetFrameworkFactory()->GetFrameworkBackend();
+  if(backend == FrameworkBackend::DEFAULT)
+  {
+    Ecore_Wl2_Input* input = ecore_wl2_input_default_input_get(ecore_wl2_connected_display_get(NULL));
+    double           rateVal, delayVal;
+    bool             ret = ecore_wl2_input_keyboard_repeat_get(input, &rateVal, &delayVal);
+    rate                 = static_cast<float>(rateVal);
+    delay                = static_cast<float>(delayVal);
 
-  return ret;
+    return ret;
+  }
+  return false;
 }
 
 } // namespace WindowSystem
index 18a5a591e48643a9eb5f41e12faceaed95fff794..1d8a8715d4c4f9bed6b617e295453f40d6537c77 100644 (file)
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/gl-abstraction.h>
 
-#ifdef ECORE_WAYLAND2
-#include <Ecore_Wl2.h>
-#else
-#include <Ecore_Wayland.h>
-#endif
-
 #include <tbm_bufmgr.h>
 #include <tbm_surface_internal.h>
 
@@ -150,14 +144,8 @@ void NativeRenderSurfaceEcoreWl::GetDpi(unsigned int& dpiHorizontal, unsigned in
   float xres, yres;
 
   // 1 inch = 25.4 millimeters
-#ifdef ECORE_WAYLAND2
-  // TODO: Application should set dpi value in wayland2
   xres = 96;
   yres = 96;
-#else
-  xres = ecore_wl_dpi_get();
-  yres = ecore_wl_dpi_get();
-#endif
 
   dpiHorizontal = int(xres + 0.5f); // rounding
   dpiVertical   = int(yres + 0.5f);
index 616c6f2bb6ecc8ee252585f9079f5544ebf37651..406ca2b4b6ce38e71005205a418676d8f21c286a 100644 (file)
@@ -21,6 +21,7 @@
 // INTERNAL HEADERS
 #include <dali/devel-api/adaptor-framework/keyboard.h>
 #include <dali/internal/system/common/file-descriptor-monitor.h>
+#include <dali/internal/system/common/system-factory.h>
 #include <dali/internal/window-system/common/window-system.h>
 
 // EXTERNAL_HEADERS
@@ -455,7 +456,7 @@ struct WindowSystemX::Impl
     XInitThreads();
     mDisplay = XOpenDisplay(nullptr); // Note, DisplayConnection now reads this var.
 
-    mXEventMonitor = new FileDescriptorMonitor(
+    mXEventMonitor = Dali::Internal::Adaptor::GetSystemFactory()->CreateFileDescriptorMonitor(
       ConnectionNumber(mDisplay),
       MakeCallback(this, &WindowSystemX::Impl::XPollCallback),
       FileDescriptorMonitor::FD_READABLE);
@@ -470,7 +471,6 @@ struct WindowSystemX::Impl
   {
     // @todo Flush events, delete fd handlers, shutdown other X subsystems
     XCloseDisplay(mDisplay);
-    delete mXEventMonitor;
   }
 
   ::Display* GetXDisplay()
@@ -663,7 +663,7 @@ struct WindowSystemX::Impl
   using EventHandlerFunctionPointer = void (*)(const XEvent*);
   std::unordered_map<int, EventHandlerFunctionPointer> mXEventHandlers;
   std::vector<WindowSystemBase::EventHandler>          mHandlers;
-  FileDescriptorMonitor*                               mXEventMonitor;
+  std::unique_ptr<FileDescriptorMonitor>               mXEventMonitor;
   XIDeviceInfo*                                        mXi2Devices{nullptr};
   int                                                  mXi2NumberOfDevices{0};
   int                                                  mXi2OpCode{-1};
index ef779f8a354c608b48f268cb6f9225b4a0ef3d8a..9a7a59ccb4250bcd6dbf4895ebe00671f1c458cc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 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.
@@ -19,6 +19,7 @@
 #include <dali/public-api/adaptor-framework/timer.h>
 
 // INTERNAL INCLUDES
+#include <dali/internal/system/common/system-factory.h>
 #include <dali/internal/system/common/timer-impl.h>
 #include <dali/public-api/dali-adaptor-common.h>
 
@@ -28,9 +29,9 @@ Timer::Timer()
 {
 }
 
-Timer Timer::New(unsigned int milliSec)
+Timer Timer::New(uint32_t milliSec)
 {
-  Internal::Adaptor::TimerPtr internal = Internal::Adaptor::Timer::New(milliSec);
+  Internal::Adaptor::TimerPtr internal = Dali::Internal::Adaptor::GetSystemFactory()->CreateTimer(milliSec);
   return Timer(internal.Get());
 }
 
index 2b1df7f0eab91519519ccf5532b07942c1b6ed65..3569f297f6c4749195d935829bf38a8578d3c7bc 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TIMER_H
 
 /*
- * Copyright (c) 2020 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.
@@ -75,7 +75,7 @@ public: // API
    * @param[in] milliSec Interval in milliseconds
    * @return A new timer
    */
-  static Timer New(unsigned int milliSec);
+  static Timer New(uint32_t milliSec);
 
   /**
    * @brief Copy constructor.
@@ -165,7 +165,7 @@ public: // API
    * @SINCE_1_0.0
    * @param[in] milliSec Interval in milliseconds
    */
-  void SetInterval(unsigned int milliSec);
+  void SetInterval(uint32_t milliSec);
 
   /**
    * @brief Sets a new interval on the timer with option to restart the timer.
@@ -175,7 +175,7 @@ public: // API
    * @param[in] milliSec Interval in milliseconds
    * @param[in] restart Flag to set enabled to restart or not.
    */
-  void SetInterval(unsigned int milliSec, bool restart);
+  void SetInterval(uint32_t milliSec, bool restart);
 
   /**
    * @brief Gets the interval of timer.
@@ -183,7 +183,7 @@ public: // API
    * @SINCE_1_0.0
    * @return Interval in milliseconds
    */
-  unsigned int GetInterval() const;
+  uint32_t GetInterval() const;
 
   /**
    * @brief Tells whether timer is running.
index fba1e83277fcb0b88d22d75042aa5b886520ab52..147c2c2ab57961284ebb8edcf7034c16cd333ebe 100644 (file)
@@ -27,7 +27,7 @@ namespace Dali
 {
 const unsigned int ADAPTOR_MAJOR_VERSION = 2;
 const unsigned int ADAPTOR_MINOR_VERSION = 2;
-const unsigned int ADAPTOR_MICRO_VERSION = 33;
+const unsigned int ADAPTOR_MICRO_VERSION = 34;
 const char* const  ADAPTOR_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 2d83651073f45963e7fb28f1d6e0e3217e052841..edf65141ddad1c7b895b8605fec847d9f469da5c 100644 (file)
@@ -17,7 +17,7 @@
 
 Name:       dali2-adaptor
 Summary:    The DALi Tizen Adaptor
-Version:    2.2.33
+Version:    2.2.34
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT
index 918eeac177e49d8ae87a98469b7951792e33aeb6..2587713813ceb3b2af374134d26b54dae8ec7c6b 100644 (file)
@@ -25,7 +25,6 @@ SET( adaptor_resampler_src_files
 
 SET( adaptor_windows_platform_src_files
     ${adaptor_thirdparty_dir}/windows-platform/dlfcn.cpp
-    ${adaptor_thirdparty_dir}/windows-platform/environment.cpp
     ${adaptor_thirdparty_dir}/windows-platform/network.cpp
     ${adaptor_thirdparty_dir}/windows-platform/thread.cpp
     ${adaptor_thirdparty_dir}/windows-platform/Win32File/CustomFile.cpp
@@ -39,6 +38,5 @@ SET( static_libraries_nanosvg_src_files
 )
 
 SET( adaptor_macos_platform_src_files
-    ${adaptor_thirdparty_dir}/macos-platform/environment.cpp
     ${adaptor_thirdparty_dir}/macos-platform/thread.cpp
 )
diff --git a/third-party/macos-platform/environment.cpp b/third-party/macos-platform/environment.cpp
deleted file mode 100644 (file)
index ddecce9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdlib>
-#include <string>
-
-const char* app_get_data_path()
-{
-  static std::string envValue;
-
-  if( envValue.empty() )
-  {
-    envValue = std::getenv( "DemoData" );
-    envValue += "/";
-  }
-
-  return envValue.c_str();
-}
index c6af7e2d9475f0976b496a09d0615535901017c3..f7a4a8cc495bcaece8fb055328df51d6ec2f4b94 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 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.
@@ -21,8 +21,6 @@
 #include <memory>
 #include <type_traits>
 
-const char* app_get_data_path();
-
 // Specialiation of std::unique_ptr for Foundation Objects
 template<typename T>
 using CFRef = std::unique_ptr<
diff --git a/third-party/windows-platform/environment.cpp b/third-party/windows-platform/environment.cpp
deleted file mode 100644 (file)
index f218e20..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdlib>
-#include <string>
-
-using namespace std;
-
-const char* app_get_data_path()
-{
-  static std::string envValue = "";
-
-  if( true == envValue.empty() )
-  {
-    envValue = std::getenv( "DemoData" );
-    envValue += "/";
-  }
-
-  return envValue.c_str();
-}
index 4b4ef276e852c4fe4a326fc763dba7e7c535fccb..5efd789c8dcd3b6975180be56248a8d2b19216f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 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.
@@ -20,8 +20,6 @@
 
 #include <xlocale>
 
-const char* app_get_data_path();
-
 static int strncasecmp(const char *s1, const char *s2, register int n)
 {
   while (--n >= 0 && toupper((unsigned char)*s1) == toupper((unsigned char)*s2++))