VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/VBoxClient/clipboard.h

Last change on this file was 106786, checked in by vboxsync, 5 weeks ago

Additions: Linux/Wayland: Rename VBClClipboardThreadStart to vbcl_wayland_thread_start and put it into common place, bugref:10796.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/** $Id: clipboard.h 106786 2024-10-30 11:33:02Z vboxsync $ */
2/** @file
3 * Guest Additions - X11 Shared Clipboard - Main header.
4 */
5
6/*
7 * Copyright (C) 2020-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef GA_INCLUDED_SRC_x11_VBoxClient_clipboard_h
29#define GA_INCLUDED_SRC_x11_VBoxClient_clipboard_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include <VBox/GuestHost/SharedClipboard-x11.h>
35#include <VBox/VBoxGuestLib.h>
36#include <iprt/thread.h>
37
38/**
39 * Callback to notify guest that host has new clipboard data in the specified formats.
40 *
41 * @returns VBox status code.
42 * @param fFormats The formats available.
43 * Optional and can be NULL.
44 */
45typedef DECLCALLBACKTYPE(int, FNHOSTCLIPREPORTFMTS, (SHCLFORMATS fFormats));
46typedef FNHOSTCLIPREPORTFMTS *PFNHOSTCLIPREPORTFMTS;
47
48/**
49 * Callback to notify guest that host wants to read clipboard data in specified format.
50 *
51 * @returns VBox status code.
52 * @param uFmt The format in which the data should be read
53 * (VBOX_SHCL_FMT_XXX).
54 */
55typedef DECLCALLBACKTYPE(int, FNHOSTCLIPREAD, (SHCLFORMAT uFmt));
56typedef FNHOSTCLIPREAD *PFNHOSTCLIPREAD;
57
58
59/**
60 * Struct keeping am X11 Shared Clipboard context.
61 */
62struct SHCLCONTEXT
63{
64 /** Client command context */
65 VBGLR3SHCLCMDCTX CmdCtx;
66#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
67 /** Associated transfer data. */
68 SHCLTRANSFERCTX TransferCtx;
69#endif
70 /** Event source for waiting for X11 request responses in the VbglR3 clipboard event loop. */
71 SHCLEVENTSOURCE EventSrc;
72 union
73 {
74 /** X11 clipboard context. */
75 SHCLX11CTX X11;
76 /** @todo Wayland clipboard context goes here. */
77 /* SHCLWAYLANDCTX Wl; */
78 };
79};
80
81/** Shared Clipboard context.
82 * Only one context is supported at a time for now. */
83extern SHCLCONTEXT g_Ctx;
84
85/**
86 * Read and process one event from the host clipboard service.
87 *
88 * @returns VBox status code.
89 * @param pCtx Host Shared Clipboard service connection context.
90 * @param pfnHGClipReport A callback to notify guest about new content in host clipboard.
91 * @param pfnGHClipRead A callback to notify guest when host requests guest clipboard content.
92 */
93RTDECL(int) VBClClipboardReadHostEvent(PSHCLCONTEXT pCtx, const PFNHOSTCLIPREPORTFMTS pfnHGClipReport,
94 const PFNHOSTCLIPREAD pfnGHClipRead);
95
96/**
97 * Read entire host clipboard buffer in given format.
98 *
99 * This function will allocate clipboard buffer of necessary size and
100 * place host clipboard content into it. Buffer needs to be freed by caller.
101 *
102 * @returns VBox status code.
103 * @param pCtx Host Shared Clipboard service connection context.
104 * @param uFmt Format in which data should be read.
105 * @param ppvData Newly allocated output buffer (should be freed by caller).
106 * @param pcbData Output buffer size.
107 */
108RTDECL(int) VBClClipboardReadHostClipboard(PVBGLR3SHCLCMDCTX pCtx, SHCLFORMAT uFmt, void **ppvData, uint32_t *pcbData);
109
110#endif /* !GA_INCLUDED_SRC_x11_VBoxClient_clipboard_h */
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