2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/integration-api/adaptor-framework/adaptor.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/public-api/object/object-registry.h>
26 #include <dali/devel-api/adaptor-framework/style-monitor.h>
27 #include <dali/integration-api/adaptor-framework/render-surface-interface.h>
28 #include <dali/integration-api/adaptor-framework/scene-holder.h>
29 #include <dali/internal/adaptor/common/adaptor-impl.h>
30 #include <dali/internal/adaptor/common/thread-controller-interface.h>
31 #include <dali/internal/window-system/common/window-impl.h>
35 Adaptor& Adaptor::New(Window window)
37 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation(window);
38 Adaptor* adaptor = Internal::Adaptor::Adaptor::New(Dali::Integration::SceneHolder(sceneHolder), NULL);
42 Adaptor& Adaptor::New(Window window, const Dali::RenderSurfaceInterface& surface)
44 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation(window);
45 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface*>(&surface);
46 Adaptor* adaptor = Internal::Adaptor::Adaptor::New(Dali::Integration::SceneHolder(sceneHolder), pSurface, NULL, Dali::Internal::Adaptor::ThreadMode::NORMAL);
50 Adaptor& Adaptor::New(Dali::Integration::SceneHolder window)
52 Adaptor* adaptor = Internal::Adaptor::Adaptor::New(window, NULL);
56 Adaptor& Adaptor::New(Dali::Integration::SceneHolder window, const Dali::RenderSurfaceInterface& surface)
58 Dali::RenderSurfaceInterface* pSurface = const_cast<Dali::RenderSurfaceInterface*>(&surface);
59 Adaptor* adaptor = Internal::Adaptor::Adaptor::New(window, pSurface, NULL, Dali::Internal::Adaptor::ThreadMode::NORMAL);
78 void Adaptor::Resume()
88 bool Adaptor::AddIdle(CallbackBase* callback, bool hasReturnValue)
90 DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
91 return mImpl->AddIdle(callback, hasReturnValue);
94 bool Adaptor::AddWindow(Dali::Integration::SceneHolder childWindow)
96 DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
97 return mImpl->AddWindow(childWindow);
100 void Adaptor::RemoveIdle(CallbackBase* callback)
102 DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
103 mImpl->RemoveIdle(callback);
106 void Adaptor::ProcessIdle()
108 DALI_ASSERT_ALWAYS(IsAvailable() && "Adaptor not instantiated");
109 mImpl->ProcessIdle();
112 void Adaptor::ReplaceSurface(Window window, Dali::RenderSurfaceInterface& surface)
114 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation(window);
115 mImpl->ReplaceSurface(Dali::Integration::SceneHolder(sceneHolder), surface);
118 void Adaptor::ReplaceSurface(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface)
120 mImpl->ReplaceSurface(window, surface);
123 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
125 return mImpl->ResizedSignal();
128 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
130 return mImpl->LanguageChangedSignal();
133 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
135 return mImpl->WindowCreatedSignal();
138 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
140 return mImpl->GetSurface();
143 Any Adaptor::GetNativeWindowHandle()
145 return mImpl->GetNativeWindowHandle();
148 Any Adaptor::GetNativeWindowHandle(Actor actor)
150 return mImpl->GetNativeWindowHandle(actor);
153 Any Adaptor::GetGraphicsDisplay()
155 return mImpl->GetGraphicsDisplay();
158 void Adaptor::ReleaseSurfaceLock()
160 mImpl->ReleaseSurfaceLock();
163 void Adaptor::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender)
165 mImpl->SetRenderRefreshRate(numberOfVSyncsPerRender);
168 void Adaptor::SetPreRenderCallback(CallbackBase* callback)
170 mImpl->SetPreRenderCallback(callback);
173 Adaptor& Adaptor::Get()
175 return Internal::Adaptor::Adaptor::Get();
178 bool Adaptor::IsAvailable()
180 return Internal::Adaptor::Adaptor::IsAvailable();
183 void Adaptor::NotifySceneCreated()
185 mImpl->NotifySceneCreated();
188 void Adaptor::NotifyLanguageChanged()
190 mImpl->NotifyLanguageChanged();
193 void Adaptor::FeedTouchPoint(TouchPoint& point, int timeStamp)
195 mImpl->FeedTouchPoint(point, timeStamp);
198 void Adaptor::FeedWheelEvent(WheelEvent& wheelEvent)
200 mImpl->FeedWheelEvent(wheelEvent);
203 void Adaptor::FeedKeyEvent(KeyEvent& keyEvent)
205 mImpl->FeedKeyEvent(keyEvent);
208 void Adaptor::SceneCreated()
210 mImpl->SceneCreated();
213 void Adaptor::SurfaceResizePrepare(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
215 mImpl->SurfaceResizePrepare(surface, surfaceSize);
218 void Adaptor::SurfaceResizeComplete(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
220 mImpl->SurfaceResizeComplete(surface, surfaceSize);
223 void Adaptor::RenderOnce()
228 void Adaptor::FlushUpdateMessages()
230 mImpl->FlushUpdateMessages();
233 void Adaptor::RequestProcessEventsOnIdle()
235 mImpl->RequestProcessEventsOnIdle();
238 const LogFactoryInterface& Adaptor::GetLogFactory()
240 return mImpl->GetLogFactory();
243 const TraceFactoryInterface& Adaptor::GetTraceFactory()
245 return mImpl->GetTraceFactory();
248 void Adaptor::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
250 mImpl->RegisterProcessor(processor, postProcessor);
253 void Adaptor::UnregisterProcessor(Integration::Processor& processor, bool postProcessor)
255 mImpl->UnregisterProcessor(processor, postProcessor);
258 Dali::WindowContainer Adaptor::GetWindows() const
260 return mImpl->GetWindows();
263 SceneHolderList Adaptor::GetSceneHolders() const
265 return mImpl->GetSceneHolders();
268 Dali::ObjectRegistry Adaptor::GetObjectRegistry() const
270 return mImpl->GetObjectRegistry();
273 void Adaptor::OnWindowShown()
275 mImpl->OnWindowShown();
278 void Adaptor::OnWindowHidden()
280 mImpl->OnWindowHidden();