]> Dogcows Code - chaz/openbox/blob - src/openbox.hh
76a7d973786d8d9095859eb5d29385dfaa27e39c
[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 #include "otk/timer.hh"
14
15 namespace ob {
16
17 class Openbox
18 {
19 public:
20 static Openbox *instance; // there can only be ONE instance of this class in
21 // the program, and it is held in here
22
23 typedef std::vector<otk::ScreenInfo> ScreenInfoList;
24
25 enum RunState {
26 State_Starting,
27 State_Normal,
28 State_Exiting
29 };
30
31 private:
32 // stuff that can be passed on the command line
33 std::string _rcfilepath; // path to the config file to use/in use
34 std::string _menufilepath; // path to the menu file to use/in use
35 char *_displayreq; // display requested by the user
36 char *_argv0; // argv[0], how the program was called
37
38 otk::OBTimerQueueManager _timermanager; // manages timers, so that they fire
39 // when their time elapses
40
41 RunState _state; // the state of the window manager
42
43 ScreenInfoList _screenInfoList; // info for all screens on the display
44
45 void parseCommandLine(int argv, char **argv);
46 void showVersion();
47 void showHelp();
48
49 static int xerrorHandler(Display *d, XErrorEvent *e);
50 static void signalHandler(int signal);
51
52 public:
53 //! Openbox constructor.
54 /*!
55 \param argc Number of command line arguments, as received in main()
56 \param argv The command line arguments, as received in main()
57 */
58 Openbox(int argc, char **argv);
59 //! Openbox destructor.
60 virtual ~Openbox();
61
62 //! Returns the state of the window manager (starting, exiting, etc).
63 inline RunState state() const { return _state; }
64
65 inline otk::OBTimerQueueManager *timerManager() { return &_timermanager; }
66
67 void eventLoop();
68
69 // XXX: TEMPORARY!#!@%*!^#*!#!#!
70 virtual void process_event(XEvent *) = 0;
71
72 //! Requests that the window manager exit.
73 inline void shutdown() { _state = State_Exiting; }
74 };
75
76 }
77
78 #endif // __openbox_hh
This page took 0.033509 seconds and 3 git commands to generate.