VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp@ 99595

Last change on this file since 99595 was 99595, checked in by vboxsync, 22 months ago

Guest Additions/VBoxClient: Moved the X11-specific code for drag'n drop into an own submodule and using the actual service as a (runtime) wrapper (for also the Wayland-specific code later). bugref:10427

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: draganddrop.cpp 99595 2023-05-04 08:58:54Z vboxsync $ */
2/** @file
3 * Guest Additions - Common drag'n drop wrapper service.
4 */
5
6/*
7 * Copyright (C) 2023 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#include <iprt/mem.h>
29
30#include "VBox/HostServices/DragAndDropSvc.h"
31#include "VBoxClient.h"
32#include "draganddrop.h"
33
34
35/** Pointer to the DnD interface class. */
36static VBClDnDSvc *g_pSvc = NULL;
37
38
39/**
40 * @interface_method_impl{VBCLSERVICE,pfnInit}
41 */
42static DECLCALLBACK(int) vbclDnDInit(void)
43{
44 switch (VBClGetSessionType())
45 {
46 case VBGHSESSIONTYPE_X11:
47 g_pSvc = new VBClX11DnDSvc();
48 break;
49
50 case VBGHSESSIONTYPE_WAYLAND:
51 RT_FALL_THROUGH();
52 default:
53 return VERR_NOT_SUPPORTED;
54 }
55
56 if (!g_pSvc)
57 return VERR_NO_MEMORY;
58
59 return g_pSvc->init();
60}
61
62/**
63 * @interface_method_impl{VBCLSERVICE,pfnWorker}
64 */
65static DECLCALLBACK(int) vbclDnDWorker(bool volatile *pfShutdown)
66{
67 return g_pSvc->worker(pfShutdown);
68}
69
70/**
71 * @interface_method_impl{VBCLSERVICE,pfnStop}
72 */
73static DECLCALLBACK(void) vbclDnDStop(void)
74{
75 g_pSvc->stop();
76}
77
78/**
79 * @interface_method_impl{VBCLSERVICE,pfnTerm}
80 */
81static DECLCALLBACK(int) vbclDnDTerm(void)
82{
83 return g_pSvc->term();
84}
85
86VBCLSERVICE g_SvcDragAndDrop =
87{
88 "dnd", /* szName */
89 "Drag'n'Drop", /* pszDescription */
90 ".vboxclient-draganddrop", /* pszPidFilePathTemplate */
91 NULL, /* pszUsage */
92 NULL, /* pszOptions */
93 NULL, /* pfnOption */
94 vbclDnDInit, /* pfnInit */
95 vbclDnDWorker, /* pfnWorker */
96 vbclDnDStop, /* pfnStop*/
97 vbclDnDTerm /* pfnTerm */
98};
99
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