]> Dogcows Code - chaz/openbox/blobdiff - src/openbox.h
moved menu from a rc file option to a command line option
[chaz/openbox] / src / openbox.h
index 144888bbcdb7d508c4100e1ad8cc906e9598fd4c..a98b2f14b7ce8026207f06dd5a0f328518826e5d 100644 (file)
 #endif // TIME_WITH_SYS_TIME
 
 #include "Resource.h"
-#include "LinkedList.h"
 #include "BaseDisplay.h"
 #include "Timer.h"
 
+#include <map>
+#include <list>
+
 //forward declaration
 class BScreen;
 class Openbox;
@@ -74,6 +76,10 @@ public:
 class Openbox : public BaseDisplay, public TimeoutHandler {
 private:
   typedef struct MenuTimestamp {
+    virtual ~MenuTimestamp() {
+      if (filename != (char *) 0)
+        delete [] filename;
+    }
     char *filename;
     time_t timestamp;
   } MenuTimestamp;
@@ -81,29 +87,39 @@ private:
   struct resource {
     Time double_click_interval;
 
-    char *menu_file, *style_file;
+    char *style_file;
     char *titlebar_layout;
     int colors_per_channel;
     timeval auto_raise_delay;
     unsigned long cache_life, cache_max;
   } resource;
 
-  typedef DataSearch<OpenboxWindow> WindowSearch;
-  LinkedList<WindowSearch> *windowSearchList, *groupSearchList;
-  typedef DataSearch<Basemenu> MenuSearch;
-  LinkedList<MenuSearch> *menuSearchList;
-  typedef DataSearch<Toolbar> ToolbarSearch;
-  LinkedList<ToolbarSearch> *toolbarSearchList;
+  typedef std::map<Window, OpenboxWindow*> WindowLookup;
+  typedef WindowLookup::value_type WindowLookupPair;
+  WindowLookup windowSearchList, groupSearchList;
+  
+  typedef std::map<Window, Basemenu*> MenuLookup;
+  typedef MenuLookup::value_type MenuLookupPair;
+  MenuLookup menuSearchList;
+
+  typedef std::map<Window, Toolbar*> ToolbarLookup;
+  typedef ToolbarLookup::value_type ToolbarLookupPair;
+  ToolbarLookup toolbarSearchList;
 
 #ifdef    SLIT
-  typedef DataSearch<Slit> SlitSearch;
-  LinkedList<SlitSearch> *slitSearchList;
+  typedef std::map<Window, Slit*> SlitLookup;
+  typedef SlitLookup::value_type SlitLookupPair;
+  SlitLookup slitSearchList; 
 #endif // SLIT
 
-  LinkedList<MenuTimestamp> *menuTimestamps;
-  LinkedList<BScreen> *screenList;
+  typedef std::list<MenuTimestamp*> MenuTimestampList;
+  MenuTimestampList menuTimestamps;
+
+  typedef std::list<BScreen*> ScreenList;
+  ScreenList screenList;
 
-  OpenboxWindow *focused_window, *masked_window;
+  BScreen *current_screen;
+  OpenboxWindow *masked_window;
   BTimer *timer;
 
 #ifdef    HAVE_GETPID
@@ -113,7 +129,7 @@ private:
   Bool no_focus, reconfigure_wait, reread_menu_wait;
   Time last_time;
   Window masked;
-  char *rc_file, **argv;
+  char *menu_file, *rc_file, **argv;
   int argc;
   Resource config;
 
@@ -128,7 +144,7 @@ protected:
 
 
 public:
-  Openbox(int, char **, char * = 0, char * = 0);
+  Openbox(int, char **, char * = 0, char * = 0, char * = 0);
   virtual ~Openbox();
 
 #ifdef    HAVE_GETPID
@@ -139,7 +155,8 @@ public:
 
   OpenboxWindow *searchGroup(Window, OpenboxWindow *);
   OpenboxWindow *searchWindow(Window);
-  inline OpenboxWindow *getFocusedWindow() { return focused_window; }
+  OpenboxWindow *focusedWindow();
+  void focusWindow(OpenboxWindow *w);
 
   BScreen *getScreen(int);
   BScreen *searchScreen(Window);
@@ -156,7 +173,8 @@ public:
   inline const char *getStyleFilename() const
     { return resource.style_file; }
   inline const char *getMenuFilename() const
-    { return resource.menu_file; }
+    { return menu_file; }
+  void addMenuTimestamp(const char *filename);
 
   inline const int &getColorsPerChannel() const
     { return resource.colors_per_channel; }
@@ -172,14 +190,14 @@ public:
   inline const unsigned long &getCacheMax() const
     { return resource.cache_max; }
 
+  inline OpenboxWindow *getMaskedWindow() const
+    { return masked_window; }
   inline void maskWindowEvents(Window w, OpenboxWindow *bw)
     { masked = w; masked_window = bw; }
   inline void setNoFocus(Bool f) { no_focus = f; }
 
-  void setFocusedWindow(OpenboxWindow *w);
   void shutdown();
-  void saveStyleFilename(const char *);
-  void saveMenuFilename(const char *);
+  void setStyleFilename(const char *);
   void saveMenuSearch(Window, Basemenu *);
   void saveWindowSearch(Window, OpenboxWindow *);
   void saveToolbarSearch(Window, Toolbar *);
This page took 0.028403 seconds and 4 git commands to generate.