*/\r
\r
// EXTERNAL INCLUDES\r
+#include <cstdint>\r
#include <string>\r
#include <unordered_map>\r
#include <vector>\r
*/\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
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
#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.
// 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>
/*
- * 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.
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()
#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.
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
#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.
*/
// EXTERNAL INCLUDES
+#include <cstdint>
#include <string>
namespace Dali
#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.
*/
// EXTERNAL INCLUDES
+#include <cstdint>
namespace Dali
{
* @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
* @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
* @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
* @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.
* @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.
* @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.
* @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.
* @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.
* @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.
* @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.
* @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.
* @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
* @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.
* @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.
* @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.
#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.
#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
{
/**
* @brief Sets an internal framework.
*/
- void SetFramework(Framework* framework)
+ void SetFramework(FrameworkAndroidInterface* framework)
{
mFramework = framework;
}
*
* @return a pointer to the internal framework
*/
- Framework* GetFramework()
+ FrameworkAndroidInterface* GetFramework()
{
return mFramework;
}
private:
AndroidFramework(Dali::Integration::AndroidFramework* androidFramework);
Dali::Integration::AndroidFramework* mAndroidFramework;
- Framework* mFramework;
+ FrameworkAndroidInterface* mFramework;
android_app* mNativeApplication;
ANativeWindow* mWindow;
{
return *androidFramework.mImpl;
}
- static Framework& GetFramework(Dali::Integration::AndroidFramework& androidFramework)
+ static FrameworkAndroidInterface& GetFramework(Dali::Integration::AndroidFramework& androidFramework)
{
return *androidFramework.mImpl->mFramework;
}
--- /dev/null
+#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
/*
- * 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>
// INTERNAL INCLUDES
#include <dali/internal/adaptor/android/android-framework-impl.h>
-#include <dali/internal/system/common/callback-manager.h>
namespace Dali
{
/**
* Impl to hide android data members
*/
-struct Framework::Impl
+struct FrameworkAndroid::Impl
{
struct IdleCallback
{
// 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)
~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()
}
// Data
- CallbackBase* mAbortCallBack;
- CallbackManager* mCallbackManager;
- std::string mLanguage;
- std::string mRegion;
- bool mFinishRequested;
+ bool mFinishRequested;
int mIdleReadPipe;
int mIdleWritePipe;
/**
* 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)
{
/**
* 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)
{
/**
* 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)
{
/**
* 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)
{
/**
* 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);
}
/**
* 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);
}
/**
* 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)
{
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:
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)
{
}
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)
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;
}
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();
}
};
-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)
{
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;
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)
{
return 0;
}
-void Framework::RemoveIdle(unsigned int id)
+
+void FrameworkAndroid::RemoveIdle(unsigned int id)
{
if(mImpl)
{
}
}
-void Framework::Quit()
+void FrameworkAndroid::Quit()
{
struct android_app* app = AndroidFramework::Get().GetNativeApplication();
if(app && !app->destroyRequested && !mImpl->mFinishRequested)
}
}
-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)
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
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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>
// 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;
/**
* 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);
}
~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)
{
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();
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();
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)
case APP_DESTROYED:
mObserver.OnTerminate();
mRunning = false;
- mPaused = false;
mInitialised = false;
break;
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
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
#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>
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();
delete mDisplayConnection;
delete mPlatformAbstraction;
- delete mCallbackManager;
+
+ mCallbackManager.reset();
+
delete mPerformanceInterface;
mGraphics->Destroy();
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
#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>
{
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
+ }
+
+
}
}
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))
}
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()
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.
{
delete mAdaptor;
delete mAdaptorBuilder;
- WindowSystem::Shutdown();
+ if(mIsSystemInitialized)
+ {
+ WindowSystem::Shutdown();
+ }
+ }
+ else
+ {
+ if(mUIThreadLoader)
+ {
+ delete mUIThreadLoader;
+ }
}
}
windowData.SetTransparency(mMainWindowMode);
windowData.SetWindowType(mDefaultWindowType);
+ DALI_LOG_RELEASE_INFO("Create Default Window");
+
WindowSystem::Initialize();
+ mIsSystemInitialized = true;
if(mLaunchpadState != Launchpad::PRE_INITIALIZED)
{
// 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();
}
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)
LowMemorySignalType mTaskLowMemorySignal;
DeviceOrientationChangedSignalType mTaskDeviceOrientationChangedSignal;
- Framework* mFramework;
+ std::unique_ptr<Framework> mFramework;
CommandLineOptions* mCommandLineOptions;
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;
};
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
-#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.
// 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>
* 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
{
/**
* 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.
*/
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.
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;
} // namespace Dali
-#endif // DALI_INTERNAL_FRAMEWORK_H
+#endif // DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_H
${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
)
# 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
)
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
)
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
)
# 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
)
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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
/**
* 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;
}
}
// 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)
{
delete mImpl;
}
-void Framework::Run()
+void FrameworkGlib::Run()
{
mRunning = true;
mObserver.OnInit();
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
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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
/**
* 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;
}
}
// 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)
{
delete mImpl;
}
-void Framework::Run()
+void FrameworkLibuv::Run()
{
mRunning = true;
mObserver.OnInit();
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
--- /dev/null
+#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
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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.
* 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
{
} // 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);
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;
}
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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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>
#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
#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;
/**
* Impl to hide EFL data members
*/
-struct Framework::Impl
+struct FrameworkTizen::Impl
{
class UiAppContext : public AppCoreUiBase
{
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),
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;
});
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;
});
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;
});
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;
});
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;
});
}
private:
- Framework* mFramework;
+ FrameworkTizen* mFramework;
std::string mNewLanguage;
std::string mNewRegion;
Dali::DeviceStatus::Battery::Status mNewBatteryStatus;
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)
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));
auto* framework = context->mFramework;
Observer* observer = &framework->mObserver;
- char* region = nullptr;
- auto appEventReturn = app_event_get_region_format(event_info, ®ion);
+ char* region = nullptr;
+ auto appEventReturn = app_event_get_region_format(event_info, ®ion);
if(appEventReturn == APP_ERROR_NONE && region)
{
framework->SetRegion(std::string(region));
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);
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);
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);
}
}
- void ProcessBundle(Framework* framework, bundle* bundleData)
+ void ProcessBundle(FrameworkTizen* framework, bundle* bundleData)
{
if(bundleData == nullptr)
{
}
private:
- Framework* mFramework;
+ FrameworkTizen* mFramework;
std::shared_ptr<AppEvent> mLanguageChanged;
std::shared_ptr<AppEvent> mDeviceOrientationChanged;
std::shared_ptr<AppEvent> mRegionFormatChanged;
// 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)
}
#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()
}
// 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};
watch_app_lifecycle_callback_s mWatchCallback;
#endif
- static void ProcessBundle(Framework* framework, bundle* bundleData)
+ static void ProcessBundle(FrameworkTizen* framework, bundle* bundleData)
{
if(bundleData == NULL)
{
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)
{
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)
{
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;
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;
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;
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();
#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);
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);
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);
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();
}
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());
static void ComponentAppTerminate(void* data)
{
- Observer* observer = &static_cast<Framework*>(data)->mObserver;
+ Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
observer->OnTerminate();
}
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)
set_last_result(TIZEN_ERROR_NOT_SUPPORTED);
}
- InitThreads();
-
mImpl = new Impl(this, type, useUiThread);
}
-Framework::~Framework()
+FrameworkTizen::~FrameworkTizen()
{
if(mRunning)
{
delete mImpl;
}
-bool Framework::Create()
+bool FrameworkTizen::Create()
{
mInitialised = true;
mObserver.OnInit();
return true;
}
-void Framework::Run()
+void FrameworkTizen::Run()
{
mRunning = true;
int ret;
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
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*\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
{\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
TranslateMessage(&nMsg);\r
DispatchMessage(&nMsg);\r
\r
- mCallbackManager->ClearIdleCallbacks();\r
-\r
if(WM_CLOSE == nMsg.message)\r
{\r
break;\r
}\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
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
--- /dev/null
+#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
#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>
// 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);
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
#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
{
/**
* 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;
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()
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
*/
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;
std::unique_ptr<Dali::Adaptor> mAdaptor;
Dali::OffscreenWindow mDefaultWindow;
+ std::unique_ptr<Internal::Adaptor::Framework> mFramework;
+
OffscreenApplicationSignalType mInitSignal;
OffscreenApplicationSignalType mTerminateSignal;
};
/*
- * 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.
mCallbackContainer.clear();
}
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
- return new AndroidCallbackManager;
-}
-
} // namespace Adaptor
} // namespace Internal
-#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.
{
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
} // namespace Dali
-#endif // __DALI_ANDROID_CALLBACK_MANAGER_H__
+#endif // 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.
*/
// 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>
/**
* Using Impl to hide away Android specific members
*/
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorAndroid::Impl
{
// Construction
Impl(int fileDescriptor, CallbackBase* callback, int eventBitmask)
}
};
-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);
}
}
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorAndroid::~FileDescriptorMonitorAndroid()
{
if(mImpl->mFileDescriptor)
{
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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
-
-// INTERNAL INCLUDES
+// CLASS HEADER
#include <dali/internal/system/common/system-settings.h>
namespace Dali
{
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
/*
- * 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/timer-impl.h>
+#include <dali/internal/system/android/timer-impl-android.h>
// EXTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/android/android-framework.h>
namespace
{
// Copied from x server
-static unsigned int GetCurrentMilliSeconds()
+static uint32_t GetCurrentMilliSeconds()
{
struct timeval tv;
} // namespace
-struct Timer::Impl
+struct TimerAndroid::Impl
{
- Impl(unsigned int milliSec)
+ Impl(uint32_t milliSec)
: mInterval(milliSec),
mStartTimestamp(0),
mPauseTimestamp(0),
{
}
- 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;
bool TimerCallback(void* data)
{
- Timer* timer = static_cast<Timer*>(data);
+ TimerAndroid* timer = static_cast<TimerAndroid*>(data);
if(timer->IsRunning())
{
return timer->Tick();
return false;
}
-void Timer::Start()
+void TimerAndroid::Start()
{
// Timer should be used in the event thread
DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
mImpl->mStartTimestamp = GetCurrentMilliSeconds();
}
-void Timer::Stop()
+void TimerAndroid::Stop()
{
// Timer should be used in the event thread
DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
ResetTimerData();
}
-void Timer::Pause()
+void TimerAndroid::Pause()
{
// Timer should be used in the event thread
DALI_ASSERT_DEBUG(Adaptor::IsAvailable());
}
}
-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;
}
}
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerAndroid::SetInterval(uint32_t interval, bool restart)
{
// stop existing timer
Stop();
}
}
-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);
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;
}
--- /dev/null
+#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
-#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.
class CallbackManager
{
public:
- /**
- * Create a new call back interface
- */
- static CallbackManager* New();
-
/**
* Virtual destructor
*/
} // namespace Dali
-#endif // DALI_INTERNAL_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_CALLBACK_MANAGER_H
-#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
* 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
// Undefined
FileDescriptorMonitor& operator=(const FileDescriptorMonitor& fileDescriptorMonitor);
-
-private:
- struct Impl;
- Impl* mImpl;
};
} // namespace Adaptor
} // namespace Dali
-#endif // DALI_INTERNAL_FILE_DESCRIPTOR_MONITOR_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_FILE_DESCRIPTOR_MONITOR_H
--- /dev/null
+#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
#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
-#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.
// 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
{
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)
} // namespace Dali
-#endif // DALI_INTERNAL_TIMER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_H
-#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.
*
*/
+// EXTERNAL INCLUDES
+#include <cstdint>
+
namespace Dali
{
namespace Internal
/**
* @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()
} // namespace Internal
} // namespace Dali
-#endif // DALI_INTERNAL_ADAPTOR_BASE_TIMER_INTERFACE_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_COMMON_TIMER_INTERFACE_H
#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
{
namespace Adaptor
{
TriggerEvent::TriggerEvent(CallbackBase* callback, TriggerEventInterface::Options options)
-: mFileDescriptorMonitor(NULL),
+: mFileDescriptorMonitor(),
mCallback(callback),
mFileDescriptor(-1),
mOptions(options)
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
{
TriggerEvent::~TriggerEvent()
{
- delete mFileDescriptorMonitor;
delete mCallback;
if(mFileDescriptor >= 0)
#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.
// EXTERNAL INCLUDES
#include <dali/public-api/signals/callback.h>
+#include <memory>
// INTERNAL INCLUDES
#include <dali/integration-api/adaptor-framework/trigger-event-interface.h>
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
${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
)
${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
${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
${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
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
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
/*
- * 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.
/**
* 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)
{
{
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);
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)
{
for(CallbackList::iterator iter = mCallbackContainer.begin(); iter != mCallbackContainer.end(); ++iter)
{
- CallbackData* data = (*iter);
+ GlibCallbackData* data = (*iter);
delete data;
}
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);
it != endIt;
++it)
{
- CallbackData* data = *it;
+ GlibCallbackData* data = *it;
if(data->mCallback == 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);
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
-#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.
{
namespace Adaptor
{
-struct CallbackData;
+struct GlibCallbackData;
/**
* @brief Glib callback manager used to install call backs in the applications main loop.
* 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
} // namespace Dali
-#endif // DALI_ADAPTOR_GLIB_CALLBACK_MANAGER_H
+#endif // 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.
*/
// 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>
/**
* Using Impl to hide away framework specific members
*/
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorGlib::Impl
{
public:
// Constructor
{
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;
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)
{
mImpl = new Impl(fileDescriptor, callback, static_cast<GIOCondition>(events));
}
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorGlib::~FileDescriptorMonitorGlib()
{
delete mImpl;
}
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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/system/common/timer-impl.h>
+#include <dali/internal/system/glib/timer-impl-glib.h>
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
{
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;
} // 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)
{
mImpl->mStartTimestamp = TimeService::GetMilliSeconds();
}
-void Timer::Stop()
+void TimerGlib::Stop()
{
if(mImpl->mTimerHandle != nullptr)
{
ResetTimerData();
}
-void Timer::Pause()
+void TimerGlib::Pause()
{
if(mImpl->mRunning)
{
}
}
-void Timer::Resume()
+void TimerGlib::Resume()
{
if(mImpl->mRunning && mImpl->mTimerHandle == nullptr)
{
}
}
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerGlib::SetInterval(uint32_t interval, bool restart)
{
// stop existing timer
Stop();
}
}
-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);
return retVal;
}
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
- return mTickSignal;
-}
-
-void Timer::ResetTimerData()
+void TimerGlib::ResetTimerData()
{
mImpl->mRunning = false;
if(mImpl->mTimerHandle)
mImpl->mTimerHandle = nullptr;
}
-bool Timer::IsRunning() const
+bool TimerGlib::IsRunning() const
{
return mImpl->mRunning;
}
--- /dev/null
+#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
mCallbackContainer.remove(callbackData);
}
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
- return new UvCallbackManager;
-}
-
} // namespace Adaptor
} // namespace Internal
-#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.
*/
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
} // namespace Dali
-#endif // __DALI_UV_CALLBACK_MANAGER_H__
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LIBUV_CALLBACK_MANAGER_H
*/
// 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>
/**
* Using Impl to hide away UV specific members
*/
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorLibuv::Impl
{
public:
// Constructor
{
if(handle->data)
{
- FileDescriptorMonitor::Impl* impl = static_cast<FileDescriptorMonitor::Impl*>(handle->data);
+ FileDescriptorMonitorLibuv::Impl* impl = static_cast<FileDescriptorMonitorLibuv::Impl*>(handle->data);
if(status < 0)
{
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)
{
mImpl = new Impl(fileDescriptor, callback, static_cast<uv_poll_event>(events));
}
-FileDescriptorMonitor::~FileDescriptorMonitor()
+FileDescriptorMonitorLibuv::~FileDescriptorMonitorLibuv()
{
delete mImpl;
}
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
*/
// 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>
{
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)
/**
* 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)
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();
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();
}
}
-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);
return retVal;
}
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
- return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerLibuv::IsRunning() const
{
return mImpl->mRunning;
}
--- /dev/null
+#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
/*
- * 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.
/**
* 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),
/**
* Destructor
*/
- ~CallbackData()
+ ~EcoreCallbackData()
{
delete mCallback;
delete mRemoveFromContainerFunction;
*/
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)
{
return false;
}
- CallbackData* callbackData = new CallbackData(callback, hasReturnValue);
+ EcoreCallbackData* callbackData = new EcoreCallbackData(callback, hasReturnValue);
callbackData->mRemoveFromContainerFunction = MakeCallback(this, &EcoreCallbackManager::RemoveCallbackFromContainer);
it != endIt;
++it)
{
- CallbackData* data = *it;
+ EcoreCallbackData* data = *it;
if(data->mCallback == callback)
{
return false;
}
- CallbackData* callbackData = new CallbackData(callback, true);
+ EcoreCallbackData* callbackData = new EcoreCallbackData(callback, true);
callbackData->mRemoveFromContainerFunction = MakeCallback(this, &EcoreCallbackManager::RemoveCallbackFromContainer);
it != endIt;
++it)
{
- CallbackData* data = *it;
+ EcoreCallbackData* data = *it;
if(data->mCallback == callback)
{
}
}
-void EcoreCallbackManager::RemoveCallbackFromContainer(CallbackData* callbackData)
+void EcoreCallbackManager::RemoveCallbackFromContainer(EcoreCallbackData* callbackData)
{
mCallbackContainer.remove(callbackData);
}
// always called from main thread
for(CallbackList::iterator iter = mCallbackContainer.begin(); iter != mCallbackContainer.end(); ++iter)
{
- CallbackData* data = (*iter);
+ EcoreCallbackData* data = (*iter);
if(data->mIdler)
{
mCallbackContainer.clear();
}
-// Creates a concrete interface for CallbackManager
-CallbackManager* CallbackManager::New()
-{
- return new EcoreCallbackManager;
-}
-
} // namespace Adaptor
} // namespace Internal
-#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.
{
namespace Adaptor
{
-struct CallbackData;
+struct EcoreCallbackData;
/**
* Ecore interface to install call backs in the applications main loop.
{
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
} // namespace Dali
-#endif // DALI_ECORE_CALLBACK_MANAGER_H
+#endif // DALI_INTERNAL_ADAPTOR_SYSTEM_LINUX_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.
*/
// 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>
/**
* Using Impl to hide away EFL specific members
*/
-struct FileDescriptorMonitor::Impl
+struct FileDescriptorMonitorEcore::Impl
{
// Construction
Impl(int fileDescriptor, CallbackBase* callback, int eventsToMonitor)
}
};
-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);
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)
{
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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/timer-impl.h>
+#include <dali/internal/system/linux/timer-impl-ecore.h>
// INTERNAL INCLUDES
#include <dali/internal/adaptor/common/adaptor-impl.h>
{
Eina_Bool TimerSourceFunc(void* data)
{
- Timer* timer = static_cast<Timer*>(data);
+ TimerEcore* timer = static_cast<TimerEcore*>(data);
bool keepRunning = timer->Tick();
/**
* 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());
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());
ResetTimerData();
}
-void Timer::Pause()
+void TimerEcore::Pause()
{
// Timer should be used in the event thread
DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
}
}
-void Timer::Resume()
+void TimerEcore::Resume()
{
// Timer should be used in the event thread
DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
}
}
-void Timer::SetInterval(unsigned int interval, bool restart)
+void TimerEcore::SetInterval(uint32_t interval, bool restart)
{
// stop existing timer
Stop();
}
}
-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);
return retVal;
}
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
- return mTickSignal;
-}
-
-void Timer::ResetTimerData()
+void TimerEcore::ResetTimerData()
{
if(mImpl->mId != NULL)
{
}
}
-bool Timer::IsRunning() const
+bool TimerEcore::IsRunning() const
{
return mImpl->mId != NULL;
}
--- /dev/null
+#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
#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
{
/**
class CocoaCallbackManager : public CallbackManager
{
public:
+ /**
+ * @brief constructor
+ */
CocoaCallbackManager();
/**
- * @copydoc CallbackManager::AddIdleCallback()
+ * @brief destructor
+ */
+ ~CocoaCallbackManager();
+
+ /**
+ * @copydoc CallbackManager::AddIdleCallback()
*/
bool AddIdleCallback(CallbackBase* callback, bool hasReturnValue) override;
*/
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;
/*
- * 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.
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);
/*
- * 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()
{
}
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
/*
- * 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/timer-impl.h>
+#include <dali/internal/system/macos/timer-impl-mac.h>
+
+// EXTERNAL INCLUDES
#include "extern-definitions.h"
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))
{
}
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;
}
}
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())
{
}
}
-void Timer::Impl::Stop()
+void TimerMac::Impl::Stop()
{
if(IsRunning())
{
}
}
-void Timer::Impl::Reset(Timer* parent, unsigned int milliSec)
+void TimerMac::Impl::Reset(TimerMac* parent, uint32_t milliSec)
{
Stop();
mTimer = CreateTimer(parent, 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;
&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();
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);
return retVal;
}
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
- return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerMac::IsRunning() const
{
return mImpl->IsRunning();
}
--- /dev/null
+#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
/*
- * 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
{
{
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
/*
- * 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
/*\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
{\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
-#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.
{
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
} // namespace Dali
-#endif // DALI_WIN_CALLBACK_MANAGER_H
+#endif // 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.
*/
// 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>
{
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()
{
}
--- /dev/null
+#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
--- /dev/null
+/*
+ * 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
--- /dev/null
+#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
/*
- * 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
/*
- * 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/timer-impl.h>
+#include <dali/internal/system/windows/timer-impl-win.h>
// INTERNAL INCLUDES
#include <dali/internal/window-system/windows/platform-implement-win.h>
{
bool TimerSourceFunc(void* data)
{
- Timer* timer = static_cast<Timer*>(data);
+ TimerWin* timer = static_cast<TimerWin*>(data);
return timer->Tick();
}
} // namespace
/**
* 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)
{
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();
mImpl = NULL;
}
-void Timer::Start()
+void TimerWin::Start()
{
if(0 > mImpl->mId)
{
}
}
-void Timer::Stop()
+void TimerWin::Stop()
{
if(0 <= mImpl->mId)
{
}
}
-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)
{
}
}
-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);
return retVal;
}
-Dali::Timer::TimerSignalType& Timer::TickSignal()
-{
- return mTickSignal;
-}
-
-bool Timer::IsRunning() const
+bool TimerWin::IsRunning() const
{
return 0 <= mImpl->mId;
}
--- /dev/null
+#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
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)
#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>
{
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);
}
*
*/
+// 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; \
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;
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
#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>
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);
// 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
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);
{
// @todo Flush events, delete fd handlers, shutdown other X subsystems
XCloseDisplay(mDisplay);
- delete mXEventMonitor;
}
::Display* GetXDisplay()
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};
/*
- * 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.
#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>
{
}
-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());
}
#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.
* @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.
* @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.
* @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.
* @SINCE_1_0.0
* @return Interval in milliseconds
*/
- unsigned int GetInterval() const;
+ uint32_t GetInterval() const;
/**
* @brief Tells whether timer is running.
{
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
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
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
)
SET( adaptor_macos_platform_src_files
- ${adaptor_thirdparty_dir}/macos-platform/environment.cpp
${adaptor_thirdparty_dir}/macos-platform/thread.cpp
)
+++ /dev/null
-#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();
-}
/*
- * 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.
#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<
+++ /dev/null
-#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();
-}
/*
- * 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.
#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++))