/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
} // unnamed namespace
-Dali::Adaptor* Adaptor::New( Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New( Any nativeWindow, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
Dali::Adaptor* adaptor = new Dali::Adaptor;
Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions );
return adaptor;
}
-Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Any nativeWindow, RenderSurface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
+Dali::Adaptor* Adaptor::New( GraphicsFactory& graphicsFactory, Any nativeWindow, Dali::RenderSurfaceInterface *surface, Dali::Configuration::ContextLoss configuration, EnvironmentOptions* environmentOptions )
{
Dali::Adaptor* adaptor = new Dali::Adaptor; // Public adaptor
Adaptor* impl = new Adaptor( nativeWindow, *adaptor, surface, environmentOptions ); // Impl adaptor
PositionSize size = defaultWindow.surface->GetPositionSize();
+ defaultWindow.surface->SetAdaptor(*this);
+
mGestureManager = new GestureManager(*this, Vector2(size.width, size.height), mCallbackManager, *mEnvironmentOptions);
mGraphics = &( graphicsFactory.Create() );
auto eglGraphics = static_cast<EglGraphics *>( mGraphics ); // This interface is temporary until Core has been updated to match
+ // This will only be created once
+ eglGraphics->Create();
+
GlImplementation& mGLES = eglGraphics->GetGlesInterface();
EglSyncImplementation& eglSyncImpl = eglGraphics->GetSyncImplementation();
{
Dali::TizenPlatform::ImageLoader::SetMaxTextureSize( mEnvironmentOptions->GetMaxTextureSize() );
}
-
- SetupSystemInformation();
}
Adaptor::~Adaptor()
return;
}
+ mCore->Initialize();
+
+ SetupSystemInformation();
+
// Start the callback manager
mCallbackManager->Start();
defaultWindow.surface->GetDpi( dpiHor, dpiVer );
- // tell core about the DPI value
- mCore->SetDpi(dpiHor, dpiVer);
-
// set the DPI value for font rendering
FontClient fontClient = FontClient::Get();
fontClient.SetDpi( dpiHor, dpiVer );
// Tell the core the size of the surface just before we start the render-thread
- PositionSize size = defaultWindow.surface->GetPositionSize();
-
- mCore->SurfaceResized( size.width, size.height );
+ mCore->SurfaceResized( defaultWindow.surface );
// Initialize the thread controller
mThreadController->Initialize();
mEventHandler->FeedKeyEvent( keyEvent );
}
-void Adaptor::ReplaceSurface( Any nativeWindow, RenderSurface& newSurface )
+void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurfaceInterface& newSurface )
{
- PositionSize positionSize = newSurface.GetPositionSize();
-
// Let the core know the surface size has changed
- mCore->SurfaceResized( positionSize.width, positionSize.height );
+ mCore->SurfaceResized( &newSurface );
mResizedSignal.Emit( mAdaptor );
WindowPane newDefaultWindow;
newDefaultWindow.nativeWindow = nativeWindow;
newDefaultWindow.surface = &newSurface;
+ newDefaultWindow.surface->SetAdaptor(*this);
WindowPane oldDefaultWindow = mWindowFrame.front();
oldDefaultWindow.surface = nullptr;
}
-RenderSurface& Adaptor::GetSurface() const
+Dali::RenderSurfaceInterface& Adaptor::GetSurface() const
{
WindowPane defaultWindow = mWindowFrame.front();
return *(defaultWindow.surface);
bool Adaptor::AddWindow( Dali::Window* childWindow, const std::string& childWindowName, const std::string& childWindowClassName, const bool& childWindowMode )
{
+ Window& windowImpl = Dali::GetImplementation( *childWindow );
+ windowImpl.SetAdaptor( Get() );
+
// This is any Window that is not the main (default) one
WindowPane additionalWindow;
additionalWindow.instance = childWindow;
additionalWindow.window_name = childWindowName;
additionalWindow.class_name = childWindowClassName;
additionalWindow.window_mode = childWindowMode;
+ additionalWindow.surface = windowImpl.GetSurface();
+ additionalWindow.id = windowImpl.GetId();
// Add the new Window to the Frame - the order is not important
mWindowFrame.push_back( additionalWindow );
- Window& windowImpl = Dali::GetImplementation( *childWindow );
- windowImpl.SetAdaptor( Get() );
-
return true;
}
return false;
}
+bool Adaptor::RemoveWindow( Window* childWindow )
+{
+ for ( WindowFrames::iterator iter = mWindowFrame.begin(); iter != mWindowFrame.end(); ++iter )
+ {
+ if( iter->id == childWindow->GetId() )
+ {
+ mWindowFrame.erase( iter );
+ return true;
+ }
+ }
+
+ return false;
+}
+
Dali::Adaptor& Adaptor::Get()
{
DALI_ASSERT_ALWAYS( IsAvailable() && "Adaptor not instantiated" );
return mSocketFactory;
}
-RenderSurface* Adaptor::GetRenderSurfaceInterface()
+Dali::RenderSurfaceInterface* Adaptor::GetRenderSurfaceInterface()
{
if( !mWindowFrame.empty())
{
RequestUpdate( false );
}
-void Adaptor::SurfaceResizePrepare( SurfaceSize surfaceSize )
+void Adaptor::SurfaceResizePrepare( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
{
// Let the core know the surface size has changed
- mCore->SurfaceResized( surfaceSize.GetWidth(), surfaceSize.GetHeight() );
+ mCore->SurfaceResized( surface );
mResizedSignal.Emit( mAdaptor );
}
-void Adaptor::SurfaceResizeComplete( SurfaceSize surfaceSize )
+void Adaptor::SurfaceResizeComplete( Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize )
{
// Flush the event queue to give the update-render thread chance
// to start processing messages for new camera setup etc as soon as possible
}
}
-void Adaptor::IndicatorSizeChanged(int height)
-{
- // Let the core know the indicator height is changed
- mCore->SetTopMargin(height);
-}
-
bool Adaptor::ProcessCoreEventsFromIdle()
{
ProcessCoreEvents();
return false;
}
-Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surface, EnvironmentOptions* environmentOptions)
+Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions)
: mResizedSignal(),
mLanguageChangedSignal(),
mAdaptor( adaptor ),
WindowPane defaultWindow;
defaultWindow.nativeWindow = nativeWindow;
defaultWindow.surface = surface;
+ defaultWindow.id = 0;
std::vector<WindowPane>::iterator iter = mWindowFrame.begin();
iter = mWindowFrame.insert( iter, defaultWindow );