seamless-x11.cpp revision a2760a4d593af57a19ec32cdfd1723b68495df8c
/** @file
*
* Seamless mode:
* Linux guest.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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.
*/
/*****************************************************************************
* Header files *
*****************************************************************************/
#include <VBox/VBoxGuest.h>
#include "seamless-guest.h"
/*****************************************************************************
* Static functions *
*****************************************************************************/
unsigned long *nItems)
{
True /* only_if_exists */);
if (propNameAtom == None)
{
return VBoxGuestX11Pointer<unsigned char>(0);
}
int actFmt = 0;
unsigned long nBytesAfter = 0;
unsigned char *propVal = 0;
return VBoxGuestX11Pointer<unsigned char>(0);
return VBoxGuestX11Pointer<unsigned char>(propVal);
}
/**
* Initialise the guest and ensure that it is capable of handling seamless mode
*
* @returns true if it can handle seamless, false otherwise
*/
{
int rc = VINF_SUCCESS;
/** Dummy values for XShapeQueryExtension */
if (0 != mObserver) /* Assertion */
{
LogRelThisFunc(("ERROR: attempt to initialise service twice!\n"));
return VERR_INTERNAL_ERROR;
}
{
LogRelThisFunc(("Failed to acquire a connection to the display.\n"));
return VERR_ACCESS_DENIED;
}
{
LogFlowFunc(("X11 shape extension not supported, returning.\n"));
return VERR_NOT_SUPPORTED;
}
return rc;
}
/**
* Read information about currently visible windows in the guest and subscribe to X11
* events about changes to this information.
*
* @note This class does not contain its own event thread, so an external thread must
* call nextEvent() for as long as events are wished.
* @todo This function should switch the guest to fullscreen mode.
*/
int VBoxGuestSeamlessX11::start(void)
{
int rc = VINF_SUCCESS;
isEnabled = true;
return rc;
}
/** Stop reporting seamless events to the host. Free information about guest windows
and stop requesting updates. */
void VBoxGuestSeamlessX11::stop(void)
{
isEnabled = false;
}
void VBoxGuestSeamlessX11::monitorDesktopWindows(void)
{
VBoxGuestX11Pointer<unsigned char> virtualRoots;
unsigned long nItems;
{
}
}
void VBoxGuestSeamlessX11::rebuildWindowTree(void)
{
VBoxGuestX11Pointer<unsigned char> virtualRoots;
unsigned long nItems;
for (unsigned i = 0; i < nItems; ++i)
{
}
/* This must be done last, so that we do not treat the desktop windows just added as
child windows. */
}
/**
* Store information about a desktop window and register for structure events on it.
* If it is mapped, go through the list of it's children and add information about
* mapped children to the tree of visible windows, making sure that those windows are
* not already in our list of desktop windows.
*
* @param hWin the window concerned - should be a "desktop" window
*/
{
unsigned int cChildren = 0;
/** Dummies */
{
return;
}
{
LogRelFunc(("Failed to get the tree of active X11 windows.\n"));
}
else
{
for (unsigned int i = 0; i < cChildren; ++i)
{
bool found = false;
{
{
found = true;
}
}
if (!found)
{
}
}
}
}
{
unsigned iParent;
{
return;
}
{
cRects = 0;
}
{
isVisible = true;
}
{
{
found = true;
}
}
if (found)
{
}
}
/**
* Free all information in the tree of visible windows
*/
void VBoxGuestSeamlessX11::freeWindowTree(void)
{
for (unsigned int i = 0; i != mDesktopWindows.size(); ++i)
{
}
/* We use post-increment in the operation to prevent the iterator from being invalidated. */
{
}
}
/**
* Waits for a position or shape-related event from guest windows
*
* @note Called from the guest event thread.
*/
void VBoxGuestSeamlessX11::nextEvent(void)
{
/* Start by sending information about the current window setup to the host. We do this
here because we want to send all such information from a single thread. */
{
case ConfigureNotify:
break;
case MapNotify:
break;
case PropertyNotify:
break;
case ShapeNotify:
break;
case UnmapNotify:
break;
default:
break;
}
}
/**
* Handle a configuration event in the seamless event thread by setting the new position and
* updating the host's rectangle information.
*
* @param event the X11 event structure
*/
{
bool found = false;
unsigned i = 0;
{
{
found = true;
}
}
if (found)
{
}
else
{
{
}
}
}
/**
* Handle a map event in the seamless event thread by adding the guest window to the list of
* visible windows and updating the host's rectangle information.
*
* @param event the X11 event structure
*/
{
bool found = false;
/* Is one of our desktop windows? */
{
{
mDesktopWindows[i].mMapped = true;
found = true;
}
}
if (!found)
{
/* Make sure that the window is not already present in the tree */
{
LogRelFunc(("Warning: MapNotify event received for a window listed as mapped\n"));
}
}
}
/**
* If the list of virtual root windows changes, completely rescan visible windows.
*
* @param event the X11 event structure
*/
{
{
}
}
/**
* Handle a window shape change event in the seamless event thread by changing the set of
* visible rectangles for the window in the list of visible guest windows and updating the
* host's rectangle information.
*
* @param event the X11 event structure
*/
{
{
{
cRects = 0;
}
}
}
/**
* Handle an unmap event in the seamless event thread by removing the guest window from the
* list of visible windows and updating the host's rectangle information.
*
* @param event the X11 event structure
*/
{
bool found = false;
/* Is this is one of our desktop windows? */
{
{
mDesktopWindows[i].mMapped = false;
found = true;
}
}
if (!found)
{
/* Make sure that the window is not already present in the tree */
{
}
else
{
LogRelFunc(("Warning: UnmapNotify event received for a window not listed as mapped\n"));
}
}
}
/**
* Sends an updated list of visible rectangles to the host
*/
{
unsigned cRects = 0;
if (0 != mcRects)
{
}
{
unsigned iParent;
bool found = false;
{
{
found = true;
}
}
{
{
}
}
}
return apRects;
}
/**
* Send a client event to wake up the X11 seamless event loop prior to stopping it.
*
* @note This function should only be called from the host event thread.
*/
bool VBoxGuestSeamlessX11::interruptEvent(void)
{
reinterpret_cast<XEvent *>(&clientMessage));
return true;
}