// EXTERNAL HEADERS
#include <dali/integration-api/core.h>
-#include <dali/integration-api/system-overlay.h>
+#include <dali/integration-api/render-task-list-integ.h>
+#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/render-tasks/render-task.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/devel-api/adaptor-framework/orientation.h>
Window::Window()
: mSurface( NULL ),
mWindowBase(),
- mIndicatorVisible( Dali::Window::VISIBLE ),
+ mIndicatorVisible( Dali::Window::INVISIBLE ), // TODO: Enable this after indicator implementation based on tizen 5.
mIndicatorIsShown( false ),
mShowRotatedIndicatorOnClose( false ),
mStarted( false ),
mIndicatorOrientation( Dali::Window::PORTRAIT ),
mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
mIndicatorOpacityMode( Dali::Window::OPAQUE ),
- mOverlay( NULL ),
mAdaptor( NULL ),
mType( Dali::Window::NORMAL ),
mPreferredOrientation( Dali::Window::PORTRAIT ),
{
if( mIndicator )
{
- mOverlay->Remove( mIndicator->GetActor() );
- Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
- Dali::RenderTask indicatorTask = taskList.GetTask(0);
- mOverlay->GetOverlayRenderTasks().RemoveTask(indicatorTask);
mIndicator->Close();
}
void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
{
- // create a window render surface
+ // Create a window render surface
Any surface;
auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
- auto windowRenderSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, name, className, mIsTransparent );
+ auto windowRenderSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
mSurface = windowRenderSurface.release();
- // create a window base
- auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
- mWindowBase = windowFactory->CreateWindowBase( this, mSurface );
+ // Get a window base
+ mWindowBase = mSurface->GetWindowBase();
- mWindowBase->Initialize();
+ // Connect signals
+ mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
+ mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
+ mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
+ mWindowBase->IndicatorFlickedSignal().Connect( this, &Window::OnIndicatorFlicked );
+
+ mSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
if( !positionSize.IsEmpty() )
{
DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
mStarted = true;
- // Only create one overlay per window
+ // Create one overlay for the main window only
Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
- Integration::Core& core = adaptorImpl.GetCore();
- mOverlay = &core.GetSystemOverlay();
-
- Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
- taskList.CreateTask();
-
mAdaptor = &adaptorImpl;
mAdaptor->AddObserver( *this );
void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
{
- mIndicatorVisible = visibleMode;
+ // TODO: Enable this after indicator implementation based on tizen 5.
+// mIndicatorVisible = visibleMode;
mWindowBase->ShowIndicator( mIndicatorVisible, mIndicatorOpacityMode );
void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
{
- mIndicatorVisible = mode;
+ // TODO: Enable this after indicator implementation based on tizen 5.
+// mIndicatorVisible = mode;
}
void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
Dali::Any Window::GetNativeHandle() const
{
- return mSurface->GetWindow();
+ return mSurface->GetNativeWindow();
}
void Window::SetAcceptFocus( bool accept )
mResizeEnabled = true;
}
- PositionSize positionSize = mSurface->GetPositionSize();
+ PositionSize oldRect = mSurface->GetPositionSize();
- if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
- {
- positionSize.width = size.GetWidth();
- positionSize.height = size.GetHeight();
+ mSurface->MoveResize( PositionSize( oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight() ) );
+
+ PositionSize newRect = mSurface->GetPositionSize();
- mSurface->MoveResize( positionSize );
+ // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
+ if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
+ {
+ Uint16Pair newSize( newRect.width, newRect.height );
- mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+ mAdaptor->SurfaceResizePrepare( newSize );
- // Emit signal
- mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
+ mResizedSignal.Emit( newSize );
- mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+ mAdaptor->SurfaceResizeComplete( newSize );
}
}
mResizeEnabled = true;
}
- PositionSize positionSize = mSurface->GetPositionSize();
+ PositionSize oldRect = mSurface->GetPositionSize();
- if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
- {
- positionSize.x = position.GetX();
- positionSize.y = position.GetY();
-
- mSurface->MoveResize( positionSize );
- }
+ mSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
}
Dali::Window::WindowPosition Window::GetPosition() const
return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
}
+void Window::SetPositionSize( PositionSize positionSize )
+{
+ if( !mResizeEnabled )
+ {
+ AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
+ mResizeEnabled = true;
+ }
+
+ PositionSize oldRect = mSurface->GetPositionSize();
+
+ mSurface->MoveResize( positionSize );
+
+ PositionSize newRect = mSurface->GetPositionSize();
+
+ // When surface size is updated, inform adaptor of resizing and emit ResizeSignal
+ if( ( oldRect.width != newRect.width ) || ( oldRect.height != newRect.height ) )
+ {
+ Uint16Pair newSize( newRect.width, newRect.height );
+
+ mAdaptor->SurfaceResizePrepare( newSize );
+
+ mResizedSignal.Emit( newSize );
+
+ mAdaptor->SurfaceResizeComplete( newSize );
+ }
+}
+
void Window::SetTransparency( bool transparent )
{
mSurface->SetTransparency( transparent );
mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
}
-void Window::OnIconifyChanged( bool iconified )
-{
- if( iconified )
- {
- mIconified = true;
-
- if( mVisible )
- {
- WindowVisibilityObserver* observer( mAdaptor );
- observer->OnWindowHidden();
- DALI_LOG_RELEASE_INFO( "Window (%p) Iconified\n", this );
- }
- }
- else
- {
- mIconified = false;
-
- if( mVisible )
- {
- WindowVisibilityObserver* observer( mAdaptor );
- observer->OnWindowShown();
- DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified\n", this );
- }
- }
-}
-
-void Window::OnFocusChanged( bool focusIn )
-{
- mFocusChangedSignal.Emit( focusIn );
-}
-
-void Window::OnOutputTransformed()
-{
- PositionSize positionSize = mSurface->GetPositionSize();
- mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
- mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
-}
-
-void Window::OnDeleteRequest()
-{
- mDeleteRequestSignal.Emit();
-}
-
void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
{
if( mIndicator == NULL )
mIndicator->SetOpacityMode( mIndicatorOpacityMode );
Dali::Actor actor = mIndicator->GetActor();
SetIndicatorActorRotation();
- mOverlay->Add(actor);
}
}
// else don't create a hidden indicator
mWindowBase->SetIndicatorProperties( isShow, lastOrientation );
}
+void Window::OnIconifyChanged( bool iconified )
+{
+ if( iconified )
+ {
+ mIconified = true;
+
+ if( mVisible )
+ {
+ WindowVisibilityObserver* observer( mAdaptor );
+ observer->OnWindowHidden();
+ DALI_LOG_RELEASE_INFO( "Window (%p) Iconified\n", this );
+ }
+ }
+ else
+ {
+ mIconified = false;
+
+ if( mVisible )
+ {
+ WindowVisibilityObserver* observer( mAdaptor );
+ observer->OnWindowShown();
+ DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified\n", this );
+ }
+ }
+}
+
+void Window::OnFocusChanged( bool focusIn )
+{
+ mFocusChangedSignal.Emit( focusIn );
+}
+
+void Window::OnOutputTransformed()
+{
+ PositionSize positionSize = mSurface->GetPositionSize();
+ mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+ mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+}
+
+void Window::OnDeleteRequest()
+{
+ mDeleteRequestSignal.Emit();
+}
+
+void Window::OnIndicatorFlicked()
+{
+ if( mIndicator )
+ {
+ mIndicator->Flicked();
+ }
+}
+
void Window::IndicatorTypeChanged( IndicatorInterface::Type type )
{
mWindowBase->IndicatorTypeChanged( type );