#include <window-render-surface.h>
// EXTERNAL INCLUDES
+#include <dlfcn.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-defines.h>
{
const int MINIMUM_DIMENSION_CHANGE( 1 ); ///< Minimum change for window to be considered to have moved
+const char* WAYLAND_EGL_SO( "libwayland-egl.so" );
} // unnamed namespace
const std::string& name,
bool isTransparent)
: EcoreWlRenderSurface( positionSize, surface, name, isTransparent ),
+ mEglWinGetCapabilitiesPtr( NULL ),
+ mEglWinSetRotationPtr( NULL ),
+ mLibHandle( NULL ),
mWlWindow( NULL ),
mEglWindow( NULL ),
mThreadSynchronization( NULL ),
{
delete mRotationTrigger;
}
+
+ if( mLibHandle != NULL )
+ {
+ dlclose( mLibHandle );
+ }
}
Ecore_Wl_Window* WindowRenderSurface::GetDrawable()
ecore_wl_window_rotation_set( mWlWindow, angle );
- wl_egl_window_set_rotation( mEglWindow, rotation );
+ if( mEglWinSetRotationPtr )
+ {
+ mEglWinSetRotationPtr( mEglWindow, rotation );
+ }
}
void WindowRenderSurface::InitializeEgl( EglInterface& eglIf )
eglImpl.CreateSurfaceWindow( windowType, mColorDepth );
// Check capability
- wl_egl_window_capability capability = static_cast< wl_egl_window_capability >( wl_egl_window_get_capabilities( mEglWindow ) );
- if( capability == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED )
+ if( !mLibHandle )
{
- DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: capability = %d\n", capability );
- mRotationSupported = true;
+ mLibHandle = dlopen( WAYLAND_EGL_SO, RTLD_LAZY );
+
+ char* error = dlerror();
+ if( mLibHandle == NULL || error != NULL )
+ {
+ DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: dlopen error: %s\n", error );
+ return;
+ }
+
+ mEglWinGetCapabilitiesPtr = reinterpret_cast< EglWinGetCapabilitiesFunction >( dlsym( mLibHandle, "wl_egl_window_get_capabilities" ) );
+ if( !mEglWinGetCapabilitiesPtr )
+ {
+ DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: Can't load wl_egl_window_get_capabilities\n" );
+ return;
+ }
+
+ mEglWinSetRotationPtr = reinterpret_cast< EglWinSetRotationFunction >( dlsym( mLibHandle, "wl_egl_window_set_rotation" ) );
+ if( !mEglWinSetRotationPtr )
+ {
+ DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: Can't load wl_egl_window_set_rotation\n" );
+ return;
+ }
+ }
+
+ if( mEglWinGetCapabilitiesPtr )
+ {
+ wl_egl_window_capability capability = static_cast< wl_egl_window_capability >( mEglWinGetCapabilitiesPtr( mEglWindow ) );
+ if( capability == WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED )
+ {
+ DALI_LOG_INFO( gRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::CreateEglSurface: capability = %d\n", capability );
+ mRotationSupported = true;
+ }
}
}
private: // Data
- Ecore_Wl_Window* mWlWindow; ///< Wayland-Window
+ typedef int (*EglWinGetCapabilitiesFunction)( wl_egl_window* eglWindow );
+ typedef int (*EglWinSetRotationFunction)( wl_egl_window* eglWindow, int rotation );
+
+ EglWinGetCapabilitiesFunction mEglWinGetCapabilitiesPtr;
+ EglWinSetRotationFunction mEglWinSetRotationPtr;
+
+ void* mLibHandle; ///< Handle for the loaded library
+ Ecore_Wl_Window* mWlWindow; ///< Wayland-Window
wl_egl_window* mEglWindow;
ThreadSynchronizationInterface* mThreadSynchronization;
TriggerEventInterface* mRotationTrigger;