1 | /** @file
|
---|
2 | *
|
---|
3 | * Guest client: seamless mode.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #include <unistd.h>
|
---|
23 |
|
---|
24 | #include <X11/Xlib.h>
|
---|
25 |
|
---|
26 | #include "VBoxClient.h"
|
---|
27 | #include "seamless.h"
|
---|
28 |
|
---|
29 | class SeamlessService : public VBoxClient::Service
|
---|
30 | {
|
---|
31 | private:
|
---|
32 | VBoxGuestSeamless mSeamless;
|
---|
33 | public:
|
---|
34 | virtual const char *getPidFilePath()
|
---|
35 | {
|
---|
36 | return ".vboxclient-seamless.pid";
|
---|
37 | }
|
---|
38 | virtual int run(bool fDaemonised /* = false */)
|
---|
39 | {
|
---|
40 | /* Initialise threading in X11 and in Xt. */
|
---|
41 | if (!XInitThreads())
|
---|
42 | {
|
---|
43 | LogRel(("VBoxClient: error initialising threads in X11, exiting.\n"));
|
---|
44 | return VERR_NOT_SUPPORTED;
|
---|
45 | }
|
---|
46 | mSeamless.init();
|
---|
47 | /* Stay running as long as X does... */
|
---|
48 | Display *pDisplay = XOpenDisplay(NULL);
|
---|
49 | XEvent ev;
|
---|
50 | while (true)
|
---|
51 | XNextEvent(pDisplay, &ev);
|
---|
52 | return VERR_INTERRUPTED;
|
---|
53 | }
|
---|
54 | virtual void cleanup()
|
---|
55 | {
|
---|
56 | VbglR3SeamlessSetCap(false);
|
---|
57 | }
|
---|
58 | };
|
---|
59 |
|
---|
60 | VBoxClient::Service *VBoxClient::GetSeamlessService()
|
---|
61 | {
|
---|
62 | return new SeamlessService;
|
---|
63 | }
|
---|