#endif // TIME_WITH_SYS_TIME
#include "Resource.h"
-#include "LinkedList.h"
#include "BaseDisplay.h"
#include "Timer.h"
+#include <map>
+#include <list>
+#include <vector>
+
//forward declaration
class BScreen;
class Openbox;
class Openbox : public BaseDisplay, public TimeoutHandler {
private:
typedef struct MenuTimestamp {
+ virtual ~MenuTimestamp() {
+ if (filename != (char *) 0)
+ delete [] filename;
+ }
char *filename;
time_t timestamp;
} MenuTimestamp;
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::vector<BScreen*> ScreenList;
+ ScreenList screenList;
- BScreen *focused_screen;
+ BScreen *current_screen;
OpenboxWindow *masked_window;
BTimer *timer;
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;
public:
- Openbox(int, char **, char * = 0, char * = 0);
+ Openbox(int, char **, char * = 0, char * = 0, char * = 0);
virtual ~Openbox();
#ifdef HAVE_GETPID
OpenboxWindow *focusedWindow();
void focusWindow(OpenboxWindow *w);
- BScreen *getScreen(int);
+ inline BScreen *getScreen(unsigned int s) {
+ ASSERT(s < screenList.size());
+ return screenList[s];
+ }
BScreen *searchScreen(Window);
+ inline unsigned int managedScreenCount() const {
+ return screenList.size();
+ }
inline Resource &getConfig() {
return config;
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; }
void shutdown();
void setStyleFilename(const char *);
- void setMenuFilename(const char *);
void saveMenuSearch(Window, Basemenu *);
void saveWindowSearch(Window, OpenboxWindow *);
void saveToolbarSearch(Window, Toolbar *);