Fix Window Manager Rotation
authorChoi Munseok <ms47.choi@samsung.com>
Thu, 28 Mar 2013 01:28:23 +0000 (10:28 +0900)
committerChoi Munseok <ms47.choi@samsung.com>
Thu, 28 Mar 2013 01:28:23 +0000 (10:28 +0900)
Change-Id: I99ceba33dd7e51a9cc316012254ccbf7a554ef31
Signed-off-by: Choi Munseok <ms47.choi@samsung.com>
src/ui/FUi_ControlImplManager.cpp
src/ui/FUi_ControlManager.cpp
src/ui/FUi_EcoreEvas.cpp
src/ui/FUi_OrientationAgent.cpp [changed mode: 0755->0644]
src/ui/FUi_OrientationAgent.h [changed mode: 0755->0644]
src/ui/FUi_Window.cpp
src/ui/inc/FUi_EcoreEvas.h
src/ui/inc/FUi_Window.h

index 31b0ad6..c3666bd 100644 (file)
@@ -246,6 +246,7 @@ void
 _ControlImplManager::OnScreenRotated(int rotation)
 {
 #if defined(WINDOW_BASE_ROTATE)
+       // Do not use the device orientation callback.
        return;
 #endif
 
index c14069e..de45c7e 100644 (file)
@@ -842,7 +842,13 @@ _ControlManager::GetScreenRotation(void) const
        }
        else
        {
+#if defined(WINDOW_BASE_ROTATE)
+               int degree = app_get_device_orientation();
+
+               return ::Convert(degree);
+#else
                return __screenRotation;
+#endif
        }
 }
 
@@ -931,6 +937,10 @@ _ControlManager::GetOrientationStatus(void) const
 void
 _ControlManager::RotateScreen(const _Control& control, _ControlRotation screenRotation)
 {
+       // Non-auto mode
+       // Rotate window
+       // Set window preferred rotation
+
        _EcoreEvas* pEcoreEvas = ::GetEcoreEvasMgr()->GetEcoreEvas();
        SysAssert(pEcoreEvas);
        if (pEcoreEvas == null)
@@ -943,8 +953,10 @@ _ControlManager::RotateScreen(const _Control& control, _ControlRotation screenRo
        if (pRootWindow)
        {
                pEcoreEvas->RotateWindow(*pRootWindow, ::Convert(screenRotation));
+               pRootWindow->SetRotation(::Convert(screenRotation));
        }
 
+#if !defined(WINDOW_BASE_ROTATE)
        // Rotate Ownees.
        int owneeCount = control.GetOwneeCount();
        for (int i = 0; i < owneeCount; i++)
@@ -955,6 +967,7 @@ _ControlManager::RotateScreen(const _Control& control, _ControlRotation screenRo
                        pEcoreEvas->RotateWindow(*pOwnee, ::Convert(screenRotation));
                }
        }
+#endif
 
        if (__orientationStatus != screenRotation)
        {
index 8a0360d..43d4bbe 100644 (file)
@@ -1101,10 +1101,6 @@ _EcoreEvas::~_EcoreEvas(void)
 void
 _EcoreEvas::RotateWindow(const _Window& window, int orientation)
 {
-#if defined(WINDOW_BASE_ROTATE)
-       return;
-#endif
-
        _EflLayer* pLayer = GetEflLayer(window);
        if (!pLayer)
        {
@@ -1112,11 +1108,14 @@ _EcoreEvas::RotateWindow(const _Window& window, int orientation)
        }
 
        Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
-       int currentOrientation = ecore_evas_rotation_get(pEcoreEvas);
-       if (currentOrientation == orientation)
+
+       /*
+       int curOrientation = ecore_evas_rotation_get(pEcoreEvas);
+       if (curOrientation == orientation)
        {
                return;
        }
+       */
 
        bool rotatePartial = true;
 
@@ -1157,6 +1156,8 @@ _EcoreEvas::RotateWindow(const _Window& window, int orientation)
                {
                        evas_object_resize(pWinObj, rootH, rootW);
                }
+
+               SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Rotate bounds(rot = %d).", win, orientation);
        }
        else
        {
@@ -1188,95 +1189,12 @@ _EcoreEvas::RotateWindow(const _Window& window, int orientation)
 
                evas_object_move(pWinObj, winX, winY);
                evas_object_resize(pWinObj, winBounds.width, winBounds.height);
-       }
-}
-
-#if defined(WINDOW_BASE_ROTATE)
-void
-_EcoreEvas::UpdateWindowBounds(const _Window& window)
-{
-       _EflLayer* pLayer = GetEflLayer(window);
-       if (!pLayer)
-       {
-               return;
-       }
-
-       bool fullScreen = false;
-
-       _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Window*>(&window));
 
-       if (pFrame)
-       {
-               FrameShowMode showMode = pFrame->GetShowMode();
-               if (showMode == FRAME_SHOW_MODE_FULL_SCREEN)
-               {
-                       fullScreen = true;
-               }
-       }
-
-       _Window* pWindow = const_cast<_Window*>(&window);
-
-       if (pWindow->IsLayoutChangable() == true)
-       {
-               fullScreen = true;
-       }
-
-       Evas_Object* pWinObj = pLayer->GetElmWin();
-       Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
-
-       int rootW = 0;
-       int rootH = 0;
-       ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
-
-       int rotation = ecore_evas_rotation_get(pLayer->GetEcoreEvas());
-
-       if (fullScreen)
-       {
-               evas_object_move(pWinObj, 0, 0);
-
-               if ((rotation == 0) || (rotation == 180))
-               {
-                       evas_object_resize(pWinObj, rootW, rootH);
-               }
-               else
-               {
-                       evas_object_resize(pWinObj, rootH, rootW);
-               }
-
-               SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Update bounds(rot = %d).", win, rotation);
-       }
-       else
-       {
-               Rectangle winBounds = _CoordinateSystemUtils::Transform(window.GetBounds());
-
-               int winX = winBounds.x;
-               int winY = winBounds.y;
-
-               switch (rotation)
-               {
-               case 270:
-                       winX = rootW - winBounds.y - winBounds.height;
-                       winY = winBounds.x;
-                       break;
-               case 90:
-                       winX = winBounds.y;
-                       winY = rootH - winBounds.x - winBounds.width;
-                       break;
-               case 180:
-                       winX = rootW - winBounds.x - winBounds.width;
-                       winY = rootH - winBounds.y - winBounds.height;
-                       break;
-               default:
-                       break;
-               }
-
-               evas_object_move(pWinObj, winX, winY);
-               evas_object_resize(pWinObj, winBounds.width, winBounds.height);
-
-               SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Update bounds(rot = %d, %d, %d, %d, %d).", win, rotation, winX, winY, winBounds.width, winBounds.height);
+               SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Rotate bounds(rot = %d, %d, %d, %d, %d).", win, orientation, winX, winY, winBounds.width, winBounds.height);
        }
 }
-#else
+
+#if !defined(WINDOW_BASE_ROTATE)
 void
 _EcoreEvas::SetWindowOrientationEnabled(const _Window& window, bool enable)
 {
old mode 100755 (executable)
new mode 100644 (file)
index 16e6a34..04d493d
@@ -151,6 +151,10 @@ void
 _OrientationAgent::Update(bool draw)
 {
 #if defined(WINDOW_BASE_ROTATE)
+       // Update orientation status(Not Auto-mode)
+       // Request rotation to window manager -> async -> Update VEs
+       // Window(not rotation) -> sync -> UpdateVEs
+
        _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
        SysAssert(pImplManager);
 
@@ -160,128 +164,84 @@ _OrientationAgent::Update(bool draw)
                return;
        }
 
-       // Set window rotation.
-       _Form* pForm = dynamic_cast<_Form*>(&(pImpl->GetCore()));
-       if (pForm)
+       _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
+       if (!pEcoreEvas)
        {
-               _Control* pParent = pForm->GetParent();
-               if (pParent)
-               {
-                       _Form* pCurrentForm = null;
-                       int childCount = pParent->GetChildCount();
-                       
-                       for (int i = childCount; i > 0; i--)
-                       {
-                               _Control* pChild = pParent->GetChild(i - 1);
-                       
-                               _Form* pChildForm = dynamic_cast<_Form*>(pChild);
-                               if (pChildForm)
-                               {
-                                       if (pChildForm->IsVisible())
-                                       {
-                                               pCurrentForm = pChildForm;
+               return;
+       }
 
-                                               break;
-                                       }
-                               }
-                       }
+       bool autoMode = false;
 
-                       // Current Form
-                       if (pCurrentForm == pForm)
-                       {
-                               _Window* pWindow = pForm->GetRootWindow();
-                               if (pWindow)
-                               {
-                                       Rectangle bounds = pWindow->GetBounds();
-                                       SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d, Form] Set window rotation with mode(%d).", 
-                                               pWindow->GetNativeHandle(), bounds.x, bounds.y, bounds.width, bounds.height, __mode);
-                                       SetRotation(*pWindow, __mode);
-                               }
+       if ((__mode == ORIENTATION_AUTOMATIC) || (__mode == ORIENTATION_AUTOMATIC_FOUR_DIRECTION))
+       {
+               autoMode = true;
+       }
 
-                               int owneeCount = pForm->GetOwneeCount();
-                               for (int i = 0; i < owneeCount; i++)
-                               {
-                                       _Window* pOwnee = pForm->GetOwnee(i);
-                       
-                                       if (pOwnee)
-                                       {
-                                               SetRotation(*pOwnee, __mode);
-                                       }
-                               }
-                       }
-               }
-               else
+//     if (autoMode == false)
+//     {
+               // [Sync]
+               // Update orientation status
+               // Update VEs
+               // Fire orientation event
+               // Rotate screen
+               // Set preffered rotation
+
+               OrientationStatus status = pImplManager->GetOrientationStatus(__mode);
+               
+               if (__updateStatus == true)
                {
-                       switch (__mode)
+                       __statusChanged = false;
+                       if (__status != status)
                        {
-                       case ORIENTATION_PORTRAIT:
-                               {
-                               __draw = draw;
-                               __tempStatus = ORIENTATION_STATUS_PORTRAIT;
-                               UpdateOrientation(true);
-                               }
-                               break;
-                       case ORIENTATION_LANDSCAPE:
-                               {
-                               __draw = draw;
-                               __tempStatus = ORIENTATION_STATUS_LANDSCAPE;
-                               UpdateOrientation(true);
-                               SysLog(NID_UI, "Window Manager Rotation");
-                               }
-                               break;
-                       case ORIENTATION_PORTRAIT_REVERSE:
-                               {
-                               __draw = draw;
-                               __tempStatus = ORIENTATION_STATUS_PORTRAIT_REVERSE;
-                               UpdateOrientation(true);
-                               }
-                               break;
-                       case ORIENTATION_LANDSCAPE_REVERSE:
-                               {
-                               __draw = draw;
-                               __tempStatus = ORIENTATION_STATUS_LANDSCAPE_REVERSE;
-                               UpdateOrientation(true);
-                               }
-                               break;
-                       default:
-                               {
-                               SysLog(NID_UI, "Window Manager Rotation Default");
-                               }
-                               break;
+                               __statusChanged = true;
+                               __updateStatus = false;
                        }
                }
-       }
-       else
-       {
-               _Frame* pFrame = dynamic_cast<_Frame*>(&(pImpl->GetCore()));
-
-               if (pFrame)
+               
+               __status = status;
+               
+               pEcoreEvas->AllowSetWindowBounds(false);
+               FireEvent(status);
+               pEcoreEvas->AllowSetWindowBounds(true);
+               
+               // For the form to be made by Ui-Builder
+               if ((draw == true) && (__statusChanged == true))
                {
-                       // Frame which has no forms
-                       int childCount = pFrame->GetChildCount();
-                       if (childCount == 0)
+                       _ControlOrientation coreOrientation =
+                               (status == ORIENTATION_STATUS_PORTRAIT || status == ORIENTATION_STATUS_PORTRAIT_REVERSE) ?
+                               _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
+               
+                       Rectangle temp;
+                       bool exist = pImpl->GetBuilderBounds(coreOrientation, temp);
+                       if (exist)
                        {
-                               Rectangle bounds = pFrame->GetBounds();
-                               SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d, Frame] Set window rotation with mode(%d).", 
-                                       pFrame->GetNativeHandle(), bounds.x, bounds.y, bounds.width, bounds.height, __mode);
-                               SetRotation(*pFrame, __mode);
-
-                               int owneeCount = pFrame->GetOwneeCount();
-                               
-                               for (int i = 0; i < owneeCount; i++)
-                               {
-                                       _Window* pOwnee = pFrame->GetOwnee(i);
-
-                                       if (pOwnee)
-                                       {
-                                               SetRotation(*pOwnee, __mode);
-                                       }
-                               }
+                               pImpl->Invalidate(true);
                        }
                }
-       }
+               
+               // Despite not changing status, it needs to rotate screen.
+               _ControlImpl* pControlImpl = _ControlImpl::GetInstance(__publicControl);
+               pImplManager->RotateScreen(pControlImpl, status);
 
-       __draw = draw;
+               _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
+               if (pRootWindow)
+               {
+                       SetRotation(*pRootWindow, __mode);
+               }
+//     }
+//     else
+//     {
+               // [Async]
+               // Set preffered rotation
+
+//             _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
+//             if (pRootWindow)
+//             {
+//                     SetRotation(*pRootWindow, __mode);
+//             }
+
+               __draw = draw;
+//     }
 #else          
        _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
        SysAssert(pImplManager);
@@ -394,8 +354,14 @@ _OrientationAgent::Update(bool draw)
 
 #if defined(WINDOW_BASE_ROTATE)
 void
-_OrientationAgent::UpdateOrientation(bool force)
+_OrientationAgent::UpdateOrientation(void)
 {
+       // Get window rotation
+       // Update VEs
+       // Fire orientation event
+       // Update window bounds
+       // Invalidate
+
        _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
        if (!pEcoreEvas)
        {
@@ -408,15 +374,13 @@ _OrientationAgent::UpdateOrientation(bool force)
                return;
        }
 
-       int rotation = 0;
-
-       _Window* pWindow = pImpl->GetCore().GetRootWindow();
-       if (pWindow)
+       _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
+       if (!pRootWindow)
        {
-               rotation = pEcoreEvas->GetWindowRotation(*pWindow);
+               return;
        }
 
-       // Update evas objects.
+       int rotation = pEcoreEvas->GetWindowRotation(*pRootWindow);
        OrientationStatus status = ORIENTATION_STATUS_NONE;
        switch (rotation)
        {
@@ -436,11 +400,6 @@ _OrientationAgent::UpdateOrientation(bool force)
                break;
        }
 
-       if (force)
-       {
-               status = __tempStatus;
-       }
-
        if (__updateStatus == true)
        {
                __statusChanged = false;
@@ -472,17 +431,12 @@ _OrientationAgent::UpdateOrientation(bool force)
                }
        }
 
-       _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
-       if (pRootWindow)
-       {
-               pEcoreEvas->UpdateWindowBounds(*pRootWindow);
-               
-               pImpl->Invalidate(true);
+       pEcoreEvas->RotateWindow(*pRootWindow, rotation);
 
-               Rectangle bounds = pRootWindow->GetBounds();
-               SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d] Update VEs to %d degree.", 
-                       pRootWindow->GetNativeHandle(), bounds.x, bounds.y, bounds.width, bounds.height, rotation);
-       }
+       pImpl->Invalidate(true);
+
+       Rectangle bounds = pRootWindow->GetBounds();
+       SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, rot = %d, %d, %d, %d, %d] Update Orientation.", pRootWindow->GetNativeHandle(), rotation, bounds.x, bounds.y, bounds.width, bounds.height);
 }
 #endif
 
@@ -589,12 +543,6 @@ _OrientationAgent::FireEvent(OrientationStatus status)
                IEventArg* pArg = _PublicOrientationEvent::CreateOrientationEventArgN(*__pPublicEvent->GetSource(), status);
                __pPublicEvent->Fire(*pArg);
 
-               _Window* pWindow = pImpl->GetCore().GetRootWindow();
-               if (pWindow)
-               {
-                       SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Fire the public orientation event..", pWindow->GetNativeHandle());
-               }
-
                __updateStatus = true;
        }
 }
@@ -609,123 +557,39 @@ _OrientationAgent::SetRotation(const _Window& window, Orientation orientation)
                return;
        }
 
-       int deviceOrientation = app_get_device_orientation();
-       int windowRotation = pEcoreEvas->GetWindowRotation(window);
-
-       bool callback = true;
-
-       // Decide updating orientation forcibly.
        switch (orientation)
        {
        case ORIENTATION_PORTRAIT:
-               {
-                       pEcoreEvas->SetWindowPreferredRotation(window, 0);
-
-                       __tempStatus = ORIENTATION_STATUS_PORTRAIT;
-                       UpdateOrientation(true);
-
-                       return;
-       
-                       /*
-                       if ((deviceOrientation == 0) || (windowRotation == 0))
-                       {
-                               callback = false;
-                       }
-                       */
-               }
+               pEcoreEvas->SetWindowPreferredRotation(window, 0);
                break;
        case ORIENTATION_LANDSCAPE:
-               {
-                       pEcoreEvas->SetWindowPreferredRotation(window, 270);
-
-                       __tempStatus = ORIENTATION_STATUS_LANDSCAPE;
-                       UpdateOrientation(true);
-
-                       return;
-
-                       /*
-                       if ((deviceOrientation == 270) || (windowRotation == 270))
-                       {
-                               callback = false;
-                       }
-                       */
-               }
+               pEcoreEvas->SetWindowPreferredRotation(window, 270);
                break;
        case ORIENTATION_PORTRAIT_REVERSE:
-               {
-                       pEcoreEvas->SetWindowPreferredRotation(window, 180);
-               
-                       __tempStatus = ORIENTATION_STATUS_PORTRAIT_REVERSE;
-                       UpdateOrientation(true);
-                       
-                       return;
-
-                       /*
-                       if ((deviceOrientation == 180) || (windowRotation == 180))
-                       {
-                               callback = false;
-                       }
-                       */
-               }
+               pEcoreEvas->SetWindowPreferredRotation(window, 180);
                break;
        case ORIENTATION_LANDSCAPE_REVERSE:
-               {
-                       pEcoreEvas->SetWindowPreferredRotation(window, 90);
-                       
-                       __tempStatus = ORIENTATION_STATUS_LANDSCAPE_REVERSE;
-                       UpdateOrientation(true);
-                       
-                       return;
-
-                       /*              
-                       if ((deviceOrientation == 90) || (windowRotation == 90))
-                       {
-                               callback = false;
-                       }
-                       */
-               }
+               pEcoreEvas->SetWindowPreferredRotation(window, 90);
                break;
        case ORIENTATION_AUTOMATIC:
                {
                        pEcoreEvas->SetWindowPreferredRotation(window, -1);
-
                        int autoRotation[3] = {0, 90, 270};
                        pEcoreEvas->SetWindowAvailabledRotation(window, autoRotation, 3);
-
-                       if (deviceOrientation == windowRotation)
-                       {
-                               callback = false;
-                       }
-                       else
-                       {
-                               if (deviceOrientation == 180)
-                               {
-                                       callback = false;
-                               }
-                       }
                }
+
                break;
        case ORIENTATION_AUTOMATIC_FOUR_DIRECTION:
                {
                        pEcoreEvas->SetWindowPreferredRotation(window, -1);
-
                        int autoFourRotation[4] = {0, 90, 180, 270};
                        pEcoreEvas->SetWindowAvailabledRotation(window, autoFourRotation, 4);
-
-                       if (deviceOrientation == windowRotation)
-                       {
-                               callback = false;
-                       }
                }
+
                break;
        default:
                break;
        }
-
-       if (callback == false)
-       {
-               UpdateOrientation();
-       }
 }
 #endif
 
old mode 100755 (executable)
new mode 100644 (file)
index 39b3263..382d414
@@ -52,7 +52,8 @@ public:
 
        void Update(bool draw = false);
 #if defined(WINDOW_BASE_ROTATE)
-       void UpdateOrientation(bool force = false);
+       void UpdateOrientation(void);
+       void SetRotation(const _Window& window, Orientation orientation);
 #endif
 
        void RequestOrientationEvent(void);
@@ -60,9 +61,6 @@ public:
 
 private:
        void FireEvent(OrientationStatus status);
-#if defined(WINDOW_BASE_ROTATE)
-       void SetRotation(const _Window& window, Orientation orientation);
-#endif
 
        _OrientationAgent(Control& publicControl);
 
index fcecddc..ab36f69 100644 (file)
@@ -520,6 +520,19 @@ _Window::OnDetachingFromMainTree(void)
 void
 _Window::OnWindowStateChanged(void)
 {
+       // <0>
+       // Update rotation
+       // <1>
+       // Find current form
+       // Call UpdateOrientation
+       // <2>
+       // Find current frame
+       // Call UpdateOrientation
+       // <3>
+       // Find window
+       // Change layout
+       // Rotate window
+
        _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
        if (!pEcoreEvas)
        {
@@ -528,51 +541,56 @@ _Window::OnWindowStateChanged(void)
 
        int rotation = pEcoreEvas->GetWindowRotation(*this);
 
-       Rectangle bounds = GetBounds();
-       SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d] OnWindowStateChanged is called with prev rotation(%d) and cur rotation(%d)", 
-               GetNativeHandle(), bounds.x, bounds.y, bounds.width, bounds.height, __rotation, rotation);
+       Rectangle winBounds = GetBounds();
+       SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d] OnWindowStateChanged : prev rot = %d, cur rot = %d", GetNativeHandle(), winBounds.x, winBounds.y, winBounds.width, winBounds.height, __rotation, rotation);
 
-       if (__rotation != rotation)
+       if (rotation == __rotation)
        {
-               __rotation = rotation;
+               return;
+       }
 
-               int childCount = GetChildCount();
-               for (int i = childCount; i > 0; i--)
+       __rotation = rotation;
+
+       // <1>
+       int childCount = GetChildCount();
+       for (int i = childCount; i > 0; i--)
+       {
+               _Control* pChild = GetChild(i - 1);
+               
+               _Form* pForm = dynamic_cast<_Form*>(pChild);
+               if (pForm)
                {
-                       _Control* pChild = GetChild(i - 1);
-                       
-                       _Form* pForm = dynamic_cast<_Form*>(pChild);
-                       if (pForm)
+                       if (pForm->IsVisible())
                        {
-                               if (pForm->IsVisible())
+                               // Current Form
+                               _FormImpl* pFormImpl = static_cast<_FormImpl*>(pForm->GetUserData());
+                               if (pFormImpl)
                                {
-                                       // Current Form
-                                       _FormImpl* pFormImpl = static_cast<_FormImpl*>(pForm->GetUserData());
-                                       if (pFormImpl)
-                                       {
-                                               pFormImpl->UpdateOrientation();
-                                       }
-
-                                       return;
+                                       pFormImpl->UpdateOrientation();
                                }
-                       }
-               }
 
-               if (IsOrientationRoot())
-               {
-                       _FrameImpl* pFrameImpl = static_cast<_FrameImpl*>(GetUserData());
-                       if (pFrameImpl)
-                       {
-                               pFrameImpl->UpdateOrientation();
+                               return;
                        }
                }
-               else
+       }
+
+       // <2>
+       if (IsOrientationRoot())
+       {
+               _FrameImpl* pFrameImpl = static_cast<_FrameImpl*>(GetUserData());
+               if (pFrameImpl)
                {
-                       _ControlOrientation controlOrientation = (rotation == 0 || rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
-                       ChangeLayout(controlOrientation);
-                       pEcoreEvas->UpdateWindowBounds(*this);
+                       pFrameImpl->UpdateOrientation();
                }
+
+               return;
        }
+
+       // <3>
+       _ControlOrientation controlOrientation = (rotation == 0 || rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
+       ChangeLayout(controlOrientation);
+
+       pEcoreEvas->RotateWindow(*this, __rotation);
 }
 #endif
 
@@ -582,6 +600,14 @@ _Window::IsLayoutChangable(void) const
        return false;
 }
 
+#if defined(WINDOW_BASE_ROTATE)
+void
+_Window::SetRotation(int rotation)
+{
+       __rotation = rotation;
+}
+#endif
+
 void
 _Window::OnChangeLayout(_ControlOrientation orientation)
 {
index 2e1d9ab..05da4b0 100644 (file)
@@ -111,7 +111,6 @@ public:
        void RotateWindow(const _Window& window, int orientation);
        int GetWindowRotation(const _Window& window);
 #if defined(WINDOW_BASE_ROTATE)
-       void UpdateWindowBounds(const _Window& window);
        void SetWindowPreferredRotation(const _Window& window, int rotation);
        void SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count);
        void RegisterWindowStateCallback(const _Window& window);
index 3e9f5ee..a9aae4f 100644 (file)
@@ -74,6 +74,9 @@ public:
        virtual result CreateLayer(void);
        virtual bool IsFocusableDescendant(const _Control* pFocus) const;
        virtual bool IsLayoutChangable(void) const;
+#if defined(WINDOW_BASE_ROTATE)
+       void SetRotation(int rotation);
+#endif
 
 // Focus
        _Control* GetFocusedControl(void) const;