display_window.cpp revision 5a96feeef6545e3b78a0e84669406a9ee2c8da2f
/* $Id$ */
/** @file
* Presenter API: CrFbDisplayWindow class implementation -- display content into host GUI window.
*/
/*
* Copyright (C) 2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "server_presenter.h"
mu32Screen(~0),
{
}
{
if (mpWindow)
delete mpWindow;
}
{
if (RT_SUCCESS(rc))
{
if (RT_SUCCESS(rc))
return VINF_SUCCESS;
else
{
WARN(("err"));
if (mpWindow)
}
}
else
WARN(("err"));
return rc;
}
{
if (mpWindow)
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
int CrFbDisplayWindow::EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return screenChanged();
}
{
return &mViewportRect;
}
{
if (!isUpdating())
{
WARN(("not updating!"));
return VERR_INVALID_STATE;
}
// always call SetPosition to ensure window is adjustep properly
// if (pViewportRect->xLeft != mViewportRect.xLeft || pViewportRect->yTop != mViewportRect.yTop)
if (mpWindow)
{
int rc = mpWindow->SetPosition(pRect->xLeft - pViewportRect->xLeft, pRect->yTop - pViewportRect->yTop);
if (!RT_SUCCESS(rc))
{
WARN(("SetPosition failed"));
return rc;
}
}
return VINF_SUCCESS;
}
{
if (isUpdating())
{
WARN(("updating!"));
return NULL;
}
if (mpWindow)
{
if (fCleanup)
}
return pWindow;
}
{
if (isUpdating())
{
WARN(("updating!"));
return NULL;
}
if (mpWindow)
windowDetach();
if (pNewWindow)
windowSync();
return mpWindow;
}
{
if (!isUpdating())
{
WARN(("not updating!"));
return VERR_INVALID_STATE;
}
int rc = VINF_SUCCESS;
{
if (!RT_SUCCESS(rc))
WARN(("window reparent failed"));
}
return rc;
}
bool CrFbDisplayWindow::isVisible()
{
if (!hFb)
return false;
return !CrVrScrCompositorIsEmpty(pCompositor);
}
{
{
return VINF_SUCCESS;
}
int rc = VINF_SUCCESS;
if (mpWindow)
{
if (RT_SUCCESS(rc))
{
if (!RT_SUCCESS(rc))
}
else
}
return rc;
}
{
return mpWindow;
}
void CrFbDisplayWindow::onUpdateEnd()
{
{
crVBoxServerNotifyEvent(mu32Screen, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA, &fVisible, sizeof(fVisible));
}
}
void CrFbDisplayWindow::ueRegions()
{
if (mpWindow)
}
int CrFbDisplayWindow::screenChanged()
{
if (!isUpdating())
{
WARN(("not updating!"));
return VERR_INVALID_STATE;
}
int rc = windowDimensionsSync();
if (!RT_SUCCESS(rc))
{
return rc;
}
return VINF_SUCCESS;
}
{
if (!mpWindow)
return VINF_SUCCESS;
if (fSet)
{
}
}
int CrFbDisplayWindow::windowCleanup()
{
if (!mpWindow)
return VINF_SUCCESS;
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = windowDimensionsSync(true);
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = windowSetCompositor(false);
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return VINF_SUCCESS;
}
int CrFbDisplayWindow::fbCleanup()
{
int rc = windowCleanup();
if (!RT_SUCCESS(rc))
{
WARN(("windowCleanup failed"));
return rc;
}
return CrFbDisplayBase::fbCleanup();
}
bool CrFbDisplayWindow::isActive()
{
}
{
int rc = VINF_SUCCESS;
if (!mpWindow)
return VINF_SUCCESS;
//HCR_FRAMEBUFFER hFb = getFramebuffer();
if (!fForceCleanup && isActive())
{
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = mpWindow->SetSize((uint32_t)(pRect->xRight - pRect->xLeft), (uint32_t)(pRect->yBottom - pRect->yTop));
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
else
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
#if 0
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
#endif
}
return rc;
}
int CrFbDisplayWindow::windowSync()
{
if (!mpWindow)
return VINF_SUCCESS;
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = windowSetCompositor(true);
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = windowDimensionsSync();
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
return rc;
}
int CrFbDisplayWindow::fbSync()
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
rc = windowSync();
if (!RT_SUCCESS(rc))
{
return rc;
}
if (CrFbHas3DData(hFb))
{
{
if (!RT_SUCCESS(rc))
{
WARN(("err"));
return rc;
}
}
}
return VINF_SUCCESS;
}
{
return CrVrScrCompositorRectGet(pCompositor);
}