+ else if ( Adaptor::IsAvailable() )
+ {
+ // Create instance and register singleton only if the adaptor is available
+
+ Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
+
+ // The Ecore_X_Window needs to use the ImfManager.
+ // Only when the render surface is window, we can get the Ecore_X_Window.
+ Ecore_X_Window ecoreXwin( 0 );
+ Dali::RenderSurface& surface( adaptorImpl.GetSurface() );
+ if( surface.GetType() == Dali::RenderSurface::WINDOW )
+ {
+ ecoreXwin = AnyCast< Ecore_X_Window >( adaptorImpl.GetSurface().GetSurface() );
+ }
+
+ // If we fail to get Ecore_X_Window, we can't use the ImfManager correctly.
+ // Thus you have to call "ecore_imf_context_client_window_set" somewhere.
+ // In EvasPlugIn, this function is called in EvasPlugin::ConnectEcoreEvent().
+
+ manager = Dali::ImfManager( new ImfManager( ecoreXwin ) );
+ service.Register( typeid( manager ), manager );
+ }