aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathias <mathias>2005-11-16 22:08:05 (GMT)
committermathias <mathias>2005-11-16 22:08:05 (GMT)
commit28837ee6e1e3226bec37a7854bd36c45406058f6 (patch)
treeb86d4fe57ec4b637d0480be8f9ce16c2dacb179e /src
parent6403deb65e7ce00c94d22c4b6893437a6cafe481 (diff)
downloadfluxbox_paul-28837ee6e1e3226bec37a7854bd36c45406058f6.zip
fluxbox_paul-28837ee6e1e3226bec37a7854bd36c45406058f6.tar.bz2
introduced session.styleOverlay (~/.fluxbox/overlay), all style settings
made in that file will override/overlay the ones made in the used style. TODO: write more specific docu about it
Diffstat (limited to 'src')
-rw-r--r--src/FbCommands.cc3
-rw-r--r--src/FbTk/Theme.cc19
-rw-r--r--src/FbTk/Theme.hh2
-rw-r--r--src/Screen.cc2
-rw-r--r--src/fluxbox.cc9
-rw-r--r--src/fluxbox.hh72
6 files changed, 65 insertions, 42 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index cdecc2b..e188a40 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -213,7 +213,8 @@ SetStyleCmd::SetStyleCmd(const std::string &filename):m_filename(filename) {
213void SetStyleCmd::execute() { 213void SetStyleCmd::execute() {
214 Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); 214 Fluxbox::instance()->saveStyleFilename(m_filename.c_str());
215 Fluxbox::instance()->save_rc(); 215 Fluxbox::instance()->save_rc();
216 FbTk::ThemeManager::instance().load(m_filename); 216 FbTk::ThemeManager::instance().load(m_filename,
217 Fluxbox::instance()->getStyleOverlayFilename());
217} 218}
218 219
219void ShowRootMenuCmd::execute() { 220void ShowRootMenuCmd::execute() {
diff --git a/src/FbTk/Theme.cc b/src/FbTk/Theme.cc
index e6a07d0..8978e11 100644
--- a/src/FbTk/Theme.cc
+++ b/src/FbTk/Theme.cc
@@ -83,7 +83,8 @@ bool ThemeManager::unregisterTheme(Theme &tm) {
83 return true; 83 return true;
84} 84}
85 85
86bool ThemeManager::load(const std::string &filename, int screen_num) { 86bool ThemeManager::load(const std::string &filename,
87 const std::string &overlay_filename, int screen_num) {
87 std::string location = FbTk::StringUtil::expandFilename(filename); 88 std::string location = FbTk::StringUtil::expandFilename(filename);
88 std::string prefix = ""; 89 std::string prefix = "";
89 90
@@ -107,6 +108,20 @@ bool ThemeManager::load(const std::string &filename, int screen_num) {
107 if (!m_database.load(location.c_str())) 108 if (!m_database.load(location.c_str()))
108 return false; 109 return false;
109 110
111
112 if (!overlay_filename.empty()) {
113 std::string overlay_location = FbTk::StringUtil::expandFilename(overlay_filename);
114 if (FileUtil::isRegularFile(overlay_location.c_str())) {
115 XrmDatabaseHelper overlay_db;
116 if (overlay_db.load(overlay_location.c_str())) {
117 // after a merge the src_db is destroyed
118 // so, make sure XrmDatabaseHelper::m_database == 0
119 XrmMergeDatabases(*overlay_db, &(*m_database));
120 *overlay_db = 0;
121 }
122 }
123 }
124
110 // relies on the fact that load_rc clears search paths each time 125 // relies on the fact that load_rc clears search paths each time
111 if (m_themelocation != "") { 126 if (m_themelocation != "") {
112 Image::removeSearchPath(m_themelocation); 127 Image::removeSearchPath(m_themelocation);
@@ -129,8 +144,8 @@ bool ThemeManager::load(const std::string &filename, int screen_num) {
129 loadTheme(**theme_it); 144 loadTheme(**theme_it);
130 else if (screen_num == (*theme_it)->screenNum()) // specified screen 145 else if (screen_num == (*theme_it)->screenNum()) // specified screen
131 loadTheme(**theme_it); 146 loadTheme(**theme_it);
132
133 } 147 }
148
134 // notify all themes that we reconfigured 149 // notify all themes that we reconfigured
135 theme_it = m_themelist.begin(); 150 theme_it = m_themelist.begin();
136 for (; theme_it != theme_it_end; ++theme_it) { 151 for (; theme_it != theme_it_end; ++theme_it) {
diff --git a/src/FbTk/Theme.hh b/src/FbTk/Theme.hh
index 18348c2..c5d8e36 100644
--- a/src/FbTk/Theme.hh
+++ b/src/FbTk/Theme.hh
@@ -127,7 +127,7 @@ class ThemeManager {
127public: 127public:
128 static ThemeManager &instance(); 128 static ThemeManager &instance();
129 /// load style file "filename" to screen 129 /// load style file "filename" to screen
130 bool load(const std::string &filename, int screen_num = -1); 130 bool load(const std::string &filename, const std::string &overlay_filename, int screen_num = -1);
131 std::string resourceValue(const std::string &name, const std::string &altname); 131 std::string resourceValue(const std::string &name, const std::string &altname);
132 void loadTheme(Theme &tm); 132 void loadTheme(Theme &tm);
133 bool loadItem(ThemeItem_base &resource); 133 bool loadItem(ThemeItem_base &resource);
diff --git a/src/Screen.cc b/src/Screen.cc
index 80c382f..c7fe1d3 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -358,6 +358,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
358 // This must be fixed in the future. 358 // This must be fixed in the future.
359 m_root_theme->lock(true); 359 m_root_theme->lock(true);
360 FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(), 360 FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(),
361 fluxbox->getStyleOverlayFilename(),
361 m_root_theme->screenNum()); 362 m_root_theme->screenNum());
362 m_root_theme->lock(false); 363 m_root_theme->lock(false);
363 m_root_theme->setLineAttributes(*resource.gc_line_width, 364 m_root_theme->setLineAttributes(*resource.gc_line_width,
@@ -789,6 +790,7 @@ void BScreen::reconfigure() {
789 790
790 // Reload style 791 // Reload style
791 FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(), 792 FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(),
793 fluxbox->getStyleOverlayFilename(),
792 m_root_theme->screenNum()); 794 m_root_theme->screenNum());
793} 795}
794 796
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index ef90d4e..94020f2 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -205,6 +205,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
205 m_rc_numlayers(m_resourcemanager, 13, "session.numLayers", "Session.NumLayers"), 205 m_rc_numlayers(m_resourcemanager, 13, "session.numLayers", "Session.NumLayers"),
206 m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"), 206 m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"),
207 m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"), 207 m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"),
208 m_rc_styleoverlayfile(m_resourcemanager, "~/.fluxbox/ovrd_style", "session.styleOverlay", "Session.StyleOverlay"),
208 m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"), 209 m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"),
209 m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"), 210 m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"),
210 m_rc_slitlistfile(m_resourcemanager, "~/.fluxbox/slitlist", "session.slitlistFile", "Session.SlitlistFile"), 211 m_rc_slitlistfile(m_resourcemanager, "~/.fluxbox/slitlist", "session.slitlistFile", "Session.SlitlistFile"),
@@ -299,7 +300,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
299 300
300 load_rc(); 301 load_rc();
301 // setup theme manager to have our style file ready to be scanned 302 // setup theme manager to have our style file ready to be scanned
302 FbTk::ThemeManager::instance().load(getStyleFilename()); 303 FbTk::ThemeManager::instance().load(getStyleFilename(), getStyleOverlayFilename());
303 304
304 // setup atom handlers before we create any windows 305 // setup atom handlers before we create any windows
305#ifdef REMEMBER 306#ifdef REMEMBER
@@ -377,9 +378,9 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
377 } 378 }
378 379
379 m_keyscreen = m_mousescreen = m_screen_list.front(); 380 m_keyscreen = m_mousescreen = m_screen_list.front();
380 381
381 // setup theme manager to have our style file ready to be scanned 382 // setup theme manager to have our style file ready to be scanned
382 FbTk::ThemeManager::instance().load(FbTk::StringUtil::expandFilename(getStyleFilename())); 383 FbTk::ThemeManager::instance().load(getStyleFilename(), getStyleOverlayFilename());
383 384
384 //XSynchronize(disp, False); 385 //XSynchronize(disp, False);
385 sync(false); 386 sync(false);
@@ -1587,7 +1588,7 @@ void Fluxbox::load_rc(BScreen &screen) {
1587 if (!(*it).empty() && (*it) != "") 1588 if (!(*it).empty() && (*it) != "")
1588 screen.addWorkspaceName((*it).c_str()); 1589 screen.addWorkspaceName((*it).c_str());
1589 } 1590 }
1590 1591
1591 } 1592 }
1592 1593
1593 FbTk::Image::removeAllSearchPaths(); 1594 FbTk::Image::removeAllSearchPaths();
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 0da630d..c32e74b 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -80,54 +80,56 @@ class Fluxbox : public FbTk::App,
80 public FbTk::SignalEventHandler, 80 public FbTk::SignalEventHandler,
81 public FbTk::Observer { 81 public FbTk::Observer {
82public: 82public:
83 Fluxbox(int argc, char **argv, const char * dpy_name= 0, 83 Fluxbox(int argc, char **argv, const char * dpy_name= 0,
84 const char *rcfilename = 0); 84 const char *rcfilename = 0);
85 virtual ~Fluxbox(); 85 virtual ~Fluxbox();
86 86
87 static Fluxbox *instance() { return s_singleton; } 87 static Fluxbox *instance() { return s_singleton; }
88
88 /// main event loop 89 /// main event loop
89 void eventLoop(); 90 void eventLoop();
90 bool validateWindow(Window win) const; 91 bool validateWindow(Window win) const;
91 void grab(); 92 void grab();
92 void ungrab(); 93 void ungrab();
93 Keys *keys() { return m_key.get(); } 94 Keys *keys() { return m_key.get(); }
94 inline Atom getFluxboxPidAtom() const { return m_fluxbox_pid; } 95 Atom getFluxboxPidAtom() const { return m_fluxbox_pid; }
95 96
96 // Not currently implemented until we decide how it'll be used 97 // Not currently implemented until we decide how it'll be used
97 //WinClient *searchGroup(Window); 98 //WinClient *searchGroup(Window);
98 WinClient *searchWindow(Window); 99 WinClient *searchWindow(Window);
99 inline WinClient *getFocusedWindow() { return m_focused_window; } 100 WinClient *getFocusedWindow() { return m_focused_window; }
100 101
101 int initScreen(int screen_nr); 102 int initScreen(int screen_nr);
102 BScreen *searchScreen(Window w); 103 BScreen *searchScreen(Window w);
103 104
104 inline unsigned int getDoubleClickInterval() const { return *m_rc_double_click_interval; } 105 unsigned int getDoubleClickInterval() const { return *m_rc_double_click_interval; }
105 inline Time getLastTime() const { return m_last_time; } 106 Time getLastTime() const { return m_last_time; }
106 107
107 AtomHandler *getAtomHandler(const std::string &name); 108 AtomHandler *getAtomHandler(const std::string &name);
108 void addAtomHandler(AtomHandler *atomh, const std::string &name); 109 void addAtomHandler(AtomHandler *atomh, const std::string &name);
109 void removeAtomHandler(AtomHandler *atomh); 110 void removeAtomHandler(AtomHandler *atomh);
110 111
111 /// obsolete 112 /// obsolete
112 enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENUICON, EMPTY}; 113 enum Titlebar{SHADE=0, MINIMIZE, MAXIMIZE, CLOSE, STICK, MENUICON, EMPTY};
113 enum TabsAttachArea{ATTACH_AREA_WINDOW= 0, ATTACH_AREA_TITLEBAR}; 114 enum TabsAttachArea{ATTACH_AREA_WINDOW= 0, ATTACH_AREA_TITLEBAR};
114 115
115 116
116 inline bool getIgnoreBorder() const { return *m_rc_ignoreborder; } 117 bool getIgnoreBorder() const { return *m_rc_ignoreborder; }
117 inline bool &getPseudoTrans() { return *m_rc_pseudotrans; } 118 bool &getPseudoTrans() { return *m_rc_pseudotrans; }
118 119
119 inline const std::vector<Fluxbox::Titlebar>& getTitlebarRight() const { return *m_rc_titlebar_right; } 120 const std::vector<Fluxbox::Titlebar>& getTitlebarRight() const { return *m_rc_titlebar_right; }
120 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; } 121 const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() const { return *m_rc_titlebar_left; }
121 inline Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_rc_tabs_attach_area; } 122 Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_rc_tabs_attach_area; }
122 inline const std::string &getStyleFilename() const { return *m_rc_stylefile; } 123 const std::string &getStyleFilename() const { return *m_rc_stylefile; }
124 const std::string &getStyleOverlayFilename() const { return *m_rc_styleoverlayfile; }
123 125
124 inline const std::string &getMenuFilename() const { return *m_rc_menufile; } 126 const std::string &getMenuFilename() const { return *m_rc_menufile; }
125 inline const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; } 127 const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; }
126 inline const std::string &getAppsFilename() const { return *m_rc_appsfile; } 128 const std::string &getAppsFilename() const { return *m_rc_appsfile; }
127 inline int colorsPerChannel() const { return *m_rc_colors_per_channel; } 129 int colorsPerChannel() const { return *m_rc_colors_per_channel; }
128 inline int getNumberOfLayers() const { return *m_rc_numlayers; } 130 int getNumberOfLayers() const { return *m_rc_numlayers; }
129 inline int getTabsPadding() const { return *m_rc_tabs_padding; } 131 int getTabsPadding() const { return *m_rc_tabs_padding; }
130 inline int getFocusedTabMinWidth() const { return *m_rc_focused_tab_min_width; } 132 int getFocusedTabMinWidth() const { return *m_rc_focused_tab_min_width; }
131 133
132 // class to store layer numbers (special Resource type) 134 // class to store layer numbers (special Resource type)
133 // we have a special resource type because we need to be able to name certain layers 135 // we have a special resource type because we need to be able to name certain layers
@@ -135,7 +137,7 @@ public:
135 class Layer { 137 class Layer {
136 public: 138 public:
137 explicit Layer(int i) : m_num(i) {}; 139 explicit Layer(int i) : m_num(i) {};
138 inline int getNum() const { return m_num; } 140 int getNum() const { return m_num; }
139 141
140 Layer &operator=(int num) { m_num = num; return *this; } 142 Layer &operator=(int num) { m_num = num; return *this; }
141 143
@@ -144,22 +146,22 @@ public:
144 }; 146 };
145 147
146 // TODO these probably should be configurable 148 // TODO these probably should be configurable
147 inline int getMenuLayer() const { return 0; } 149 int getMenuLayer() const { return 0; }
148 inline int getAboveDockLayer() const { return 2; } 150 int getAboveDockLayer() const { return 2; }
149 inline int getDockLayer() const { return 4; } 151 int getDockLayer() const { return 4; }
150 inline int getTopLayer() const { return 6; } 152 int getTopLayer() const { return 6; }
151 inline int getNormalLayer() const { return 8; } 153 int getNormalLayer() const { return 8; }
152 inline int getBottomLayer() const { return 10; } 154 int getBottomLayer() const { return 10; }
153 inline int getDesktopLayer() const { return 12; } 155 int getDesktopLayer() const { return 12; }
154 156
155 157
156 inline time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; } 158 time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; }
157 159
158 inline unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; } 160 unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; }
159 inline unsigned int getCacheMax() const { return *m_rc_cache_max; } 161 unsigned int getCacheMax() const { return *m_rc_cache_max; }
160 inline bool useMod1() const { return *m_rc_use_mod1; } 162 bool useMod1() const { return *m_rc_use_mod1; }
161 163
162 inline void maskWindowEvents(Window w, FluxboxWindow *bw) 164 void maskWindowEvents(Window w, FluxboxWindow *bw)
163 { m_masked = w; m_masked_window = bw; } 165 { m_masked = w; m_masked_window = bw; }
164 166
165 void watchKeyRelease(BScreen &screen, unsigned int mods); 167 void watchKeyRelease(BScreen &screen, unsigned int mods);
@@ -173,6 +175,7 @@ public:
173 void loadRootCommand(BScreen &scr); 175 void loadRootCommand(BScreen &scr);
174 void loadTitlebar(); 176 void loadTitlebar();
175 void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); } 177 void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); }
178 void saveStyleOverlayFilename(const char *val) { m_rc_styleoverlayfile = (val == 0 ? "" : val); }
176 void saveMenuFilename(const char *); 179 void saveMenuFilename(const char *);
177 void clearMenuFilenames(); 180 void clearMenuFilenames();
178 void saveTitlebarFilename(const char *); 181 void saveTitlebarFilename(const char *);
@@ -247,7 +250,7 @@ private:
247 void handleButtonEvent(XButtonEvent &be); 250 void handleButtonEvent(XButtonEvent &be);
248 void handleUnmapNotify(XUnmapEvent &ue); 251 void handleUnmapNotify(XUnmapEvent &ue);
249 void handleClientMessage(XClientMessageEvent &ce); 252 void handleClientMessage(XClientMessageEvent &ce);
250 void handleKeyEvent(XKeyEvent &ke); 253 void handleKeyEvent(XKeyEvent &ke);
251 void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg); 254 void setTitlebar(std::vector<Fluxbox::Titlebar>& dir, const char *arg);
252 255
253 std::auto_ptr<FbAtoms> m_fbatoms; 256 std::auto_ptr<FbAtoms> m_fbatoms;
@@ -263,6 +266,7 @@ private:
263 m_rc_tabs_padding, 266 m_rc_tabs_padding,
264 m_rc_focused_tab_min_width; 267 m_rc_focused_tab_min_width;
265 FbTk::Resource<std::string> m_rc_stylefile, 268 FbTk::Resource<std::string> m_rc_stylefile,
269 m_rc_styleoverlayfile,
266 m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile, 270 m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile,
267 m_rc_groupfile, m_rc_appsfile; 271 m_rc_groupfile, m_rc_appsfile;
268 272
@@ -280,7 +284,7 @@ private:
280 // A window is the group leader, which can map to several 284 // A window is the group leader, which can map to several
281 // WinClients in the group, it is *not* fluxbox's concept of groups 285 // WinClients in the group, it is *not* fluxbox's concept of groups
282 // See ICCCM section 4.1.11 286 // See ICCCM section 4.1.11
283 // The group leader (which may not be mapped, so may not have a WinClient) 287 // The group leader (which may not be mapped, so may not have a WinClient)
284 // will have it's window being the group index 288 // will have it's window being the group index
285 std::multimap<Window, WinClient *> m_group_search; 289 std::multimap<Window, WinClient *> m_group_search;
286 290