1 | /** @file
|
---|
2 | * X11 Guest client - seamless mode, missing proper description while using the
|
---|
3 | * potentially confusing word 'host'.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2011 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef __Additions_client_seamless_host_h
|
---|
19 | # define __Additions_client_seamless_host_h
|
---|
20 |
|
---|
21 | #include <iprt/thread.h>
|
---|
22 |
|
---|
23 | #include <VBox/log.h>
|
---|
24 | #include <VBox/VBoxGuestLib.h> /* for the R3 guest library functions */
|
---|
25 |
|
---|
26 | #include "seamless-x11.h"
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Interface to the host
|
---|
30 | */
|
---|
31 | class SeamlessMain : public SeamlessHostProxy
|
---|
32 | {
|
---|
33 | private:
|
---|
34 | // We don't want a copy constructor or assignment operator
|
---|
35 | SeamlessMain(const SeamlessMain&);
|
---|
36 | SeamlessMain& operator=(const SeamlessMain&);
|
---|
37 |
|
---|
38 | /** X11 event monitor object */
|
---|
39 | SeamlessX11 mX11Monitor;
|
---|
40 |
|
---|
41 | /** Thread to start and stop when we enter and leave seamless mode which
|
---|
42 | * monitors X11 windows in the guest. */
|
---|
43 | RTTHREAD mX11MonitorThread;
|
---|
44 | /** Should the X11 monitor thread be stopping? */
|
---|
45 | volatile bool mX11MonitorThreadStopping;
|
---|
46 | /** Host seamless event thread. */
|
---|
47 | RTTHREAD mHostEventThread;
|
---|
48 | /** Is the thread running? */
|
---|
49 | volatile bool mHostEventThreadRunning;
|
---|
50 | /** Should the thread be stopping? */
|
---|
51 | volatile bool mHostEventThreadStopping;
|
---|
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 | /**
|
---|
62 | * Interrupt an event wait and cause nextStateChangeEvent() to return immediately.
|
---|
63 | */
|
---|
64 | void cancelEvent(void) { VbglR3InterruptEventWaits(); }
|
---|
65 |
|
---|
66 | /** Thread function to query seamless activation and deactivation events
|
---|
67 | * from the host. */
|
---|
68 | static DECLCALLBACK(int) hostEventThread(RTTHREAD self, void *pvUser);
|
---|
69 |
|
---|
70 | /** Helper to start the seamless state change notification listener
|
---|
71 | * thread. */
|
---|
72 | int startHostEventThread();
|
---|
73 |
|
---|
74 | /** Helper to stop the event query thread again. */
|
---|
75 | void stopHostEventThread();
|
---|
76 |
|
---|
77 | /** Thread function to monitor X11 window configuration changes. */
|
---|
78 | static DECLCALLBACK(int) x11MonitorThread(RTTHREAD self, void *pvUser);
|
---|
79 |
|
---|
80 | /** Helper to start the X11 monitor thread. */
|
---|
81 | int startX11MonitorThread(void);
|
---|
82 |
|
---|
83 | /** Helper to stop the X11 monitor thread again. */
|
---|
84 | void stopX11MonitorThread(void);
|
---|
85 |
|
---|
86 | public:
|
---|
87 | SeamlessMain(void);
|
---|
88 | virtual ~SeamlessMain();
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * Start the service.
|
---|
92 | * @returns iprt status value
|
---|
93 | */
|
---|
94 | int start(void);
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * Stops the service.
|
---|
98 | */
|
---|
99 | void stop();
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Update the set of visible rectangles in the host.
|
---|
103 | */
|
---|
104 | virtual void sendRegionUpdate(RTRECT *pRects, size_t cRects);
|
---|
105 | };
|
---|
106 |
|
---|
107 | #endif /* __Additions_xclient_seamless_h not defined */
|
---|