darwin.cpp revision ad27e1d5e48ca41245120c331cc88b50464813ce
* Shared Clipboard: Mac OS X host. * Copyright (C) 2008 Oracle Corporation * This file is part of VirtualBox Open Source Edition (OSE), as * you can redistribute it and/or modify it under the terms of the GNU * 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. /** Global clipboard context information */ /** We have a separate thread to poll for new clipboard content */ /** The reference to the current pasteboard */ /** Only one client is supported. There seems to be no need for more clients. */ * Checks if something is present on the clipboard and calls vboxSvcClipboardReportMsg. * @returns IPRT status code (ignored). * @param pCtx The context. /* Retrieve the formats currently in the clipboard and supported by vbox */ Log ((
"vboxClipboardChanged fFormats %02X\n",
fFormats));
* This thread will check for the arrival of new data on the clipboard. * @returns VINF_SUCCESS (not used). * @param Thread Our thread handle. * @param pvUser Pointer to the VBOXCLIPBOARDCONTEXT structure. Log ((
"vboxClipboardThread: starting clipboard thread\n"));
/* call this behind the lock because we don't know if the api is thread safe and in any case we're calling several methods. */ /* Sleep for 200 msecs before next poll */ Log ((
"vboxClipboardThread: clipboard thread terminated successfully with return code %Rrc\n",
VINF_SUCCESS));
* Public platform dependent functions. /** Initialise the host side of the shared clipboard - called by the hgcm layer. */ Log ((
"vboxClipboardInit\n"));
/** Terminate the host side of the shared clipboard - called by the hgcm layer. */ Log ((
"vboxClipboardDestroy\n"));
* Signal the termination of the polling thread and wait for it to respond. * Destroy the pasteboard and uninitialize the global context record. * Enable the shared clipboard - called by the hgcm clipboard subsystem. * @param pClient Structure containing context information about the guest system * @returns RT status code /* Initially sync the host clipboard content with the client. */ * Synchronise the contents of the host clipboard with the guest, called by the HGCM layer * after a save and restore of the guest. /* Sync the host clipboard content with the client. */ * Shut down the shared clipboard subsystem and "disconnect" the guest. Log ((
"vboxClipboardDisconnect\n"));
* The guest is taking possession of the shared clipboard. Called by the HGCM clipboard * @param pClient Context data for the guest system * @param u32Formats Clipboard formats the guest is offering Log ((
"vboxClipboardFormatAnnounce u32Formats %02X\n",
u32Formats));
/* This is just an automatism, not a genuine announcement */ * Called by the HGCM clipboard subsystem when the guest wants to read the host clipboard. * @param pClient Context information about the guest VM * @param u32Format The format that the guest would like to receive the data in * @param pv Where to write the data to * @param cb The size of the buffer to write the data to * @param pcbActual Where to write the actual size of the written data /* Default to no data available. */ * Called by the HGCM clipboard subsystem when we have requested data and that data arrives. * @param pClient Context information about the guest VM * @param pv Buffer to which the data was written * @param cb The size of the data written * @param u32Format The format of the data written