VirtualBox

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

最後變更 在這個檔案從99600是 99597,由 vboxsync 提交於 23 月 前

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) [build fix]. bugref:10427

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.6 KB
 
1/* $Id: draganddrop.cpp 99597 2023-05-04 09:12:46Z 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.alldomusa.eu.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 int rc = VINF_SUCCESS;
84
85 if (g_pSvc)
86 {
87 rc = g_pSvc->term();
88
89 delete g_pSvc;
90 g_pSvc = NULL;
91 }
92
93 return rc;
94}
95
96VBCLSERVICE g_SvcDragAndDrop =
97{
98 "dnd", /* szName */
99 "Drag'n'Drop", /* pszDescription */
100 ".vboxclient-draganddrop", /* pszPidFilePathTemplate */
101 NULL, /* pszUsage */
102 NULL, /* pszOptions */
103 NULL, /* pfnOption */
104 vbclDnDInit, /* pfnInit */
105 vbclDnDWorker, /* pfnWorker */
106 vbclDnDStop, /* pfnStop*/
107 vbclDnDTerm /* pfnTerm */
108};
109
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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