|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include <X11/X.h> |
|
7 #include <X11/Xlib.h> |
|
8 |
|
9 #include "nsRemoteClient.h" |
|
10 |
|
11 class XRemoteClient : public nsRemoteClient |
|
12 { |
|
13 public: |
|
14 XRemoteClient(); |
|
15 ~XRemoteClient(); |
|
16 |
|
17 virtual nsresult Init(); |
|
18 virtual nsresult SendCommand(const char *aProgram, const char *aUsername, |
|
19 const char *aProfile, const char *aCommand, |
|
20 const char* aDesktopStartupID, |
|
21 char **aResponse, bool *aSucceeded); |
|
22 virtual nsresult SendCommandLine(const char *aProgram, const char *aUsername, |
|
23 const char *aProfile, |
|
24 int32_t argc, char **argv, |
|
25 const char* aDesktopStartupID, |
|
26 char **aResponse, bool *aSucceeded); |
|
27 void Shutdown(); |
|
28 |
|
29 private: |
|
30 |
|
31 Window CheckWindow (Window aWindow); |
|
32 Window CheckChildren (Window aWindow); |
|
33 nsresult GetLock (Window aWindow, bool *aDestroyed); |
|
34 nsresult FreeLock (Window aWindow); |
|
35 Window FindBestWindow (const char *aProgram, |
|
36 const char *aUsername, |
|
37 const char *aProfile, |
|
38 bool aSupportsCommandLine); |
|
39 nsresult SendCommandInternal(const char *aProgram, const char *aUsername, |
|
40 const char *aProfile, const char *aCommand, |
|
41 int32_t argc, char **argv, |
|
42 const char* aDesktopStartupID, |
|
43 char **aResponse, bool *aWindowFound); |
|
44 nsresult DoSendCommand (Window aWindow, |
|
45 const char *aCommand, |
|
46 const char* aDesktopStartupID, |
|
47 char **aResponse, |
|
48 bool *aDestroyed); |
|
49 nsresult DoSendCommandLine(Window aWindow, |
|
50 int32_t argc, char **argv, |
|
51 const char* aDesktopStartupID, |
|
52 char **aResponse, |
|
53 bool *aDestroyed); |
|
54 bool WaitForResponse (Window aWindow, char **aResponse, |
|
55 bool *aDestroyed, Atom aCommandAtom); |
|
56 |
|
57 Display *mDisplay; |
|
58 |
|
59 Atom mMozVersionAtom; |
|
60 Atom mMozLockAtom; |
|
61 Atom mMozCommandAtom; |
|
62 Atom mMozCommandLineAtom; |
|
63 Atom mMozResponseAtom; |
|
64 Atom mMozWMStateAtom; |
|
65 Atom mMozUserAtom; |
|
66 Atom mMozProfileAtom; |
|
67 Atom mMozProgramAtom; |
|
68 |
|
69 char *mLockData; |
|
70 |
|
71 bool mInitialized; |
|
72 }; |