]> Dogcows Code - chaz/openbox/blob - src/openbox.hh
96cb2158b90912c96353dd094102d229e69a3510
[chaz/openbox] / 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 // stuff that can be passed on the command line
32 std::string _rcfilepath; // path to the config file to use/in use
33 std::string _menufilepath; // path to the menu file to use/in use
34 char *_displayreq; // display requested by the user
35 char *_argv0; // argv[0], how the program was called
36
37 RunState _state; // the state of the window manager
38
39 ScreenInfoList _screenInfoList; // info for all screens on the display
40
41 void parseCommandLine(int argv, char **argv);
42 void showVersion();
43 void showHelp();
44
45 static int xerrorHandler(Display *d, XErrorEvent *e);
46 static void signalHandler(int signal);
47
48 public:
49 //! Openbox constructor.
50 /*!
51 \param argc Number of command line arguments, as received in main()
52 \param argv The command line arguments, as received in main()
53 */
54 Openbox(int argc, char **argv);
55 //! Openbox destructor.
56 virtual ~Openbox();
57
58 //! Returns the state of the window manager (starting, exiting, etc).
59 inline RunState state() const { return _state; }
60
61 void eventLoop();
62
63 // XXX: TEMPORARY!#!@%*!^#*!#!#!
64 virtual void process_event(XEvent *) = 0;
65
66 //! Requests that the window manager exit.
67 inline void shutdown() { _state = State_Exiting; }
68 };
69
70 }
71
72 #endif // __openbox_hh
This page took 0.034697 seconds and 4 git commands to generate.