/*
- * 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.
#include <dali/public-api/object/type-registry.h>
#include <dali/internal/event/actors/layer-list.h>
#include <dali/internal/event/common/property-helper.h>
-#include <dali/internal/event/common/stage-impl.h>
+#include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/common/event-thread-services.h>
using Dali::Internal::SceneGraph::UpdateManager;
typedef Layer::Behavior Behavior;
DALI_ENUM_TO_STRING_TABLE_BEGIN( BEHAVIOR )
-DALI_ENUM_TO_STRING_WITH_SCOPE( Layer, LAYER_2D )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Layer, LAYER_UI )
DALI_ENUM_TO_STRING_WITH_SCOPE( Layer, LAYER_3D )
DALI_ENUM_TO_STRING_TABLE_END( BEHAVIOR )
// create node, nodes are owned by UpdateManager
SceneGraph::Layer* layerNode = SceneGraph::Layer::New();
OwnerPointer< SceneGraph::Node > transferOwnership( layerNode );
- AddNodeMessage( Stage::GetCurrent()->GetUpdateManager(), transferOwnership );
+ AddNodeMessage( EventThreadServices::Get().GetUpdateManager(), transferOwnership );
LayerPtr layer( new Layer( Actor::LAYER, *layerNode ) );
// Second-phase construction
return layer;
}
-LayerPtr Layer::NewRoot( LayerList& layerList, UpdateManager& manager )
+LayerPtr Layer::NewRoot( LayerList& layerList )
{
// create node, nodes are owned by UpdateManager
SceneGraph::Layer* rootLayer = SceneGraph::Layer::New();
OwnerPointer< SceneGraph::Layer > transferOwnership( rootLayer );
- InstallRootMessage( manager, transferOwnership );
+ InstallRootMessage( EventThreadServices::Get().GetUpdateManager(), transferOwnership );
LayerPtr root( new Layer( Actor::ROOT_LAYER, *rootLayer ) );
mLayerList( NULL ),
mClippingBox( 0, 0, 0, 0 ),
mSortFunction( Layer::ZValue ),
- mBehavior( Dali::Layer::LAYER_2D ),
+ mBehavior( Dali::Layer::LAYER_UI ),
mIsClipping( false ),
mDepthTestDisabled( true ),
mTouchConsumed( false ),
Layer::~Layer()
{
+ if ( mIsRoot )
+ {
+ // Guard to allow handle destruction after Core has been destroyed
+ if( EventThreadServices::IsCoreRunning() )
+ {
+ UninstallRootMessage( GetEventThreadServices().GetUpdateManager(), &GetSceneLayerOnStage() );
+
+ GetEventThreadServices().UnregisterObject( this );
+ }
+ }
}
unsigned int Layer::GetDepth() const
// Notify update side object.
SetBehaviorMessage( GetEventThreadServices(), GetSceneLayerOnStage(), behavior );
- // By default, disable depth test for LAYER_2D, and enable for LAYER_3D.
- SetDepthTestDisabled( mBehavior == Dali::Layer::LAYER_2D );
+ // By default, disable depth test for LAYER_UI, and enable for LAYER_3D.
+ SetDepthTestDisabled( mBehavior == Dali::Layer::LAYER_UI );
}
void Layer::SetClipping(bool enabled)
// Convert mClippingBox to GL based coordinates (from bottom-left)
ClippingBox clippingBox( mClippingBox );
- StagePtr stage = Stage::GetCurrent();
- if( stage )
+ if( mScene )
{
- clippingBox.y = static_cast<int32_t>( stage->GetSize().height ) - clippingBox.y - clippingBox.height;
+ clippingBox.y = static_cast<int32_t>( mScene->GetSize().height ) - clippingBox.y - clippingBox.height;
// layerNode is being used in a separate thread; queue a message to set the value
SetClippingBoxMessage( GetEventThreadServices(), GetSceneLayerOnStage(), clippingBox );
DALI_ASSERT_DEBUG( NULL == mLayerList );
// Find the ordered layer-list
- // This is different for Layers added via Integration::GetSystemOverlay()
for ( Actor* parent = mParent; parent != NULL; parent = parent->GetParent() )
{
if( parent->IsLayer() )
}
case Dali::Layer::Property::BEHAVIOR:
{
- Behavior behavior(Dali::Layer::LAYER_2D);
+ Behavior behavior(Dali::Layer::LAYER_UI);
if( Scripting::GetEnumeration< Behavior >( propertyValue.Get< std::string >().c_str(), BEHAVIOR_TABLE, BEHAVIOR_TABLE_COUNT, behavior ) )
{
SetBehavior( behavior );