X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fx11%2Fwindow-render-surface-x.cpp;h=2bc2f0252aa0618f51e18ef49fcbf5183343336f;hb=58ede8dfbc02cbab6c834cf9c2e2d10d12d0cda6;hp=1636193108b47892759bb8c1afe9adbc14d5af74;hpb=6c48d965d1eca249b71488ab4193bf6dcdd74bcd;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/adaptors/x11/window-render-surface-x.cpp b/adaptors/x11/window-render-surface-x.cpp index 1636193..2bc2f02 100644 --- a/adaptors/x11/window-render-surface-x.cpp +++ b/adaptors/x11/window-render-surface-x.cpp @@ -30,18 +30,15 @@ #include // INTERNAL INCLUDES + #include #include +#include +#include namespace Dali { -namespace Internal -{ - -namespace Adaptor -{ - #if defined(DEBUG_ENABLED) extern Debug::Filter* gRenderSurfaceLogFilter; #endif @@ -58,10 +55,9 @@ const int MINIMUM_DIMENSION_CHANGE( 1 ); ///< Minimum change for window to be co WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize, Any surface, - Any display, const std::string& name, bool isTransparent) -: RenderSurface( Dali::RenderSurface::WINDOW, positionSize, surface, display, name, isTransparent ), +: EcoreXRenderSurface( positionSize, surface, name, isTransparent ), mNeedToApproveDeiconify(false) { DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" ); @@ -82,11 +78,6 @@ Ecore_X_Drawable WindowRenderSurface::GetDrawable() return (Ecore_X_Drawable)mX11Window; } -Dali::RenderSurface::SurfaceType WindowRenderSurface::GetType() -{ - return Dali::RenderSurface::WINDOW; -} - Any WindowRenderSurface::GetSurface() { // already an e-core type @@ -107,8 +98,7 @@ void WindowRenderSurface::InitializeEgl( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); - eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); eglImpl.ChooseConfig(true, mColorDepth); } @@ -117,7 +107,7 @@ void WindowRenderSurface::CreateEglSurface( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); // create the EGL surface // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit @@ -129,21 +119,19 @@ void WindowRenderSurface::DestroyEglSurface( EglInterface& eglIf ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& eglImpl = static_cast( eglIf ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( eglIf ); eglImpl.DestroySurface(); } -bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& eglIf ) +bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl ) { DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter ); - EglImplementation& egl = static_cast( eglIf ); - egl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); - // need to cast to X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit XWindow window = static_cast< XWindow >( mX11Window ); - return egl.ReplaceSurfaceWindow( (EGLNativeWindowType)window, // reinterpret_cast does not compile - reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); + + return eglImpl.ReplaceSurfaceWindow( (EGLNativeWindowType)window ); // reinterpret_cast does not compile } void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize ) @@ -188,15 +176,19 @@ void WindowRenderSurface::Map() ecore_x_window_show(mX11Window); } +void WindowRenderSurface::StartRender() +{ +} + bool WindowRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& ) { // nothing to do for windows return true; } -void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int, SyncMode ) +void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, unsigned int deltaTime, bool replacingSurface ) { - EglImplementation& eglImpl = static_cast( egl ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); eglImpl.SwapBuffers(); // When the window is deiconified, it approves the deiconify operation to window manager after rendering @@ -205,19 +197,35 @@ void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstract // SwapBuffer is desychronized. So make sure to sychronize when window is deiconified. glAbstraction.Finish(); + XDisplay* display = AnyCast(displayConnection->GetDisplay()); + +#ifndef DALI_PROFILE_UBUNTU /* client sends immediately reply message using value 1 */ - ecore_x_client_message32_send(mX11Window, - ECORE_X_ATOM_E_DEICONIFY_APPROVE, - ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, - mX11Window, 1, - 0, 0, 0); + XEvent xev; + + xev.xclient.window = mX11Window; + xev.xclient.type = ClientMessage; + xev.xclient.message_type = ECORE_X_ATOM_E_DEICONIFY_APPROVE; + xev.xclient.format = 32; + xev.xclient.data.l[0] = mX11Window; + xev.xclient.data.l[1] = 1; + xev.xclient.data.l[2] = 0; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; - ecore_x_sync(); + XSendEvent(display, mX11Window, false, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, &xev); +#endif // DALI_PROFILE_UBUNTU + + XSync(display, false); mNeedToApproveDeiconify = false; } } +void WindowRenderSurface::StopRender() +{ +} + void WindowRenderSurface::SetViewMode( ViewMode viewMode ) { Ecore_X_Atom viewModeAtom( ecore_x_atom_get( "_E_COMP_3D_APP_WIN" ) ); @@ -286,10 +294,11 @@ void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId ) mX11Window = static_cast< Ecore_X_Window >( surfaceId ); } -} // namespace ECore - -} // namespace Adaptor +void WindowRenderSurface::ReleaseLock() +{ + // Nothing to do. +} -} // namespace Internal +} // namespace ECore } // namespace Dali