fix window rotation to decide orientation timing
authorwoo <s-w.woo@samsung.com>
Tue, 26 Mar 2013 17:06:07 +0000 (02:06 +0900)
committerwoo <s-w.woo@samsung.com>
Tue, 26 Mar 2013 17:06:17 +0000 (02:06 +0900)
Change-Id: I7ca595a325a7629317209bc7d2ee91b9110d3faf
Signed-off-by: woo <s-w.woo@samsung.com>
src/ui/FUi_OrientationAgent.cpp [changed mode: 0644->0755]
src/ui/FUi_OrientationAgent.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index c308301..16e6a34
@@ -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:
                {
old mode 100644 (file)
new mode 100755 (executable)
index e858eec..39b3263
@@ -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;