[3.0] Modify iconify part for wayland
[platform/core/uifw/dali-adaptor.git] / adaptors / ecore / wayland / window-render-surface-ecore-wl.cpp
index 532c47f..baf7cb9 100644 (file)
@@ -50,7 +50,7 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
                                           const std::string& name,
                                           bool isTransparent)
 : EcoreWlRenderSurface( positionSize, surface, name, isTransparent ),
-  mNeedToApproveDeiconify(false)
+  mEglWindow( NULL )
 {
   DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
   Init( surface );
@@ -58,6 +58,12 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
 
 WindowRenderSurface::~WindowRenderSurface()
 {
+  if( mEglWindow != NULL )
+  {
+    wl_egl_window_destroy(mEglWindow);
+    mEglWindow = NULL;
+  }
+
   if( mOwnSurface )
   {
     ecore_wl_window_free( mWlWindow );
@@ -81,11 +87,6 @@ Ecore_Wl_Window* WindowRenderSurface::GetWlWindow()
   return mWlWindow;
 }
 
-void WindowRenderSurface::RequestToApproveDeiconify()
-{
-  mNeedToApproveDeiconify = true;
-}
-
 void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
 {
   DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
@@ -123,8 +124,12 @@ void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf )
 
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
   eglImpl.DestroySurface();
-  wl_egl_window_destroy(mEglWindow);
-  mEglWindow = NULL;
+
+  if( mEglWindow != NULL )
+  {
+    wl_egl_window_destroy(mEglWindow);
+    mEglWindow = NULL;
+  }
 }
 
 bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
@@ -205,15 +210,9 @@ void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract
   Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( egl );
   eglImpl.SwapBuffers();
 
-  // When the window is deiconified, it approves the deiconify operation to window manager after rendering
-  if(mNeedToApproveDeiconify)
+  if( mRenderNotification )
   {
-    // SwapBuffer is desychronized. So make sure to sychronize when window is deiconified.
-    glAbstraction.Finish();
-
-    //FIXME
-
-    mNeedToApproveDeiconify = false;
+    mRenderNotification->Trigger();
   }
 }
 
@@ -244,8 +243,6 @@ void WindowRenderSurface::CreateWlRenderable()
   {
       DALI_ASSERT_ALWAYS(0 && "Failed to create X window");
   }
-
-  //FIXME
 }
 
 void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId )