summaryrefslogtreecommitdiff
path: root/src/openbox.hh
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-11-03 11:46:05 +0000
committerDana Jansens <danakj@orodu.net>2002-11-03 11:46:05 +0000
commitace8c8896aa13a6fc4e489277cf9c96f49175322 (patch)
tree69748320de56b6c0c1fccdefc768b2b12ab012b7 /src/openbox.hh
parent37e56007680a6664967e0e71ac52981654def6a6 (diff)
WE DONT USE BASE DISPLAY FOR ANYTHING ANY MORE!!@^!*@*!! YAY
Diffstat (limited to 'src/openbox.hh')
-rw-r--r--src/openbox.hh71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/openbox.hh b/src/openbox.hh
new file mode 100644
index 00000000..56e31d06
--- /dev/null
+++ b/src/openbox.hh
@@ -0,0 +1,71 @@
+// -*- mode: C++; indent-tabs-mode: nil; -*-
+#ifndef __openbox_hh
+#define __openbox_hh
+
+extern "C" {
+#include <X11/Xlib.h>
+}
+
+#include <string>
+#include <vector>
+
+#include "otk/screeninfo.hh"
+
+namespace ob {
+
+class Openbox
+{
+public:
+ static Openbox *instance; // there can only be ONE instance of this class in
+ // the program, and it is held in here
+
+ typedef std::vector<otk::ScreenInfo> ScreenInfoList;
+
+ enum RunState {
+ State_Starting,
+ State_Normal,
+ State_Exiting
+ };
+
+private:
+ std::string _rcfilepath; // path to the config file to use/in use
+ std::string _menufilepath; // path to the menu file to use/in use
+ char *_displayreq; // display requested by the user
+ char *_argv0; // argv[0], how the program was called
+
+ RunState _state; // the state of the window manager
+
+ ScreenInfoList _screenInfoList; // info for all screens on the display
+
+ void parseCommandLine(int argv, char **argv);
+ void showVersion();
+ void showHelp();
+
+ static int xerrorHandler(Display *d, XErrorEvent *e);
+ static void signalHandler(int signal);
+
+public:
+ //! Openbox constructor.
+ /*!
+ \param argc Number of command line arguments, as received in main()
+ \param argv The command line arguments, as received in main()
+ */
+ Openbox(int argc, char **argv);
+ //! Openbox destructor.
+ virtual ~Openbox();
+
+ //! Returns the state of the window manager (starting, exiting, etc).
+ inline RunState state() const { return _state; }
+
+ void eventLoop();
+
+ // XXX: TEMPORARY!#!@%*!^#*!#!#!
+ virtual void process_event(XEvent *) = 0;
+
+ //! Requests that the window manager exit.
+ inline void shutdown() { _state = State_Exiting; }
+};
+
+}
+
+#endif // __openbox_hh