/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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/internal/window-system/common/window-impl.h>
// EXTERNAL HEADERS
+#include <thread>
#include <dali/integration-api/core.h>
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/actors/layer.h>
// INTERNAL HEADERS
#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/window-system/common/event-handler.h>
#include <dali/internal/window-system/common/orientation-impl.h>
#include <dali/internal/window-system/common/render-surface-factory.h>
} // unnamed namespace
-Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
+Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
+{
+ Any surface;
+ return Window::New(surface, positionSize, name, className, isTransparent);
+}
+
+Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
{
Window* window = new Window();
window->mIsTransparent = isTransparent;
- window->Initialize( positionSize, name, className );
+ window->Initialize(surface, positionSize, name, className);
return window;
}
mWindowHeight( 0 ),
mOrientationMode( Internal::Adaptor::Window::OrientationMode::PORTRAIT ),
mNativeWindowId( -1 ),
- mFocusChangedSignal(),
mResizedSignal(),
mDeleteRequestSignal(),
mFocusChangeSignal(),
}
}
-void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
+void Window::Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className)
{
// Create a window render surface
- Any surface;
auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
mSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
mWindowSurface = static_cast<WindowRenderSurface*>( mSurface.get() );
mWindowSurface = static_cast<WindowRenderSurface*>( surface );
}
-void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
-{
-}
-
-void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
-{
-}
-
-void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
-{
-}
-
void Window::SetClass( std::string name, std::string className )
{
mName = name;
void Window::Raise()
{
mWindowBase->Raise();
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
+
DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId );
}
void Window::Lower()
{
mWindowBase->Lower();
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
+
DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId );
}
void Window::Activate()
{
mWindowBase->Activate();
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
+
DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId );
}
mVisibilityChangedSignal.Emit( handle, true );
}
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
+
DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
}
mVisibilityChangedSignal.Emit( handle, false );
}
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
+
DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Hide(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
}
{
mWindowBase->SetInputRegion( inputRegion );
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
+
DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
}
{
Uint16Pair newSize( newRect.width, newRect.height );
- SurfaceResized();
+ bool forceUpdate = false;
+ if( mWindowBase->IsEglWindowRotationSupported() )
+ {
+ forceUpdate = true;
+ }
+
+ SurfaceResized( forceUpdate );
mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
}
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
}
Dali::Window::WindowSize Window::GetSize() const
PositionSize oldRect = mSurface->GetPositionSize();
mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
}
Dali::Window::WindowPosition Window::GetPosition() const
{
Uint16Pair newSize( newRect.width, newRect.height );
- SurfaceResized();
+ bool forceUpdate = false;
+ if( mWindowBase->IsEglWindowRotationSupported() )
+ {
+ forceUpdate = true;
+ }
+
+ SurfaceResized( forceUpdate );
mAdaptor->SurfaceResizePrepare( mSurface.get(), newSize );
mResizeSignal.Emit( handle, newSize );
mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
}
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
}
Dali::Layer Window::GetRootLayer() const
DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible );
}
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
}
void Window::OnFocusChanged( bool focusIn )
{
Dali::Window handle( this );
- mFocusChangedSignal.Emit( focusIn );
mFocusChangeSignal.Emit( handle, focusIn );
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
}
void Window::OnOutputTransformed()
{
+ bool forceUpdate = false;
+ if( mWindowBase->IsEglWindowRotationSupported() )
+ {
+ forceUpdate = true;
+ }
+ DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnOutputTransformed()\n", this, mNativeWindowId );
+ SurfaceResized( forceUpdate );
+
PositionSize positionSize = mSurface->GetPositionSize();
- SurfaceResized();
mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
}
mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
- SurfaceResized();
+ bool forceUpdate = false;
+ if( mWindowBase->IsEglWindowRotationSupported() )
+ {
+ forceUpdate = true;
+ }
+
+ SurfaceResized( forceUpdate );
mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
{
mEventHandler->Pause();
}
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
}
void Window::OnResume()
{
mEventHandler->Resume();
}
+
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetFullSwapNextFrame();
+ }
}
void Window::RecalculateTouchPosition( Integration::Point& point )
SetAvailableAnlges( mAvailableAngles );
}
+int32_t Window::GetNativeId() const
+{
+ return mWindowBase->GetNativeWindowId();
+}
+
+void Window::SetDamagedAreas(std::vector<Dali::Rect<int>>& areas)
+{
+ GraphicsInterface& graphics = mAdaptor->GetGraphicsInterface();
+ EglGraphics* eglGraphics = static_cast<EglGraphics*>(&graphics);
+ if (eglGraphics)
+ {
+ eglGraphics->SetDamagedAreas(areas);
+ }
+}
+
} // Adaptor
} // Internal