VirtualBox

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

Last change on this file was 99601, checked in by vboxsync, 13 months ago

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

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.0 KB
RevLine 
[55401]1/* $Id: seamless.h 99601 2023-05-04 10:43:08Z vboxsync $ */
[6202]2/** @file
[21227]3 * X11 Guest client - seamless mode, missing proper description while using the
4 * potentially confusing word 'host'.
[6202]5 */
6
7/*
[98103]8 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
[6202]9 *
[96407]10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.virtualbox.org.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation, in version 3 of the
16 * License.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see <https://www.gnu.org/licenses>.
25 *
26 * SPDX-License-Identifier: GPL-3.0-only
[6202]27 */
28
[76563]29#ifndef GA_INCLUDED_SRC_x11_VBoxClient_seamless_h
30#define GA_INCLUDED_SRC_x11_VBoxClient_seamless_h
[76535]31#ifndef RT_WITHOUT_PRAGMA_ONCE
32# pragma once
33#endif
[6202]34
[99600]35#include <iprt/asm.h>
[50336]36#include <iprt/thread.h>
37
[7449]38#include <VBox/log.h>
[21218]39#include <VBox/VBoxGuestLib.h> /* for the R3 guest library functions */
[6202]40
[50337]41#include "seamless-x11.h"
[6202]42
[99600]43/** @name Generic seamless functions
44 * @{ */
[99601]45void VBClSeamlessSendRegionUpdate(RTRECT *pRects, size_t cRects);
[99600]46/** @} */
47
[6202]48/**
[99600]49 * Interface class for seamless mode service implementation.
[6202]50 */
[99600]51class VBClSeamlessSvc
[6202]52{
[99600]53protected:
54
55 /* Note: Constructor must not throw, as we don't have exception handling on the guest side. */
56 VBClSeamlessSvc(void) { }
57
58public:
59
60 virtual ~VBClSeamlessSvc(void) { }
61
62public:
63
64 virtual int init(void) { return VINF_SUCCESS; }
65 virtual int worker(bool volatile *pfShutdown) { RT_NOREF(pfShutdown); return VINF_SUCCESS; }
66 virtual void reset(void) { }
67 virtual void stop(void) { }
68 virtual int term(void) { return VINF_SUCCESS; }
69
70#ifdef IN_GUEST
71 RTMEM_IMPLEMENT_NEW_AND_DELETE();
72#endif
73};
74
75/**
76 * Service class which implements seamless mode for X11.
77 */
78class VBClX11SeamlessSvc : public VBClSeamlessSvc
79{
80public:
81 VBClX11SeamlessSvc(void);
82
83 virtual ~VBClX11SeamlessSvc();
84
85public:
86
87 /** @copydoc VBCLSERVICE::pfnInit */
88 virtual int init(void);
89
90 /** @copydoc VBCLSERVICE::pfnWorker */
91 virtual int worker(bool volatile *pfShutdown);
92
93 /** @copydoc VBCLSERVICE::pfnStop */
94 virtual void stop(void);
95
96 /** @copydoc VBCLSERVICE::pfnTerm */
97 virtual int term(void);
98
[6202]99private:
[99600]100 /** Note: We don't want a copy constructor or assignment operator. */
101 VBClX11SeamlessSvc(const VBClX11SeamlessSvc&);
102 VBClX11SeamlessSvc& operator=(const VBClX11SeamlessSvc&);
[6202]103
[99600]104 /** X11 event monitor object. */
105 VBClX11SeamlessMonitor mX11Monitor;
[50337]106
[50324]107 /** Thread to start and stop when we enter and leave seamless mode which
108 * monitors X11 windows in the guest. */
[50346]109 RTTHREAD mX11MonitorThread;
[50336]110 /** Should the X11 monitor thread be stopping? */
[50346]111 volatile bool mX11MonitorThreadStopping;
[6202]112
[50495]113 /** The current seamless mode we are in. */
114 VMMDevSeamlessMode mMode;
115 /** Is the service currently paused? */
116 volatile bool mfPaused;
117
[6202]118 /**
119 * Waits for a seamless state change events from the host and dispatch it. This is
120 * meant to be called by the host event monitor thread exclusively.
121 *
122 * @returns IRPT return code.
123 */
[50346]124 int nextStateChangeEvent(void);
[6202]125
[50336]126 /** Thread function to monitor X11 window configuration changes. */
[50346]127 static DECLCALLBACK(int) x11MonitorThread(RTTHREAD self, void *pvUser);
[50336]128
[50346]129 /** Helper to start the X11 monitor thread. */
130 int startX11MonitorThread(void);
131
[50336]132 /** Helper to stop the X11 monitor thread again. */
[50495]133 int stopX11MonitorThread(void);
[53624]134
[50495]135 /** Is the service currently actively monitoring X11 windows? */
136 bool isX11MonitorThreadRunning()
137 {
138 return mX11MonitorThread != NIL_RTTHREAD;
139 }
[6202]140};
141
[76563]142#endif /* !GA_INCLUDED_SRC_x11_VBoxClient_seamless_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use