aboutsummaryrefslogtreecommitdiff
path: root/src/fluxbox.hh
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-01-18 01:23:54 (GMT)
committerfluxgen <fluxgen>2002-01-18 01:23:54 (GMT)
commitf16075f27763005cd9de7a7166f7f56f86910bb4 (patch)
treeb5800d5d90a096c18b5f244fb6c7a7165e99d622 /src/fluxbox.hh
parenta8af15fdc2956aea8c2b791c724976b022a79e03 (diff)
downloadfluxbox_pavel-f16075f27763005cd9de7a7166f7f56f86910bb4.zip
fluxbox_pavel-f16075f27763005cd9de7a7166f7f56f86910bb4.tar.bz2
Fixed better resourcehandling with Resource<T>
Diffstat (limited to 'src/fluxbox.hh')
-rw-r--r--src/fluxbox.hh76
1 files changed, 41 insertions, 35 deletions
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 17228e9..ca1d614 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.hh,v 1.6 2002/01/11 09:18:58 fluxgen Exp $ 25// $Id: fluxbox.hh,v 1.7 2002/01/18 01:23:54 fluxgen Exp $
26 26
27#ifndef _FLUXBOX_HH_ 27#ifndef _FLUXBOX_HH_
28#define _FLUXBOX_HH_ 28#define _FLUXBOX_HH_
@@ -45,8 +45,13 @@
45# endif // HAVE_SYS_TIME_H 45# endif // HAVE_SYS_TIME_H
46#endif // TIME_WITH_SYS_TIME 46#endif // TIME_WITH_SYS_TIME
47 47
48//forward declaration 48#ifndef _RESOURCE_HH_
49class Fluxbox; 49#include "Resource.hh"
50#endif
51
52#ifndef _KEYS_HH_
53#include "Keys.hh"
54#endif
50 55
51#ifndef _BASEDISPLAY_HH_ 56#ifndef _BASEDISPLAY_HH_
52#include "BaseDisplay.hh" 57#include "BaseDisplay.hh"
@@ -76,10 +81,6 @@ class Fluxbox;
76#include "Toolbar.hh" 81#include "Toolbar.hh"
77#endif 82#endif
78 83
79#ifndef _KEYS_HH_
80#include "Keys.hh"
81#endif
82
83#ifdef SLIT 84#ifdef SLIT
84# include "Slit.hh" 85# include "Slit.hh"
85#endif // SLIT 86#endif // SLIT
@@ -93,10 +94,10 @@ public:
93 94
94 static Fluxbox *instance(int m_argc=0, char **m_argv=0, char *dpy_name=0, char *rc=0); 95 static Fluxbox *instance(int m_argc=0, char **m_argv=0, char *dpy_name=0, char *rc=0);
95 96
96 inline bool useTabs() const { return resource.tabs; } 97 inline bool useTabs() { return *m_rc_tabs; }
97 inline bool useIconBar() const { return resource.iconbar; } 98 inline bool useIconBar() { return *m_rc_iconbar; }
98 inline void saveTabs(bool value) { resource.tabs = value; } 99 inline void saveTabs(bool value) { *m_rc_tabs = value; }
99 inline void saveIconBar(bool value) { resource.iconbar = value; } 100 inline void saveIconBar(bool value) { m_rc_iconbar = value; }
100#ifdef HAVE_GETPID 101#ifdef HAVE_GETPID
101 inline const Atom &getFluxboxPidAtom(void) const { return fluxbox_pid; } 102 inline const Atom &getFluxboxPidAtom(void) const { return fluxbox_pid; }
102 #ifdef KDE 103 #ifdef KDE
@@ -124,24 +125,24 @@ public:
124 125
125 enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENU, EMPTY}; 126 enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENU, EMPTY};
126 127
127 inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() { return titlebar.right; } 128 inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() { return *m_rc_titlebar_right; }
128 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return titlebar.left; } 129 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return *m_rc_titlebar_left; }
129 inline const char *getStyleFilename(void) const 130 inline const char *getStyleFilename(void)
130 { return resource.style_file; } 131 { return m_rc_stylefile->c_str(); }
131 132
132 inline const char *getMenuFilename(void) const 133 inline const char *getMenuFilename(void)
133 { return resource.menu_file; } 134 { return m_rc_menufile->c_str(); }
134 135
135 inline const int &getColorsPerChannel(void) const 136 inline const int &getColorsPerChannel(void)
136 { return resource.colors_per_channel; } 137 { return *m_rc_colors_per_channel; }
137 138
138 inline const timeval &getAutoRaiseDelay(void) const 139 inline const timeval &getAutoRaiseDelay(void) const
139 { return resource.auto_raise_delay; } 140 { return resource.auto_raise_delay; }
140 141
141 inline const unsigned long &getCacheLife(void) const 142 inline const unsigned int getCacheLife(void)
142 { return resource.cache_life; } 143 { return *m_rc_cache_life * 60000; }
143 inline const unsigned long &getCacheMax(void) const 144 inline const unsigned int getCacheMax(void)
144 { return resource.cache_max; } 145 { return *m_rc_cache_max; }
145 146
146 inline void maskWindowEvents(Window w, FluxboxWindow *bw) 147 inline void maskWindowEvents(Window w, FluxboxWindow *bw)
147 { masked = w; masked_window = bw; } 148 { masked = w; masked_window = bw; }
@@ -152,7 +153,7 @@ public:
152 void load_rc(BScreen *); 153 void load_rc(BScreen *);
153 void loadRootCommand(BScreen *); 154 void loadRootCommand(BScreen *);
154 void loadTitlebar(); 155 void loadTitlebar();
155 void saveStyleFilename(const char *); 156 void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); }
156 void saveMenuFilename(const char *); 157 void saveMenuFilename(const char *);
157 void saveTitlebarFilename(const char *); 158 void saveTitlebarFilename(const char *);
158 void saveMenuSearch(Window, Basemenu *); 159 void saveMenuSearch(Window, Basemenu *);
@@ -201,6 +202,7 @@ public:
201 inline Z *getData(void) { return data; } 202 inline Z *getData(void) { return data; }
202 }; 203 };
203 204
205 typedef std::vector<Fluxbox::Titlebar> TitlebarList;
204 206
205private: 207private:
206 typedef struct MenuTimestamp { 208 typedef struct MenuTimestamp {
@@ -210,21 +212,23 @@ private:
210 212
211 struct resource { 213 struct resource {
212 Time double_click_interval; 214 Time double_click_interval;
213 215
214 char *menu_file, *style_file, *titlebar_file, *keys_file;
215 int colors_per_channel;
216 timeval auto_raise_delay; 216 timeval auto_raise_delay;
217 unsigned long cache_life, cache_max; 217 //unsigned long cache_life, cache_max;
218 bool tabs, iconbar;
219 } resource; 218 } resource;
219
220 ResourceManager m_resourcemanager;
220 221
221 struct titlebar_t { 222 //--- Resources
222 std::vector<Fluxbox::Titlebar> left; 223 Resource<bool> m_rc_tabs, m_rc_iconbar;
223 std::vector<Fluxbox::Titlebar> right; 224 Resource<int> m_rc_colors_per_channel;
224 }; 225 Resource<std::string> m_rc_stylefile,
226 m_rc_menufile, m_rc_keyfile;
225 227
226 titlebar_t titlebar; 228 Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right;
227 std::vector<std::string> parseTitleArgs(const char *arg); 229 Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;
230
231 //std::vector<std::string> parseTitleArgs(const char *arg);
228 void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg); 232 void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg);
229 233
230 typedef DataSearch<FluxboxWindow> WindowSearch; 234 typedef DataSearch<FluxboxWindow> WindowSearch;
@@ -262,6 +266,7 @@ private:
262 char *rc_file, **argv; 266 char *rc_file, **argv;
263 int argc; 267 int argc;
264 Keys *key; 268 Keys *key;
269
265 void doWindowAction(Keys::KeyAction action); 270 void doWindowAction(Keys::KeyAction action);
266protected: 271protected:
267 Fluxbox(int, char **, char * = 0, char * = 0); 272 Fluxbox(int, char **, char * = 0, char * = 0);
@@ -274,6 +279,7 @@ protected:
274 279
275 virtual void process_event(XEvent *); 280 virtual void process_event(XEvent *);
276 //only main should be able to creat new blackbox object 281 //only main should be able to creat new blackbox object
282 //TODO this must be removed!
277 friend int main(int,char **); 283 friend int main(int,char **);
278 static Fluxbox *singleton; //singleton object ( can only be destroyed by main ) 284 static Fluxbox *singleton; //singleton object ( can only be destroyed by main )
279 virtual ~Fluxbox(void); 285 virtual ~Fluxbox(void);