seamless-host.h revision 0a95212cc657b3c58b8bba4fd925871371f44f67
/** @file
* X11 Guest client - seamless mode, missing proper description while using the
* potentially confusing word 'host'.
*/
/*
* 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.
*/
# define __Additions_client_seamless_host_h
#include <memory> /* for auto_ptr */
#include <vector> /* for vector */
#include "seamless-glue.h" /* for VBoxGuestSeamlessObserver */
#include "thread.h" /* for VBoxGuestThread */
/**
* Host event (i.e. enter or leave seamless mode) thread function for the main
* seamless class
*/
{
// Copying or assigning a thread object is not sensible
// Private member variables
/** The host proxy object */
/** The thread object running us. */
{
}
virtual ~VBoxGuestSeamlessHostThread(void) {}
/**
* The actual thread function.
*
* @returns iprt status code as thread return value
* @param pParent the VBoxGuestThread running this thread function
*/
/**
* Send a signal to the thread function that it should exit
*/
};
/**
* Interface to the host
*/
{
/** Events which can be reported by this class */
enum meEvent
{
/** Empty event */
NONE,
/** Request to enable seamless mode */
/** Request to disable seamless mode */
};
// We don't want a copy constructor or assignment operator
/** Observer to connect guest and host and ferry events back and forth. */
/** Host seamless event (i.e. enter and leave) thread function. */
/** Host seamless event thread. */
/** Is the service running? */
bool mRunning;
/** Last request issued by the host. */
/**
* Waits for a seamless state change events from the host and dispatch it. This is
* meant to be called by the host event monitor thread exclusively.
*
* @returns IRPT return code.
*/
int nextEvent(void);
/**
* Interrupt an event wait and cause nextEvent() to return immediately.
*/
void cancelEvent(void) { VbglR3InterruptEventWaits(); }
/**
* Initialise the guest and ensure that it is capable of handling seamless mode
* @param pObserver Observer class to connect host and guest interfaces
*
* @returns iprt status code
*/
{
LogRelFlowFunc(("\n"));
if (mObserver != 0) /* Assertion */
{
LogRel(("VBoxClient: ERROR: attempt to initialise seamless host object twice!\n"));
return VERR_INTERNAL_ERROR;
}
LogRelFlowFunc(("returning VINF_SUCCESS\n"));
return VINF_SUCCESS;
}
/**
* Start the service.
* @returns iprt status value
*/
int start(void);
/**
* Stops the service.
* @param cMillies how long to wait for the thread to exit
*/
/** Returns the current state of the host - i.e. requesting seamless or not. */
/**
* Update the set of visible rectangles in the host.
*/
RTTHREADFLAGS_WAITABLE, "Host events")
{
mObserver = 0;
mRunning = false;
}
{
LogRelFlowFunc(("\n"));
if (mRunning) /* Assertion */
{
LogRel(("VBoxClient: seamless host object still running! Stopping...\n"));
{
stop(2000);
}
catch(...) {}
}
LogRelFlowFunc(("returning\n"));
}
};
#endif /* __Additions_xclient_seamless_h not defined */