1 | /** @file
|
---|
2 | * Shared Clipboard - Common Guest and Host Code.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef VBOX_INCLUDED_GuestHost_SharedClipboard_h
|
---|
27 | #define VBOX_INCLUDED_GuestHost_SharedClipboard_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <iprt/cdefs.h>
|
---|
33 | #include <iprt/types.h>
|
---|
34 |
|
---|
35 | /** A single Shared Clipboard format. */
|
---|
36 | typedef uint32_t VBOXCLIPBOARDFORMAT;
|
---|
37 | /** Pointer to a single Shared Clipboard format. */
|
---|
38 | typedef VBOXCLIPBOARDFORMAT *PVBOXCLIPBOARDFORMAT;
|
---|
39 |
|
---|
40 | /** Bit map of Shared Clipboard formats. */
|
---|
41 | typedef uint32_t VBOXCLIPBOARDFORMATS;
|
---|
42 | /** Pointer to a bit map of Shared Clipboard formats. */
|
---|
43 | typedef VBOXCLIPBOARDFORMATS *PVBOXCLIPBOARDFORMATS;
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Supported data formats for Shared Clipboard. Bit mask.
|
---|
47 | */
|
---|
48 | /** No format set. */
|
---|
49 | #define VBOX_SHARED_CLIPBOARD_FMT_NONE 0
|
---|
50 | /** Shared Clipboard format is an Unicode text. */
|
---|
51 | #define VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT UINT32_C(0x01)
|
---|
52 | /** Shared Clipboard format is bitmap (BMP / DIB). */
|
---|
53 | #define VBOX_SHARED_CLIPBOARD_FMT_BITMAP UINT32_C(0x02)
|
---|
54 | /** Shared Clipboard format is HTML. */
|
---|
55 | #define VBOX_SHARED_CLIPBOARD_FMT_HTML UINT32_C(0x04)
|
---|
56 | #ifdef VBOX_WITH_SHARED_CLIPBOARD_URI_LIST
|
---|
57 | /** Shared Clipboard format is an URI list. */
|
---|
58 | #define VBOX_SHARED_CLIPBOARD_FMT_URI_LIST UINT32_C(0x08)
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Enumeration to specify the Shared Clipboard URI source type.
|
---|
63 | */
|
---|
64 | typedef enum SHAREDCLIPBOARDSOURCE
|
---|
65 | {
|
---|
66 | /** Invalid source type. */
|
---|
67 | SHAREDCLIPBOARDSOURCE_INVALID = 0,
|
---|
68 | /** Source is local. */
|
---|
69 | SHAREDCLIPBOARDSOURCE_LOCAL,
|
---|
70 | /** Source is remote. */
|
---|
71 | SHAREDCLIPBOARDSOURCE_REMOTE,
|
---|
72 | /** The usual 32-bit hack. */
|
---|
73 | SHAREDCLIPBOARDSOURCE_32Bit_Hack = 0x7fffffff
|
---|
74 | } SHAREDCLIPBOARDSOURCE;
|
---|
75 |
|
---|
76 | enum
|
---|
77 | {
|
---|
78 | /** The number of milliseconds before the clipboard times out. */
|
---|
79 | #ifndef TESTCASE
|
---|
80 | CLIPBOARD_TIMEOUT = 5000
|
---|
81 | #else
|
---|
82 | CLIPBOARD_TIMEOUT = 1
|
---|
83 | #endif
|
---|
84 | };
|
---|
85 |
|
---|
86 | /** Opaque data structure for the X11/VBox frontend/glue code. */
|
---|
87 | struct _VBOXCLIPBOARDCONTEXT;
|
---|
88 | typedef struct _VBOXCLIPBOARDCONTEXT VBOXCLIPBOARDCONTEXT;
|
---|
89 | typedef struct _VBOXCLIPBOARDCONTEXT *PVBOXCLIPBOARDCONTEXT;
|
---|
90 |
|
---|
91 | /** Opaque data structure for the X11/VBox backend code. */
|
---|
92 | struct _CLIPBACKEND;
|
---|
93 | typedef struct _CLIPBACKEND CLIPBACKEND;
|
---|
94 |
|
---|
95 | /** Opaque request structure for clipboard data.
|
---|
96 | * @todo All use of single and double underscore prefixes is banned! */
|
---|
97 | struct _CLIPREADCBREQ;
|
---|
98 | typedef struct _CLIPREADCBREQ CLIPREADCBREQ;
|
---|
99 |
|
---|
100 | /* APIs exported by the X11 backend */
|
---|
101 | extern CLIPBACKEND *ClipConstructX11(VBOXCLIPBOARDCONTEXT *pFrontend, bool fHeadless);
|
---|
102 | extern void ClipDestructX11(CLIPBACKEND *pBackend);
|
---|
103 | #ifdef __cplusplus
|
---|
104 | extern int ClipStartX11(CLIPBACKEND *pBackend, bool grab = false);
|
---|
105 | #else
|
---|
106 | extern int ClipStartX11(CLIPBACKEND *pBackend, bool grab);
|
---|
107 | #endif
|
---|
108 | extern int ClipStopX11(CLIPBACKEND *pBackend);
|
---|
109 | extern int ClipAnnounceFormatToX11(CLIPBACKEND *pBackend,
|
---|
110 | VBOXCLIPBOARDFORMATS vboxFormats);
|
---|
111 | extern int ClipRequestDataFromX11(CLIPBACKEND *pBackend, VBOXCLIPBOARDFORMATS vboxFormat,
|
---|
112 | CLIPREADCBREQ *pReq);
|
---|
113 |
|
---|
114 | /* APIs exported by the X11/VBox frontend */
|
---|
115 | extern int ClipRequestDataForX11(VBOXCLIPBOARDCONTEXT *pCtx,
|
---|
116 | uint32_t u32Format, void **ppv,
|
---|
117 | uint32_t *pcb);
|
---|
118 | extern void ClipReportX11Formats(VBOXCLIPBOARDCONTEXT *pCtx,
|
---|
119 | uint32_t u32Formats);
|
---|
120 | extern void ClipCompleteDataRequestFromX11(VBOXCLIPBOARDCONTEXT *pCtx, int rc,
|
---|
121 | CLIPREADCBREQ *pReq, void *pv,
|
---|
122 | uint32_t cb);
|
---|
123 | #endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_h */
|
---|