VirtualBox

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

Last change on this file since 85922 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.4 KB
Line 
1/* $Id: seamless.h 82968 2020-02-04 10:35:17Z 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-2020 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef GA_INCLUDED_SRC_x11_VBoxClient_seamless_h
20#define GA_INCLUDED_SRC_x11_VBoxClient_seamless_h
21#ifndef RT_WITHOUT_PRAGMA_ONCE
22# pragma once
23#endif
24
25#include <iprt/thread.h>
26
27#include <VBox/log.h>
28#include <VBox/VBoxGuestLib.h> /* for the R3 guest library functions */
29
30#include "seamless-x11.h"
31
32/**
33 * Interface to the host
34 */
35class SeamlessMain
36{
37private:
38 // We don't want a copy constructor or assignment operator
39 SeamlessMain(const SeamlessMain&);
40 SeamlessMain& operator=(const SeamlessMain&);
41
42 /** X11 event monitor object */
43 SeamlessX11 mX11Monitor;
44
45 /** Thread to start and stop when we enter and leave seamless mode which
46 * monitors X11 windows in the guest. */
47 RTTHREAD mX11MonitorThread;
48 /** Should the X11 monitor thread be stopping? */
49 volatile bool mX11MonitorThreadStopping;
50
51 /** The current seamless mode we are in. */
52 VMMDevSeamlessMode mMode;
53 /** Is the service currently paused? */
54 volatile bool mfPaused;
55
56 /**
57 * Waits for a seamless state change events from the host and dispatch it. This is
58 * meant to be called by the host event monitor thread exclusively.
59 *
60 * @returns IRPT return code.
61 */
62 int nextStateChangeEvent(void);
63
64 /** Thread function to monitor X11 window configuration changes. */
65 static DECLCALLBACK(int) x11MonitorThread(RTTHREAD self, void *pvUser);
66
67 /** Helper to start the X11 monitor thread. */
68 int startX11MonitorThread(void);
69
70 /** Helper to stop the X11 monitor thread again. */
71 int stopX11MonitorThread(void);
72
73 /** Is the service currently actively monitoring X11 windows? */
74 bool isX11MonitorThreadRunning()
75 {
76 return mX11MonitorThread != NIL_RTTHREAD;
77 }
78
79public:
80 SeamlessMain(void);
81 virtual ~SeamlessMain();
82#ifdef RT_NEED_NEW_AND_DELETE
83 RTMEM_IMPLEMENT_NEW_AND_DELETE();
84#endif
85
86 /**
87 * Initialise the service.
88 */
89 int init(void);
90
91 /**
92 * Run the service.
93 * @returns iprt status value
94 */
95 int run(void);
96
97 /**
98 * Stops the service.
99 */
100 void stop();
101
102 /** Pause the service loop. This must be safe to call on a different thread
103 * and potentially before @a run is or after it exits.
104 * This is called by the VT monitoring thread to allow the service to disable
105 * itself when the X server is switched out. If the monitoring functionality
106 * is available then @a pause or @a resume will be called as soon as it starts
107 * up. */
108 int pause();
109 /** Resume after pausing. The same applies here as for @a pause. */
110 int resume();
111
112 /** Run a few tests to be sure everything is working as intended. */
113 int selfTest();
114};
115
116#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