VirtualBox

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

Last change on this file since 69498 was 69498, checked in by vboxsync, 7 years ago

backed out r118835 as it incorrectly updated the 'This file is based on' file headers.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.2 KB
Line 
1/* $Id: seamless.h 69498 2017-10-28 15:07:25Z 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-2016 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
22#include <iprt/thread.h>
23
24#include <VBox/log.h>
25#include <VBox/VBoxGuestLib.h> /* for the R3 guest library functions */
26
27#include "seamless-x11.h"
28
29/**
30 * Interface to the host
31 */
32class SeamlessMain
33{
34private:
35 // We don't want a copy constructor or assignment operator
36 SeamlessMain(const SeamlessMain&);
37 SeamlessMain& operator=(const SeamlessMain&);
38
39 /** X11 event monitor object */
40 SeamlessX11 mX11Monitor;
41
42 /** Thread to start and stop when we enter and leave seamless mode which
43 * monitors X11 windows in the guest. */
44 RTTHREAD mX11MonitorThread;
45 /** Should the X11 monitor thread be stopping? */
46 volatile bool mX11MonitorThreadStopping;
47
48 /** The current seamless mode we are in. */
49 VMMDevSeamlessMode mMode;
50 /** Is the service currently paused? */
51 volatile bool mfPaused;
52
53 /**
54 * Waits for a seamless state change events from the host and dispatch it. This is
55 * meant to be called by the host event monitor thread exclusively.
56 *
57 * @returns IRPT return code.
58 */
59 int nextStateChangeEvent(void);
60
61 /** Thread function to monitor X11 window configuration changes. */
62 static DECLCALLBACK(int) x11MonitorThread(RTTHREAD self, void *pvUser);
63
64 /** Helper to start the X11 monitor thread. */
65 int startX11MonitorThread(void);
66
67 /** Helper to stop the X11 monitor thread again. */
68 int stopX11MonitorThread(void);
69
70 /** Is the service currently actively monitoring X11 windows? */
71 bool isX11MonitorThreadRunning()
72 {
73 return mX11MonitorThread != NIL_RTTHREAD;
74 }
75
76public:
77 SeamlessMain(void);
78 virtual ~SeamlessMain();
79
80 /**
81 * Initialise the service.
82 */
83 int init(void);
84
85 /**
86 * Run the service.
87 * @returns iprt status value
88 */
89 int run(void);
90
91 /**
92 * Stops the service.
93 */
94 void stop();
95
96 /** Pause the service loop. This must be safe to call on a different thread
97 * and potentially before @a run is or after it exits.
98 * This is called by the VT monitoring thread to allow the service to disable
99 * itself when the X server is switched out. If the monitoring functionality
100 * is available then @a pause or @a resume will be called as soon as it starts
101 * up. */
102 int pause();
103 /** Resume after pausing. The same applies here as for @a pause. */
104 int resume();
105
106 /** Run a few tests to be sure everything is working as intended. */
107 int selfTest();
108};
109
110#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