In Tizen embedded system, two types of rotation are supported.
One is Window Rotation and the other is Screen rotation
Although their use-case are different, their rotation itself almost works are same.
Real surface buffer is not rotated.
When rotation event is received from window server,
then internal contents are rotated and drawn with angle of the event.
This patch is to support the Tizen Rotation.
Change-Id: I311a7a93bdba55022d979e930dbc571b74e18454
virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
/**
+ * @brief Return the orientation of the surface.
+ * @return The orientation
+ */
+ virtual int GetOrientation() const = 0;
+
+ /**
* @brief InitializeGraphics the platform specific graphics surface interfaces
*/
virtual void InitializeGraphics() = 0;
// Create the scene
PositionSize surfacePositionSize = mSurface->GetPositionSize();
- mScene = Dali::Integration::Scene::New(Size(static_cast<float>(surfacePositionSize.width), static_cast<float>(surfacePositionSize.height)));
+ int orientation = mSurface->GetOrientation();
+ mScene = Dali::Integration::Scene::New(Size(static_cast<float>(surfacePositionSize.width), static_cast<float>(surfacePositionSize.height)), orientation);
Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
mAdaptor = &adaptorImpl;
OnResume();
}
+void SceneHolder::SurfaceRotated(float width, float height, int orientation)
+{
+ mScene.SurfaceRotated(width, height, orientation);
+}
+
void SceneHolder::FeedTouchPoint(Dali::Integration::Point& point, int timeStamp)
{
if(timeStamp < 1)
}
/**
+ * @brief Informs the scene that the set surface has been rotated.
+ *
+ * @param[in] width The width of rotated surface
+ * @param[in] height The height of rotated surface
+ * @param[in] orientation The orientation of rotated surface
+ */
+ void SurfaceRotated(float width, float height, int orientation);
+
+ /**
* @copydoc Dali::Integration::SceneHolder::FeedTouchPoint
*/
void FeedTouchPoint(Dali::Integration::Point& point, int timeStamp);
return -1;
}
+int WindowBaseAndroid::GetOrientation() const
+{
+ return 0;
+}
+
} // namespace Adaptor
} // namespace Internal
*/
int CreateFramePresentedSyncFence() override;
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
+ */
+ int GetOrientation() const override;
+
private:
/**
virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) = 0;
/**
+ * @brief Return the orientation of the surface.
+ * @return The orientation
+ */
+ virtual int GetOrientation() const = 0;
+
+ /**
* @brief Get the screen rotation angle of the window
*/
virtual int GetScreenRotationAngle() = 0;
}
Window::Window()
-: mWindowSurface( nullptr ),
+: mWindowSurface(nullptr),
mWindowBase(),
mIsTransparent( false ),
mIsFocusAcceptable( true ),
mType( WindowType::NORMAL ),
mParentWindow( NULL ),
mPreferredAngle( static_cast< int >( WindowOrientation::NO_ORIENTATION_PREFERENCE ) ),
- mRotationAngle( -1 ),
+ mRotationAngle( 0 ),
mWindowWidth( 0 ),
mWindowHeight( 0 ),
mOrientationMode( Internal::Adaptor::Window::OrientationMode::PORTRAIT ),
void Window::OnOutputTransformed()
{
PositionSize positionSize = mSurface->GetPositionSize();
- SurfaceResized();
- mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
- mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
+
+ int orientation = (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
+ SurfaceRotated(static_cast<float>(positionSize.width), static_cast<float>(positionSize.height), orientation);
+
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(positionSize.width, positionSize.height));
}
void Window::OnDeleteRequest()
FeedKeyEvent( keyEvent );
}
-void Window::OnRotation( const RotationEvent& rotation )
+void Window::OnRotation(const RotationEvent& rotation)
{
mRotationAngle = rotation.angle;
- mWindowWidth = rotation.width;
- mWindowHeight = rotation.height;
+ mWindowWidth = rotation.width;
+ mWindowHeight = rotation.height;
// Notify that the orientation is changed
- mOrientation->OnOrientationChange( rotation );
+ mOrientation->OnOrientationChange(rotation);
- mWindowSurface->RequestRotation( mRotationAngle, mWindowWidth, mWindowHeight );
+ mWindowSurface->RequestRotation(mRotationAngle, mWindowWidth, mWindowHeight);
- SurfaceResized();
+ int orientation = (mRotationAngle + mWindowBase->GetScreenRotationAngle()) % 360;
+ SurfaceRotated(mWindowWidth, mWindowHeight, orientation);
- mAdaptor->SurfaceResizePrepare( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
+ mAdaptor->SurfaceResizePrepare(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
- DALI_LOG_RELEASE_INFO( "Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight );
+ DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), OnRotation(): resize signal emit [%d x %d]\n", this, mNativeWindowId, mWindowWidth, mWindowHeight);
// Emit signal
- Dali::Window handle( this );
- mResizeSignal.Emit( handle, Dali::Window::WindowSize( mWindowWidth, mWindowHeight ) );
+ Dali::Window handle(this);
+ mResizeSignal.Emit(handle, Dali::Window::WindowSize(mWindowWidth, mWindowHeight));
- mAdaptor->SurfaceResizeComplete( mSurface.get(), Adaptor::SurfaceSize( mWindowWidth, mWindowHeight ) );
+ mAdaptor->SurfaceResizeComplete(mSurface.get(), Adaptor::SurfaceSize(mWindowWidth, mWindowHeight));
}
void Window::OnPause()
} // unnamed namespace
-WindowRenderSurface::WindowRenderSurface( Dali::PositionSize positionSize, Any surface, bool isTransparent )
-: mEGL( nullptr ),
- mDisplayConnection( nullptr ),
- mPositionSize( positionSize ),
+WindowRenderSurface::WindowRenderSurface(Dali::PositionSize positionSize, Any surface, bool isTransparent)
+: mEGL(nullptr),
+ mDisplayConnection(nullptr),
+ mPositionSize(positionSize),
mWindowBase(),
- mThreadSynchronization( NULL ),
- mRenderNotification( NULL ),
- mRotationTrigger( NULL ),
+ mThreadSynchronization(nullptr),
+ mRenderNotification(nullptr),
+ mRotationTrigger(nullptr),
mFrameRenderedTrigger(),
- mGraphics( nullptr ),
- mEGLSurface( nullptr ),
- mEGLContext( nullptr ),
- mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
+ mGraphics(nullptr),
+ mEGLSurface(nullptr),
+ mEGLContext(nullptr),
+ mColorDepth(isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24),
mOutputTransformedSignal(),
mFrameCallbackInfoContainer(),
mBufferDamagedRects(),
mMutex(),
- mRotationAngle( 0 ),
- mScreenRotationAngle( 0 ),
- mDpiHorizontal( 0 ),
- mDpiVertical( 0 ),
- mOwnSurface( false ),
- mRotationSupported( false ),
- mRotationFinished( true ),
- mScreenRotationFinished( true ),
- mResizeFinished( true )
+ mWindowRotationAngle(0),
+ mScreenRotationAngle(0),
+ mDpiHorizontal(0),
+ mDpiVertical(0),
+ mOwnSurface(false),
+ mWindowRotationFinished(true),
+ mScreenRotationFinished(true),
+ mResizeFinished(true),
+ mDefaultScreenRotationAvailable(false)
{
DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "Creating Window\n" );
Initialize( surface );
if( mScreenRotationAngle != 0 )
{
mScreenRotationFinished = false;
+ mResizeFinished = false;
+ mDefaultScreenRotationAvailable = true;
+ DALI_LOG_RELEASE_INFO("WindowRenderSurface::Initialize, screen rotation is enabled, screen rotation angle:[%d]\n", mScreenRotationAngle );
}
}
mWindowBase->SetTransparency( transparent );
}
-void WindowRenderSurface::RequestRotation( int angle, int width, int height )
+void WindowRenderSurface::RequestRotation(int angle, int width, int height)
{
- if( !mRotationSupported )
+ if(!mRotationTrigger)
{
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: Rotation is not supported!\n" );
- return;
+ mRotationTrigger = TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &WindowRenderSurface::ProcessRotationRequest), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER);
}
- if( !mRotationTrigger )
- {
- mRotationTrigger = TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessRotationRequest ), TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER );
- }
-
- mPositionSize.width = width;
+ mPositionSize.width = width;
mPositionSize.height = height;
- mRotationAngle = angle;
- mRotationFinished = false;
+ mWindowRotationAngle = angle;
+ mWindowRotationFinished = false;
- mWindowBase->SetWindowRotationAngle( mRotationAngle );
+ mWindowBase->SetWindowRotationAngle(mWindowRotationAngle);
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
+ DALI_LOG_INFO(gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::Rotate: angle = %d screen rotation = %d\n", mWindowRotationAngle, mScreenRotationAngle);
}
WindowBase* WindowRenderSurface::GetWindowBase()
dpiVertical = mDpiVertical;
}
+int WindowRenderSurface::GetOrientation() const
+{
+ return mWindowBase->GetOrientation();
+}
+
void WindowRenderSurface::InitializeGraphics()
{
mGraphics = &mAdaptor->GetGraphicsInterface();
void WindowRenderSurface::CreateSurface()
{
- DALI_LOG_TRACE_METHOD( gWindowRenderSurfaceLogFilter );
+ DALI_LOG_TRACE_METHOD(gWindowRenderSurfaceLogFilter);
int width, height;
- if( mScreenRotationAngle == 0 || mScreenRotationAngle == 180 )
+ if(mScreenRotationAngle == 0 || mScreenRotationAngle == 180)
{
- width = mPositionSize.width;
+ width = mPositionSize.width;
height = mPositionSize.height;
}
else
{
- width = mPositionSize.height;
+ width = mPositionSize.height;
height = mPositionSize.width;
}
// Create the EGL window
- EGLNativeWindowType window = mWindowBase->CreateEglWindow( width, height );
+ EGLNativeWindowType window = mWindowBase->CreateEglWindow(width, height);
- auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ auto eglGraphics = static_cast<EglGraphics*>(mGraphics);
Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
- mEGLSurface = eglImpl.CreateSurfaceWindow( window, mColorDepth );
-
- // Check rotation capability
- mRotationSupported = mWindowBase->IsEglWindowRotationSupported();
+ mEGLSurface = eglImpl.CreateSurfaceWindow(window, mColorDepth);
DALI_LOG_RELEASE_INFO("WindowRenderSurface::CreateSurface: WinId (%d), w = %d h = %d angle = %d screen rotation = %d\n",
- mWindowBase->GetNativeWindowId(), mPositionSize.width, mPositionSize.height, mRotationAngle, mScreenRotationAngle );
+ mWindowBase->GetNativeWindowId(),
+ mPositionSize.width,
+ mPositionSize.height,
+ mWindowRotationAngle,
+ mScreenRotationAngle);
}
void WindowRenderSurface::DestroySurface()
{
}
-bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect )
+bool WindowRenderSurface::PreRender(bool resizingSurface, const std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect)
{
Dali::Integration::Scene::FrameCallbackContainer callbacks;
Dali::Integration::Scene scene = mScene.GetHandle();
- if( scene )
+ if(scene)
{
bool needFrameRenderedTrigger = false;
- scene.GetFrameRenderedCallback( callbacks );
- if( !callbacks.empty() )
+ scene.GetFrameRenderedCallback(callbacks);
+ if(!callbacks.empty())
{
int frameRenderedSync = mWindowBase->CreateFrameRenderedSyncFence();
- if( frameRenderedSync != -1 )
+ if(frameRenderedSync != -1)
{
- Dali::Mutex::ScopedLock lock( mMutex );
+ Dali::Mutex::ScopedLock lock(mMutex);
DALI_LOG_RELEASE_INFO( "WindowRenderSurface::PreRender: CreateFrameRenderedSyncFence [%d]\n", frameRenderedSync );
- mFrameCallbackInfoContainer.push_back( std::unique_ptr< FrameCallbackInfo >( new FrameCallbackInfo( callbacks, frameRenderedSync ) ) );
+ mFrameCallbackInfoContainer.push_back(std::unique_ptr<FrameCallbackInfo>(new FrameCallbackInfo(callbacks, frameRenderedSync)));
needFrameRenderedTrigger = true;
}
else
{
- DALI_LOG_ERROR( "WindowRenderSurface::PreRender: CreateFrameRenderedSyncFence is failed\n" );
+ DALI_LOG_ERROR("WindowRenderSurface::PreRender: CreateFrameRenderedSyncFence is failed\n");
}
// Clear callbacks
callbacks.clear();
}
- scene.GetFramePresentedCallback( callbacks );
- if( !callbacks.empty() )
+ scene.GetFramePresentedCallback(callbacks);
+ if(!callbacks.empty())
{
int framePresentedSync = mWindowBase->CreateFramePresentedSyncFence();
- if( framePresentedSync != -1 )
+ if(framePresentedSync != -1)
{
- Dali::Mutex::ScopedLock lock( mMutex );
+ Dali::Mutex::ScopedLock lock(mMutex);
DALI_LOG_RELEASE_INFO( "WindowRenderSurface::PreRender: CreateFramePresentedSyncFence [%d]\n", framePresentedSync );
- mFrameCallbackInfoContainer.push_back( std::unique_ptr< FrameCallbackInfo >( new FrameCallbackInfo( callbacks, framePresentedSync ) ) );
+ mFrameCallbackInfoContainer.push_back(std::unique_ptr<FrameCallbackInfo>(new FrameCallbackInfo(callbacks, framePresentedSync)));
needFrameRenderedTrigger = true;
}
else
{
- DALI_LOG_ERROR( "WindowRenderSurface::PreRender: CreateFramePresentedSyncFence is failed\n" );
+ DALI_LOG_ERROR("WindowRenderSurface::PreRender: CreateFramePresentedSyncFence is failed\n");
}
// Clear callbacks
callbacks.clear();
}
- if( needFrameRenderedTrigger )
+ if(needFrameRenderedTrigger)
{
- if( !mFrameRenderedTrigger )
+ if(!mFrameRenderedTrigger)
{
- mFrameRenderedTrigger = std::unique_ptr< TriggerEventInterface >( TriggerEventFactory::CreateTriggerEvent( MakeCallback( this, &WindowRenderSurface::ProcessFrameCallback ),
- TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER ) );
+ mFrameRenderedTrigger = std::unique_ptr<TriggerEventInterface>(TriggerEventFactory::CreateTriggerEvent(MakeCallback(this, &WindowRenderSurface::ProcessFrameCallback),
+ TriggerEventInterface::KEEP_ALIVE_AFTER_TRIGGER));
}
mFrameRenderedTrigger->Trigger();
}
MakeContextCurrent();
- if( resizingSurface )
+ /**
+ * wl_egl_window_tizen_set_rotation(SetEglWindowRotation) -> PreRotation
+ * wl_egl_window_tizen_set_buffer_transform(SetEglWindowBufferTransform) -> Screen Rotation
+ * wl_egl_window_tizen_set_window_transform(SetEglWindowTransform) -> Window Rotation
+ * These function should be called before calling first drawing gl Function.
+ * Notice : PreRotation is not used in the latest tizen,
+ * because output transform event should be occured before egl window is not created.
+ */
+
+ if(resizingSurface || mDefaultScreenRotationAvailable)
{
+ int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
+
// Window rotate or screen rotate
- if( !mRotationFinished || !mScreenRotationFinished )
+ if(!mWindowRotationFinished || !mScreenRotationFinished)
{
- int totalAngle = (mRotationAngle + mScreenRotationAngle) % 360;
-
- mWindowBase->SetEglWindowRotation( totalAngle );
- mWindowBase->SetEglWindowBufferTransform( totalAngle );
+ mWindowBase->SetEglWindowBufferTransform(totalAngle);
// Reset only screen rotation flag
mScreenRotationFinished = true;
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set rotation [%d] [%d]\n", mRotationAngle, mScreenRotationAngle );
+ DALI_LOG_RELEASE_INFO("WindowRenderSurface::PreRender: Set rotation [%d] [%d]\n", mWindowRotationAngle, mScreenRotationAngle);
}
// Only window rotate
- if( !mRotationFinished )
+ if(!mWindowRotationFinished)
{
- mWindowBase->SetEglWindowTransform( mRotationAngle );
+ mWindowBase->SetEglWindowTransform(mWindowRotationAngle);
}
// Resize case
- if( !mResizeFinished )
+ if(!mResizeFinished)
{
- mWindowBase->ResizeEglWindow( mPositionSize );
+ Dali::PositionSize positionSize;
+ positionSize.x = mPositionSize.x;
+ positionSize.y = mPositionSize.y;
+ if(totalAngle == 0 || totalAngle == 180)
+ {
+ positionSize.width = mPositionSize.width;
+ positionSize.height = mPositionSize.height;
+ }
+ else
+ {
+ positionSize.width = mPositionSize.height;
+ positionSize.height = mPositionSize.width;
+ }
+ mWindowBase->ResizeEglWindow(positionSize);
mResizeFinished = true;
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: Set resize\n" );
+ DALI_LOG_RELEASE_INFO("WindowRenderSurface::PreRender: Set resize\n");
}
SetFullSwapNextFrame();
+ mDefaultScreenRotationAvailable = false;
}
- SetBufferDamagedRects( damagedRects, clippingRect );
+ SetBufferDamagedRects(damagedRects, clippingRect);
return true;
}
-void WindowRenderSurface::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector<Rect<int>>& damagedRects )
+void WindowRenderSurface::PostRender(bool renderToFbo, bool replacingSurface, bool resizingSurface, const std::vector<Rect<int>>& damagedRects)
{
// Inform the gl implementation that rendering has finished before informing the surface
- auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
- if ( eglGraphics )
+ auto eglGraphics = static_cast<EglGraphics*>(mGraphics);
+ if(eglGraphics)
{
GlImplementation& mGLES = eglGraphics->GetGlesInterface();
mGLES.PostRender();
- if( renderToFbo )
+ if(renderToFbo)
{
mGLES.Flush();
mGLES.Finish();
}
else
{
- if( resizingSurface )
+ if(resizingSurface)
{
- if( !mRotationFinished )
+ if(!mWindowRotationFinished)
{
- if( mThreadSynchronization )
+ if(mThreadSynchronization)
{
// Enable PostRender flag
mThreadSynchronization->PostRenderStarted();
}
- DALI_LOG_RELEASE_INFO("WindowRenderSurface::PostRender: Trigger rotation event\n" );
+ DALI_LOG_RELEASE_INFO("WindowRenderSurface::PostRender: Trigger rotation event\n");
mRotationTrigger->Trigger();
- if( mThreadSynchronization )
+ if(mThreadSynchronization)
{
// Wait until the event-thread complete the rotation event processing
mThreadSynchronization->PostRenderWaitForCompletion();
}
}
- SwapBuffers( damagedRects );
+ SwapBuffers(damagedRects);
- if( mRenderNotification )
+ if(mRenderNotification)
{
mRenderNotification->Trigger();
}
{
int screenRotationAngle = mWindowBase->GetScreenRotationAngle();
- if( mScreenRotationAngle != screenRotationAngle )
+ if(mScreenRotationAngle != screenRotationAngle)
{
- mScreenRotationAngle = screenRotationAngle;
+ mScreenRotationAngle = screenRotationAngle;
mScreenRotationFinished = false;
+ mResizeFinished = false;
mOutputTransformedSignal.Emit();
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OutputTransformed: angle = %d screen rotation = %d\n", mRotationAngle, mScreenRotationAngle );
+ DALI_LOG_RELEASE_INFO("WindowRenderSurface::OutputTransformed: window = %d screen = %d\n", mWindowRotationAngle, mScreenRotationAngle);
}
else
{
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OutputTransformed: Ignore output transform [%d]\n", mScreenRotationAngle );
+ DALI_LOG_RELEASE_INFO("WindowRenderSurface::OutputTransformed: Ignore output transform [%d]\n", mScreenRotationAngle);
}
}
void WindowRenderSurface::ProcessRotationRequest()
{
- mRotationFinished = true;
+ mWindowRotationFinished = true;
- mWindowBase->WindowRotationCompleted( mRotationAngle, mPositionSize.width, mPositionSize.height );
+ mWindowBase->WindowRotationCompleted(mWindowRotationAngle, mPositionSize.width, mPositionSize.height);
- DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::ProcessRotationRequest: Rotation Done\n" );
+ DALI_LOG_INFO(gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::ProcessRotationRequest: Rotation Done\n");
- if( mThreadSynchronization )
+ if(mThreadSynchronization)
{
mThreadSynchronization->PostRenderComplete();
}
void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::RenderSurfaceInterface::GetOrientation()
+ */
+ int GetOrientation() const override;
+
+ /**
* @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
*/
void InitializeGraphics() override;
FrameCallbackInfoContainer mFrameCallbackInfoContainer;
DamagedRectsContainer mBufferDamagedRects;
Dali::Mutex mMutex;
- int mRotationAngle;
+ int mWindowRotationAngle;
int mScreenRotationAngle;
uint32_t mDpiHorizontal;
uint32_t mDpiVertical;
bool mOwnSurface; ///< Whether we own the surface (responsible for deleting it)
- bool mRotationSupported;
- bool mRotationFinished;
+ bool mWindowRotationFinished;
bool mScreenRotationFinished;
bool mResizeFinished;
+ bool mDefaultScreenRotationAvailable;
}; // class WindowRenderSurface
} // unnamed namespace
-WindowBaseEcoreWl::WindowBaseEcoreWl( Dali::PositionSize positionSize, Any surface, bool isTransparent )
+WindowBaseEcoreWl::WindowBaseEcoreWl(Dali::PositionSize positionSize, Any surface, bool isTransparent)
: mEcoreEventHandler(),
- mEcoreWindow( NULL ),
- mWlSurface( NULL ),
- mEglWindow( NULL ),
- mDisplay( NULL ),
- mEventQueue( NULL ),
- mTizenPolicy( NULL ),
- mTizenDisplayPolicy( NULL ),
+ mEcoreWindow(nullptr),
+ mWlSurface(nullptr),
+ mEglWindow(nullptr),
+ mDisplay(nullptr),
+ mEventQueue(nullptr),
+ mTizenPolicy(nullptr),
+ mTizenDisplayPolicy(nullptr),
mSupportedAuxiliaryHints(),
mAuxiliaryHints(),
- mNotificationLevel( -1 ),
- mNotificationChangeState( 0 ),
- mNotificationLevelChangeDone( true ),
- mScreenOffMode( 0 ),
- mScreenOffModeChangeState( 0 ),
- mScreenOffModeChangeDone( true ),
- mBrightness( 0 ),
- mBrightnessChangeState( 0 ),
- mBrightnessChangeDone( true ),
- mOwnSurface( false )
+ mNotificationLevel(-1),
+ mNotificationChangeState(0),
+ mNotificationLevelChangeDone(true),
+ mScreenOffMode(0),
+ mScreenOffModeChangeState(0),
+ mScreenOffModeChangeDone(true),
+ mBrightness(0),
+ mBrightnessChangeState(0),
+ mBrightnessChangeDone(true),
+ mOwnSurface(false),
+ mWindowRotationAngle(0),
+ mScreenRotationAngle(0),
+ mSupportedPreProtation(0)
#ifdef DALI_ELDBUS_AVAILABLE
- , mSystemConnection( NULL )
+ ,
+ mSystemConnection(NULL)
#endif
{
- Initialize( positionSize, surface, isTransparent );
+ Initialize(positionSize, surface, isTransparent);
}
WindowBaseEcoreWl::~WindowBaseEcoreWl()
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 )
{
+ mSupportedPreProtation = true;
return true;
}
-
+ mSupportedPreProtation = false;
return false;
}
dpiVertical = int( yres + 0.5f );
}
+int WindowBaseEcoreWl::GetOrientation() const
+{
+ int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
+ if(mSupportedPreProtation)
+ {
+ orientation = 0;
+ }
+ return orientation;
+}
+
int WindowBaseEcoreWl::GetScreenRotationAngle()
{
int transform = 0;
transform = ecore_wl_output_transform_get( ecore_wl_window_output_find( mEcoreWindow ) );
}
- return transform * 90;
+ mScreenRotationAngle = transform * 90;
+ return mScreenRotationAngle;
}
void WindowBaseEcoreWl::SetWindowRotationAngle( int degree )
{
+ mWindowRotationAngle = degree;
ecore_wl_window_rotation_set( mEcoreWindow, degree );
}
void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
+ */
+ int GetOrientation() const override;
+
+ /**
* @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
*/
int GetScreenRotationAngle() override;
bool mOwnSurface;
+ int mWindowRotationAngle;
+ int mScreenRotationAngle;
+ int mSupportedPreProtation;
#ifdef DALI_ELDBUS_AVAILABLE
Eldbus_Connection* mSystemConnection;
#endif // DALI_ELDBUS_AVAILABLE
} // unnamed namespace
-WindowBaseEcoreWl2::WindowBaseEcoreWl2( Dali::PositionSize positionSize, Any surface, bool isTransparent )
+WindowBaseEcoreWl2::WindowBaseEcoreWl2(Dali::PositionSize positionSize, Any surface, bool isTransparent)
: mEcoreEventHandler(),
- mEcoreWindow( NULL ),
- mWlSurface( NULL ),
- mEglWindow( NULL ),
- mDisplay( NULL ),
- mEventQueue( NULL ),
- mTizenPolicy( NULL ),
- mTizenDisplayPolicy( NULL ),
- mKeyMap( NULL ),
+ mEcoreWindow(nullptr),
+ mWlSurface(nullptr),
+ mEglWindow(nullptr),
+ mDisplay(nullptr),
+ mEventQueue(nullptr),
+ mTizenPolicy(nullptr),
+ mTizenDisplayPolicy(nullptr),
+ mKeyMap(nullptr),
mSupportedAuxiliaryHints(),
mAuxiliaryHints(),
- mNotificationLevel( -1 ),
- mNotificationChangeState( 0 ),
- mNotificationLevelChangeDone( true ),
- mScreenOffMode( 0 ),
- mScreenOffModeChangeState( 0 ),
- mScreenOffModeChangeDone( true ),
- mBrightness( 0 ),
- mBrightnessChangeState( 0 ),
- mBrightnessChangeDone( true ),
- mVisible( true ),
- mWindowPositionSize( positionSize ),
- mOwnSurface( false ),
- mMoveResizeSerial( 0 ),
- mLastSubmittedMoveResizeSerial( 0 )
+ mNotificationLevel(-1),
+ mNotificationChangeState(0),
+ mNotificationLevelChangeDone(true),
+ mScreenOffMode(0),
+ mScreenOffModeChangeState(0),
+ mScreenOffModeChangeDone(true),
+ mBrightness(0),
+ mBrightnessChangeState(0),
+ mBrightnessChangeDone(true),
+ mVisible(true),
+ mWindowPositionSize(positionSize),
+ mOwnSurface(false),
+ mMoveResizeSerial(0),
+ mLastSubmittedMoveResizeSerial(0),
+ mWindowRotationAngle(0),
+ mScreenRotationAngle(0),
+ mSupportedPreProtation(0)
#ifdef DALI_ELDBUS_AVAILABLE
- , mSystemConnection( NULL )
+ ,
+ mSystemConnection(NULL)
#endif
{
- Initialize( positionSize, surface, isTransparent );
+ Initialize(positionSize, surface, isTransparent);
}
WindowBaseEcoreWl2::~WindowBaseEcoreWl2()
{
DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
+ mScreenRotationAngle = GetScreenRotationAngle();
+
mOutputTransformedSignal.Emit();
}
{
DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventIgnoreOutputTransform\n", mEcoreWindow );
+ mScreenRotationAngle = GetScreenRotationAngle();
+
mOutputTransformedSignal.Emit();
}
return ECORE_CALLBACK_PASS_ON;
}
-void WindowBaseEcoreWl2::OnRotation( void* data, int type, void* event )
+void WindowBaseEcoreWl2::OnRotation(void* data, int type, void* event)
{
- Ecore_Wl2_Event_Window_Rotation* ev( static_cast< Ecore_Wl2_Event_Window_Rotation* >( event ) );
+ Ecore_Wl2_Event_Window_Rotation* ev(static_cast<Ecore_Wl2_Event_Window_Rotation*>(event));
- if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
+ if(ev->win == static_cast<unsigned int>(ecore_wl2_window_id_get(mEcoreWindow)))
{
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h );
+ DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h);
RotationEvent rotationEvent;
- rotationEvent.angle = ev->angle;
+ rotationEvent.angle = ev->angle;
rotationEvent.winResize = 0;
+ mWindowRotationAngle = ev->angle;
- if( ev->angle == 0 || ev->angle == 180 )
+ if(ev->angle == 0 || ev->angle == 180)
{
- rotationEvent.width = ev->w;
+ rotationEvent.width = ev->w;
rotationEvent.height = ev->h;
}
else
{
- rotationEvent.width = ev->h;
+ rotationEvent.width = ev->h;
rotationEvent.height = ev->w;
}
- mWindowPositionSize.width = rotationEvent.width;
+ mWindowPositionSize.width = rotationEvent.width;
mWindowPositionSize.height = rotationEvent.height;
- mRotationSignal.Emit( rotationEvent );
+ mRotationSignal.Emit(rotationEvent);
}
}
mTouchEventSignal.Emit( point, touchEvent->timestamp );
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n" );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n" );
}
}
if( mouseWheelEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
{
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseWheel: direction: %d, modifiers: %d, x: %d, y: %d, z: %d\n", mouseWheelEvent->direction, mouseWheelEvent->modifiers, mouseWheelEvent->x, mouseWheelEvent->y, mouseWheelEvent->z );
Integration::WheelEvent wheelEvent( Integration::WheelEvent::MOUSE_WHEEL, mouseWheelEvent->direction, mouseWheelEvent->modifiers, Vector2( mouseWheelEvent->x, mouseWheelEvent->y ), mouseWheelEvent->z, mouseWheelEvent->timestamp );
{
Ecore_Event_Detent_Rotate* detentEvent = static_cast< Ecore_Event_Detent_Rotate* >( event );
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnDetentRotation\n" );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl2::OnDetentRotation\n" );
int direction = ( detentEvent->direction == ECORE_DETENT_DIRECTION_CLOCKWISE ) ? 1 : -1;
int timeStamp = detentEvent->timestamp;
if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
{
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyDown\n" );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyDown\n" );
std::string keyName( keyEvent->keyname );
std::string logicalKey( "" );
if( keyEvent->window == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
{
- DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnKeyUp\n" );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnKeyUp\n" );
#if defined(ECORE_VERSION_MAJOR) && (ECORE_VERSION_MAJOR >= 1) && defined(ECORE_VERSION_MINOR) && (ECORE_VERSION_MINOR >= 23)
// Cancel processing flag is sent because this key event will combine with the previous key. So, the event should not actually perform anything.
return ecore_wl2_window_id_get( mEcoreWindow );
}
-EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow( int width, int height )
+EGLNativeWindowType WindowBaseEcoreWl2::CreateEglWindow(int width, int height)
{
- mEglWindow = wl_egl_window_create( mWlSurface, width, height );
+ int totalAngle = (mWindowRotationAngle + mScreenRotationAngle) % 360;
+ if(totalAngle == 90 || totalAngle == 270)
+ {
+ mEglWindow = wl_egl_window_create(mWlSurface, height, width);
+ }
+ else
+ {
+ mEglWindow = wl_egl_window_create(mWlSurface, width, height);
+ }
- return static_cast< EGLNativeWindowType >( mEglWindow );
+ return static_cast<EGLNativeWindowType>(mEglWindow);
}
void WindowBaseEcoreWl2::DestroyEglWindow()
bool WindowBaseEcoreWl2::IsEglWindowRotationSupported()
{
// Check capability
- wl_egl_window_tizen_capability capability = static_cast< wl_egl_window_tizen_capability >( wl_egl_window_tizen_get_capabilities( mEglWindow ) );
- if( capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED )
+ wl_egl_window_tizen_capability capability = static_cast<wl_egl_window_tizen_capability>(wl_egl_window_tizen_get_capabilities(mEglWindow));
+ if(capability == WL_EGL_WINDOW_TIZEN_CAPABILITY_ROTATION_SUPPORTED)
{
+ mSupportedPreProtation = true;
return true;
}
-
+ mSupportedPreProtation = false;
return false;
}
ecore_wl2_window_activate( mEcoreWindow );
}
-void WindowBaseEcoreWl2::SetAvailableAnlges( const std::vector< int >& angles )
+void WindowBaseEcoreWl2::SetAvailableAnlges(const std::vector<int>& angles)
{
- int rotations[4] = { 0 };
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size() );
- for( std::size_t i = 0; i < angles.size(); ++i )
+ int rotations[4] = {0};
+ DALI_LOG_RELEASE_INFO("WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d, angles\n", angles.size());
+ for(std::size_t i = 0; i < angles.size(); ++i)
{
- rotations[i] = static_cast< int >( angles[i] );
- DALI_LOG_RELEASE_INFO( "%d ", rotations[i] );
+ rotations[i] = static_cast<int>(angles[i]);
+ DALI_LOG_RELEASE_INFO("%d ", rotations[i]);
}
- ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, angles.size() );
+ ecore_wl2_window_available_rotations_set(mEcoreWindow, rotations, angles.size());
}
void WindowBaseEcoreWl2::SetPreferredAngle( int angle )
{
+ DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle );
ecore_wl2_window_preferred_rotation_set( mEcoreWindow, angle );
}
dpiVertical = int( yres + 0.5f );
}
+int WindowBaseEcoreWl2::GetOrientation() const
+{
+ int orientation = (mScreenRotationAngle + mWindowRotationAngle) % 360;
+ if(mSupportedPreProtation)
+ {
+ orientation = 0;
+ }
+ return orientation;
+}
+
int WindowBaseEcoreWl2::GetScreenRotationAngle()
{
int transform = 0;
- if( ecore_wl2_window_ignore_output_transform_get( mEcoreWindow ) )
+ if(ecore_wl2_window_ignore_output_transform_get(mEcoreWindow))
{
transform = 0;
}
else
{
- transform = ecore_wl2_output_transform_get( ecore_wl2_window_output_find( mEcoreWindow ) );
+ transform = ecore_wl2_output_transform_get(ecore_wl2_window_output_find(mEcoreWindow));
}
-
- return transform * 90;
+ mScreenRotationAngle = transform * 90;
+ return mScreenRotationAngle;
}
-void WindowBaseEcoreWl2::SetWindowRotationAngle( int degree )
+void WindowBaseEcoreWl2::SetWindowRotationAngle(int degree)
{
- ecore_wl2_window_rotation_set( mEcoreWindow, degree );
+ mWindowRotationAngle = degree;
+ ecore_wl2_window_rotation_set(mEcoreWindow, degree);
}
-void WindowBaseEcoreWl2::WindowRotationCompleted( int degree, int width, int height )
+void WindowBaseEcoreWl2::WindowRotationCompleted(int degree, int width, int height)
{
- ecore_wl2_window_rotation_change_done_send( mEcoreWindow, degree, width, height );
+ ecore_wl2_window_rotation_change_done_send(mEcoreWindow, degree, width, height);
}
void WindowBaseEcoreWl2::SetTransparency( bool transparent )
void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
+ */
+ int GetOrientation() const override;
+
+ /**
* @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
*/
int GetScreenRotationAngle() override;
volatile uint32_t mMoveResizeSerial;
uint32_t mLastSubmittedMoveResizeSerial;
+ int mWindowRotationAngle;
+ int mScreenRotationAngle;
+ int mSupportedPreProtation;
#ifdef DALI_ELDBUS_AVAILABLE
Eldbus_Connection* mSystemConnection;
#endif // DALI_ELDBUS_AVAILABLE
dpiVertical = int( yres + 0.5f );
}
+int NativeRenderSurfaceEcoreWl::GetOrientation() const
+{
+ return 0;
+}
+
void NativeRenderSurfaceEcoreWl::InitializeGraphics()
{
DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::RenderSurfaceInterface::GetOrientation()
+ */
+ int GetOrientation() const override;
+
+ /**
* @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
*/
void InitializeGraphics() override;
dpiVertical = int( yres + 0.5f );
}
+int PixmapRenderSurfaceEcoreX::GetOrientation() const
+{
+ return 0;
+}
+
void PixmapRenderSurfaceEcoreX::InitializeGraphics()
{
mGraphics = &mAdaptor->GetGraphicsInterface();
void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
+ */
+ int GetOrientation() const override;
+
+ /**
* @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
*/
void InitializeGraphics() override;
} // unnamed namespace
-WindowBaseEcoreX::WindowBaseEcoreX( Dali::PositionSize positionSize, Any surface, bool isTransparent )
+WindowBaseEcoreX::WindowBaseEcoreX(Dali::PositionSize positionSize, Any surface, bool isTransparent)
: mEcoreEventHandler(),
- mEcoreWindow( 0 ),
- mOwnSurface( false ),
- mIsTransparent( false ), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
- mRotationAppSet( false )
+ mEcoreWindow(0),
+ mOwnSurface(false),
+ mIsTransparent(false), // Should only be set to true once we actually create a transparent window regardless of what isTransparent is.
+ mRotationAppSet(false),
+ mWindowRotationAngle(0)
{
- Initialize( positionSize, surface, isTransparent );
+ Initialize(positionSize, surface, isTransparent);
}
WindowBaseEcoreX::~WindowBaseEcoreX()
dpiVertical = ecore_x_dpi_get();
}
+int WindowBaseEcoreX::GetOrientation() const
+{
+ return 0;
+}
+
int WindowBaseEcoreX::GetScreenRotationAngle()
{
return 0;
void WindowBaseEcoreX::SetWindowRotationAngle( int degree )
{
+ mWindowRotationAngle = degree;
}
void WindowBaseEcoreX::WindowRotationCompleted( int degree, int width, int height )
void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
/**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
+ */
+ int GetOrientation() const override;
+
+ /**
* @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
*/
int GetScreenRotationAngle() override;
bool mOwnSurface:1; ///< Whether we own the surface (responsible for deleting it)
bool mIsTransparent; ///< Whether the window is transparent (32 bit or 24 bit)
bool mRotationAppSet:1;
+ int mWindowRotationAngle;
};
} // namespace Adaptor
{
}
+int WindowBaseWin::GetOrientation() const
+{
+ return 0;
+}
+
uintptr_t WindowBaseWin::GetSurfaceId( Any surface ) const
{
uintptr_t surfaceId = 0;
void SetTransparency( bool transparent ) override;
/**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
+ */
+ int GetOrientation() const override;
+
+ /**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
*/
void SetParent( WindowBase* parentWinBase ) override;