, __pPublicEvent(null)
, __mode(ORIENTATION_PORTRAIT)
, __status(ORIENTATION_STATUS_PORTRAIT)
+ , __tempStatus(ORIENTATION_STATUS_PORTRAIT)
, __firePublicEvent(false)
, __statusChanged(false)
, __updateStatus(true)
_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);
- }
- }
+// if (autoMode == false)
+// {
+ // [Sync]
+ // Update orientation status
+ // Update VEs
+ // Fire orientation event
+ // Rotate screen
+ // Set preffered rotation
+
+ OrientationStatus status = pImplManager->GetOrientationStatus(__mode);
+ SysLog(NID_UI, "[Window Manager Rotation] Update : __mode(%d) -> status(%d)", __mode, status);
+
+ if (__updateStatus == true)
+ {
+ __statusChanged = false;
+ if (__status != status)
+ {
+ __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);
void
_OrientationAgent::UpdateOrientation(void)
{
+ // Get window rotation
+ // Update VEs
+ // Fire orientation event
+ // Update window bounds
+ // Invalidate
+
_EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
if (!pEcoreEvas)
{
return;
}
- int rotation = pEcoreEvas->GetWindowRotation(*(pImpl->GetCore().GetRootWindow()));
+ _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
+ if (!pRootWindow)
+ {
+ return;
+ }
- // Update evas objects.
+ int rotation = pEcoreEvas->GetWindowRotation(*pRootWindow);
OrientationStatus status = ORIENTATION_STATUS_NONE;
switch (rotation)
{
}
}
- _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);
- _ControlImpl* pImpl = _ControlImpl::GetInstance(__publicControl);
- if (pImpl)
- {
- _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;
}
}
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);
-
- if ((deviceOrientation == 0) || (windowRotation == 0))
- {
- callback = false;
- }
-
break;
case ORIENTATION_LANDSCAPE:
pEcoreEvas->SetWindowPreferredRotation(window, 270);
-
- if ((deviceOrientation == 270) || (windowRotation == 270))
- {
- callback = false;
- }
-
break;
case ORIENTATION_PORTRAIT_REVERSE:
pEcoreEvas->SetWindowPreferredRotation(window, 180);
-
- if ((deviceOrientation == 180) || (windowRotation == 180))
- {
- callback = false;
- }
-
break;
case ORIENTATION_LANDSCAPE_REVERSE:
pEcoreEvas->SetWindowPreferredRotation(window, 90);
-
- if ((deviceOrientation == 90) || (windowRotation == 90))
- {
- callback = false;
- }
-
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)
+ // [Ownee]
+ // 1. ActivateWindow
+ // 2. SetOwner
+ // 3. SetRotation
+
+ _ControlImpl* pImpl = _ControlImpl::GetInstance(__publicControl);
+ if (!pImpl)
+ {
+ return;
+ }
+
+ int owneeCount = pImpl->GetCore().GetOwneeCount();
+ for (int i = 0; i < owneeCount; i++)
{
- UpdateOrientation();
+ _Window* pOwnee = pImpl->GetCore().GetOwnee(i);
+ if (pOwnee)
+ {
+ pEcoreEvas->SetOwner(*pOwnee, pImpl->GetCore());
+ }
+ }
+
+ _Control* pParent = pImpl->GetCore().GetParent();
+ if (pParent)
+ {
+ int owneeCount = pParent->GetOwneeCount();
+ for (int i = 0; i < owneeCount; i++)
+ {
+ _Window* pOwnee = pParent->GetOwnee(i);
+ if (pOwnee)
+ {
+ pEcoreEvas->SetOwner(*pOwnee, *pParent);
+ }
+ }
}
}
#endif