void
_EcoreEvas::RotateWindow(const _Window& window, int orientation)
{
-#if defined(WINDOW_BASE_ROTATE)
- return;
-#endif
-
_EflLayer* pLayer = GetEflLayer(window);
if (!pLayer)
{
}
Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
- int currentOrientation = ecore_evas_rotation_get(pEcoreEvas);
- if (currentOrientation == orientation)
+
+ /*
+ int curOrientation = ecore_evas_rotation_get(pEcoreEvas);
+ if (curOrientation == orientation)
{
return;
}
+ */
bool rotatePartial = true;
{
evas_object_resize(pWinObj, rootH, rootW);
}
+
+ SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Rotate bounds(rot = %d).", win, orientation);
}
else
{
evas_object_move(pWinObj, winX, winY);
evas_object_resize(pWinObj, winBounds.width, winBounds.height);
- }
-}
-
-#if defined(WINDOW_BASE_ROTATE)
-void
-_EcoreEvas::UpdateWindowBounds(const _Window& window)
-{
- _EflLayer* pLayer = GetEflLayer(window);
- if (!pLayer)
- {
- return;
- }
-
- bool fullScreen = false;
-
- _Frame* pFrame = dynamic_cast<_Frame*>(const_cast<_Window*>(&window));
- if (pFrame)
- {
- FrameShowMode showMode = pFrame->GetShowMode();
- if (showMode == FRAME_SHOW_MODE_FULL_SCREEN)
- {
- fullScreen = true;
- }
- }
-
- _Window* pWindow = const_cast<_Window*>(&window);
-
- if (pWindow->IsLayoutChangable() == true)
- {
- fullScreen = true;
- }
-
- Evas_Object* pWinObj = pLayer->GetElmWin();
- Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
-
- int rootW = 0;
- int rootH = 0;
- ecore_x_window_size_get(ecore_x_window_root_get(win), &rootW, &rootH);
-
- int rotation = ecore_evas_rotation_get(pLayer->GetEcoreEvas());
-
- if (fullScreen)
- {
- evas_object_move(pWinObj, 0, 0);
-
- if ((rotation == 0) || (rotation == 180))
- {
- evas_object_resize(pWinObj, rootW, rootH);
- }
- else
- {
- evas_object_resize(pWinObj, rootH, rootW);
- }
-
- SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, FULL SCREEN] Update bounds(rot = %d).", win, rotation);
- }
- else
- {
- Rectangle winBounds = _CoordinateSystemUtils::Transform(window.GetBounds());
-
- int winX = winBounds.x;
- int winY = winBounds.y;
-
- switch (rotation)
- {
- case 270:
- winX = rootW - winBounds.y - winBounds.height;
- winY = winBounds.x;
- break;
- case 90:
- winX = winBounds.y;
- winY = rootH - winBounds.x - winBounds.width;
- break;
- case 180:
- winX = rootW - winBounds.x - winBounds.width;
- winY = rootH - winBounds.y - winBounds.height;
- break;
- default:
- break;
- }
-
- evas_object_move(pWinObj, winX, winY);
- evas_object_resize(pWinObj, winBounds.width, winBounds.height);
-
- SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Update bounds(rot = %d, %d, %d, %d, %d).", win, rotation, winX, winY, winBounds.width, winBounds.height);
+ SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, PARTIAL SCREEN] Rotate bounds(rot = %d, %d, %d, %d, %d).", win, orientation, winX, winY, winBounds.width, winBounds.height);
}
}
-#else
+
+#if !defined(WINDOW_BASE_ROTATE)
void
_EcoreEvas::SetWindowOrientationEnabled(const _Window& window, bool enable)
{
_OrientationAgent::Update(bool draw)
{
#if defined(WINDOW_BASE_ROTATE)
+ // Update orientation status(Not Auto-mode)
+ // Request rotation to window manager -> async -> Update VEs
+ // Window(not rotation) -> sync -> UpdateVEs
+
_ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
SysAssert(pImplManager);
return;
}
- // Set window rotation.
- _Form* pForm = dynamic_cast<_Form*>(&(pImpl->GetCore()));
- if (pForm)
+ _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
+ if (!pEcoreEvas)
{
- _Control* pParent = pForm->GetParent();
- if (pParent)
- {
- _Form* pCurrentForm = null;
- int childCount = pParent->GetChildCount();
-
- for (int i = childCount; i > 0; i--)
- {
- _Control* pChild = pParent->GetChild(i - 1);
-
- _Form* pChildForm = dynamic_cast<_Form*>(pChild);
- if (pChildForm)
- {
- if (pChildForm->IsVisible())
- {
- pCurrentForm = pChildForm;
+ return;
+ }
- break;
- }
- }
- }
+ bool autoMode = false;
- // Current Form
- if (pCurrentForm == pForm)
- {
- _Window* pWindow = pForm->GetRootWindow();
- if (pWindow)
- {
- Rectangle bounds = pWindow->GetBounds();
- SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d, Form] Set window rotation with mode(%d).",
- pWindow->GetNativeHandle(), bounds.x, bounds.y, bounds.width, bounds.height, __mode);
- SetRotation(*pWindow, __mode);
- }
+ if ((__mode == ORIENTATION_AUTOMATIC) || (__mode == ORIENTATION_AUTOMATIC_FOUR_DIRECTION))
+ {
+ autoMode = true;
+ }
- int owneeCount = pForm->GetOwneeCount();
- for (int i = 0; i < owneeCount; i++)
- {
- _Window* pOwnee = pForm->GetOwnee(i);
-
- if (pOwnee)
- {
- SetRotation(*pOwnee, __mode);
- }
- }
- }
- }
- else
+// if (autoMode == false)
+// {
+ // [Sync]
+ // Update orientation status
+ // Update VEs
+ // Fire orientation event
+ // Rotate screen
+ // Set preffered rotation
+
+ OrientationStatus status = pImplManager->GetOrientationStatus(__mode);
+
+ if (__updateStatus == true)
{
- switch (__mode)
+ __statusChanged = false;
+ if (__status != status)
{
- 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;
+ __statusChanged = true;
+ __updateStatus = false;
}
}
- }
- else
- {
- _Frame* pFrame = dynamic_cast<_Frame*>(&(pImpl->GetCore()));
-
- if (pFrame)
+
+ __status = status;
+
+ pEcoreEvas->AllowSetWindowBounds(false);
+ FireEvent(status);
+ pEcoreEvas->AllowSetWindowBounds(true);
+
+ // For the form to be made by Ui-Builder
+ if ((draw == true) && (__statusChanged == true))
{
- // Frame which has no forms
- int childCount = pFrame->GetChildCount();
- if (childCount == 0)
+ _ControlOrientation coreOrientation =
+ (status == ORIENTATION_STATUS_PORTRAIT || status == ORIENTATION_STATUS_PORTRAIT_REVERSE) ?
+ _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
+
+ Rectangle temp;
+ bool exist = pImpl->GetBuilderBounds(coreOrientation, temp);
+ if (exist)
{
- Rectangle bounds = pFrame->GetBounds();
- SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d, Frame] Set window rotation with mode(%d).",
- pFrame->GetNativeHandle(), bounds.x, bounds.y, bounds.width, bounds.height, __mode);
- SetRotation(*pFrame, __mode);
-
- int owneeCount = pFrame->GetOwneeCount();
-
- for (int i = 0; i < owneeCount; i++)
- {
- _Window* pOwnee = pFrame->GetOwnee(i);
-
- if (pOwnee)
- {
- SetRotation(*pOwnee, __mode);
- }
- }
+ pImpl->Invalidate(true);
}
}
- }
+
+ // Despite not changing status, it needs to rotate screen.
+ _ControlImpl* pControlImpl = _ControlImpl::GetInstance(__publicControl);
+ pImplManager->RotateScreen(pControlImpl, status);
- __draw = draw;
+ _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
+ if (pRootWindow)
+ {
+ SetRotation(*pRootWindow, __mode);
+ }
+// }
+// else
+// {
+ // [Async]
+ // Set preffered rotation
+
+// _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
+// if (pRootWindow)
+// {
+// SetRotation(*pRootWindow, __mode);
+// }
+
+ __draw = draw;
+// }
#else
_ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
SysAssert(pImplManager);
#if defined(WINDOW_BASE_ROTATE)
void
-_OrientationAgent::UpdateOrientation(bool force)
+_OrientationAgent::UpdateOrientation(void)
{
+ // Get window rotation
+ // Update VEs
+ // Fire orientation event
+ // Update window bounds
+ // Invalidate
+
_EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
if (!pEcoreEvas)
{
return;
}
- int rotation = 0;
-
- _Window* pWindow = pImpl->GetCore().GetRootWindow();
- if (pWindow)
+ _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
+ if (!pRootWindow)
{
- rotation = pEcoreEvas->GetWindowRotation(*pWindow);
+ return;
}
- // Update evas objects.
+ int rotation = pEcoreEvas->GetWindowRotation(*pRootWindow);
OrientationStatus status = ORIENTATION_STATUS_NONE;
switch (rotation)
{
break;
}
- if (force)
- {
- status = __tempStatus;
- }
-
if (__updateStatus == true)
{
__statusChanged = false;
}
}
- _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
- if (pRootWindow)
- {
- pEcoreEvas->UpdateWindowBounds(*pRootWindow);
-
- pImpl->Invalidate(true);
+ pEcoreEvas->RotateWindow(*pRootWindow, rotation);
- Rectangle bounds = pRootWindow->GetBounds();
- SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d] Update VEs to %d degree.",
- pRootWindow->GetNativeHandle(), bounds.x, bounds.y, bounds.width, bounds.height, rotation);
- }
+ pImpl->Invalidate(true);
+
+ 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);
}
#endif
IEventArg* pArg = _PublicOrientationEvent::CreateOrientationEventArgN(*__pPublicEvent->GetSource(), status);
__pPublicEvent->Fire(*pArg);
- _Window* pWindow = pImpl->GetCore().GetRootWindow();
- if (pWindow)
- {
- SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Fire the public orientation event..", pWindow->GetNativeHandle());
- }
-
__updateStatus = true;
}
}
return;
}
- int deviceOrientation = app_get_device_orientation();
- int windowRotation = pEcoreEvas->GetWindowRotation(window);
-
- bool callback = true;
-
- // Decide updating orientation forcibly.
switch (orientation)
{
case ORIENTATION_PORTRAIT:
- {
- pEcoreEvas->SetWindowPreferredRotation(window, 0);
-
- __tempStatus = ORIENTATION_STATUS_PORTRAIT;
- UpdateOrientation(true);
-
- return;
-
- /*
- if ((deviceOrientation == 0) || (windowRotation == 0))
- {
- callback = false;
- }
- */
- }
+ pEcoreEvas->SetWindowPreferredRotation(window, 0);
break;
case ORIENTATION_LANDSCAPE:
- {
- pEcoreEvas->SetWindowPreferredRotation(window, 270);
-
- __tempStatus = ORIENTATION_STATUS_LANDSCAPE;
- UpdateOrientation(true);
-
- return;
-
- /*
- if ((deviceOrientation == 270) || (windowRotation == 270))
- {
- callback = false;
- }
- */
- }
+ pEcoreEvas->SetWindowPreferredRotation(window, 270);
break;
case ORIENTATION_PORTRAIT_REVERSE:
- {
- pEcoreEvas->SetWindowPreferredRotation(window, 180);
-
- __tempStatus = ORIENTATION_STATUS_PORTRAIT_REVERSE;
- UpdateOrientation(true);
-
- return;
-
- /*
- if ((deviceOrientation == 180) || (windowRotation == 180))
- {
- callback = false;
- }
- */
- }
+ pEcoreEvas->SetWindowPreferredRotation(window, 180);
break;
case ORIENTATION_LANDSCAPE_REVERSE:
- {
- pEcoreEvas->SetWindowPreferredRotation(window, 90);
-
- __tempStatus = ORIENTATION_STATUS_LANDSCAPE_REVERSE;
- UpdateOrientation(true);
-
- return;
-
- /*
- if ((deviceOrientation == 90) || (windowRotation == 90))
- {
- callback = false;
- }
- */
- }
+ pEcoreEvas->SetWindowPreferredRotation(window, 90);
break;
case ORIENTATION_AUTOMATIC:
{
pEcoreEvas->SetWindowPreferredRotation(window, -1);
-
int autoRotation[3] = {0, 90, 270};
pEcoreEvas->SetWindowAvailabledRotation(window, autoRotation, 3);
-
- if (deviceOrientation == windowRotation)
- {
- callback = false;
- }
- else
- {
- if (deviceOrientation == 180)
- {
- callback = false;
- }
- }
}
+
break;
case ORIENTATION_AUTOMATIC_FOUR_DIRECTION:
{
pEcoreEvas->SetWindowPreferredRotation(window, -1);
-
int autoFourRotation[4] = {0, 90, 180, 270};
pEcoreEvas->SetWindowAvailabledRotation(window, autoFourRotation, 4);
-
- if (deviceOrientation == windowRotation)
- {
- callback = false;
- }
}
+
break;
default:
break;
}
-
- if (callback == false)
- {
- UpdateOrientation();
- }
}
#endif
void
_Window::OnWindowStateChanged(void)
{
+ // <0>
+ // Update rotation
+ // <1>
+ // Find current form
+ // Call UpdateOrientation
+ // <2>
+ // Find current frame
+ // Call UpdateOrientation
+ // <3>
+ // Find window
+ // Change layout
+ // Rotate window
+
_EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
if (!pEcoreEvas)
{
int rotation = pEcoreEvas->GetWindowRotation(*this);
- Rectangle bounds = GetBounds();
- SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d] OnWindowStateChanged is called with prev rotation(%d) and cur rotation(%d)",
- GetNativeHandle(), bounds.x, bounds.y, bounds.width, bounds.height, __rotation, rotation);
+ 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);
- if (__rotation != rotation)
+ if (rotation == __rotation)
{
- __rotation = rotation;
+ return;
+ }
- int childCount = GetChildCount();
- for (int i = childCount; i > 0; i--)
+ __rotation = rotation;
+
+ // <1>
+ int childCount = GetChildCount();
+ for (int i = childCount; i > 0; i--)
+ {
+ _Control* pChild = GetChild(i - 1);
+
+ _Form* pForm = dynamic_cast<_Form*>(pChild);
+ if (pForm)
{
- _Control* pChild = GetChild(i - 1);
-
- _Form* pForm = dynamic_cast<_Form*>(pChild);
- if (pForm)
+ if (pForm->IsVisible())
{
- if (pForm->IsVisible())
+ // Current Form
+ _FormImpl* pFormImpl = static_cast<_FormImpl*>(pForm->GetUserData());
+ if (pFormImpl)
{
- // Current Form
- _FormImpl* pFormImpl = static_cast<_FormImpl*>(pForm->GetUserData());
- if (pFormImpl)
- {
- pFormImpl->UpdateOrientation();
- }
-
- return;
+ pFormImpl->UpdateOrientation();
}
- }
- }
- if (IsOrientationRoot())
- {
- _FrameImpl* pFrameImpl = static_cast<_FrameImpl*>(GetUserData());
- if (pFrameImpl)
- {
- pFrameImpl->UpdateOrientation();
+ return;
}
}
- else
+ }
+
+ // <2>
+ if (IsOrientationRoot())
+ {
+ _FrameImpl* pFrameImpl = static_cast<_FrameImpl*>(GetUserData());
+ if (pFrameImpl)
{
- _ControlOrientation controlOrientation = (rotation == 0 || rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
- ChangeLayout(controlOrientation);
- pEcoreEvas->UpdateWindowBounds(*this);
+ pFrameImpl->UpdateOrientation();
}
+
+ return;
}
+
+ // <3>
+ _ControlOrientation controlOrientation = (rotation == 0 || rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
+ ChangeLayout(controlOrientation);
+
+ pEcoreEvas->RotateWindow(*this, __rotation);
}
#endif
return false;
}
+#if defined(WINDOW_BASE_ROTATE)
+void
+_Window::SetRotation(int rotation)
+{
+ __rotation = rotation;
+}
+#endif
+
void
_Window::OnChangeLayout(_ControlOrientation orientation)
{