Fix Window Manager Rotation
authorChoi Munseok <ms47.choi@samsung.com>
Fri, 29 Mar 2013 01:53:37 +0000 (10:53 +0900)
committerChoi Munseok <ms47.choi@samsung.com>
Fri, 29 Mar 2013 01:53:37 +0000 (10:53 +0900)
Change-Id: If3bf776f593573ef0394ec9638c28af9b3972f59
Signed-off-by: Choi Munseok <ms47.choi@samsung.com>
src/ui/FUi_ControlManager.cpp
src/ui/FUi_EcoreEvas.cpp
src/ui/FUi_OrientationAgent.cpp
src/ui/FUi_Window.cpp
src/ui/inc/FUi_Window.h

index b56acca..585420e 100644 (file)
@@ -956,7 +956,7 @@ _ControlManager::RotateScreen(const _Control& control, _ControlRotation screenRo
        if (pRootWindow)
        {
                pEcoreEvas->RotateWindow(*pRootWindow, ::Convert(screenRotation));
-               pRootWindow->SetRotation(::Convert(screenRotation));
+               //pRootWindow->SetRotation(::Convert(screenRotation));
        }
 
 #if !defined(WINDOW_BASE_ROTATE)
index 43d4bbe..fd5dc42 100644 (file)
@@ -2197,16 +2197,21 @@ _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
        {
                if (rotations)
                {
-                       SetWindowPreferredRotation(ownee, -1);
                        SetWindowAvailabledRotation(ownee, rotations, count);
                        free(rotations);
                }
        }
-       else
+
+       bool preferredRoation = pOwnerWindow->GetPreferredRotation();
+       if (preferredRoation == true)
        {
                int preferredRotation = ecore_evas_wm_rotation_preferred_rotation_get(pOwnerLayer->GetEcoreEvas());
                SetWindowPreferredRotation(ownee, preferredRotation);
        }
+       else
+       {
+               SetWindowPreferredRotation(ownee, -1);
+       }
 #endif
 
        SetLastResult(E_SUCCESS);
@@ -2238,6 +2243,19 @@ _EcoreEvas::SetWindowPreferredRotation(const _Window& window, int rotation)
        Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
        SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set window preferred rotation(%d).", win, rotation);
        ecore_evas_wm_rotation_preferred_rotation_set(pLayer->GetEcoreEvas(), rotation);
+
+       _Window* pWindow = const_cast<_Window*>(&window);
+       if (pWindow)
+       {
+               if (rotation == -1)
+               {
+                       pWindow->SetPreferredRotation(false);
+               }
+               else
+               {
+                       pWindow->SetPreferredRotation(true);
+               }
+       }
 }
 
 void
index 04d493d..763b234 100644 (file)
@@ -590,6 +590,41 @@ _OrientationAgent::SetRotation(const _Window& window, Orientation orientation)
        default:
                break;
        }
+
+       // [Ownee]
+       // 1. ActivateWindow
+       // 2. SetOwner
+       // 3. SetRotation
+
+       _ControlImpl* pImpl = _ControlImpl::GetInstance(__publicControl);
+       if (!pImpl)
+       {
+               return;
+       }
+
+       int owneeCount = pImpl->GetCore().GetOwneeCount();
+       for (int i = 0; i < owneeCount; i++)
+       {
+               _Window* pOwnee = pImpl->GetCore().GetOwnee(i);
+               if (pOwnee)
+               {
+                       pEcoreEvas->SetOwner(*pOwnee, pImpl->GetCore());
+               }
+       }
+
+       _Control* pParent = pImpl->GetCore().GetParent();
+       if (pParent)
+       {
+               int owneeCount = pParent->GetOwneeCount();
+               for (int i = 0; i < owneeCount; i++)
+               {
+                       _Window* pOwnee = pParent->GetOwnee(i);
+                       if (pOwnee)
+                       {
+                               pEcoreEvas->SetOwner(*pOwnee, *pParent);
+                       }
+               }
+       }
 }
 #endif
 
index aa6ab72..bc22603 100644 (file)
@@ -592,6 +592,18 @@ _Window::OnWindowStateChanged(void)
 
        pEcoreEvas->RotateWindow(*this, __rotation);
 }
+
+void
+_Window::SetPreferredRotation(bool enable)
+{
+       __preferredRotation = enable;
+}
+
+bool
+_Window::GetPreferredRotation(void) const
+{
+       return __preferredRotation;
+}
 #endif
 
 bool
@@ -681,6 +693,7 @@ _Window::_Window()
        , __orientationEnabled(false)
 #else
        , __rotation(0)
+       , __preferredRotation(false)
 #endif
 {
        SetControlDelegate(*this);
index 68fea56..ede34e2 100644 (file)
@@ -93,6 +93,8 @@ public:
        virtual result OnDetachingFromMainTree(void);
 #if defined(WINDOW_BASE_ROTATE)
        void OnWindowStateChanged(void);
+       void SetPreferredRotation(bool enable);
+       bool GetPreferredRotation(void) const;
 #else
        void SetOrientationEnabled(bool enable);
        bool IsOrientationEnabled(void);
@@ -157,6 +159,7 @@ private:
        bool __orientationEnabled;
 #else
        int __rotation;
+       bool __preferredRotation;
 #endif
 
        friend class _ControlManager;