]> Dogcows Code - chaz/openbox/blobdiff - src/openbox.hh
speed up workspace switching by causing the minimal number of expose events (none...
[chaz/openbox] / src / openbox.hh
index d53bce0b43172f3853da424e04a5cbf5c08d40be..460caa0cee00c09d5353fecb35800caf9517309c 100644 (file)
@@ -16,8 +16,6 @@ extern "C" {
 
 #include "otk/display.hh"
 #include "otk/screeninfo.hh"
-#include "otk/property.hh"
-#include "otk/configuration.hh"
 #include "otk/eventdispatcher.hh"
 #include "otk/eventhandler.hh"
 
@@ -74,9 +72,6 @@ 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
   /*!
@@ -93,29 +88,24 @@ private:
     Defaults to $(HOME)/.openbox/user.py
   */
   std::string _scriptfilepath;
-  //! The display requested by the user, or null to use the DISPLAY env var
-  char *_displayreq;
   //! The value of argv, i.e. how this application was executed
   char **_argv;
   //! Run the application in synchronous mode? (for debugging)
   bool _sync;
   //! Should Openbox run on a single screen or on all available screens?
   bool _single;
+  //! Optimize for a remote/low-bandwidth connection to the display?
+  bool _remote;
 
   //! A list of all managed clients
   ClientMap _clients;
 
   //! A list of all the managed screens
   ScreenList _screens;
-  
-  //! 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 number of managed screens
+  int _managed_count;
+  
   //! The action interface through which all user-available actions occur
   Actions *_actions;
 
@@ -163,7 +153,6 @@ private:
   static void signalHandler(int signal);
 
 public:
-#ifndef SWIG
   //! Openbox constructor.
   /*!
     \param argc Number of command line arguments, as received in main()
@@ -172,37 +161,42 @@ public:
   Openbox(int argc, char **argv);
   //! Openbox destructor.
   virtual ~Openbox();
-#endif
 
   //! Returns the state of the window manager (starting, exiting, etc)
   inline RunState state() const { return _state; }
 
-  //! 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 < 0 || num >= (signed)_screens.size()) return 0;
     return _screens[num];
   }
 
-  //! Returns the number of managed screens
-  inline int screenCount() const {
-    return (signed)_screens.size();
+  inline int managedScreenCount() const { return _managed_count; }
+
+  inline Screen *managedScreen(int num) {
+    assert(num >= 0); assert(num < _managed_count);
+    if (num < 0 || num >= _managed_count) return 0;
+    ScreenList::iterator it, end = _screens.end();
+    int i = -1;
+    for (it = _screens.begin(); it != end; ++it)
+      if (*it && ++i == num)
+        return *it;
   }
 
   //! Returns the mouse cursors used throughout Openbox
   inline const Cursors &cursors() const { return _cursors; }
 
-#ifndef SWIG
   //! The main function of the Openbox class
   /*!
     This function should be called after instantiating the Openbox class.
@@ -210,7 +204,6 @@ public:
     The Openbox::shutdown method will cause this function to exit.
   */
   void eventLoop();
-#endif
 
   //! Adds an Client to the client list for lookups
   void addClient(Window window, Client *client);
@@ -244,8 +237,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.02474 seconds and 4 git commands to generate.