VirtualBox

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

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

Shared Clipboard: Build fix.

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