1 // -*- mode: C++; indent-tabs-mode: nil; -*-
12 #include "otk/screeninfo.hh"
13 #include "otk/timerqueuemanager.hh"
17 //! The main class for the Openbox window manager.
19 Only a single instance of the Openbox class may be used in the application. A
20 pointer to this instance is held in the Openbox::instance static member
22 Instantiation of this class begins the window manager. After instantiation,
23 the Openbox::eventLoop function should be called. The eventLoop method does
24 not exit until the window manager is ready to be destroyed. Destruction of
25 the Openbox class instance will shutdown the window manager.
30 //! The single instance of the Openbox class for the application.
32 Since this variable is globally available in the application, the Openbox
33 class does not need to be passed around to any of the other classes.
35 static Openbox
*instance
;
37 //! The posible running states of the window manager
39 //! The window manager is starting up (being created)
41 //! The window manager is running in its normal state
43 //! The window manager is exiting (being destroyed)
48 // stuff that can be passed on the command line
49 //! Path to the config file to use/in use
51 Defaults to $(HOME)/.openbox/rc3
53 std::string _rcfilepath
;
54 //! Path to the menu file to use/in use
56 Defaults to $(HOME)/.openbox/menu3
58 std::string _menufilepath
;
59 //! The display requested by the user, or null to use the DISPLAY env var
61 //! The value of argv[0], i.e. how this application was executed
64 //! Manages all timers for the application
66 Use of the otk::OBTimerQueueManager::fire funtion in this object ensures
67 that all timers fire when their times elapse.
69 otk::OBTimerQueueManager _timermanager
;
71 //! The running state of the window manager
74 //! When set to true, the Openbox::eventLoop function will stop and return
77 //! Parses the command line used when executing this application
78 void parseCommandLine(int argv
, char **argv
);
79 //! Displays the version string to stdout
81 //! Displays usage information and help to stdout
84 //! Handles signal events for the application
85 static void signalHandler(int signal
);
88 //! Openbox constructor.
90 \param argc Number of command line arguments, as received in main()
91 \param argv The command line arguments, as received in main()
93 Openbox(int argc
, char **argv
);
94 //! Openbox destructor.
97 //! Returns the state of the window manager (starting, exiting, etc)
98 inline RunState
state() const { return _state
; }
100 //! Returns the otk::OBTimerQueueManager for the application
102 All otk::OBTimer objects used in the application should be made to use this
103 otk::OBTimerQueueManager.
105 inline otk::OBTimerQueueManager
*timerManager() { return &_timermanager
; }
107 //! The main function of the Openbox class
109 This function should be called after instantiating the Openbox class.
110 Loops indefinately while handling all events in the application.
111 The Openbox::shutdown method will cause this function to exit.
115 // XXX: TEMPORARY!#!@%*!^#*!#!#!
116 virtual void process_event(XEvent
*) = 0;
118 //! Requests that the window manager exit
120 Causes the Openbox::eventLoop function to stop looping, so that the window
121 manager can be destroyed.
123 inline void shutdown() { _doshutdown
= true; }
128 #endif // __openbox_hh