void LoadingState::animationsFinished()
{
	CardWindow* activeWin = m_wm->activeWindow();
	if (activeWin && activeWin->addedToWindowManager()) {
		m_wm->maximizeActiveWindow(!lastWindowAddedType());
	}
}
void MaximizeState::finishMaximizingActiveWindow()
{
	// set the active windows' size to the positive space

	CardWindow* activeWin = m_wm->activeWindow();

        if(activeWin){
            activeWin->setMaxAndLoading(1);
        }
	if (activeWin && activeWin->addedToWindowManager()) {
                // allow direct rendering if no one has requested it to be disabled - Do this only if the window is NOT a modal window
		if(WindowType::Type_ModalChildWindowCard != activeWin->type()) {
			const QRect& r = m_wm->targetPositiveSpace();
            resizeWindow(activeWin, r.width(), r.height());

			if (m_disableDirectRendering == 0) {
				if(false == m_wm->isModalDismissed()) {
					SystemUiController::instance()->setDirectRenderingForWindow(SystemUiController::CARD_WINDOW_MANAGER, activeWin, true);
				}
				else {
					m_wm->setModalDismissed(false);
				}
			}
		}

		if (G_UNLIKELY(Settings::LunaSettings()->perfTesting)) {
			// NOV-97107, hook for automated performance testing
			g_message("SYSMGR PERF: STATE MAXIMIZED appid: %s, processid: %s, type: %s, time: %d",
				activeWin->appId().c_str(),
				activeWin->processId().c_str(),
				activeWin->isHost() ? "host" : "card",
				Time::curTimeMs());
		}
	}
}
void LoadingState::onExit(QEvent* event)
{
    CardWindowManagerState::onExit(event);

	// in case we exit the Loading state during the maximizing animation
	CardWindow* activeWin = m_wm->activeWindow();
	if (activeWin && activeWin->addedToWindowManager()) {

		activeWin->stopLoadingOverlay();
	}
}