VMControl.cpp revision 99f34065aa871a12e9afacbaf27bd9dc9ff8d0bb
/** @file
*
* VBox frontends: Basic Frontend (BFE):
* VBoxBFE VM control routines
*
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#include "DisplayImpl.h"
#include "ConsoleImpl.h"
#include "VBoxBFE.h"
#include "VMControl.h"
/**
* Fullscreen / Windowed toggle.
*/
int
VMCtrlToggleFullscreen(void)
{
/* not allowed */
if (!gfAllowFullscreenToggle)
return VERR_ACCESS_DENIED;
/*
* screen repaint, just to be sure.
*/
return VINF_SUCCESS;
}
/**
* Pause the VM.
*/
int
VMCtrlPause(void)
{
if (machineState != VMSTATE_RUNNING)
return VERR_VM_INVALID_VM_STATE;
if (gConsole->inputGrabbed())
gConsole->inputGrabEnd();
return VINF_SUCCESS;
}
/**
* Resume the VM.
*/
int
VMCtrlResume(void)
{
if (machineState != VMSTATE_SUSPENDED)
return VERR_VM_INVALID_VM_STATE;
return VINF_SUCCESS;
}
/**
* Reset the VM
*/
int
VMCtrlReset(void)
{
return VINF_SUCCESS;
}
/**
* Send ACPI power button press event
*/
int
VMCtrlACPIPowerButton(void)
{
if (RT_SUCCESS (vrc))
{
}
return VINF_SUCCESS;
}
/**
* Send ACPI sleep button press event
*/
int
VMCtrlACPISleepButton(void)
{
if (RT_SUCCESS (vrc))
{
}
return VINF_SUCCESS;
}
/**
* Worker thread while saving the VM
*/
{
int rc;
startProgressInfo("Saving");
(PFNRT)VMR3Save, 5, gpVM, g_pszStateFile, false /*fContinueAftewards*/, &callProgressInfo, (uintptr_t)NULL);
pfnQuit();
return VINF_SUCCESS;
}
/*
* Save the machine's state
*/
int
VMCtrlSave(void (*pfnQuit)(void))
{
int rc;
if (!g_pszStateFile || !*g_pszStateFile)
return VERR_INVALID_PARAMETER;
if (gConsole->inputGrabbed())
gConsole->inputGrabEnd();
if (machineState == VMSTATE_RUNNING)
{
}
RTTHREADTYPE_MAIN_WORKER, 0, "Save");
if (RT_FAILURE(rc))
{
return rc;
}
return VINF_SUCCESS;
}