Fix Rotation for ownee windows
authorChoi Munseok <ms47.choi@samsung.com>
Mon, 8 Apr 2013 04:49:35 +0000 (13:49 +0900)
committerChoi Munseok <ms47.choi@samsung.com>
Mon, 8 Apr 2013 04:49:35 +0000 (13:49 +0900)
Change-Id: I3da2dad61eb9fb746b44449bf8d8f345fb89a2dd
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 [changed mode: 0755->0644]
src/ui/inc/FUi_Types.h
src/ui/inc/FUi_Window.h [changed mode: 0755->0644]

index e8a5aee..090bb2e 100644 (file)
@@ -561,12 +561,16 @@ _ControlManager::ActivateWindow(_Window& window)
                _EcoreEvas* pEcoreEvas = ::GetEcoreEvasMgr()->GetEcoreEvas();
                if (pEcoreEvas)
                {
+#if !defined(WINDOW_OWNEE_PREFERRED)
                        window.ChangeLayout(GetOrientation());
                        pEcoreEvas->RotateWindow(window, ::Convert(__orientationStatus));
 //                     window.SetRotation(::Convert(__orientationStatus));
 //                     window.Invalidate(true);
 
                        pEcoreEvas->SetWindowPreferredRotation(window, ::Convert(__orientationStatus));
+#else
+                       pEcoreEvas->SetWindowPreferredRotation(window, ::Convert(__orientationStatus));
+#endif
                }
 #endif
        }
index 72ba409..23d0196 100644 (file)
@@ -2257,6 +2257,7 @@ _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
        int rotation = GetWindowRotation(*pOwnerWindow);
        RotateWindow(ownee, rotation);
 #else
+#if !defined(WINDOW_OWNEE_PREFERRED)
        int* rotations = null;
        unsigned int count = 0;
        Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pOwnerLayer->GetEcoreEvas(), &rotations, &count);
@@ -2280,6 +2281,44 @@ _EcoreEvas::SetOwner(const _Window& ownee, const _Control& owner)
        {
                SetWindowPreferredRotation(ownee, -1);
        }
+#else
+       // Ownee window
+       // 1. IsLayoutChangable : true
+       // 2. IsRotationSynchronized : true
+       // -> available_set
+
+       if ((ownee.IsLayoutChangable() == true) || (ownee.IsRotationSynchronized() == true))
+       {
+               int* rotations = null;
+               unsigned int count = 0;
+               Eina_Bool ret = ecore_evas_wm_rotation_available_rotations_get(pOwnerLayer->GetEcoreEvas(), &rotations, &count);
+               
+               if (ret)
+               {
+                       if (rotations)
+                       {
+                               SetWindowAvailabledRotation(ownee, rotations, count);
+                               free(rotations);
+                       }
+               }
+               
+               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);
+               }
+       }
+       else
+       {
+               int ownerRotation = GetWindowRotation(*pOwnerWindow);
+               SetWindowPreferredRotation(ownee, ownerRotation);
+       }
+#endif
 #endif
 
        SetLastResult(E_SUCCESS);
index b10c828..16a825c 100644 (file)
@@ -517,6 +517,14 @@ _OrientationAgent::FireEvent(OrientationStatus status)
                return;
        }
 
+#if defined(WINDOW_OWNEE_PREFERRED)
+       _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
+       if (!pEcoreEvas)
+       {
+               return;
+       }
+#endif
+
        _ControlOrientation coreOrientation =
                (status == ORIENTATION_STATUS_PORTRAIT || status == ORIENTATION_STATUS_PORTRAIT_REVERSE) ?
                _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
@@ -543,6 +551,34 @@ _OrientationAgent::FireEvent(OrientationStatus status)
        }
 #endif
 
+#if defined(WINDOW_OWNEE_PREFERRED)
+       int owneeCount = pImpl->GetCore().GetOwneeCount();
+       for (int i = 0; i < owneeCount; i++)
+       {
+               _Window* pOwnee = pImpl->GetCore().GetOwnee(i);
+               if (pOwnee)
+               {
+                       pOwnee->ChangeLayout(coreOrientation); // Need to test
+                       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)
+                       {
+                               pOwnee->ChangeLayout(coreOrientation); // Need to test
+                               pEcoreEvas->SetOwner(*pOwnee, *pParent);
+                       }
+               }
+       }
+#endif
+
        // Public
        if (__firePublicEvent && __statusChanged)
        {
@@ -597,6 +633,7 @@ _OrientationAgent::SetRotation(const _Window& window, Orientation orientation)
                break;
        }
 
+#if !defined(WINDOW_OWNEE_PREFERRED)
        // [Ownee]
        // 1. ActivateWindow
        // 2. SetOwner
@@ -631,6 +668,7 @@ _OrientationAgent::SetRotation(const _Window& window, Orientation orientation)
                        }
                }
        }
+#endif
 }
 #endif
 
old mode 100755 (executable)
new mode 100644 (file)
index d84e008..7a37859
@@ -590,12 +590,16 @@ _Window::OnWindowStateChanged(void)
        }
 
        // <3>
+       SysLog(NID_UI, "[Window Manager Rotation] ---------- Update Ownee Window : START ----------");
+
        _ControlOrientation controlOrientation = (rotation == 0 || rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
        ChangeLayout(controlOrientation);
 
        pEcoreEvas->RotateWindow(*this, __rotation);
 
        Invalidate(true);
+
+       SysLog(NID_UI, "[Window Manager Rotation] ---------- Update Ownee Window : END ----------");
 }
 
 void
@@ -609,6 +613,14 @@ _Window::GetPreferredRotation(void) const
 {
        return __preferredRotation;
 }
+
+#if defined(WINDOW_OWNEE_PREFERRED)
+bool
+_Window::IsRotationSynchronized(void) const
+{
+       return false;
+}
+#endif
 #endif
 
 bool
@@ -704,7 +716,11 @@ _Window::_Window()
 #if !defined(WINDOW_BASE_ROTATE)
        , __orientationEnabled(false)
 #else
+#if !defined(WINDOW_OWNEE_PREFERRED)
        , __rotation(0)
+#else
+       , __rotation(-1)
+#endif
        , __preferredRotation(false)
 #endif
 {
index 7aa66b3..a392aa5 100644 (file)
@@ -25,6 +25,7 @@
 
 #define MULTI_WINDOW
 #define WINDOW_BASE_ROTATE
+#define WINDOW_OWNEE_PREFERRED
 
 namespace Tizen { namespace Ui
 {
old mode 100755 (executable)
new mode 100644 (file)
index 7dc15b6..830653b
@@ -96,6 +96,9 @@ public:
        void OnWindowStateChanged(void);
        void SetPreferredRotation(bool enable);
        bool GetPreferredRotation(void) const;
+#if defined(WINDOW_OWNEE_PREFERRED)
+       virtual bool IsRotationSynchronized(void) const;
+#endif
 #else
        void SetOrientationEnabled(bool enable);
        bool IsOrientationEnabled(void);