private:
// Undefined
- FrameworkAndroid(const FrameworkAndroid&);
- FrameworkAndroid& operator=(FrameworkAndroid&);
+ FrameworkAndroid(const FrameworkAndroid&) = delete;
+ FrameworkAndroid& operator=(FrameworkAndroid&) = delete;
private:
bool mInitialised;
private:
// Undefined
- FrameworkAndroidJni(const FrameworkAndroidJni&);
- FrameworkAndroidJni& operator=(FrameworkAndroidJni&);
+ FrameworkAndroidJni(const FrameworkAndroidJni&) = delete;
+ FrameworkAndroidJni& operator=(FrameworkAndroidJni&) = delete;
private:
bool mInitialised;
#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
private:
// Undefined
- Framework(const Framework&);
- Framework& operator=(Framework&);
+ Framework(const Framework&) = delete;
+ Framework& operator=(Framework&) = delete;
protected:
Observer& mObserver;
private:
// Undefined
- FrameworkGlib(const FrameworkGlib&);
- FrameworkGlib& operator=(FrameworkGlib&);
+ FrameworkGlib(const FrameworkGlib&) = delete;
+ FrameworkGlib& operator=(FrameworkGlib&) = delete;
private: // impl members
struct Impl;
private:
// Undefined
- FrameworkLibuv(const FrameworkLibuv&);
- FrameworkLibuv& operator=(FrameworkLibuv&);
+ FrameworkLibuv(const FrameworkLibuv&) = delete;
+ FrameworkLibuv& operator=(FrameworkLibuv&) = delete;
private: // impl members
struct Impl;
private:
// Undefined
- FrameworkMac(const FrameworkMac&);
- FrameworkMac& operator=(FrameworkMac&);
+ FrameworkMac(const FrameworkMac&) = delete;
+ FrameworkMac& operator=(FrameworkMac&) = delete;
};
} // namespace Adaptor
private:
// Undefined
- FrameworkTizen(const FrameworkTizen&);
- FrameworkTizen& operator=(FrameworkTizen&);
+ FrameworkTizen(const FrameworkTizen&) = delete;
+ FrameworkTizen& operator=(FrameworkTizen&) = delete;
private:
/**
private:
// Undefined
- FrameworkUbuntu(const FrameworkUbuntu&);
- FrameworkUbuntu& operator=(FrameworkUbuntu&);
+ FrameworkUbuntu(const FrameworkUbuntu&) = delete;
+ FrameworkUbuntu& operator=(FrameworkUbuntu&) = delete;
private:
/**
private:
// Undefined
- FrameworkWin(const FrameworkWin&);
- FrameworkWin& operator=(FrameworkWin&);
+ FrameworkWin(const FrameworkWin&) = delete;
+ FrameworkWin& operator=(FrameworkWin&) = delete;
private: // impl members
struct Impl;
/*
- * 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.
*/
// 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.
{
public:
/**
- * Create a new call back interface
- */
- static CallbackManager* New();
-
- /**
* Virtual destructor
*/
virtual ~CallbackManager()
} // 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
-#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}/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
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.
*/
void RemoveCallbackFromContainer(CallbackData* callbackData);
+ // Undefined
+ GlibCallbackManager(const GlibCallbackManager&) = delete;
+ GlibCallbackManager& operator=(GlibCallbackManager&) = 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_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.
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.
{
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
- */
+ * @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
+ EcoreCallbackManager(const EcoreCallbackManager&) = delete;
+ EcoreCallbackManager& operator=(EcoreCallbackManager&) = delete;
+
+private:
typedef std::list<CallbackData*> CallbackList;
bool mRunning; ///< flag is set to true if when running
} // 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/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()
+{
+ return Utils::MakeUnique<EcoreCallbackManager>();
+}
+
+std::unique_ptr<FileDescriptorMonitor> SystemFactoryEcore::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
+{
+ return Utils::MakeUnique<FileDescriptorMonitorEcore>(fileDescriptor, callback, eventBitmask);
+}
+
+TimerPtr SystemFactoryEcore::CreateTimer(uint32_t milliSec)
+{
+ 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
/*
- * 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
/*\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.
*/
// 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
#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);
}
// 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.