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 nsXRemoteClient : public nsRemoteClient {
12  public:
13   nsXRemoteClient();
14   ~nsXRemoteClient();
15 
16   virtual nsresult Init() override;
17   virtual nsresult SendCommandLine(const char* aProgram, const char* aProfile,
18                                    int32_t argc, char** argv,
19                                    const char* aDesktopStartupID,
20                                    char** aResponse, bool* aSucceeded) override;
21   void Shutdown();
22 
23  private:
24   Window CheckWindow(Window aWindow);
25   Window CheckChildren(Window aWindow);
26   nsresult GetLock(Window aWindow, bool* aDestroyed);
27   nsresult FreeLock(Window aWindow);
28   Window FindBestWindow(const char* aProgram, const char* aProfile);
29   nsresult DoSendCommandLine(Window aWindow, int32_t argc, char** argv,
30                              const char* aDesktopStartupID, char** aResponse,
31                              bool* aDestroyed);
32   bool WaitForResponse(Window aWindow, char** aResponse, bool* aDestroyed,
33                        Atom aCommandAtom);
34 
35   Display* mDisplay;
36 
37   Atom mMozVersionAtom;
38   Atom mMozLockAtom;
39   Atom mMozCommandLineAtom;
40   Atom mMozResponseAtom;
41   Atom mMozWMStateAtom;
42   Atom mMozUserAtom;
43   Atom mMozProfileAtom;
44   Atom mMozProgramAtom;
45 
46   char* mLockData;
47 
48   bool mInitialized;
49 };
50