X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=adaptors%2Fx11%2Fwindow-render-surface-x.cpp;h=af290209c8bcbcfc26dd16bdc9e6f7ba55be4805;hb=d370ec687e37a2adb6cc230625bb289361f11446;hp=1cf78e1218398d47ada3512e4621ab20a0c96372;hpb=dd9d92514bbc7c15ef4926bb8038bf2f4bf01626;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 1cf78e1..af29020 100644 --- a/adaptors/x11/window-render-surface-x.cpp +++ b/adaptors/x11/window-render-surface-x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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. @@ -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,11 +55,13 @@ 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, + const std::string& className, bool isTransparent) -: RenderSurface( Dali::RenderSurface::WINDOW, positionSize, surface, display, name, isTransparent ), - mNeedToApproveDeiconify(false) +: EcoreXRenderSurface( positionSize, surface, name, isTransparent ), + mX11Window( 0 ), + mNeedToApproveDeiconify(false), + mClassName(className) { DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" ); Init( surface ); @@ -79,12 +78,7 @@ WindowRenderSurface::~WindowRenderSurface() Ecore_X_Drawable WindowRenderSurface::GetDrawable() { // already an e-core type - return (Ecore_X_Drawable)mX11Window; -} - -Dali::RenderSurface::SurfaceType WindowRenderSurface::GetType() -{ - return Dali::RenderSurface::WINDOW; + return static_cast< Ecore_X_Drawable >( mX11Window ); } Any WindowRenderSurface::GetSurface() @@ -107,8 +101,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,33 +110,31 @@ 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 - XWindow window = static_cast< XWindow>( mX11Window ); - eglImpl.CreateSurfaceWindow( (EGLNativeWindowType)window, mColorDepth ); // reinterpret_cast does not compile + // need to create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit + XWindow window( mX11Window ); + eglImpl.CreateSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( window ), mColorDepth ); } 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 create X handle as in 64bit system ECore handle is 32 bit whereas EGLnative and XWindow are 64 bit + XWindow window( mX11Window ); + Internal::Adaptor::EglImplementation& eglImpl = static_cast( egl ); - // 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 ) ); + return eglImpl.ReplaceSurfaceWindow( reinterpret_cast< EGLNativeWindowType >( window ) ); } void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize ) @@ -198,9 +189,9 @@ bool WindowRenderSurface::PreRender( EglInterface&, Integration::GlAbstraction& return true; } -void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, unsigned int, bool ) +void WindowRenderSurface::PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, 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 @@ -209,16 +200,26 @@ 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; + + XSendEvent(display, mX11Window, false, ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, &xev); #endif // DALI_PROFILE_UBUNTU - ecore_x_sync(); + XSync(display, false); mNeedToApproveDeiconify = false; } @@ -270,6 +271,7 @@ void WindowRenderSurface::CreateXRenderable() // set up window title which will be helpful for debug utitilty ecore_x_icccm_title_set( mX11Window, mTitle.c_str() ); ecore_x_netwm_name_set( mX11Window, mTitle.c_str() ); + ecore_x_icccm_name_class_set( mX11Window, mTitle.c_str(), mClassName.c_str() ); // set up etc properties to match with ecore-evas char *id = NULL; @@ -296,6 +298,11 @@ void WindowRenderSurface::UseExistingRenderable( unsigned int surfaceId ) mX11Window = static_cast< Ecore_X_Window >( surfaceId ); } +void WindowRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& /* threadSynchronization */ ) +{ + // Nothing to do. +} + void WindowRenderSurface::ReleaseLock() { // Nothing to do. @@ -303,8 +310,4 @@ void WindowRenderSurface::ReleaseLock() } // namespace ECore -} // namespace Adaptor - -} // namespace Internal - } // namespace Dali