]> icculus.org git repositories - mikachu/openbox.git/blob - src/openbox.hh
WE DONT USE BASE DISPLAY FOR ANYTHING ANY MORE!!@^!*@*!! YAY
[mikachu/openbox.git] / src / openbox.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 #ifndef   __openbox_hh
3 #define   __openbox_hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7 }
8
9 #include <string>
10 #include <vector>
11
12 #include "otk/screeninfo.hh"
13
14 namespace ob {
15
16 class Openbox
17 {
18 public:
19   static Openbox *instance;  // there can only be ONE instance of this class in
20                              // the program, and it is held in here
21
22   typedef std::vector<otk::ScreenInfo> ScreenInfoList;
23
24   enum RunState {
25     State_Starting,
26     State_Normal,
27     State_Exiting
28   };
29   
30 private:
31   std::string _rcfilepath;   // path to the config file to use/in use
32   std::string _menufilepath; // path to the menu file to use/in use
33   char *_displayreq;         // display requested by the user
34   char *_argv0;              // argv[0], how the program was called
35
36   RunState _state;           // the state of the window manager
37
38   ScreenInfoList _screenInfoList; // info for all screens on the display
39
40   void parseCommandLine(int argv, char **argv);
41   void showVersion();
42   void showHelp();
43
44   static int xerrorHandler(Display *d, XErrorEvent *e);
45   static void signalHandler(int signal);
46
47 public:
48   //! Openbox constructor.
49   /*!
50     \param argc Number of command line arguments, as received in main()
51     \param argv The command line arguments, as received in main()
52   */
53   Openbox(int argc, char **argv);
54   //! Openbox destructor.
55   virtual ~Openbox();
56
57   //! Returns the state of the window manager (starting, exiting, etc).
58   inline RunState state() const { return _state; }
59
60   void eventLoop();
61
62   // XXX: TEMPORARY!#!@%*!^#*!#!#!
63   virtual void process_event(XEvent *) = 0;
64
65   //! Requests that the window manager exit.
66   inline void shutdown() { _state = State_Exiting; }
67 };
68
69 }
70
71 #endif // __openbox_hh