Merge branch 'devel/master' into tizen
authorJiyun Yang <ji.yang@samsung.com>
Thu, 26 Nov 2020 06:20:04 +0000 (15:20 +0900)
committerJiyun Yang <ji.yang@samsung.com>
Thu, 26 Nov 2020 06:20:04 +0000 (15:20 +0900)
29 files changed:
automated-tests/src/dali-adaptor/dali-test-suite-utils/dali-test-suite-utils.h
dali/devel-api/adaptor-framework/offscreen-application.h
dali/devel-api/adaptor-framework/offscreen-window.h
dali/integration-api/adaptor-framework/render-surface-interface.h
dali/integration-api/adaptor-framework/scene-holder-impl.cpp
dali/integration-api/adaptor-framework/scene-holder-impl.h
dali/internal/imaging/android/native-image-source-impl-android.cpp
dali/internal/window-system/android/window-base-android.cpp
dali/internal/window-system/android/window-base-android.h
dali/internal/window-system/common/window-base.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-render-surface.cpp
dali/internal/window-system/common/window-render-surface.h
dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h
dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.h
dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h
dali/internal/window-system/windows/platform-implement-win.cpp
dali/internal/window-system/windows/platform-implement-win.h
dali/internal/window-system/windows/window-base-win.cpp
dali/internal/window-system/windows/window-base-win.h
dali/public-api/dali-adaptor-version.cpp
packaging/dali-adaptor.spec

index 2c1c703..b8de978 100644 (file)
@@ -378,6 +378,34 @@ inline void DALI_TEST_PRINT_ASSERT(DaliException& e)
     DALI_TEST_ASSERT(e, assertstring, TEST_LOCATION);                                                       \
   }
 
+/**
+ * Test that given piece of code triggers an exception
+ * Fails the test if the exception didn't occur.
+ * Turns off logging during the execution of the code to avoid excessive false positive log output from the assertions
+ * @param expressions code to execute
+ * @param except the exception expected in the assert
+ */
+#define DALI_TEST_THROWS(expressions, except)                                                               \
+  try                                                                                                       \
+  {                                                                                                         \
+    TestApplication::EnableLogging(false);                                                                  \
+    expressions;                                                                                            \
+    TestApplication::EnableLogging(true);                                                                   \
+    fprintf(stderr, "Test failed in %s, expected exception: '%s' didn't occur\n", __FILELINE__, #except);   \
+    tet_result(TET_FAIL);                                                                                   \
+    throw("TET_FAIL");                                                                                      \
+  }                                                                                                         \
+  catch(except &)                                                                                           \
+  {                                                                                                         \
+    tet_result(TET_PASS);                                                                                   \
+  }                                                                                                         \
+  catch(...)                                                                                                \
+  {                                                                                                         \
+    fprintf(stderr, "Test failed in %s, unexpected exception\n", __FILELINE__);                             \
+    tet_result(TET_FAIL);                                                                                   \
+    throw;                                                                                                  \
+  }
+
 // Functor to test whether an Applied signal is emitted
 struct ConstraintAppliedCheck
 {
index 3daa735..d03d99b 100644 (file)
@@ -23,6 +23,9 @@
 #include <dali/public-api/object/base-handle.h>
 #include <dali/public-api/signals/dali-signal.h>
 
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
 namespace Dali
 {
 /**
@@ -41,7 +44,7 @@ class OffscreenApplication;
  * @brief Appliations can draw UI on offscreen surface with the OffscreenApplication.
  * When you use a OffscreenApplication, you don't have to create a Window.
  */
-class DALI_IMPORT_API OffscreenApplication : public Dali::BaseHandle
+class DALI_ADAPTOR_API OffscreenApplication : public Dali::BaseHandle
 {
 public:
   using OffscreenApplicationSignalType = Signal<void(void)>;
index 23386cd..5e2b502 100644 (file)
@@ -24,6 +24,9 @@
 #include <dali/public-api/object/any.h>
 #include <dali/public-api/signals/dali-signal.h>
 
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
 namespace Dali
 {
 /**
@@ -38,7 +41,7 @@ namespace Internal
 class OffscreenWindow;
 }
 
-class DALI_IMPORT_API OffscreenWindow : public Dali::BaseHandle
+class DALI_ADAPTOR_API OffscreenWindow : public Dali::BaseHandle
 {
 public:
   using WindowSize           = Uint16Pair;
index 20e1915..45250b1 100644 (file)
@@ -108,6 +108,12 @@ public:
   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;
index 72db0ba..2fb9af9 100644 (file)
@@ -205,7 +205,8 @@ void SceneHolder::SetAdaptor(Dali::Adaptor& adaptor)
 
   // 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;
@@ -235,6 +236,11 @@ void SceneHolder::Resume()
   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)
@@ -305,14 +311,14 @@ void SceneHolder::AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callbac
 {
   mScene.AddFrameRenderedCallback(std::move(callback), frameId);
 
-  DALI_LOG_INFO(gSceneHolderLogFilter, Debug::General, "SceneHolder::AddFrameRenderedCallback:: Added [%d]\n", frameId);
+  DALI_LOG_RELEASE_INFO("SceneHolder::AddFrameRenderedCallback:: Added [%d]\n", frameId);
 }
 
 void SceneHolder::AddFramePresentedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId)
 {
   mScene.AddFramePresentedCallback(std::move(callback), frameId);
 
-  DALI_LOG_INFO(gSceneHolderLogFilter, Debug::General, "SceneHolder::AddFramePresentedCallback:: Added [%d]\n", frameId);
+  DALI_LOG_RELEASE_INFO("SceneHolder::AddFramePresentedCallback:: Added [%d]\n", frameId);
 }
 
 Dali::Integration::SceneHolder SceneHolder::Get(Dali::Actor actor)
index 65e4a7b..7eb7e56 100644 (file)
@@ -160,6 +160,15 @@ public:
   }
 
   /**
+   * @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);
index 2a64bfb..1052d0b 100755 (executable)
@@ -183,9 +183,30 @@ bool NativeImageSourceAndroid::GetPixels(std::vector<unsigned char>& pixbuf, uns
     return success;
   }
 
-  uint32_t size = bufferDescription.stride * bufferDescription.height;
-  pixbuf.resize( size );
-  memcpy( pixbuf.data(), buffer, size );
+  uint32_t pixelBytes = GetBytesPerPixel(pixelFormat);
+  if ( bufferDescription.stride < (pixelBytes * bufferDescription.width) )
+  {
+    //On Android device, bufferDescription.stride doesn't seem to mean (width * pixelbytes)
+    //in an actual case, (AHardwareBuffer_Desc) bufferDescription = (width = 1080, height = 1060, layers = 1, format = 1, usage = 306, stride = 1088, rfu0 = 0, rfu1 = 0)
+    //deal with situation
+    uint32_t dstStride = pixelBytes * bufferDescription.width;
+    uint32_t srcStride = pixelBytes * bufferDescription.stride;
+    uint32_t size = dstStride * bufferDescription.height;
+    pixbuf.resize( size );
+    //copy each row over
+    const unsigned char* ptrSrc = reinterpret_cast<const unsigned char*>(buffer);
+    unsigned char* ptrDst = pixbuf.data();
+    for (int y=0; y < bufferDescription.height; y++, ptrSrc += srcStride, ptrDst += dstStride )
+    {
+      memcpy( ptrDst, ptrSrc, dstStride );
+    }
+  }
+  else
+  {
+    uint32_t size = bufferDescription.stride * bufferDescription.height;
+    pixbuf.resize( size );
+    memcpy( pixbuf.data(), buffer, size );
+  }
 
   ret = AHardwareBuffer_unlock( mPixmap, NULL );
   if( ret != 0 )
index b507124..5e6b7ae 100644 (file)
@@ -353,6 +353,11 @@ int WindowBaseAndroid::CreateFramePresentedSyncFence()
   return -1;
 }
 
+int WindowBaseAndroid::GetOrientation() const
+{
+  return 0;
+}
+
 } // namespace Adaptor
 
 } // namespace Internal
index 8b212b6..ee5c300 100644 (file)
@@ -362,6 +362,11 @@ public:
    */
   int CreateFramePresentedSyncFence() override;
 
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetOrientation()
+   */
+  int GetOrientation() const override;
+
 private:
 
   /**
index 01d3650..f4081ea 100644 (file)
@@ -314,6 +314,12 @@ public:
   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;
index ab97cb4..2c63958 100755 (executable)
@@ -75,7 +75,7 @@ Window* Window::New(Any surface, const PositionSize& positionSize, const std::st
 }
 
 Window::Window()
-: mWindowSurface( nullptr ),
+: mWindowSurface(nullptr),
   mWindowBase(),
   mIsTransparent( false ),
   mIsFocusAcceptable( true ),
@@ -85,7 +85,7 @@ Window::Window()
   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 ),
@@ -763,9 +763,12 @@ void Window::OnFocusChanged( bool focusIn )
 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()
@@ -805,27 +808,28 @@ void Window::OnKeyEvent( Dali::Integration::KeyEvent& keyEvent )
   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()
index 021843e..d92c5dc 100644 (file)
@@ -83,32 +83,32 @@ void InsertRects( WindowRenderSurface::DamagedRectsContainer& damagedRectsList,
 
 } // 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 );
@@ -145,6 +145,9 @@ void WindowRenderSurface::Initialize( Any 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 );
   }
 }
 
@@ -173,28 +176,22 @@ void WindowRenderSurface::SetTransparency( bool transparent )
   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()
@@ -232,6 +229,11 @@ void WindowRenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpi
   dpiVertical = mDpiVertical;
 }
 
+int WindowRenderSurface::GetOrientation() const
+{
+  return mWindowBase->GetOrientation();
+}
+
 void WindowRenderSurface::InitializeGraphics()
 {
   mGraphics = &mAdaptor->GetGraphicsInterface();
@@ -255,33 +257,34 @@ void WindowRenderSurface::InitializeGraphics()
 
 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()
@@ -387,67 +390,67 @@ void WindowRenderSurface::StartRender()
 {
 }
 
-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_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: CreateFrameRenderedSyncFence [%d]\n", frameRenderedSync );
+        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_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::PreRender: CreateFramePresentedSyncFence [%d]\n", framePresentedSync );
+        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();
     }
@@ -455,76 +458,98 @@ bool WindowRenderSurface::PreRender( bool resizingSurface, const std::vector<Rec
 
   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();
@@ -533,9 +558,9 @@ void WindowRenderSurface::PostRender( bool renderToFbo, bool replacingSurface, b
       }
     }
 
-    SwapBuffers( damagedRects );
+    SwapBuffers(damagedRects);
 
-    if( mRenderNotification )
+    if(mRenderNotification)
     {
       mRenderNotification->Trigger();
     }
@@ -585,30 +610,31 @@ void WindowRenderSurface::OutputTransformed()
 {
   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();
   }
@@ -625,7 +651,7 @@ void WindowRenderSurface::ProcessFrameCallback()
       iter->fileDescriptorMonitor = std::unique_ptr< FileDescriptorMonitor >( new FileDescriptorMonitor( iter->fileDescriptor,
                                                                              MakeCallback( this, &WindowRenderSurface::OnFileDescriptorEventDispatched ), FileDescriptorMonitor::FD_READABLE ) );
 
-      DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::ProcessFrameCallback: Add handler [%d]\n", iter->fileDescriptor );
+      DALI_LOG_RELEASE_INFO( "WindowRenderSurface::ProcessFrameCallback: Add handler [%d]\n", iter->fileDescriptor );
     }
   }
 }
@@ -639,7 +665,7 @@ void WindowRenderSurface::OnFileDescriptorEventDispatched( FileDescriptorMonitor
     return;
   }
 
-  DALI_LOG_INFO( gWindowRenderSurfaceLogFilter, Debug::Verbose, "WindowRenderSurface::OnFileDescriptorEventDispatched: Frame rendered [%d]\n", fileDescriptor );
+  DALI_LOG_RELEASE_INFO( "WindowRenderSurface::OnFileDescriptorEventDispatched: Frame rendered [%d]\n", fileDescriptor );
 
   std::unique_ptr< FrameCallbackInfo > callbackInfo;
   {
index 395656f..e748b18 100644 (file)
@@ -129,6 +129,11 @@ public: // from Dali::RenderSurfaceInterface
   void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
 
   /**
+   * @copydoc Dali::RenderSurfaceInterface::GetOrientation()
+   */
+  int GetOrientation() const override;
+
+  /**
    * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
    */
   void InitializeGraphics() override;
@@ -301,15 +306,15 @@ private: // Data
   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
 
index 17027c7..74a67c0 100644 (file)
@@ -565,32 +565,36 @@ const struct tizen_display_policy_listener tizenDisplayPolicyListener =
 
 } // 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()
@@ -1326,9 +1330,10 @@ bool WindowBaseEcoreWl::IsEglWindowRotationSupported()
   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;
 }
 
@@ -2071,6 +2076,16 @@ void WindowBaseEcoreWl::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVe
   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;
@@ -2084,11 +2099,13 @@ int WindowBaseEcoreWl::GetScreenRotationAngle()
     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 );
 }
 
index 6b673ef..24f676e 100644 (file)
@@ -395,6 +395,11 @@ public:
   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;
@@ -485,6 +490,9 @@ private:
 
   bool                                 mOwnSurface;
 
+  int                                  mWindowRotationAngle;
+  int                                  mScreenRotationAngle;
+  int                                  mSupportedPreProtation;
 #ifdef DALI_ELDBUS_AVAILABLE
   Eldbus_Connection*                   mSystemConnection;
 #endif // DALI_ELDBUS_AVAILABLE
index 0879f0f..856a8de 100755 (executable)
@@ -702,37 +702,41 @@ const struct tizen_display_policy_listener tizenDisplayPolicyListener =
 
 } // 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()
@@ -949,6 +953,8 @@ Eina_Bool WindowBaseEcoreWl2::OnOutputTransform( void* data, int type, void* eve
   {
     DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "Window (%p) EcoreEventOutputTransform\n", mEcoreWindow );
 
+    mScreenRotationAngle = GetScreenRotationAngle();
+
     mOutputTransformedSignal.Emit();
   }
 
@@ -963,39 +969,42 @@ Eina_Bool WindowBaseEcoreWl2::OnIgnoreOutputTransform( void* data, int type, voi
   {
     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);
   }
 }
 
@@ -1117,7 +1126,7 @@ void WindowBaseEcoreWl2::OnMouseButtonCancel( void* data, int type, void* event
 
     mTouchEventSignal.Emit( point, touchEvent->timestamp );
 
-    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl::OnMouseButtonCancel\n" );
+    DALI_LOG_INFO( gWindowBaseLogFilter, Debug::General, "WindowBaseEcoreWl2::OnMouseButtonCancel\n" );
   }
 }
 
@@ -1127,7 +1136,7 @@ void WindowBaseEcoreWl2::OnMouseWheel( void* data, int type, void* event )
 
   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 );
 
@@ -1139,7 +1148,7 @@ void WindowBaseEcoreWl2::OnDetentRotation( void* data, int type, void* event )
 {
   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;
@@ -1155,7 +1164,7 @@ void WindowBaseEcoreWl2::OnKeyDown( void* data, int type, void* event )
 
   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( "" );
@@ -1217,7 +1226,7 @@ void WindowBaseEcoreWl2::OnKeyUp( void* data, int type, void* event )
 
   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.
@@ -1436,11 +1445,19 @@ int WindowBaseEcoreWl2::GetNativeWindowId()
   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()
@@ -1575,12 +1592,13 @@ void WindowBaseEcoreWl2::ResizeEglWindow( PositionSize positionSize )
 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;
 }
 
@@ -1624,20 +1642,21 @@ void WindowBaseEcoreWl2::Activate()
   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 );
 }
 
@@ -2334,30 +2353,41 @@ void WindowBaseEcoreWl2::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiV
   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 )
index 9ca8a30..436a249 100644 (file)
@@ -427,6 +427,11 @@ public:
   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;
@@ -524,6 +529,9 @@ private:
   volatile uint32_t                    mMoveResizeSerial;
   uint32_t                             mLastSubmittedMoveResizeSerial;
 
+  int                                  mWindowRotationAngle;
+  int                                  mScreenRotationAngle;
+  int                                  mSupportedPreProtation;
 #ifdef DALI_ELDBUS_AVAILABLE
   Eldbus_Connection*                   mSystemConnection;
 #endif // DALI_ELDBUS_AVAILABLE
index 7b7f923..118b020 100644 (file)
@@ -161,6 +161,11 @@ void NativeRenderSurfaceEcoreWl::GetDpi( unsigned int& dpiHorizontal, unsigned i
   dpiVertical   = int( yres + 0.5f );
 }
 
+int NativeRenderSurfaceEcoreWl::GetOrientation() const
+{
+  return 0;
+}
+
 void NativeRenderSurfaceEcoreWl::InitializeGraphics()
 {
   DALI_LOG_TRACE_METHOD( gNativeSurfaceLogFilter );
index d21ed86..595f1af 100644 (file)
@@ -90,6 +90,11 @@ public: // from Dali::RenderSurfaceInterface
   void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
 
   /**
+   * @copydoc Dali::RenderSurfaceInterface::GetOrientation()
+   */
+  int GetOrientation() const override;
+
+  /**
    * @copydoc Dali::RenderSurfaceInterface::InitializeGraphics()
    */
   void InitializeGraphics() override;
index 527f5cc..462279a 100644 (file)
@@ -147,6 +147,11 @@ void PixmapRenderSurfaceEcoreX::GetDpi( unsigned int& dpiHorizontal, unsigned in
   dpiVertical   = int( yres + 0.5f );
 }
 
+int PixmapRenderSurfaceEcoreX::GetOrientation() const
+{
+  return 0;
+}
+
 void PixmapRenderSurfaceEcoreX::InitializeGraphics()
 {
   mGraphics = &mAdaptor->GetGraphicsInterface();
index b88c3f6..c8a7163 100644 (file)
@@ -82,6 +82,11 @@ public: // from Dali::RenderSurfaceInterface
   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;
index e6d4fa0..107c734 100755 (executable)
@@ -243,14 +243,15 @@ static Eina_Bool EcoreEventKeyUp( void* data, int type, void* event )
 
 } // 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()
@@ -834,6 +835,11 @@ void WindowBaseEcoreX::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVer
   dpiVertical   = ecore_x_dpi_get();
 }
 
+int WindowBaseEcoreX::GetOrientation() const
+{
+  return 0;
+}
+
 int WindowBaseEcoreX::GetScreenRotationAngle()
 {
   return 0;
@@ -841,6 +847,7 @@ int WindowBaseEcoreX::GetScreenRotationAngle()
 
 void WindowBaseEcoreX::SetWindowRotationAngle( int degree )
 {
+  mWindowRotationAngle = degree;
 }
 
 void WindowBaseEcoreX::WindowRotationCompleted( int degree, int width, int height )
index 948740f..44375dc 100644 (file)
@@ -329,6 +329,11 @@ public:
   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;
@@ -397,6 +402,7 @@ private:
   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
index 3e51425..c56d31e 100755 (executable)
@@ -279,7 +279,7 @@ void KillTimer(intptr_t id)
   delete info;
 }
 
-const char* GetKeyName( int keyCode )
+std::string GetKeyName( int keyCode )
 {
   switch( keyCode )
   {
@@ -361,6 +361,10 @@ const char* GetKeyName( int keyCode )
     }
     default:
     {
+      if (keyCode > 0 && keyCode < 128)
+      {
+        return std::string(1u, static_cast<char>(keyCode));
+      }
       break;
     }
   }
index 21c19fa..d31099f 100755 (executable)
@@ -20,6 +20,7 @@
 \r
 // EXTERNAL_HEADERS\r
 #include <stdint.h>\r
+#include <string>\r
 #include <dali/public-api/signals/callback.h>\r
 \r
 typedef uintptr_t  WinWindowHandle;\r
@@ -49,7 +50,7 @@ intptr_t SetTimer(int interval, timerCallback callback, void *data);
 \r
 void KillTimer(intptr_t id);\r
 \r
-const char* GetKeyName( int keyCode );\r
+std::string GetKeyName( int keyCode );\r
 \r
 uint64_t GetCurrentThreadId();\r
 \r
index 00d671a..9db4403 100755 (executable)
@@ -462,6 +462,11 @@ void WindowBaseWin::SetTransparency( bool transparent )
 {
 }
 
+int WindowBaseWin::GetOrientation() const
+{
+  return 0;
+}
+
 uintptr_t WindowBaseWin::GetSurfaceId( Any surface ) const
 {
   uintptr_t surfaceId = 0;
index 2c60cb3..531386f 100755 (executable)
@@ -337,6 +337,11 @@ public:
   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;
index 33ba5ea..72411dd 100644 (file)
@@ -27,7 +27,7 @@ namespace Dali
 {
 const unsigned int ADAPTOR_MAJOR_VERSION = 2;
 const unsigned int ADAPTOR_MINOR_VERSION = 0;
-const unsigned int ADAPTOR_MICRO_VERSION = 1;
+const unsigned int ADAPTOR_MICRO_VERSION = 2;
 const char* const  ADAPTOR_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 2cdb4df..281fbf0 100644 (file)
@@ -17,7 +17,7 @@
 
 Name:       dali2-adaptor
 Summary:    The DALi Tizen Adaptor
-Version:    2.0.1
+Version:    2.0.2
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT