aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkt <markt>2007-07-07 23:11:04 (GMT)
committermarkt <markt>2007-07-07 23:11:04 (GMT)
commit135019abf97c7adb236c061d46e3906e51c8a145 (patch)
tree2e675ac4d9dfda48301e0b2a40b057448174692e /src
parentb735d405f58ac226e025d6ef4dbd91a0129bb12e (diff)
downloadfluxbox_pavel-135019abf97c7adb236c061d46e3906e51c8a145.zip
fluxbox_pavel-135019abf97c7adb236c061d46e3906e51c8a145.tar.bz2
fixes for --program-prefix and --program-suffix, plus fixed overwriting init file on reconfigure
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am13
-rw-r--r--src/MenuCreator.cc3
-rw-r--r--src/RootCmdMenuItem.cc8
-rw-r--r--src/RootCmdMenuItem.hh2
-rw-r--r--src/RootTheme.cc9
-rw-r--r--src/Workspace.cc2
-rw-r--r--src/fluxbox.cc25
-rw-r--r--src/fluxbox.hh3
8 files changed, 40 insertions, 25 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5b74800..b6cb024 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,8 @@ DEFAULT_MENU=@DEFAULT_MENU@
28DEFAULT_STYLE=$(pkgdatadir)/styles/Clean 28DEFAULT_STYLE=$(pkgdatadir)/styles/Clean
29DEFAULT_KEYSFILE=@DEFAULT_KEYS@ 29DEFAULT_KEYSFILE=@DEFAULT_KEYS@
30DEFAULT_INITFILE=@DEFAULT_INIT@ 30DEFAULT_INITFILE=@DEFAULT_INIT@
31PROGRAM_PREFIX=@program_prefix@
32PROGRAM_SUFFIX=@program_suffix@
31 33
32AM_CPPFLAGS=-I$(srcdir)/FbTk 34AM_CPPFLAGS=-I$(srcdir)/FbTk
33 35
@@ -37,14 +39,25 @@ CONFIG_CLEAN_FILES = defaults.hh
37defaults.hh: Makefile 39defaults.hh: Makefile
38 @( \ 40 @( \
39 echo '// This file is generated from Makefile. Do not edit!'; \ 41 echo '// This file is generated from Makefile. Do not edit!'; \
42 echo '#include <string>'; \
43 echo ''; \
40 echo '#define DEFAULTMENU "$(DEFAULT_MENU)"'; \ 44 echo '#define DEFAULTMENU "$(DEFAULT_MENU)"'; \
41 echo '#define DEFAULTSTYLE "$(DEFAULT_STYLE)"'; \ 45 echo '#define DEFAULTSTYLE "$(DEFAULT_STYLE)"'; \
42 echo '#define DEFAULTKEYSFILE "$(DEFAULT_KEYSFILE)"'; \ 46 echo '#define DEFAULTKEYSFILE "$(DEFAULT_KEYSFILE)"'; \
43 echo '#define DEFAULT_INITFILE "$(DEFAULT_INITFILE)"'; \ 47 echo '#define DEFAULT_INITFILE "$(DEFAULT_INITFILE)"'; \
48 echo '#define PROGRAM_PREFIX "$(PROGRAM_PREFIX:NONE=)"'; \
49 echo '#define PROGRAM_SUFFIX "$(PROGRAM_SUFFIX:NONE=)"'; \
50 echo 'std::string realProgramName(std::string name);'; \
44 echo 'const char* svnversion(void);' ) > defaults.hh 51 echo 'const char* svnversion(void);' ) > defaults.hh
45 52
46defaults.cc: force 53defaults.cc: force
47 @( \ 54 @( \
55 echo '#include "defaults.hh"'; \
56 echo ''; \
57 echo 'std::string realProgramName(std::string name) {'; \
58 echo ' return PROGRAM_PREFIX + name + PROGRAM_SUFFIX;'; \
59 echo '}'; \
60 echo ''; \
48 echo 'const char* svnversion(void) {'; \ 61 echo 'const char* svnversion(void) {'; \
49 echo ' return "'`(svnversion . | sed "s/[^0-9].*//") 2> /dev/null`'";';\ 62 echo ' return "'`(svnversion . | sed "s/[^0-9].*//") 2> /dev/null`'";';\
50 echo '}' ) > defaults_tmp.cc 63 echo '}' ) > defaults_tmp.cc
diff --git a/src/MenuCreator.cc b/src/MenuCreator.cc
index 552e514..1aa8877 100644
--- a/src/MenuCreator.cc
+++ b/src/MenuCreator.cc
@@ -24,6 +24,7 @@
24 24
25#include "MenuCreator.hh" 25#include "MenuCreator.hh"
26 26
27#include "defaults.hh"
27#include "Screen.hh" 28#include "Screen.hh"
28#include "CommandParser.hh" 29#include "CommandParser.hh"
29#include "fluxbox.hh" 30#include "fluxbox.hh"
@@ -349,7 +350,7 @@ static void translateMenuItem(Parser &parse, ParseItem &pitem, FbTk::StringConve
349 else if (str_key == "wallpapers" || str_key == "wallpapermenu" || 350 else if (str_key == "wallpapers" || str_key == "wallpapermenu" ||
350 str_key == "rootcommands") { 351 str_key == "rootcommands") {
351 createRootCmdMenu(menu, str_label, str_label, 352 createRootCmdMenu(menu, str_label, str_label,
352 str_cmd == "" ? "fbsetbg" : str_cmd); 353 str_cmd == "" ? realProgramName("fbsetbg") : str_cmd);
353 } // end of wallpapers 354 } // end of wallpapers
354 else if (str_key == "workspaces") { 355 else if (str_key == "workspaces") {
355 BScreen *screen = Fluxbox::instance()->findScreen(screen_number); 356 BScreen *screen = Fluxbox::instance()->findScreen(screen_number);
diff --git a/src/RootCmdMenuItem.cc b/src/RootCmdMenuItem.cc
index eabc5d3..a52a4d8 100644
--- a/src/RootCmdMenuItem.cc
+++ b/src/RootCmdMenuItem.cc
@@ -23,6 +23,7 @@
23 23
24#include "RootCmdMenuItem.hh" 24#include "RootCmdMenuItem.hh"
25 25
26#include "defaults.hh"
26#include "FbCommands.hh" 27#include "FbCommands.hh"
27#include "fluxbox.hh" 28#include "fluxbox.hh"
28 29
@@ -33,9 +34,10 @@ RootCmdMenuItem::RootCmdMenuItem(const FbTk::FbString &label,
33 const std::string &cmd): 34 const std::string &cmd):
34 FbTk::MenuItem(label), 35 FbTk::MenuItem(label),
35 m_filename(filename) { 36 m_filename(filename) {
36 37
37 FbTk::RefCount<FbTk::Command> 38 std::string prog = cmd.empty() ? realProgramName("fbsetbg") : cmd;
38 setwp_cmd(new FbCommands::ExecuteCmd(cmd + " \"" + m_filename + "\"")); 39 FbTk::RefCount<FbTk::Command>
40 setwp_cmd(new FbCommands::ExecuteCmd(prog + " \"" + m_filename + "\""));
39 setCommand(setwp_cmd); 41 setCommand(setwp_cmd);
40 setToggleItem(true); 42 setToggleItem(true);
41} 43}
diff --git a/src/RootCmdMenuItem.hh b/src/RootCmdMenuItem.hh
index 8c8ac8d..4a541d9 100644
--- a/src/RootCmdMenuItem.hh
+++ b/src/RootCmdMenuItem.hh
@@ -31,7 +31,7 @@ class RootCmdMenuItem: public FbTk::MenuItem {
31public: 31public:
32 RootCmdMenuItem(const FbTk::FbString &label, 32 RootCmdMenuItem(const FbTk::FbString &label,
33 const std::string &filename, 33 const std::string &filename,
34 const std::string &cmd = "fbsetbg"); 34 const std::string &cmd = "");
35 bool isSelected() const; 35 bool isSelected() const;
36private: 36private:
37 const std::string m_filename; 37 const std::string m_filename;
diff --git a/src/RootTheme.cc b/src/RootTheme.cc
index 5189fbb..90478e3 100644
--- a/src/RootTheme.cc
+++ b/src/RootTheme.cc
@@ -23,6 +23,7 @@
23 23
24#include "RootTheme.hh" 24#include "RootTheme.hh"
25 25
26#include "defaults.hh"
26#include "FbRootWindow.hh" 27#include "FbRootWindow.hh"
27#include "FbCommands.hh" 28#include "FbCommands.hh"
28#include "Screen.hh" 29#include "Screen.hh"
@@ -212,7 +213,8 @@ void RootTheme::reconfigTheme() {
212 options = "-A "; 213 options = "-A ";
213 214
214 // compose wallpaper application "fbsetbg" with argumetns 215 // compose wallpaper application "fbsetbg" with argumetns
215 std::string commandargs = "fbsetbg " + options + filename; 216 std::string commandargs = realProgramName("fbsetbg") + " " + options +
217 filename;
216 218
217 // call command with options 219 // call command with options
218 FbCommands::ExecuteCmd exec(commandargs, screenNum()); 220 FbCommands::ExecuteCmd exec(commandargs, screenNum());
@@ -220,7 +222,8 @@ void RootTheme::reconfigTheme() {
220 222
221 } else if (FbTk::FileUtil::isDirectory(filename.c_str()) && 223 } else if (FbTk::FileUtil::isDirectory(filename.c_str()) &&
222 strstr(m_background->options().c_str(), "random") != 0) { 224 strstr(m_background->options().c_str(), "random") != 0) {
223 std::string commandargs = "fbsetbg -R " + filename; 225 std::string commandargs = realProgramName("fbsetbg") + " -R " +
226 filename;
224 FbCommands::ExecuteCmd exec(commandargs, screenNum()); 227 FbCommands::ExecuteCmd exec(commandargs, screenNum());
225 exec.execute(); 228 exec.execute();
226 } else { 229 } else {
@@ -251,7 +254,7 @@ void RootTheme::reconfigTheme() {
251 options += "-gradient '" + m_background->options() + "'"; 254 options += "-gradient '" + m_background->options() + "'";
252 } 255 }
253 256
254 std::string commandargs = "fbsetroot " + options; 257 std::string commandargs = realProgramName("fbsetroot") + " " + options;
255 258
256 FbCommands::ExecuteCmd exec(commandargs, screenNum()); 259 FbCommands::ExecuteCmd exec(commandargs, screenNum());
257 exec.execute(); 260 exec.execute();
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 35fcf54..2f575af 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.cc
@@ -371,6 +371,8 @@ void Workspace::update(FbTk::Subject *subj) {
371 371
372void Workspace::setName(const string &name) { 372void Workspace::setName(const string &name) {
373 if (!name.empty() && name != "") { 373 if (!name.empty() && name != "") {
374 if (name == m_name)
375 return;
374 m_name = name; 376 m_name = name;
375 } else { //if name == 0 then set default name from nls 377 } else { //if name == 0 then set default name from nls
376 _FB_USES_NLS; 378 _FB_USES_NLS;
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 4ebfe95..7745a89 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -202,12 +202,12 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
202 m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"), 202 m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"),
203 m_rc_tabs_padding(m_resourcemanager, 0, "session.tabPadding", "Session.TabPadding"), 203 m_rc_tabs_padding(m_resourcemanager, 0, "session.tabPadding", "Session.TabPadding"),
204 m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"), 204 m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"),
205 m_rc_styleoverlayfile(m_resourcemanager, "~/.fluxbox/overlay", "session.styleOverlay", "Session.StyleOverlay"), 205 m_rc_styleoverlayfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/overlay", "session.styleOverlay", "Session.StyleOverlay"),
206 m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"), 206 m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"),
207 m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"), 207 m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"),
208 m_rc_slitlistfile(m_resourcemanager, "~/.fluxbox/slitlist", "session.slitlistFile", "Session.SlitlistFile"), 208 m_rc_slitlistfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/slitlist", "session.slitlistFile", "Session.SlitlistFile"),
209 m_rc_groupfile(m_resourcemanager, "~/.fluxbox/groups", "session.groupFile", "Session.GroupFile"), 209 m_rc_groupfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/groups", "session.groupFile", "Session.GroupFile"),
210 m_rc_appsfile(m_resourcemanager, "~/.fluxbox/apps", "session.appsFile", "Session.AppsFile"), 210 m_rc_appsfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/apps", "session.appsFile", "Session.AppsFile"),
211 m_rc_tabs_attach_area(m_resourcemanager, ATTACH_AREA_WINDOW, "session.tabsAttachArea", "Session.TabsAttachArea"), 211 m_rc_tabs_attach_area(m_resourcemanager, ATTACH_AREA_WINDOW, "session.tabsAttachArea", "Session.TabsAttachArea"),
212 m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), 212 m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"),
213 m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), 213 m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"),
@@ -227,7 +227,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile
227 m_shutdown(false), 227 m_shutdown(false),
228 m_server_grabs(0), 228 m_server_grabs(0),
229 m_randr_event_type(0), 229 m_randr_event_type(0),
230 m_RC_PATH("fluxbox"), 230 m_RC_PATH(realProgramName("fluxbox")),
231 m_RC_INIT_FILE("init") { 231 m_RC_INIT_FILE("init") {
232 232
233 _FB_USES_NLS; 233 _FB_USES_NLS;
@@ -588,7 +588,7 @@ void Fluxbox::setupConfigFiles() {
588 588
589 bool create_init = false, create_keys = false, create_menu = false; 589 bool create_init = false, create_keys = false, create_menu = false;
590 590
591 string dirname = getenv("HOME") + string("/.") + string(m_RC_PATH) + "/"; 591 string dirname = getenv("HOME") + string("/.") + m_RC_PATH + "/";
592 string init_file, keys_file, menu_file, slitlist_file; 592 string init_file, keys_file, menu_file, slitlist_file;
593 init_file = dirname + m_RC_INIT_FILE; 593 init_file = dirname + m_RC_INIT_FILE;
594 keys_file = dirname + "keys"; 594 keys_file = dirname + "keys";
@@ -645,8 +645,8 @@ void Fluxbox::setupConfigFiles() {
645 if (*config_version < CONFIG_VERSION) { 645 if (*config_version < CONFIG_VERSION) {
646 // configs are out of date, so run fluxbox-update_configs 646 // configs are out of date, so run fluxbox-update_configs
647 647
648 string commandargs = "fluxbox-update_configs -rc "; 648 string commandargs = realProgramName("fluxbox-update_configs");
649 commandargs += init_file; 649 commandargs += " -rc " + init_file;
650 650
651#ifdef HAVE_GETPID 651#ifdef HAVE_GETPID
652 // add the fluxbox pid so fbuc can have us reload rc if necessary 652 // add the fluxbox pid so fbuc can have us reload rc if necessary
@@ -1084,7 +1084,7 @@ void Fluxbox::handleSignal(int signum) {
1084 load_rc(); 1084 load_rc();
1085 break; 1085 break;
1086 case SIGUSR2: 1086 case SIGUSR2:
1087 reload_rc(); 1087 reconfigure();
1088 break; 1088 break;
1089 case SIGSEGV: 1089 case SIGSEGV:
1090 abort(); 1090 abort();
@@ -1559,13 +1559,8 @@ void Fluxbox::load_rc(BScreen &screen) {
1559 } 1559 }
1560} 1560}
1561 1561
1562void Fluxbox::reload_rc() {
1563 load_rc();
1564 reconfigure();
1565}
1566
1567
1568void Fluxbox::reconfigure() { 1562void Fluxbox::reconfigure() {
1563 load_rc();
1569 m_reconfigure_wait = true; 1564 m_reconfigure_wait = true;
1570 m_reconfig_timer.start(); 1565 m_reconfig_timer.start();
1571} 1566}
diff --git a/src/fluxbox.hh b/src/fluxbox.hh
index 66fdff5..51ecc06 100644
--- a/src/fluxbox.hh
+++ b/src/fluxbox.hh
@@ -216,7 +216,6 @@ private:
216 216
217 std::string getRcFilename(); 217 std::string getRcFilename();
218 void load_rc(); 218 void load_rc();
219 void reload_rc();
220 219
221 void real_rereadMenu(); 220 void real_rereadMenu();
222 void real_reconfigure(); 221 void real_reconfigure();
@@ -305,7 +304,7 @@ private:
305 int m_randr_event_type; ///< the type number of randr event 304 int m_randr_event_type; ///< the type number of randr event
306 int m_shape_eventbase; ///< event base for shape events 305 int m_shape_eventbase; ///< event base for shape events
307 bool m_have_shape; ///< if shape is supported by server 306 bool m_have_shape; ///< if shape is supported by server
308 const char *m_RC_PATH; 307 std::string m_RC_PATH;
309 const char *m_RC_INIT_FILE; 308 const char *m_RC_INIT_FILE;
310 Atom m_kwm1_dockwindow, m_kwm2_dockwindow; 309 Atom m_kwm1_dockwindow, m_kwm2_dockwindow;
311 310