VirtualBox

source: vbox/trunk/include/VBox/GuestHost/SharedClipboard-x11.h@ 82156

Last change on this file since 82156 was 82156, checked in by vboxsync, 5 years ago

Shared Clipboard/VBoxClient: More cleanup for X11-specific code.

  • Property svn:executable set to *
File size: 4.5 KB
Line 
1/** @file
2 * Shared Clipboard - Common X11 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_X11_h
27#define VBOX_INCLUDED_GuestHost_SharedClipboard_X11_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <X11/Intrinsic.h>
33
34/** The different clipboard formats which we support. */
35enum CLIPFORMAT
36{
37 INVALID = 0,
38 TARGETS,
39 TEXT, /* Treat this as UTF-8, but it may really be ascii */
40 UTF8,
41 BMP,
42 HTML
43#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
44 , URI_LIST
45#endif
46};
47
48/** Defines a single X11 clipboad format. */
49typedef unsigned CLIPX11FORMAT;
50
51/**
52 * Structure for maintaining a Shared Clipboard context on X11 platforms.
53 */
54typedef struct _SHCLX11CTX
55{
56 /** Opaque data structure describing the front-end. */
57 SHCLCONTEXT *pFrontend;
58 /** Is an X server actually available? */
59 bool fHaveX11;
60 /** The X Toolkit application context structure */
61 XtAppContext appContext;
62
63 /** We have a separate thread to wait for Window and Clipboard events */
64 RTTHREAD thread;
65 /** The X Toolkit widget which we use as our clipboard client. It is never made visible. */
66 Widget widget;
67
68 /** Should we try to grab the clipboard on startup? */
69 bool fGrabClipboardOnStart;
70
71 /** The best text format X11 has to offer, as an index into the formats
72 * table */
73 CLIPX11FORMAT X11TextFormat;
74 /** The best bitmap format X11 has to offer, as an index into the formats
75 * table */
76 CLIPX11FORMAT X11BitmapFormat;
77 /** The best HTML format X11 has to offer, as an index into the formats
78 * table */
79 CLIPX11FORMAT X11HTMLFormat;
80#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
81 /** The best HTML format X11 has to offer, as an index into the formats
82 * table */
83 CLIPX11FORMAT X11URIListFormat;
84#endif
85 /** What kind of formats does VBox have to offer? */
86 SHCLFORMATS vboxFormats;
87 /** Cache of the last unicode data that we received */
88 void *pvUnicodeCache;
89 /** Size of the unicode data in the cache */
90 uint32_t cbUnicodeCache;
91 /** When we wish the clipboard to exit, we have to wake up the event
92 * loop. We do this by writing into a pipe. This end of the pipe is
93 * the end that another thread can write to. */
94 int wakeupPipeWrite;
95 /** The reader end of the pipe */
96 int wakeupPipeRead;
97 /** A pointer to the XFixesSelectSelectionInput function */
98 void (*fixesSelectInput)(Display *, Window, Atom, unsigned long);
99 /** The first XFixes event number */
100 int fixesEventBase;
101} SHCLX11CTX, *PSHCLX11CTX;
102
103/** @name Shared Clipboard APIs for X11.
104 * @{
105 */
106int ShClX11Init(PSHCLX11CTX pCtx, PSHCLCONTEXT pParent, bool fHeadless);
107void ShClX11Destroy(PSHCLX11CTX pCtx);
108int ShClX11ThreadStart(PSHCLX11CTX pCtx, bool grab);
109int ShClX11ThreadStop(PSHCLX11CTX pCtx);
110int ShClX11ReportFormatsToX11(PSHCLX11CTX pCtx, SHCLFORMATS vboxFormats);
111int ShClX11ReadDataFromX11(PSHCLX11CTX pCtx, SHCLFORMATS vboxFormat, CLIPREADCBREQ *pReq);
112/** @} */
113
114/** @name Shared Clipboard callbacks exported by the X11 APIs.
115 * @{
116 */
117DECLCALLBACK(int) ShClX11RequestDataForX11Callback(SHCLCONTEXT *pCtx, SHCLFORMAT Format, void **ppv, uint32_t *pcb);
118DECLCALLBACK(void) ShClX11ReportFormatsCallback(SHCLCONTEXT *pCtx, SHCLFORMATS Formats);
119DECLCALLBACK(void) ShClRequestFromX11CompleteCallback(SHCLCONTEXT *pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb);
120/** @} */
121
122#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_X11_h */
123
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette