Returns Ecore APIs to default value
[platform/core/uifw/dali-adaptor.git] / dali / internal / system / linux / system-factory-ecore.cpp
1 /*
2  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 // CLASS HEADER
18 #include <dali/internal/system/linux/system-factory-ecore.h>
19
20 // INTERNAL HEADERS
21 #include <dali/internal/adaptor/common/framework-factory.h>
22 #include <dali/internal/system/glib/callback-manager-glib.h>
23 #include <dali/internal/system/glib/file-descriptor-monitor-glib.h>
24 #include <dali/internal/system/glib/timer-impl-glib.h>
25 #include <dali/internal/system/linux/callback-manager-ecore.h>
26 #include <dali/internal/system/linux/file-descriptor-monitor-ecore.h>
27 #include <dali/internal/system/linux/timer-impl-ecore.h>
28 #include <dali/internal/window-system/common/display-utils.h>
29
30 namespace Dali
31 {
32 namespace Internal
33 {
34 namespace Adaptor
35 {
36 std::unique_ptr<CallbackManager> SystemFactoryEcore::CreateCallbackManager()
37 {
38   auto frameworkFactory = Dali::Internal::Adaptor::GetFrameworkFactory();
39   if(frameworkFactory != nullptr && frameworkFactory->GetFrameworkBackend() == FrameworkBackend::GLIB)
40   {
41     return Utils::MakeUnique<GlibCallbackManager>();
42   }
43   return Utils::MakeUnique<EcoreCallbackManager>();
44 }
45
46 std::unique_ptr<FileDescriptorMonitor> SystemFactoryEcore::CreateFileDescriptorMonitor(int fileDescriptor, CallbackBase* callback, int eventBitmask)
47 {
48   auto frameworkFactory = Dali::Internal::Adaptor::GetFrameworkFactory();
49   if(frameworkFactory != nullptr && frameworkFactory->GetFrameworkBackend() == FrameworkBackend::GLIB)
50   {
51     return Utils::MakeUnique<FileDescriptorMonitorGlib>(fileDescriptor, callback, eventBitmask);
52   }
53   return Utils::MakeUnique<FileDescriptorMonitorEcore>(fileDescriptor, callback, eventBitmask);
54 }
55
56 TimerPtr SystemFactoryEcore::CreateTimer(uint32_t milliSec)
57 {
58   auto frameworkFactory = Dali::Internal::Adaptor::GetFrameworkFactory();
59   if(frameworkFactory != nullptr && frameworkFactory->GetFrameworkBackend() == FrameworkBackend::GLIB)
60   {
61     return TimerGlib::New(milliSec);
62   }
63   return TimerEcore::New(milliSec);
64 }
65
66 std::unique_ptr<SystemFactory> GetSystemFactory()
67 {
68   return Utils::MakeUnique<SystemFactoryEcore>();
69 }
70
71 } // namespace Adaptor
72 } // namespace Internal
73 } // namespace Dali