display.cpp revision 27c6038f0669210b5f3f77d0ffcbbe6cdad9ed3a
/* $Id$ */
/** @file
* X11 guest client - display management.
*/
/*
* Copyright (C) 2006-2012 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.
*/
/** @todo this should probably be replaced by something IPRT */
/* For system() and WEXITSTATUS() */
#include <stdlib.h>
#include <errno.h>
#include <X11/cursorfont.h>
#include <VBox/VBoxGuestLib.h>
#include "VBoxClient.h"
{
int rc = VINF_SUCCESS;
uint32_t fMouseFeatures = 0;
LogRelFlowFunc(("testing dynamic resizing\n"));
int iDummy;
if (RT_SUCCESS(rc))
else
/* Log and ignore the return value, as there is not much we can do with
* it. */
/* Enable support for switching between hardware and software cursors */
LogRelFlowFunc(("enabling relative mouse re-capturing support\n"));
if (RT_SUCCESS(rc))
{
0);
if (RT_SUCCESS(rc))
}
if (RT_FAILURE(rc))
{
}
return VINF_SUCCESS;
}
void cleanupDisplay(void)
{
uint32_t fMouseFeatures = 0;
LogRelFlowFunc(("\n"));
if (RT_SUCCESS(rc))
LogRelFlowFunc(("returning\n"));
}
/** This thread just runs a dummy X11 event loop to be sure that we get
* terminated should the X server exit. */
static int x11ConnectionMonitor(RTTHREAD, void *)
{
while (true)
return 0;
}
/**
* This method first resets the current resolution using RandR to wake up
* the graphics driver, then sets the resolution requested if it is among
* those offered by the driver.
*/
{
int cSizes;
/* Reset the current mode */
if (pConfig)
{
unsigned uDist = UINT32_MAX;
int iMode = -1;
for (int i = 0; i < cSizes; ++i)
{
#define VBCL_SQUARE(x) (x) * (x)
{
iMode = i;
}
}
if (iMode >= 0)
{
Time config_timestamp = 0;
}
}
}
/**
* Display change request monitor thread function.
* Before entering the loop, we re-read the last request
* received, and if the first one received inside the
* loop is identical we ignore it, because it is probably
* stale.
*/
{
LogRelFlowFunc(("\n"));
bool fExtDispReqSupport = true;
RRMin = 0;
const char *pcszXrandr = "xrandr";
if (RTFileExists("/usr/X11/bin/xrandr"))
pcszXrandr = "/usr/X11/bin/xrandr";
RTTHREADTYPE_INFREQUENT_POLLER, 0, "X11 monitor");
if (RT_FAILURE(rc))
return rc;
while (true)
{
bool fEnabled = false;
return rc;
/* Jiggle the mouse pointer to wake up the driver. */
/* And if it is a size hint, set the new size now that the video
* driver has had a chance to update its list. */
{
/* Extended display version not supported on host */
if (RT_FAILURE(rc2))
{
LogRel(("GetDisplayChangeReq Extended Version not supported. "
fExtDispReqSupport = false;
}
else
LogRelFlowFunc(("Got Extended Param from Host cx=%d, cy=%d, bpp=%d, iDisp=%d, "
/* If we are not stopping, sleep for a bit to avoid using up
too much CPU while retrying. */
if (RT_FAILURE(rc2))
else
if (RRMin < 2)
else
{
char szCommand[256];
if (fExtDispReqSupport)
{
if (fEnabled)
{
{
"%s --output VBOX%u --set VBOX_MODE %dx%d",
}
/* Extended Display support possible . Secondary monitor position supported */
{
"%s --output VBOX%u --auto --pos %dx%d",
}
"%s --output VBOX%u --preferred",
}
else /* disable the virtual monitor */
{
"%s --output VBOX%u --off",
}
}
else /* Extended display support not possible */
{
{
"%s --output VBOX%u --set VBOX_MODE %dx%d",
"%s --output VBOX%u --preferred",
}
}
}
}
}
return VINF_SUCCESS;
}
{
public:
virtual const char *getPidFilePath()
{
return ".vboxclient-display.pid";
}
{
if (!pDisplay)
return VERR_NOT_FOUND;
if (RT_SUCCESS(rc))
return rc;
}
virtual void cleanup()
{
}
};
{
return new DisplayService;
}