VirtualBox

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

Last change on this file since 98103 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.1 KB
Line 
1/* $Id: seamless.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * X11 Guest client - seamless mode, missing proper description while using the
4 * potentially confusing word 'host'.
5 */
6
7/*
8 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
9 *
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
27 */
28
29#ifndef GA_INCLUDED_SRC_x11_VBoxClient_seamless_h
30#define GA_INCLUDED_SRC_x11_VBoxClient_seamless_h
31#ifndef RT_WITHOUT_PRAGMA_ONCE
32# pragma once
33#endif
34
35#include <iprt/thread.h>
36
37#include <VBox/log.h>
38#include <VBox/VBoxGuestLib.h> /* for the R3 guest library functions */
39
40#include "seamless-x11.h"
41
42/**
43 * Interface to the host
44 */
45class SeamlessMain
46{
47private:
48 // We don't want a copy constructor or assignment operator
49 SeamlessMain(const SeamlessMain&);
50 SeamlessMain& operator=(const SeamlessMain&);
51
52 /** X11 event monitor object */
53 SeamlessX11 mX11Monitor;
54
55 /** Thread to start and stop when we enter and leave seamless mode which
56 * monitors X11 windows in the guest. */
57 RTTHREAD mX11MonitorThread;
58 /** Should the X11 monitor thread be stopping? */
59 volatile bool mX11MonitorThreadStopping;
60
61 /** The current seamless mode we are in. */
62 VMMDevSeamlessMode mMode;
63 /** Is the service currently paused? */
64 volatile bool mfPaused;
65
66 /**
67 * Waits for a seamless state change events from the host and dispatch it. This is
68 * meant to be called by the host event monitor thread exclusively.
69 *
70 * @returns IRPT return code.
71 */
72 int nextStateChangeEvent(void);
73
74 /** Thread function to monitor X11 window configuration changes. */
75 static DECLCALLBACK(int) x11MonitorThread(RTTHREAD self, void *pvUser);
76
77 /** Helper to start the X11 monitor thread. */
78 int startX11MonitorThread(void);
79
80 /** Helper to stop the X11 monitor thread again. */
81 int stopX11MonitorThread(void);
82
83 /** Is the service currently actively monitoring X11 windows? */
84 bool isX11MonitorThreadRunning()
85 {
86 return mX11MonitorThread != NIL_RTTHREAD;
87 }
88
89public:
90 SeamlessMain(void);
91 virtual ~SeamlessMain();
92#ifdef RT_NEED_NEW_AND_DELETE
93 RTMEM_IMPLEMENT_NEW_AND_DELETE();
94#endif
95
96 /** @copydoc VBCLSERVICE::pfnInit */
97 int init(void);
98
99 /** @copydoc VBCLSERVICE::pfnWorker */
100 int worker(bool volatile *pfShutdown);
101
102 /** @copydoc VBCLSERVICE::pfnStop */
103 void stop(void);
104
105 /** @copydoc VBCLSERVICE::pfnTerm */
106 int term(void);
107};
108
109#endif /* !GA_INCLUDED_SRC_x11_VBoxClient_seamless_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