VirtualBox

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

Last change on this file since 76535 was 76535, checked in by vboxsync, 6 years ago

Additions/x11: scm --fix-header-guards. bugref:9344

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.3 KB
Line 
1/* $Id: seamless.h 76535 2018-12-30 06:17:14Z 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-2017 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 __Additions_client_seamless_host_h
20#define __Additions_client_seamless_host_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
83 /**
84 * Initialise the service.
85 */
86 int init(void);
87
88 /**
89 * Run the service.
90 * @returns iprt status value
91 */
92 int run(void);
93
94 /**
95 * Stops the service.
96 */
97 void stop();
98
99 /** Pause the service loop. This must be safe to call on a different thread
100 * and potentially before @a run is or after it exits.
101 * This is called by the VT monitoring thread to allow the service to disable
102 * itself when the X server is switched out. If the monitoring functionality
103 * is available then @a pause or @a resume will be called as soon as it starts
104 * up. */
105 int pause();
106 /** Resume after pausing. The same applies here as for @a pause. */
107 int resume();
108
109 /** Run a few tests to be sure everything is working as intended. */
110 int selfTest();
111};
112
113#endif /* __Additions_xclient_seamless_h not defined */
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