VirtualBox

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

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

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

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id Revision
檔案大小: 4.7 KB
 
1/* $Id: seamless.cpp 99600 2023-05-04 10:29:18Z vboxsync $ */
2/** @file
3 * Guest Additions - Common seamless mode wrapper service.
4 */
5
6/*
7 * Copyright (C) 2006-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
29/*********************************************************************************************************************************
30* Header files *
31*********************************************************************************************************************************/
32#include <new>
33
34#include <X11/Xlib.h>
35
36#include <iprt/asm.h>
37#include <iprt/errcore.h>
38#include <iprt/mem.h>
39
40#include <VBox/log.h>
41#include <VBox/VBoxGuestLib.h>
42
43#include "VBoxClient.h"
44#include "seamless.h"
45
46
47/*********************************************************************************************************************************
48* Global Variables *
49*********************************************************************************************************************************/
50
51/** Pointer to the DnD interface class. */
52static VBClSeamlessSvc *g_pSvc = NULL;
53
54
55/*********************************************************************************************************************************
56* Common functions *
57*********************************************************************************************************************************/
58
59/**
60 * Reports region updates to the host.
61 *
62 * @param pRects Pointer to array of regions to report.
63 * @param cRects Number of regions in \a pRect.
64 */
65void VBClSeamnlessSendRegionUpdate(RTRECT *pRects, size_t cRects)
66{
67 if ( cRects
68 && !pRects) /* Assertion */
69 {
70 VBClLogError(("Region update called with NULL pointer\n"));
71 return;
72 }
73 VbglR3SeamlessSendRects(cRects, pRects);
74}
75
76
77/*********************************************************************************************************************************
78* Service wrapper *
79*********************************************************************************************************************************/
80
81/**
82 * @interface_method_impl{VBCLSERVICE,pfnInit}
83 */
84static DECLCALLBACK(int) vbclSeamlessInit(void)
85{
86 switch (VBClGetSessionType())
87 {
88 case VBGHSESSIONTYPE_X11:
89 g_pSvc = new VBClX11SeamlessSvc();
90 break;
91
92 case VBGHSESSIONTYPE_WAYLAND:
93 RT_FALL_THROUGH();
94 default:
95 return VERR_NOT_SUPPORTED;
96 }
97
98 if (!g_pSvc)
99 return VERR_NO_MEMORY;
100
101 return g_pSvc->init();
102}
103
104/**
105 * @interface_method_impl{VBCLSERVICE,pfnWorker}
106 */
107static DECLCALLBACK(int) vbclSeamlessWorker(bool volatile *pfShutdown)
108{
109 return g_pSvc->worker(pfShutdown);
110}
111
112/**
113 * @interface_method_impl{VBCLSERVICE,pfnStop}
114 */
115static DECLCALLBACK(void) vbclSeamlessStop(void)
116{
117 return g_pSvc->stop();
118}
119
120/**
121 * @interface_method_impl{VBCLSERVICE,pfnTerm}
122 */
123static DECLCALLBACK(int) vbclSeamlessTerm(void)
124{
125 int rc = VINF_SUCCESS;
126
127 if (g_pSvc)
128 {
129 rc = g_pSvc->term();
130
131 delete g_pSvc;
132 g_pSvc = NULL;
133 }
134
135 return rc;
136}
137
138VBCLSERVICE g_SvcSeamless =
139{
140 "seamless", /* szName */
141 "Seamless Mode Support", /* pszDescription */
142 ".vboxclient-seamless", /* pszPidFilePathTemplate */
143 NULL, /* pszUsage */
144 NULL, /* pszOptions */
145 NULL, /* pfnOption */
146 vbclSeamlessInit, /* pfnInit */
147 vbclSeamlessWorker, /* pfnWorker */
148 vbclSeamlessStop, /* pfnStop*/
149 vbclSeamlessTerm /* pfnTerm */
150};
151
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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