SharedClipboard.h revision 2feb1c8e55e737875aba0cfd07e4bd5544621c7b
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync/** @file
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync *
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * Shared Clipboard
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync */
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync/*
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync *
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * available from http://www.virtualbox.org. This file is free software;
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * General Public License (GPL) as published by the Free Software
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync *
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync * The contents of this file may alternatively be used under the terms
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync * of the Common Development and Distribution License Version 1.0
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync * VirtualBox OSE distribution, in which case the provisions of the
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync * CDDL are applicable instead of those of the GPL.
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync *
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync * You may elect to license modified versions of this file under the
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync * terms and conditions of either the GPL or the CDDL or both.
e5501b5897a4a5958157bed31ee5647cfa770333vboxsync *
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * additional information or have any questions.
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync */
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync#ifndef ___GUESTHOST_VBOXCLIPBOARD__H
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync#define ___GUESTHOST_VBOXCLIPBOARD__H
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync#include <iprt/cdefs.h>
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync#include <iprt/types.h>
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsyncenum {
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync /** The number of milliseconds before the clipboard times out. */
289fdd35bf70c71ed32075f45c3af244431ffa71vboxsync CLIPBOARD_TIMEOUT = 5000
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync};
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
3226d4d605c81794a1e11ee873dfbe83e1033c05vboxsync/** Opaque data structure for the X11/VBox frontend/glue code. */
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsyncstruct _VBOXCLIPBOARDCONTEXT;
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsynctypedef struct _VBOXCLIPBOARDCONTEXT VBOXCLIPBOARDCONTEXT;
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
3226d4d605c81794a1e11ee873dfbe83e1033c05vboxsync/** Opaque data structure for the X11/VBox backend code. */
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsyncstruct _CLIPBACKEND;
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsynctypedef struct _CLIPBACKEND CLIPBACKEND;
3226d4d605c81794a1e11ee873dfbe83e1033c05vboxsync
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync/** A structure containing information about where to store a request
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * for the X11 clipboard contents. */
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsyncstruct _VBOXCLIPBOARDREQUEST
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync{
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync /** The buffer to write X11 clipboard data to (valid during a request
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * for the clipboard contents) */
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync void *pv;
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync /** The size of the buffer to write X11 clipboard data to (valid during
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * a request for the clipboard contents) */
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync unsigned cb;
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync /** The size of the X11 clipboard data written to the buffer (valid
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync * during a request for the clipboard contents) */
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync uint32_t *pcbActual;
289fdd35bf70c71ed32075f45c3af244431ffa71vboxsync /** The format VBox would like the data in */
289fdd35bf70c71ed32075f45c3af244431ffa71vboxsync uint32_t format;
333d861631508b4f204e797b3e70a5e1729274e7vboxsync /** Return code for the request processing code */
333d861631508b4f204e797b3e70a5e1729274e7vboxsync int rc;
289fdd35bf70c71ed32075f45c3af244431ffa71vboxsync /** Semaphore which is signalled when the request is completed */
289fdd35bf70c71ed32075f45c3af244431ffa71vboxsync RTSEMEVENT finished;
c4e3ff6a6b0826e8ec2d19bfc24bf882f4d4813cvboxsync /** The clipboard context this request is associated with */
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsync CLIPBACKEND *pCtx;
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync};
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsynctypedef struct _VBOXCLIPBOARDREQUEST VBOXCLIPBOARDREQUEST;
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync/* APIs exported by the X11 backend */
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsyncextern CLIPBACKEND *VBoxX11ClipboardConstructX11
7a17f9411762ca9a1688b1981d4d635524854e71vboxsync (VBOXCLIPBOARDCONTEXT *pFrontend);
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsyncextern void VBoxX11ClipboardDestructX11(CLIPBACKEND *pBackend);
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsyncextern int VBoxX11ClipboardStartX11(CLIPBACKEND *pBackend);
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsyncextern int VBoxX11ClipboardStopX11(CLIPBACKEND *pBackend);
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsyncextern void VBoxX11ClipboardAnnounceVBoxFormat(CLIPBACKEND
3226d4d605c81794a1e11ee873dfbe83e1033c05vboxsync *pBackend, uint32_t u32Formats);
2feb1c8e55e737875aba0cfd07e4bd5544621c7bvboxsyncextern int VBoxX11ClipboardReadX11Data(CLIPBACKEND *pBackend,
3226d4d605c81794a1e11ee873dfbe83e1033c05vboxsync uint32_t u32Format,
289fdd35bf70c71ed32075f45c3af244431ffa71vboxsync void *pv, uint32_t cb,
289fdd35bf70c71ed32075f45c3af244431ffa71vboxsync uint32_t *pcbActual);
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync/* APIs exported by the X11/VBox frontend */
3226d4d605c81794a1e11ee873dfbe83e1033c05vboxsyncextern int VBoxX11ClipboardReadVBoxData(VBOXCLIPBOARDCONTEXT *pCtx,
3226d4d605c81794a1e11ee873dfbe83e1033c05vboxsync uint32_t u32Format, void **ppv,
3226d4d605c81794a1e11ee873dfbe83e1033c05vboxsync uint32_t *pcb);
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsyncextern void VBoxX11ClipboardReportX11Formats(VBOXCLIPBOARDCONTEXT *pCtx,
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync uint32_t u32Formats);
b26977a29bd8af11e3059ef8fb47a92a1241f20dvboxsync#endif /* ___GUESTHOST_VBOXCLIPBOARD__H */