Adjust the position of the Partial Frame
authorChoi Munseok <ms47.choi@samsung.com>
Tue, 2 Apr 2013 02:25:56 +0000 (11:25 +0900)
committerChoi Munseok <ms47.choi@samsung.com>
Tue, 2 Apr 2013 02:25:56 +0000 (11:25 +0900)
Change-Id: I6a2a36b6fff40b83eeef33b303915d118e9eb621
Signed-off-by: Choi Munseok <ms47.choi@samsung.com>
packaging/osp-uifw.spec
src/CMakeLists.txt
src/ui/FUi_ControlImplManager.cpp
src/ui/FUi_ControlManager.cpp
src/ui/FUi_OrientationAgent.cpp [changed mode: 0755->0644]
src/ui/controls/FUiCtrl_FormImpl.cpp
src/ui/controls/FUiCtrl_FrameImpl.cpp
src/uifw/CMakeLists.txt

index 8e6f70d..d2a3ba8 100644 (file)
@@ -15,6 +15,7 @@ BuildRequires:  pkgconfig(capi-system-device)
 BuildRequires:  pkgconfig(capi-system-runtime-info)
 BuildRequires:  pkgconfig(bundle)
 BuildRequires:  pkgconfig(appcore-common)
+BuildRequires:  pkgconfig(sensor)
 BuildRequires:  pkgconfig(appsvc)
 BuildRequires:  pkgconfig(cairo)
 BuildRequires:  pkgconfig(chromium)
index 6e88f96..ac0630a 100644 (file)
@@ -2,6 +2,7 @@ SET(SLP_INCLUDE_DIRS
      /usr/include 
      /usr/include/appfw
      /usr/include/appcore
+     /usr/include/sensor
      /usr/include/glib-2.0 
      /usr/lib/glib-2.0/include 
      /usr/include/cairo
index c878d70..d2c814d 100644 (file)
@@ -74,7 +74,7 @@ Convert(_ControlRotation rotate, bool allowReverse)
                        status = ORIENTATION_STATUS_PORTRAIT_REVERSE;
                        break;
                case _CONTROL_ROTATION_90:
-                       status =  ORIENTATION_STATUS_LANDSCAPE_REVERSE;
+                       status = ORIENTATION_STATUS_LANDSCAPE_REVERSE;
                        break;
                }
        }
@@ -296,10 +296,10 @@ _ControlImplManager::GetOrientationStatus(Orientation mode) const
        switch (mode)
        {
        case ORIENTATION_PORTRAIT:
-               status =  ORIENTATION_STATUS_PORTRAIT;
+               status = ORIENTATION_STATUS_PORTRAIT;
                break;
        case ORIENTATION_LANDSCAPE:
-               status =  ORIENTATION_STATUS_LANDSCAPE;
+               status = ORIENTATION_STATUS_LANDSCAPE;
                break;
        case ORIENTATION_PORTRAIT_REVERSE:
                status = ORIENTATION_STATUS_PORTRAIT_REVERSE;
index d4be148..4373fa7 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <new>
 #include <app.h>
+#include <sensor.h>
+#include <sensor_accel.h>
 #include <runtime_info.h>
 #include <Ecore_X.h>
 #include <Elementary.h>
@@ -848,10 +850,40 @@ _ControlManager::GetScreenRotation(void) const
        else
        {
 #if defined(WINDOW_BASE_ROTATE)
-               int degree = app_get_device_orientation();
-               SysLog(NID_UI, "[Window Manager Rotation] device_orientation = %d", degree);
+//             int degree = app_get_device_orientation();
 
-               return ::Convert(degree);
+               unsigned long rotationState = 0;
+               int ret = sf_check_rotation(&rotationState);
+               int device_rotation = 0;
+
+               if (ret == 0)
+               {
+                       switch (rotationState)
+                       {
+                       case ROTATION_EVENT_0:
+                               device_rotation = 0;
+                               break;
+                       case ROTATION_EVENT_90:
+                               device_rotation = 270;
+                               break;
+                       case ROTATION_EVENT_180:
+                               device_rotation = 180;
+                               break;
+                       case ROTATION_EVENT_270:
+                               device_rotation = 90;
+                               break;
+                       default:
+                               break;
+                       }
+
+                       SysLog(NID_UI, "[Window Manager Rotation] device_rotation = %d", device_rotation);
+               }
+               else
+               {
+                       SysLog(NID_UI, "[Window Manager Rotation] device_rotation = error");
+               }
+
+               return ::Convert(device_rotation);
 #else
                return __screenRotation;
 #endif
@@ -959,7 +991,7 @@ _ControlManager::RotateScreen(const _Control& control, _ControlRotation screenRo
        if (pRootWindow)
        {
                pEcoreEvas->RotateWindow(*pRootWindow, ::Convert(screenRotation));
-               //pRootWindow->SetRotation(::Convert(screenRotation));
+               pRootWindow->SetRotation(::Convert(screenRotation));
        }
 
 #if !defined(WINDOW_BASE_ROTATE)
old mode 100755 (executable)
new mode 100644 (file)
index 9a245e1..f33c904
@@ -155,6 +155,8 @@ _OrientationAgent::Update(bool draw)
        // Request rotation to window manager -> async -> Update VEs
        // Window(not rotation) -> sync -> UpdateVEs
 
+       SysLog(NID_UI, "[Window Manager Rotation] ---------- Update : START ----------");
+
        _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
        SysAssert(pImplManager);
 
@@ -243,6 +245,8 @@ _OrientationAgent::Update(bool draw)
 
                __draw = draw;
 //     }
+
+       SysLog(NID_UI, "[Window Manager Rotation] ---------- Update : END ----------");
 #else          
        _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
        SysAssert(pImplManager);
@@ -363,6 +367,8 @@ _OrientationAgent::UpdateOrientation(void)
        // Update window bounds
        // Invalidate
 
+       SysLog(NID_UI, "[Window Manager Rotation] ---------- UpdateOrientation : START ----------");
+
        _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
        if (!pEcoreEvas)
        {
@@ -438,6 +444,8 @@ _OrientationAgent::UpdateOrientation(void)
 
        Rectangle bounds = pRootWindow->GetBounds();
        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
 
index 41a1aba..1ae4fd9 100644 (file)
@@ -44,6 +44,7 @@
 #include "FUiCtrl_FooterImpl.h"
 #include "FUiCtrl_Form.h"
 #include "FUiCtrl_Frame.h"
+#include "FUiCtrl_FrameImpl.h"
 #include "FUiCtrl_TabImpl.h"
 #include "FUiCtrl_Indicator.h"
 
@@ -1038,6 +1039,37 @@ _FormImpl::OnChangeLayout(_ControlOrientation orientation)
        const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
        const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
 
+       // Adjust the position of the partial Frame.
+       _FrameImpl* pFrameImpl = dynamic_cast<_FrameImpl*>(GetParent());
+       if (pFrameImpl)
+       {
+               FrameShowMode frameShowMode = pFrameImpl->GetShowMode();
+
+               if ((frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
+               {
+                       bool movable = pFrameImpl->GetCore().IsMovable();
+                       pFrameImpl->GetCore().SetMovable(true);
+               
+                       FloatPoint prevPoint = pFrameImpl->GetPositionF();
+                       FloatPoint curPoint(0.0f, 0.0f);
+               
+                       if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+                       {
+                               curPoint.x = portraitSize.width / portraitSize.height * prevPoint.x;
+                               curPoint.y = portraitSize.height / portraitSize.width * prevPoint.y;
+                       }
+                       else
+                       {
+                               curPoint.x = portraitSize.height / portraitSize.width * prevPoint.x;
+                               curPoint.y = portraitSize.width / portraitSize.height * prevPoint.y;
+                       }
+               
+                       pFrameImpl->SetPosition(curPoint);
+               
+                       pFrameImpl->GetCore().SetMovable(movable);
+               }
+       }
+
        // Change layout.
        _ContainerImpl::OnChangeLayout(orientation);
        SysTryReturnVoidResult(NID_UI_CTRL, GetLastResult() == E_SUCCESS, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
index 3eb40f5..efc339f 100644 (file)
@@ -302,7 +302,9 @@ _FrameImpl::OnChangeLayout(_ControlOrientation orientation)
        SysAssert(pCoreManager);
        const FloatDimension& screenSize = pCoreManager->GetScreenSizeF();
 
-       if (GetCore().GetShowMode() == FRAME_SHOW_MODE_FULL_SCREEN)
+       FrameShowMode frameShowMode = GetCore().GetShowMode();
+
+       if (frameShowMode == FRAME_SHOW_MODE_FULL_SCREEN)
        {
                if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
                {
@@ -313,6 +315,30 @@ _FrameImpl::OnChangeLayout(_ControlOrientation orientation)
                        SetSize(FloatDimension(screenSize.height, screenSize.width));
                }
        }
+       else if ((frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (frameShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
+       {
+               // Adjust the position of the partial Frame.
+               bool movable = IsMovable();
+               SetMovable(true);
+
+               FloatPoint prevPoint = GetPositionF();
+               FloatPoint curPoint(0.0f, 0.0f);
+
+               if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       curPoint.x = screenSize.width / screenSize.height * prevPoint.x;
+                       curPoint.y = screenSize.height / screenSize.width * prevPoint.y;
+               }
+               else
+               {
+                       curPoint.x = screenSize.height / screenSize.width * prevPoint.x;
+                       curPoint.y = screenSize.width / screenSize.height * prevPoint.y;
+               }
+
+               SetPosition(curPoint);
+
+               SetMovable(movable);
+       }
 
        SetResizable(resizable);
 }
index b0953f7..0d8e228 100644 (file)
@@ -58,6 +58,7 @@ TARGET_LINK_LIBRARIES(${this_target} "-losp-speech-tts" )
 TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-application" )
 TARGET_LINK_LIBRARIES(${this_target} "-lappcore-common" )
 TARGET_LINK_LIBRARIES(${this_target} "-lappsvc" )
+TARGET_LINK_LIBRARIES(${this_target} "-lsensor" )
 TARGET_LINK_LIBRARIES(${this_target} "-lelementary" )
 TARGET_LINK_LIBRARIES(${this_target} "-lX11" )
 TARGET_LINK_LIBRARIES(${this_target} "-lXdamage" )