Revert "[Tizen] Add screen and client rotation itself function"
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
index b21ca77..fe1dacc 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -32,6 +32,7 @@
 
 // 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>
@@ -87,13 +88,12 @@ Window::Window()
   mWindowHeight( 0 ),
   mOrientationMode( Internal::Adaptor::Window::OrientationMode::PORTRAIT ),
   mNativeWindowId( -1 ),
-  mFocusChangedSignal(),
-  mResizedSignal(),
   mDeleteRequestSignal(),
   mFocusChangeSignal(),
   mResizeSignal(),
   mVisibilityChangedSignal(),
-  mTransitionEffectEventSignal()
+  mTransitionEffectEventSignal(),
+  mKeyboardRepeatSettingsChangedSignal()
 {
 }
 
@@ -120,6 +120,8 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std
   mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
   mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
   mWindowBase->TransitionEffectEventSignal().Connect( this, &Window::OnTransitionEffectEvent );
+  mWindowBase->KeyboardRepeatSettingsChangedSignal().Connect( this, &Window::OnKeyboardRepeatSettingsChanged );
+  mWindowBase->WindowRedrawRequestSignal().Connect( this, &Window::OnWindowRedrawRequest );
 
   mWindowSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
 
@@ -152,7 +154,7 @@ void Window::Initialize(Any surface, const PositionSize& positionSize, const std
 
 void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
 {
-  mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface, *mAdaptor ) );
+  mEventHandler = EventHandlerPtr(new EventHandler( mWindowSurface->GetWindowBase(), *mAdaptor ) );
   mEventHandler->AddObserver( *this );
 }
 
@@ -161,18 +163,6 @@ void Window::OnSurfaceSet( Dali::RenderSurfaceInterface* surface )
   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;
@@ -188,18 +178,27 @@ std::string Window::GetClassName() const
 void Window::Raise()
 {
   mWindowBase->Raise();
+
+  mSurface->SetFullSwapNextFrame();
+
   DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Raise() \n", this, mNativeWindowId );
 }
 
 void Window::Lower()
 {
   mWindowBase->Lower();
+
+  mSurface->SetFullSwapNextFrame();
+
   DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Lower() \n", this, mNativeWindowId );
 }
 
 void Window::Activate()
 {
   mWindowBase->Activate();
+
+  mSurface->SetFullSwapNextFrame();
+
   DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Activate() \n", this, mNativeWindowId );
 }
 
@@ -412,6 +411,8 @@ void Window::Show()
     mVisibilityChangedSignal.Emit( handle, true );
   }
 
+  mSurface->SetFullSwapNextFrame();
+
   DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible );
 }
 
@@ -584,11 +585,12 @@ void Window::SetSize( Dali::Window::WindowSize size )
     DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetSize(): resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
 
     Dali::Window handle( this );
-    mResizedSignal.Emit( newSize );
     mResizeSignal.Emit( handle, newSize );
 
     mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
   }
+
+  mSurface->SetFullSwapNextFrame();
 }
 
 Dali::Window::WindowSize Window::GetSize() const
@@ -609,6 +611,8 @@ void Window::SetPosition( Dali::Window::WindowPosition position )
   PositionSize oldRect = mSurface->GetPositionSize();
 
   mWindowSurface->MoveResize( PositionSize( position.GetX(), position.GetY(), oldRect.width, oldRect.height ) );
+
+  mSurface->SetFullSwapNextFrame();
 }
 
 Dali::Window::WindowPosition Window::GetPosition() const
@@ -643,10 +647,11 @@ void Window::SetPositionSize( PositionSize positionSize )
 
     DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), SetPositionSize():resize signal [%d x %d]\n", this, mNativeWindowId, newRect.width, newRect.height );
     Dali::Window handle( this );
-    mResizedSignal.Emit( newSize );
     mResizeSignal.Emit( handle, newSize );
     mAdaptor->SurfaceResizeComplete( mSurface.get(), newSize );
   }
+
+  mSurface->SetFullSwapNextFrame();
 }
 
 Dali::Layer Window::GetRootLayer() const
@@ -711,13 +716,16 @@ void Window::OnIconifyChanged( bool iconified )
 
     DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), Deiconified: visible = %d\n", this, mNativeWindowId, mVisible );
   }
+
+  mSurface->SetFullSwapNextFrame();
 }
 
 void Window::OnFocusChanged( bool focusIn )
 {
   Dali::Window handle( this );
-  mFocusChangedSignal.Emit( focusIn );
   mFocusChangeSignal.Emit( handle, focusIn );
+
+  mSurface->SetFullSwapNextFrame();
 }
 
 void Window::OnOutputTransformed()
@@ -739,6 +747,17 @@ void Window::OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindo
   mTransitionEffectEventSignal.Emit( handle, state, type );
 }
 
+void Window::OnKeyboardRepeatSettingsChanged()
+{
+  Dali::Window handle( this );
+  mKeyboardRepeatSettingsChangedSignal.Emit();
+}
+
+void Window::OnWindowRedrawRequest()
+{
+  mAdaptor->RenderOnce();
+}
+
 void Window::OnTouchPoint( Dali::Integration::Point& point, int timeStamp )
 {
   FeedTouchPoint( point, timeStamp );
@@ -772,7 +791,6 @@ void Window::OnRotation( const RotationEvent& rotation )
   DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight );
   // Emit signal
   Dali::Window handle( this );
-  mResizedSignal.Emit( Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
   mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
 
   mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
@@ -792,6 +810,8 @@ void Window::OnResume()
   {
     mEventHandler->Resume();
   }
+
+  mSurface->SetFullSwapNextFrame();
 }
 
 void Window::RecalculateTouchPosition( Integration::Point& point )