From 95ed90e52b0d536a1195d15f4948cfa73f3aa624 Mon Sep 17 00:00:00 2001 From: Choi Munseok Date: Mon, 8 Apr 2013 13:49:35 +0900 Subject: [PATCH] Fix Rotation for ownee windows Change-Id: I3da2dad61eb9fb746b44449bf8d8f345fb89a2dd Signed-off-by: Choi Munseok --- src/ui/FUi_ControlManager.cpp | 4 ++++ src/ui/FUi_EcoreEvas.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/ui/FUi_OrientationAgent.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/ui/FUi_Window.cpp | 16 ++++++++++++++++ src/ui/inc/FUi_Types.h | 1 + src/ui/inc/FUi_Window.h | 3 +++ 6 files changed, 101 insertions(+) mode change 100755 => 100644 src/ui/FUi_Window.cpp mode change 100755 => 100644 src/ui/inc/FUi_Window.h diff --git a/src/ui/FUi_ControlManager.cpp b/src/ui/FUi_ControlManager.cpp index e8a5aee..090bb2e 100644 --- a/src/ui/FUi_ControlManager.cpp +++ b/src/ui/FUi_ControlManager.cpp @@ -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 } diff --git a/src/ui/FUi_EcoreEvas.cpp b/src/ui/FUi_EcoreEvas.cpp index 72ba409..23d0196 100644 --- a/src/ui/FUi_EcoreEvas.cpp +++ b/src/ui/FUi_EcoreEvas.cpp @@ -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); diff --git a/src/ui/FUi_OrientationAgent.cpp b/src/ui/FUi_OrientationAgent.cpp index b10c828..16a825c 100644 --- a/src/ui/FUi_OrientationAgent.cpp +++ b/src/ui/FUi_OrientationAgent.cpp @@ -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 diff --git a/src/ui/FUi_Window.cpp b/src/ui/FUi_Window.cpp old mode 100755 new mode 100644 index d84e008..7a37859 --- a/src/ui/FUi_Window.cpp +++ b/src/ui/FUi_Window.cpp @@ -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 { diff --git a/src/ui/inc/FUi_Types.h b/src/ui/inc/FUi_Types.h index 7aa66b3..a392aa5 100644 --- a/src/ui/inc/FUi_Types.h +++ b/src/ui/inc/FUi_Types.h @@ -25,6 +25,7 @@ #define MULTI_WINDOW #define WINDOW_BASE_ROTATE +#define WINDOW_OWNEE_PREFERRED namespace Tizen { namespace Ui { diff --git a/src/ui/inc/FUi_Window.h b/src/ui/inc/FUi_Window.h old mode 100755 new mode 100644 index 7dc15b6..830653b --- a/src/ui/inc/FUi_Window.h +++ b/src/ui/inc/FUi_Window.h @@ -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); -- 2.7.4