]> Dogcows Code - chaz/openbox/blobdiff - src/openbox.hh
stop using a desktop number for iconic windows. woot!
[chaz/openbox] / src / openbox.hh
index 5167189796014706db503ad4f5e15e88d5287f8a..8145531fc4e64abb36105f8b78985947fab5b1c1 100644 (file)
@@ -14,10 +14,8 @@ extern "C" {
 #include <vector>
 #include <map>
 
+#include "otk/display.hh"
 #include "otk/screeninfo.hh"
-#include "otk/timerqueuemanager.hh"
-#include "otk/property.hh"
-#include "otk/configuration.hh"
 #include "otk/eventdispatcher.hh"
 #include "otk/eventhandler.hh"
 
@@ -38,6 +36,14 @@ struct Cursors {
   Cursor ur_angle; //!< For resizing the right corner of a window
 };
 
+class Openbox;
+
+//! The single instance of the Openbox class for the application
+/*!
+  Since this variable is globally available in the application, the Openbox
+  class does not need to be passed around to any of the other classes.
+*/
+extern Openbox *openbox;
 
 //! The main class for the Openbox window manager
 /*!
@@ -52,13 +58,6 @@ struct Cursors {
 class Openbox : public otk::EventDispatcher, public otk::EventHandler
 {
 public:
-  //! The single instance of the Openbox class for the application
-  /*!
-    Since this variable is globally available in the application, the Openbox
-    class does not need to be passed around to any of the other classes.
-  */
-  static Openbox *instance;
-
   //! The posible running states of the window manager
   enum RunState {
     State_Starting, //!< The window manager is starting up (being created)
@@ -73,6 +72,9 @@ public:
   typedef std::vector<Screen *> ScreenList;
   
 private:
+  //! The display on which Openbox is running
+  otk::Display _display;
+  
   // stuff that can be passed on the command line
   //! Path to the config file to use/in use
   /*!
@@ -104,21 +106,6 @@ private:
   //! A list of all the managed screens
   ScreenList _screens;
   
-  //! Manages all timers for the application
-  /*!
-    Use of the otk::TimerQueueManager::fire funtion in this object ensures
-    that all timers fire when their times elapse.
-  */
-  otk::TimerQueueManager _timermanager;
-
-  //! Cached atoms on the display
-  /*!
-    This is a pointer because the Property class uses otk::Display::display
-    in its constructor, so, it needs to be initialized <b>after</b> the display
-    is initialized in this class' constructor.
-  */
-  otk::Property *_property;
-
   //! The action interface through which all user-available actions occur
   Actions *_actions;
 
@@ -180,35 +167,23 @@ public:
   //! Returns the state of the window manager (starting, exiting, etc)
   inline RunState state() const { return _state; }
 
-  //! Returns the otk::TimerQueueManager for the application
-  /*!
-    All otk::Timer objects used in the application should be made to use this
-    otk::TimerQueueManager.
-  */
-  inline otk::TimerQueueManager *timerManager() { return &_timermanager; }
-
-  //! Returns the otk::Property instance for the window manager
-  inline const otk::Property *property() const { return _property; }
-
   //! Returns the Actions instance for the window manager
   inline Actions *actions() const { return _actions; }
 
   //! Returns the Bindings instance for the window manager
   inline Bindings *bindings() const { return _bindings; }
 
-  //! Returns a managed screen
+  //! Returns a managed screen or a null pointer
+  /*!
+    ALWAYS check the return value for a non-null, as any unmanaged screens
+    will return one. This includes screen(0) if the first managed screen is 1.
+  */
   inline Screen *screen(int num) {
-    assert(num >= 0); assert(num < (signed)_screens.size());
-    if (num >= screenCount())
-      return NULL;
+    assert(num >= 0); assert(num < (signed)ScreenCount(**otk::display));
+    if (num >= (signed)_screens.size()) return 0;
     return _screens[num];
   }
 
-  //! Returns the number of managed screens
-  inline int screenCount() const {
-    return (signed)_screens.size();
-  }
-
   //! Returns the mouse cursors used throughout Openbox
   inline const Cursors &cursors() const { return _cursors; }
 
@@ -254,8 +229,12 @@ public:
     _shutdown = true; _restart = true; _restart_prog = bin;
   }
 
-  //! Executes a command on a screen
-  void execute(int screen, const std::string &bin);
+  //! True if Openbox should be restarted instead of exiting
+  inline bool doRestart() const { return _restart; }
+
+  //! The command line requested to be executed in place of restarting
+  //! Openbox the way it was run previously.
+  inline const std::string &restartProgram() const { return _restart_prog; }
 };
 
 }
This page took 0.024336 seconds and 4 git commands to generate.