2 * Copyright (c) 2024 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)
92 return mImpl->AddIdle(callback, hasReturnValue);
96 DALI_LOG_ERROR("Adaptor not instantiated");
101 bool Adaptor::AddWindow(Dali::Integration::SceneHolder childWindow)
105 return mImpl->AddWindow(childWindow);
109 DALI_LOG_ERROR("Adaptor not instantiated");
114 void Adaptor::RemoveIdle(CallbackBase* callback)
118 mImpl->RemoveIdle(callback);
122 DALI_LOG_ERROR("Adaptor not instantiated");
126 void Adaptor::ProcessIdle()
130 mImpl->ProcessIdle();
134 DALI_LOG_ERROR("Adaptor not instantiated");
138 void Adaptor::ReplaceSurface(Window window, Dali::RenderSurfaceInterface& surface)
140 Internal::Adaptor::SceneHolder* sceneHolder = &Dali::GetImplementation(window);
141 mImpl->ReplaceSurface(Dali::Integration::SceneHolder(sceneHolder), surface);
144 void Adaptor::ReplaceSurface(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface& surface)
146 mImpl->ReplaceSurface(window, surface);
149 Adaptor::AdaptorSignalType& Adaptor::ResizedSignal()
151 return mImpl->ResizedSignal();
154 Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal()
156 return mImpl->LanguageChangedSignal();
159 Adaptor::WindowCreatedSignalType& Adaptor::WindowCreatedSignal()
161 return mImpl->WindowCreatedSignal();
164 Adaptor::LocaleChangedSignalType& Adaptor::LocaleChangedSignal()
166 return mImpl->LocaleChangedSignal();
169 Dali::RenderSurfaceInterface& Adaptor::GetSurface()
171 return mImpl->GetSurface();
174 Any Adaptor::GetNativeWindowHandle()
176 return mImpl->GetNativeWindowHandle();
179 Any Adaptor::GetNativeWindowHandle(Actor actor)
181 return mImpl->GetNativeWindowHandle(actor);
184 Any Adaptor::GetGraphicsDisplay()
186 return mImpl->GetGraphicsDisplay();
189 void Adaptor::ReleaseSurfaceLock()
191 mImpl->ReleaseSurfaceLock();
194 void Adaptor::SetRenderRefreshRate(unsigned int numberOfVSyncsPerRender)
196 mImpl->SetRenderRefreshRate(numberOfVSyncsPerRender);
199 void Adaptor::SetPreRenderCallback(CallbackBase* callback)
201 mImpl->SetPreRenderCallback(callback);
204 Adaptor& Adaptor::Get()
206 return Internal::Adaptor::Adaptor::Get();
209 bool Adaptor::IsAvailable()
211 return Internal::Adaptor::Adaptor::IsAvailable();
214 void Adaptor::NotifySceneCreated()
216 mImpl->NotifySceneCreated();
219 void Adaptor::NotifyLanguageChanged()
221 mImpl->NotifyLanguageChanged();
224 void Adaptor::FeedTouchPoint(TouchPoint& point, int timeStamp)
226 mImpl->FeedTouchPoint(point, timeStamp);
229 void Adaptor::FeedWheelEvent(WheelEvent& wheelEvent)
231 mImpl->FeedWheelEvent(wheelEvent);
234 void Adaptor::FeedKeyEvent(KeyEvent& keyEvent)
236 mImpl->FeedKeyEvent(keyEvent);
239 void Adaptor::SceneCreated()
241 mImpl->SceneCreated();
244 void Adaptor::SurfaceResizePrepare(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
246 mImpl->SurfaceResizePrepare(surface, surfaceSize);
249 void Adaptor::SurfaceResizeComplete(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
251 mImpl->SurfaceResizeComplete(surface, surfaceSize);
254 void Adaptor::UpdateOnce()
256 mImpl->RequestUpdateOnce();
259 void Adaptor::RenderOnce()
264 void Adaptor::FlushUpdateMessages()
266 mImpl->FlushUpdateMessages();
269 void Adaptor::RequestProcessEventsOnIdle()
271 mImpl->RequestProcessEventsOnIdle();
274 const LogFactoryInterface& Adaptor::GetLogFactory()
276 return mImpl->GetLogFactory();
279 const TraceFactoryInterface& Adaptor::GetTraceFactory()
281 return mImpl->GetTraceFactory();
284 void Adaptor::RegisterProcessor(Integration::Processor& processor, bool postProcessor)
286 mImpl->RegisterProcessor(processor, postProcessor);
289 void Adaptor::UnregisterProcessor(Integration::Processor& processor, bool postProcessor)
291 mImpl->UnregisterProcessor(processor, postProcessor);
294 Dali::WindowContainer Adaptor::GetWindows() const
296 return mImpl->GetWindows();
299 SceneHolderList Adaptor::GetSceneHolders() const
301 return mImpl->GetSceneHolders();
304 Dali::ObjectRegistry Adaptor::GetObjectRegistry() const
306 return mImpl->GetObjectRegistry();
309 void Adaptor::OnWindowShown()
311 mImpl->OnWindowShown();
314 void Adaptor::OnWindowHidden()
316 mImpl->OnWindowHidden();