/*
- * 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.
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+
#include <ecore-x-types.h>
#include <trigger-event.h>
+#include <gl/egl-implementation.h>
+#include <base/display-connection.h>
namespace Dali
{
-namespace Internal
-{
-
-namespace Adaptor
-{
-
#if defined(DEBUG_ENABLED)
extern Debug::Filter* gRenderSurfaceLogFilter;
#endif
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 );
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()
{
DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
- EglImplementation& eglImpl = static_cast<EglImplementation&>( eglIf );
- eglImpl.InitializeGles( reinterpret_cast< EGLNativeDisplayType >( mMainDisplay ) );
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
eglImpl.ChooseConfig(true, mColorDepth);
}
{
DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
- EglImplementation& eglImpl = static_cast<EglImplementation&>( eglIf );
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( 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<EglImplementation&>( eglIf );
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>( eglIf );
eglImpl.DestroySurface();
}
-bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& eglIf )
+bool WindowRenderSurface::ReplaceEGLSurface( EglInterface& egl )
{
DALI_LOG_TRACE_METHOD( gRenderSurfaceLogFilter );
- EglImplementation& egl = static_cast<EglImplementation&>( 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<Internal::Adaptor::EglImplementation&>( 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 )
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, bool replacingSurface )
{
- EglImplementation& eglImpl = static_cast<EglImplementation&>( egl );
+ 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
// SwapBuffer is desychronized. So make sure to sychronize when window is deiconified.
glAbstraction.Finish();
+ XDisplay* display = AnyCast<XDisplay *>(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;
- ecore_x_sync();
+ 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
+
+ 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" ) );
// 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;
mX11Window = static_cast< Ecore_X_Window >( surfaceId );
}
-} // namespace ECore
+void WindowRenderSurface::SetThreadSynchronization( ThreadSynchronizationInterface& /* threadSynchronization */ )
+{
+ // Nothing to do.
+}
-} // namespace Adaptor
+void WindowRenderSurface::ReleaseLock()
+{
+ // Nothing to do.
+}
-} // namespace Internal
+} // namespace ECore
} // namespace Dali