VirtualBox

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

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

GuestHost/SharedClipboard.h: Got rid of all the leading underscores that I could spot. Shuffled the members of SHCLDATABLOCK so we save 8 bytes on 64-bit machines. bugref:9437

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.9 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/**
39 * Enumeration for all clipboard formats which we support on X11.
40 */
41typedef enum _SHCLX11FMT
42{
43 SHCLX11FMT_INVALID = 0,
44 SHCLX11FMT_TARGETS,
45 SHCLX11FMT_TEXT, /* Treat this as UTF-8, but it may really be ascii */
46 SHCLX11FMT_UTF8,
47 SHCLX11FMT_BMP,
48 SHCLX11FMT_HTML
49#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
50 , SHCLX11FMT_URI_LIST
51#endif
52} SHCLX11FMT;
53
54/** Defines an index of the X11 clipboad format table. */
55typedef unsigned SHCLX11FMTIDX;
56
57/**
58 * Structure for maintaining a Shared Clipboard context on X11 platforms.
59 */
60typedef struct _SHCLX11CTX
61{
62 /** Opaque data structure describing the front-end. */
63 PSHCLCONTEXT pFrontend;
64 /** Is an X server actually available? */
65 bool fHaveX11;
66 /** The X Toolkit application context structure */
67 XtAppContext appContext;
68
69 /** We have a separate thread to wait for window and clipboard events. */
70 RTTHREAD Thread;
71 /** The X Toolkit widget which we use as our clipboard client. It is never made visible. */
72 Widget pWidget;
73
74 /** Should we try to grab the clipboard on startup? */
75 bool fGrabClipboardOnStart;
76
77 /** The best text format X11 has to offer, as an index into the formats table. */
78 SHCLX11FMTIDX X11TextFormat;
79 /** The best bitmap format X11 has to offer, as an index into the formats table. */
80 SHCLX11FMTIDX X11BitmapFormat;
81 /** The best HTML format X11 has to offer, as an index into the formats table. */
82 SHCLX11FMTIDX X11HTMLFormat;
83#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
84 /** The best HTML format X11 has to offer, as an index into the formats table. */
85 SHCLX11FMTIDX X11URIListFormat;
86#endif
87 /** What kind of formats does VBox have to offer? */
88 SHCLFORMATS vboxFormats;
89 /** Cache of the last unicode data that we received. */
90 void *pvUnicodeCache;
91 /** Size of the unicode data in the cache. */
92 uint32_t cbUnicodeCache;
93 /** When we wish the clipboard to exit, we have to wake up the event
94 * loop. We do this by writing into a pipe. This end of the pipe is
95 * the end that another thread can write to. */
96 int wakeupPipeWrite;
97 /** The reader end of the pipe. */
98 int wakeupPipeRead;
99 /** A pointer to the XFixesSelectSelectionInput function. */
100 void (*fixesSelectInput)(Display *, Window, Atom, unsigned long);
101 /** The first XFixes event number. */
102 int fixesEventBase;
103 /** XtGetSelectionValue on some versions of libXt isn't re-entrant
104 * so block overlapping requests on this flag. */
105 bool fXtBusy;
106 /** If a request is blocked on the previous flag, set this flag to request
107 * an update later - the first callback should check and clear this flag
108 * before processing the callback event. */
109 bool fXtNeedsUpdate;
110} SHCLX11CTX, *PSHCLX11CTX;
111
112/** @name Shared Clipboard APIs for X11.
113 * @{
114 */
115int ShClX11Init(PSHCLX11CTX pCtx, PSHCLCONTEXT pParent, bool fHeadless);
116void ShClX11Destroy(PSHCLX11CTX pCtx);
117int ShClX11ThreadStart(PSHCLX11CTX pCtx, bool grab);
118int ShClX11ThreadStop(PSHCLX11CTX pCtx);
119int ShClX11ReportFormatsToX11(PSHCLX11CTX pCtx, SHCLFORMATS vboxFormats);
120int ShClX11ReadDataFromX11(PSHCLX11CTX pCtx, SHCLFORMATS vboxFormat, CLIPREADCBREQ *pReq);
121/** @} */
122
123/** @name Shared Clipboard callbacks exported by the X11 APIs.
124 * @{
125 */
126DECLCALLBACK(int) ShClX11RequestDataForX11Callback(SHCLCONTEXT *pCtx, SHCLFORMAT Format, void **ppv, uint32_t *pcb);
127DECLCALLBACK(void) ShClX11ReportFormatsCallback(SHCLCONTEXT *pCtx, SHCLFORMATS Formats);
128DECLCALLBACK(void) ShClX11RequestFromX11CompleteCallback(SHCLCONTEXT *pCtx, int rc, CLIPREADCBREQ *pReq, void *pv, uint32_t cb);
129/** @} */
130
131#endif /* !VBOX_INCLUDED_GuestHost_SharedClipboard_x11_h */
132
Note: See TracBrowser for help on using the repository browser.

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