Change layout when orientation is changed
authorjisun10.lee <jisun10.lee@samsung.com>
Wed, 19 Mar 2014 09:06:25 +0000 (18:06 +0900)
committerjisun10.lee <jisun10.lee@samsung.com>
Wed, 19 Mar 2014 09:06:25 +0000 (18:06 +0900)
Change-Id: I89a30e56e161fdbb80607365c8dbfe7238794205
Signed-off-by: jisun10.lee <jisun10.lee@samsung.com>
src/ui/FUi_ControlManager.cpp
src/ui/FUi_OrientationAgent.cpp
src/ui/FUi_Window.cpp
src/ui/FUi_XUiEventManager.cpp
src/ui/animations/platform/FUiAnim_EcoreXLooper.cpp
src/ui/controls/FUiCtrl_FormImpl.cpp
src/ui/controls/FUiCtrl_Indicator.cpp
src/ui/inc/FUiCtrl_Indicator.h
src/ui/inc/FUi_Window.h
src/uifw/CMakeLists.txt

index 2be2220..100f173 100644 (file)
@@ -931,7 +931,6 @@ _ControlManager::SetOrientation(_ControlOrientation orientation)
 _ControlRotation
 _ControlManager::GetScreenRotation(void) const
 {
-#ifdef BUILD_BREAK
        bool autoRotate = true;
        int ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_AUTO_ROTATION_ENABLED, &autoRotate);
 
@@ -979,12 +978,7 @@ _ControlManager::GetScreenRotation(void) const
                                        _Window* pCurrentFrame = GetCurrentFrame();
                                        if (pCurrentFrame)
                                        {
-                                               _EcoreEvas* pEcoreEvas = ::GetEcoreEvasMgr()->GetEcoreEvas();
-                                               if (pEcoreEvas)
-                                               {
-                                                       SysLog(NID_UI, "[Window Manager Rotation] ROTATION_UNKNOWN");
-                                                       device_rotation = pEcoreEvas->GetWindowRotation(*pCurrentFrame);
-                                               }
+                                               device_rotation = pCurrentFrame->GetRotation();
                                        }
                                }
                                break;
@@ -1000,8 +994,7 @@ _ControlManager::GetScreenRotation(void) const
                }
 
                return ::Convert(device_rotation);
-       }
-#endif 
+       }       
 }
 
 void
index c495ce7..7d3251a 100644 (file)
@@ -208,11 +208,11 @@ _OrientationAgent::Update(bool draw)
                }
 
                __status = status;
-#ifdef BUILD_BREAK
-               pEcoreEvas->AllowSetWindowBounds(false);
+
+        //pEcoreEvas->AllowSetWindowBounds(false);
                FireEvent(status);
-               pEcoreEvas->AllowSetWindowBounds(true);
-#endif         
+        //pEcoreEvas->AllowSetWindowBounds(true);
+
                // For the form to be made by Ui-Builder
                if ((draw == true) && (__statusChanged == true))
                {
@@ -265,12 +265,6 @@ _OrientationAgent::UpdateOrientation(void)
        // Invalidate
 
        SysLog(NID_UI, "[Window Manager Rotation] ---------- UpdateOrientation : START ----------");
-#ifdef BUILD_BREAK
-       _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
-       if (!pEcoreEvas)
-       {
-               return;
-       }
 
        _ControlImpl* pImpl = _ControlImpl::GetInstance(__publicControl);
        if (!pImpl)
@@ -284,7 +278,7 @@ _OrientationAgent::UpdateOrientation(void)
                return;
        }
 
-       int rotation = pEcoreEvas->GetWindowRotation(*pRootWindow);
+       int rotation = pRootWindow->GetRotation();
        OrientationStatus status = ORIENTATION_STATUS_NONE;
        switch (rotation)
        {
@@ -316,9 +310,9 @@ _OrientationAgent::UpdateOrientation(void)
 
        __status = status;
 
-       pEcoreEvas->AllowSetWindowBounds(false);
+       //pEcoreEvas->AllowSetWindowBounds(false);
        FireEvent(status, true);
-       pEcoreEvas->AllowSetWindowBounds(true);
+       //pEcoreEvas->AllowSetWindowBounds(true);
 
        // For the form to be made by Ui-Builder
        if ((__draw == true) && (__statusChanged == true))
@@ -335,7 +329,7 @@ _OrientationAgent::UpdateOrientation(void)
                }
        }
 
-       pEcoreEvas->RotateWindow(*pRootWindow, rotation, false);
+       //pEcoreEvas->RotateWindow(*pRootWindow, rotation, false);
 
        if (__statusChanged == true)
        {
@@ -352,7 +346,7 @@ _OrientationAgent::UpdateOrientation(void)
        SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, rot = %d, %d, %d, %d, %d] Update Orientation.", pRootWindow->GetNativeHandle(), rotation, bounds.x, bounds.y, bounds.width, bounds.height);
 
        SysLog(NID_UI, "[Window Manager Rotation] ---------- UpdateOrientation : END ----------");
-#endif 
+
 }
 
 void
index 732a28c..d3b3fc1 100644 (file)
@@ -698,9 +698,8 @@ _Window::OnDetachingFromMainTree(void)
 }
 
 void
-_Window::OnOrientationChanged(void)
+_Window::OnOrientationChanged(int orientation)
 {
-#ifdef BUILD_BREAK
        // <0>
        // Update rotation
        // <1>
@@ -715,23 +714,21 @@ _Window::OnOrientationChanged(void)
        // Rotate window
 
        SetOrientationCallbackModeEnabled(true);
-       _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
-       if (!pEcoreEvas)
-       {
-               return;
-       }
-
-       int rotation = pEcoreEvas->GetWindowRotation(*this);
 
        Rectangle winBounds = GetBounds();
-       SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d] OnWindowStateChanged : prev rot = %d, cur rot = %d", GetNativeHandle(), winBounds.x, winBounds.y, winBounds.width, winBounds.height, __rotation, rotation);
+       SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d] OnOrientationChanged : prev rot = %d, cur rot = %d", GetNativeHandle(), winBounds.x, winBounds.y, winBounds.width, winBounds.height, __rotation, orientation);
 
-       if (rotation == __rotation)
+       if (orientation == __rotation)
        {
                return;
        }
 
-       __rotation = rotation;
+       __rotation = orientation;
+
+       if (__pLayer)
+       {
+               __pLayer->SetOrientationChanged(__rotation);
+       }
 
        // <1>
        int childCount = GetChildCount();
@@ -771,11 +768,11 @@ _Window::OnOrientationChanged(void)
        // <3>
        SysLog(NID_UI, "[Window Manager Rotation] ---------- Update Ownee Window : START ----------");
 
-       _ControlOrientation controlOrientation = (rotation == 0 || rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
+       _ControlOrientation controlOrientation = (__rotation == 0 || __rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
        ChangeLayout(controlOrientation, false);
 
        _ControlRotation controlRotation = _CONTROL_ROTATION_0;
-       switch (rotation)
+       switch (__rotation)
        {
                case 0:
                        controlRotation = _CONTROL_ROTATION_0;
@@ -792,15 +789,16 @@ _Window::OnOrientationChanged(void)
                default:
                        break;
        }
+
        ChangeLayout(controlRotation);
 
-       pEcoreEvas->RotateWindow(*this, __rotation, false);
+       //pEcoreEvas->RotateWindow(*this, __rotation, false);
 
        Invalidate(true);
 
        SysLog(NID_UI, "[Window Manager Rotation] ---------- Update Ownee Window : END ----------");
        SetOrientationCallbackModeEnabled(false);
-#endif
+
 }
 
 void
@@ -849,6 +847,12 @@ _Window::SetRotation(int rotation)
        __rotation = rotation;
 }
 
+int
+_Window::GetRotation(void)
+{
+       return __rotation;
+}
+
 _WindowType
 _Window::GetWindowType(void)
 {
index b9bf516..ac88041 100644 (file)
@@ -866,7 +866,7 @@ public:
                                        
                                                if (rawEvent.rawWindow == pWindow->GetNativeHandle())
                                                {
-                                                       pWindow->OnOrientationChanged();
+                                                       pWindow->OnOrientationChanged(rawEvent.data.rotate.angle);
                                                        break;
                                                }
                                        }
index b58fe89..f69798d 100644 (file)
@@ -378,8 +378,6 @@ OnClientMessageReceived(void* pData, int type, void* pEventInfo)
 
                                        pEcoreXWindow->SetOrientation(rotationInfo);
                                }
-
-                               pGlLayer->SetOrientationChanged(pEvent->data.l[1]);
                        }
 
                        _RawEvent rawEvent;
index 11ea9e5..abbc3b9 100644 (file)
@@ -1229,6 +1229,7 @@ _FormImpl::OnChangeLayout(_ControlOrientation orientation)
        {
                if (pIndicator)
                {
+                       pIndicator->SetIndicatorOrientation(orientation);
                        if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
                        {
                                pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight));
@@ -1255,12 +1256,12 @@ _FormImpl::OnChangeLayout(_ControlOrientation orientation)
        {
                GetCore().SetIndicatorShowState(false);
        }
+
        if (pIndicator)
        {
                pIndicator->OnChangeLayout(orientation);
        }
 
-
        float adjHeight = 0.0f;
 
        if (GetCore().HasHeader())
index 18a7795..c041f9b 100644 (file)
@@ -28,6 +28,7 @@
 #include "FUiCtrl_Form.h"
 #include "FUiCtrl_Indicator.h"
 #include "FUiAnim_ControlVisualElement.h"
+#include "FUi_UiEventManager.h"
 
 using namespace Tizen::Base::Runtime;
 using namespace Tizen::Graphics;
@@ -75,6 +76,7 @@ _Indicator::_Indicator(void)
 _Indicator::~_Indicator(void)
 {
        _IndicatorManager::GetInstance()->RemoveIndicatorSurfaceEventListener(this);
+       //_UiEventManager::GetInstance()->RemoveTouchEventListener(*this);
 }
 
 result
@@ -142,6 +144,8 @@ _Indicator::AddIndicatorObject(_Control* pControl, _Window* pWindow)
                }
        }
 
+       //_UiEventManager::GetInstance()->AddTouchEventListener(*this);
+
        return r;
 }
 
@@ -430,6 +434,12 @@ _Indicator::GetIndicatorAutoHide(void) const
        }
 }
 
+void
+_Indicator::SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation)
+{
+       __orientation = orientation;
+}
+
 result
 _Indicator::SetNotificationTrayOpenEnabled(bool enable)
 {
index 625826c..fc3898b 100644 (file)
@@ -30,6 +30,7 @@
 #include "FUi_UiTouchEvent.h"
 #include "FUiAnim_ControlVisualElement.h"
 #include "FUiCtrl_IndicatorManager.h"
+#include "FUi_ITouchEventListener.h"
 
 namespace Tizen { namespace Ui { namespace Controls {
 enum _IndicatorOpacity
@@ -43,6 +44,7 @@ enum _IndicatorOpacity
 class _Indicator
        : public Tizen::Ui::Animations::_ControlVisualElement
        , public _IIndicatorSurfaceEventListener
+       , public Tizen::Ui::_ITouchEventListener
 {
 public:
        _Indicator(void);
@@ -61,19 +63,21 @@ public:
        void SetIndicatorAutoHide(bool portrait, bool landscape);
        bool GetIndicatorAutoHide(void) const;
 
+       void SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation);
+
        result SetNotificationTrayOpenEnabled(bool enable);
        bool IsNotificationTrayOpenEnabled(void) const;
 
-
        virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
        virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
        virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
        virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
+
        virtual bool OnFocusGained(const _Control& source);
        virtual bool OnFocusLost(const _Control& source);
 
        void OnChangeLayout(_ControlOrientation orientation);
-    result OnAttachedToMainTree(void);
+       result OnAttachedToMainTree(void);
        
        virtual void OnPortraitSurfaceContentUpdated(void);
        virtual void OnLandscapeSurfaceContentUpdated(void);
index 56e7e85..fa8e5e6 100644 (file)
@@ -83,6 +83,7 @@ public:
        virtual result CreateLayer(void);
        virtual bool IsLayoutChangable(void) const;
        void SetRotation(int rotation);
+       int GetRotation(void);
        _WindowType GetWindowType(void);
 
 // Focus
@@ -100,7 +101,7 @@ public:
        virtual result OnAttachingToMainTree(const _Control* pParent);
        virtual result OnDetachingFromMainTree(void);
        virtual void OnFocusableStateChanged(bool focusalbeState);
-       virtual void OnOrientationChanged(void);
+       virtual void OnOrientationChanged(int orientation);
        virtual void OnTouchCaptureGained(void);
        virtual void OnTouchCaptureLost(void);
        void SetPreferredRotation(bool enable);
index 4609df8..0cbfeb2 100644 (file)
@@ -59,6 +59,7 @@ TARGET_LINK_LIBRARIES(${this_target} "-losp-image-core" )
 TARGET_LINK_LIBRARIES(${this_target} "-lappcore-common" )
 TARGET_LINK_LIBRARIES(${this_target} "-lappcore-efl" )
 TARGET_LINK_LIBRARIES(${this_target} "-lappsvc" )
+TARGET_LINK_LIBRARIES(${this_target} "-lsensor" )
 TARGET_LINK_LIBRARIES(${this_target} "-lX11" )
 TARGET_LINK_LIBRARIES(${this_target} "-lXdamage" )
 TARGET_LINK_LIBRARIES(${this_target} "-lvconf" )