[Tizen] Modify iconify part for wayland 74/104474/3
authorsuhyung Eom <suhyung.eom@samsung.com>
Tue, 13 Dec 2016 10:26:58 +0000 (19:26 +0900)
committersu hyung Eom <suhyung.eom@samsung.com>
Tue, 13 Dec 2016 11:07:26 +0000 (03:07 -0800)
Change-Id: Ifde5981c915ce9564251b2605cb5a7cc65a69790

adaptors/ecore/wayland/window-impl-ecore-wl.cpp
adaptors/ecore/wayland/window-render-surface-ecore-wl.cpp
adaptors/ecore/wayland/window-render-surface.h

index 3cc1f204cd0e32d8c8eb7fd2bebcec41f4e76d67..184299ca185413ebbff55cc7d0f88b4850c1bba5 100644 (file)
@@ -63,7 +63,7 @@ struct Window::EventHandler
   EventHandler( Window* window )
   : mWindow( window ),
     mWindowPropertyHandler( NULL ),
-    mClientMessageHandler( NULL ),
+    mWindowIconifyStateHandler( NULL ),
     mEcoreWindow( 0 )
   {
     // store ecore window handle
@@ -73,6 +73,14 @@ struct Window::EventHandler
       mEcoreWindow = wlWindow->GetWlWindow();
     }
     DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no ecore Wl window");
+
+#ifndef DALI_PROFILE_UBUNTU
+    if( mWindow->mEcoreEventHander )
+    {
+      mWindowIconifyStateHandler = ecore_event_handler_add( ECORE_WL_EVENT_WINDOW_ICONIFY_STATE_CHANGE, EcoreEventWindowIconifyStateChanged, this );
+    }
+#endif
+
   }
 
   /**
@@ -84,9 +92,9 @@ struct Window::EventHandler
     {
       ecore_event_handler_del( mWindowPropertyHandler );
     }
-    if ( mClientMessageHandler )
+    if ( mWindowIconifyStateHandler )
     {
-      ecore_event_handler_del( mClientMessageHandler );
+      ecore_event_handler_del( mWindowIconifyStateHandler );
     }
   }
 
@@ -98,16 +106,41 @@ struct Window::EventHandler
     return EINA_FALSE;
   }
 
-  /// Called when the window properties are changed.
-  static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
+#ifndef DALI_PROFILE_UBUNTU
+  /// Called when the window iconify state is changed.
+  static Eina_Bool EcoreEventWindowIconifyStateChanged( void* data, int type, void* event )
   {
-    return EINA_FALSE;
+    Ecore_Wl_Event_Window_Iconify_State_Change* iconifyChangedEvent( (Ecore_Wl_Event_Window_Iconify_State_Change*)event );
+    EventHandler* handler( (EventHandler*)data );
+    Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
+
+    if ( handler && handler->mWindow )
+    {
+      WindowVisibilityObserver* observer( handler->mWindow->mAdaptor );
+      if ( observer && ( iconifyChangedEvent->win == (unsigned int) ecore_wl_window_id_get( handler->mEcoreWindow ) ) )
+      {
+        if( iconifyChangedEvent->iconified == EINA_TRUE )
+        {
+          observer->OnWindowHidden();
+          DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Iconfied\n", handler->mEcoreWindow );
+        }
+        else
+        {
+          observer->OnWindowShown();
+          DALI_LOG_INFO( gWindowLogFilter, Debug::General, "Window (%d) Shown\n", handler->mEcoreWindow );
+        }
+        handled = ECORE_CALLBACK_DONE;
+      }
+    }
+
+    return handled;
   }
+#endif
 
   // Data
   Window* mWindow;
   Ecore_Event_Handler* mWindowPropertyHandler;
-  Ecore_Event_Handler* mClientMessageHandler;
+  Ecore_Event_Handler* mWindowIconifyStateHandler;
   Ecore_Wl_Window* mEcoreWindow;
 };
 
index 0d0609a1c4ce6cb9cdb58bb3d832c2b8e676a82a..892f6cc694b2698c6c879fbf8068c236a927d117 100644 (file)
@@ -50,9 +50,7 @@ WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize,
                                           const std::string& name,
                                           bool isTransparent)
 : EcoreWlRenderSurface( positionSize, surface, name, isTransparent ),
-  mWlWindow( NULL ),
-  mEglWindow( NULL ),
-  mNeedToApproveDeiconify( false )
+  mEglWindow( NULL )
 {
   DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
   Init( surface );
@@ -89,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 );
@@ -221,17 +214,6 @@ void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract
   {
     mRenderNotification->Trigger();
   }
-
-  // When the window is deiconified, it approves the deiconify operation to window manager after rendering
-  if(mNeedToApproveDeiconify)
-  {
-    // SwapBuffer is desychronized. So make sure to sychronize when window is deiconified.
-    glAbstraction.Finish();
-
-    //FIXME
-
-    mNeedToApproveDeiconify = false;
-  }
 }
 
 void WindowRenderSurface::StopRender()
index 7aea88bc7982eaee2567ba99687fa17e4399e58d..8fa093a8141e6e24c18b01e53a39bd3601d0a7fc 100644 (file)
@@ -60,12 +60,6 @@ public: // API
    */
   virtual Ecore_Wl_Window* GetDrawable();
 
-  /**
-   * Request to approve deiconify operation
-   * If it is requested, it will send ECORE_X_ATOM_E_DEICONIFY_APPROVE event to window manager after rendering
-   */
-  void RequestToApproveDeiconify();
-
   /**
    * Map window
    */
@@ -159,7 +153,6 @@ private: // Data
 
   Ecore_Wl_Window*   mWlWindow; ///< Wayland-Window
   wl_egl_window*     mEglWindow;
-  bool             mNeedToApproveDeiconify; ///< Whether need to send ECORE_X_ATOM_E_DEICONIFY_APPROVE event
 
 }; // class WindowRenderSurface
 
@@ -167,4 +160,4 @@ private: // Data
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_ECORE_X_WINDOW_RENDER_SURFACE_H__
+#endif // __DALI_INTERNAL_ECORE_WL_WINDOW_RENDER_SURFACE_H__