From 351a78a55104b9a884a0edc892a864d98cc0b110 Mon Sep 17 00:00:00 2001 From: woo Date: Wed, 27 Mar 2013 02:51:37 +0900 Subject: [PATCH] fix window rotation to decide orientation timing Change-Id: Ia87638c46efbdf2894eedbeb6bb453bfe7ffa26d Signed-off-by: woo --- src/ui/FUi_OrientationAgent.cpp | 128 +++++++++++++++++++++++++++++++++------- src/ui/FUi_OrientationAgent.h | 3 +- 2 files changed, 108 insertions(+), 23 deletions(-) mode change 100644 => 100755 src/ui/FUi_OrientationAgent.cpp mode change 100644 => 100755 src/ui/FUi_OrientationAgent.h diff --git a/src/ui/FUi_OrientationAgent.cpp b/src/ui/FUi_OrientationAgent.cpp old mode 100644 new mode 100755 index c308301..16e6a34 --- a/src/ui/FUi_OrientationAgent.cpp +++ b/src/ui/FUi_OrientationAgent.cpp @@ -74,6 +74,7 @@ _OrientationAgent::_OrientationAgent(Control& publicControl) , __pPublicEvent(null) , __mode(ORIENTATION_PORTRAIT) , __status(ORIENTATION_STATUS_PORTRAIT) + , __tempStatus(ORIENTATION_STATUS_PORTRAIT) , __firePublicEvent(false) , __statusChanged(false) , __updateStatus(true) @@ -209,6 +210,46 @@ _OrientationAgent::Update(bool draw) } } } + else + { + switch (__mode) + { + 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; + } + } } else { @@ -353,7 +394,7 @@ _OrientationAgent::Update(bool draw) #if defined(WINDOW_BASE_ROTATE) void -_OrientationAgent::UpdateOrientation(void) +_OrientationAgent::UpdateOrientation(bool force) { _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); if (!pEcoreEvas) @@ -367,7 +408,13 @@ _OrientationAgent::UpdateOrientation(void) return; } - int rotation = pEcoreEvas->GetWindowRotation(*(pImpl->GetCore().GetRootWindow())); + int rotation = 0; + + _Window* pWindow = pImpl->GetCore().GetRootWindow(); + if (pWindow) + { + rotation = pEcoreEvas->GetWindowRotation(*pWindow); + } // Update evas objects. OrientationStatus status = ORIENTATION_STATUS_NONE; @@ -389,6 +436,11 @@ _OrientationAgent::UpdateOrientation(void) break; } + if (force) + { + status = __tempStatus; + } + if (__updateStatus == true) { __statusChanged = false; @@ -566,40 +618,72 @@ _OrientationAgent::SetRotation(const _Window& window, Orientation orientation) switch (orientation) { case ORIENTATION_PORTRAIT: - pEcoreEvas->SetWindowPreferredRotation(window, 0); - - if ((deviceOrientation == 0) || (windowRotation == 0)) { - callback = false; + pEcoreEvas->SetWindowPreferredRotation(window, 0); + + __tempStatus = ORIENTATION_STATUS_PORTRAIT; + UpdateOrientation(true); + + return; + + /* + if ((deviceOrientation == 0) || (windowRotation == 0)) + { + callback = false; + } + */ } - break; case ORIENTATION_LANDSCAPE: - pEcoreEvas->SetWindowPreferredRotation(window, 270); - - if ((deviceOrientation == 270) || (windowRotation == 270)) { - callback = false; + pEcoreEvas->SetWindowPreferredRotation(window, 270); + + __tempStatus = ORIENTATION_STATUS_LANDSCAPE; + UpdateOrientation(true); + + return; + + /* + if ((deviceOrientation == 270) || (windowRotation == 270)) + { + callback = false; + } + */ } - break; case ORIENTATION_PORTRAIT_REVERSE: - pEcoreEvas->SetWindowPreferredRotation(window, 180); - - if ((deviceOrientation == 180) || (windowRotation == 180)) { - callback = false; - } + pEcoreEvas->SetWindowPreferredRotation(window, 180); + __tempStatus = ORIENTATION_STATUS_PORTRAIT_REVERSE; + UpdateOrientation(true); + + return; + + /* + if ((deviceOrientation == 180) || (windowRotation == 180)) + { + callback = false; + } + */ + } break; case ORIENTATION_LANDSCAPE_REVERSE: - pEcoreEvas->SetWindowPreferredRotation(window, 90); - - if ((deviceOrientation == 90) || (windowRotation == 90)) { - callback = false; + pEcoreEvas->SetWindowPreferredRotation(window, 90); + + __tempStatus = ORIENTATION_STATUS_LANDSCAPE_REVERSE; + UpdateOrientation(true); + + return; + + /* + if ((deviceOrientation == 90) || (windowRotation == 90)) + { + callback = false; + } + */ } - break; case ORIENTATION_AUTOMATIC: { diff --git a/src/ui/FUi_OrientationAgent.h b/src/ui/FUi_OrientationAgent.h old mode 100644 new mode 100755 index e858eec..39b3263 --- a/src/ui/FUi_OrientationAgent.h +++ b/src/ui/FUi_OrientationAgent.h @@ -52,7 +52,7 @@ public: void Update(bool draw = false); #if defined(WINDOW_BASE_ROTATE) - void UpdateOrientation(void); + void UpdateOrientation(bool force = false); #endif void RequestOrientationEvent(void); @@ -74,6 +74,7 @@ private: _PublicOrientationEvent* __pPublicEvent; Orientation __mode; OrientationStatus __status; + OrientationStatus __tempStatus; bool __firePublicEvent; bool __statusChanged; bool __updateStatus; -- 2.7.4