seamless.cpp revision 5b5c073298425e5aa1744546e2ca8590cacbcb5b
ece9652d971886b99a269656ea4782319637e75avboxsync * X11 Guest client - seamless mode: main logic, communication with the host and
ece9652d971886b99a269656ea4782319637e75avboxsync * wrapper interface for the main code of the VBoxClient deamon. The
ece9652d971886b99a269656ea4782319637e75avboxsync * X11-specific parts are split out into their own file for ease of testing.
ece9652d971886b99a269656ea4782319637e75avboxsync * Copyright (C) 2006-2014 Oracle Corporation
ece9652d971886b99a269656ea4782319637e75avboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
ece9652d971886b99a269656ea4782319637e75avboxsync * available from http://www.virtualbox.org. This file is free software;
ece9652d971886b99a269656ea4782319637e75avboxsync * you can redistribute it and/or modify it under the terms of the GNU
ece9652d971886b99a269656ea4782319637e75avboxsync * General Public License (GPL) as published by the Free Software
ece9652d971886b99a269656ea4782319637e75avboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
ece9652d971886b99a269656ea4782319637e75avboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
ece9652d971886b99a269656ea4782319637e75avboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
ece9652d971886b99a269656ea4782319637e75avboxsync/*****************************************************************************
ece9652d971886b99a269656ea4782319637e75avboxsync* Header files *
ece9652d971886b99a269656ea4782319637e75avboxsync*****************************************************************************/
e7f5b62e52275099a4d14501306063e23876b771vboxsync * Update the set of visible rectangles in the host.
e7f5b62e52275099a4d14501306063e23876b771vboxsyncstatic void sendRegionUpdate(RTRECT *pRects, size_t cRects)
ece9652d971886b99a269656ea4782319637e75avboxsync LogRelFunc(("ERROR: called with null pointer!\n"));
e7f5b62e52275099a4d14501306063e23876b771vboxsync * initialise the service.
e7f5b62e52275099a4d14501306063e23876b771vboxsync rc = VbglR3CtlFilterMask(VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST, 0);
e7f5b62e52275099a4d14501306063e23876b771vboxsync pcszStage = "Reporting support for seamless capability";
e7f5b62e52275099a4d14501306063e23876b771vboxsync } while(0);
e7f5b62e52275099a4d14501306063e23876b771vboxsync LogRel(("VBoxClient (seamless): failed to start. Stage: \"%s\" Error: %Rrc\n",
e7f5b62e52275099a4d14501306063e23876b771vboxsync * Run the main service thread which listens for host state change
e7f5b62e52275099a4d14501306063e23876b771vboxsync * notifications.
e7f5b62e52275099a4d14501306063e23876b771vboxsync * @returns iprt status value. Service will be set to the stopped state on
e7f5b62e52275099a4d14501306063e23876b771vboxsync /* This will only exit if something goes wrong. */
e7f5b62e52275099a4d14501306063e23876b771vboxsync /* If we are not stopping, sleep for a bit to avoid using up too
e7f5b62e52275099a4d14501306063e23876b771vboxsync much CPU while retrying. */
ece9652d971886b99a269656ea4782319637e75avboxsync LogRel(("VBoxClient (seamless): event loop failed with error: %Rrc\n",
e7f5b62e52275099a4d14501306063e23876b771vboxsync/** Stops the service. */
ece9652d971886b99a269656ea4782319637e75avboxsync VbglR3CtlFilterMask(0, VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST);
ece9652d971886b99a269656ea4782319637e75avboxsync * Waits for a seamless state change events from the host and dispatch it.
e7f5b62e52275099a4d14501306063e23876b771vboxsync * @returns IRPT return code.
e7f5b62e52275099a4d14501306063e23876b771vboxsync VMMDevSeamlessMode newMode = VMMDev_Seamless_Disabled;
ece9652d971886b99a269656ea4782319637e75avboxsync /* A simplified seamless mode, obtained by making the host VM window
ece9652d971886b99a269656ea4782319637e75avboxsync * borderless and making the guest desktop transparent. */
ece9652d971886b99a269656ea4782319637e75avboxsync LogRelFlowFunc(("\"Visible region\" mode requested (VBoxClient).\n"));
ece9652d971886b99a269656ea4782319637e75avboxsync LogRelFlowFunc(("\"Disabled\" mode requested (VBoxClient).\n"));
ece9652d971886b99a269656ea4782319637e75avboxsync /* One host window represents one guest window. Not yet implemented. */
ece9652d971886b99a269656ea4782319637e75avboxsync LogRelFunc(("Unsupported \"host window\" mode requested (VBoxClient).\n"));
ece9652d971886b99a269656ea4782319637e75avboxsync LogRelFunc(("Unsupported mode %d requested (VBoxClient).\n",
e7f5b62e52275099a4d14501306063e23876b771vboxsync if (mMode == VMMDev_Seamless_Visible_Region && !mfPaused)
e7f5b62e52275099a4d14501306063e23876b771vboxsync /* This does it's own logging on failure. */
e7f5b62e52275099a4d14501306063e23876b771vboxsync /* This does it's own logging on failure. */
e7f5b62e52275099a4d14501306063e23876b771vboxsync LogRelFunc(("VbglR3SeamlessWaitEvent returned %Rrc (VBoxClient)\n", rc));
return VbglR3InterruptEventWaits();
return rc;
int rc;
mX11MonitorThreadStopping = false;
if (isX11MonitorThreadRunning())
return VINF_SUCCESS;
return rc;
int rc;
mX11MonitorThreadStopping = true;
if (!isX11MonitorThreadRunning())
return VINF_SUCCESS;
rc));
return rc;
int rc;
const char *pcszStage;
mfPaused = true;
return rc;
int rc;
const char *pcszStage;
mfPaused = false;
return rc;
const char *pcszStage;
!= VERR_TIMEOUT)
pcszStage));
return rc;
struct SEAMLESSSERVICE
bool mIsInitialised;
static const char *getPidFilePath(void)
return pSelf;
int rc;
return VERR_INTERNAL_ERROR;
return rc;
return rc;
return VINF_SUCCESS;
int rc;
return VERR_INTERNAL_ERROR;
return rc;
VbglR3SeamlessSetCap(false);
init,
run,
if (!pService)