fixes for --program-prefix and --program-suffix, plus fixed overwriting init file on reconfigure
@@ -1,6 +1,10 @@
(Format: Year/Month/Day) Changes for 1.0.0: *07/07/07: + * Don't overwrite changes to init file on reconfigure (Mark) + Workspace.cc fluxbox.cc/hh + * Make things work a little better with configure script's --program-prefix + and --program-suffix options (Mark) * Allow negative numbers in :Workspace <int> command, which counts backwards from the last one (Mark) * Right clicking on a submenu didn't revert focus to its parent (Mark)
@@ -1,5 +1,8 @@
# data/Makefile.am for Fluxbox - an X11 Window manager +PROGRAM_PREFIX=@program_prefix@ +PROGRAM_SUFFIX=@program_suffix@ + DEFAULT_MENU = @DEFAULT_MENU@ DEFAULT_STYLE = @DEFAULT_STYLE@ DEFAULT_KEYS = @DEFAULT_KEYS@@@ -26,6 +29,8 @@ distclean-local:
rm -f *\~ init: init.in @regex_cmd@ -e "s,@pkgdatadir@,$(pkgdatadir),g" \ + -e "s,@pkgprefix@,$(PROGRAM_PREFIX:NONE=),g" \ + -e "s,@pkgsuffix@,$(PROGRAM_SUFFIX:NONE=),g" \ -e "s,@default_style@,$(DEFAULT_STYLE),g" $(srcdir)/init.in > init menu: ../util/fluxbox-generate_menu
@@ -3,8 +3,6 @@ session.screen0.slit.direction: Vertical
session.screen0.slit.onTop: False session.screen0.slit.autoHide: False session.screen0.tab.placement: Top -session.screen0.tab.alignment: Left -session.screen0.tab.rotatevertical: True session.screen0.toolbar.onTop: False session.screen0.toolbar.autoHide: False session.screen0.toolbar.placement: BottomCenter@@ -25,10 +23,10 @@ session.screen0.tab.height: 16
session.screen0.showwindowposition: true session.opaqueMove: False session.autoRaiseDelay: 250 -session.menuFile: ~/.fluxbox/menu +session.menuFile: ~/.@pkgprefix@fluxbox@pkgsuffix@/menu session.cacheLife: 5 session.styleFile: @default_style@ -session.keyFile: ~/.fluxbox/keys +session.keyFile: ~/.@pkgprefix@fluxbox@pkgsuffix@/keys session.colorsPerChannel: 4 session.doubleClickInterval: 250 session.cacheMax: 200
@@ -28,6 +28,8 @@ DEFAULT_MENU=@DEFAULT_MENU@
DEFAULT_STYLE=$(pkgdatadir)/styles/Clean DEFAULT_KEYSFILE=@DEFAULT_KEYS@ DEFAULT_INITFILE=@DEFAULT_INIT@ +PROGRAM_PREFIX=@program_prefix@ +PROGRAM_SUFFIX=@program_suffix@ AM_CPPFLAGS=-I$(srcdir)/FbTk@@ -37,14 +39,25 @@ CONFIG_CLEAN_FILES = defaults.hh
defaults.hh: Makefile @( \ echo '// This file is generated from Makefile. Do not edit!'; \ + echo '#include <string>'; \ + echo ''; \ echo '#define DEFAULTMENU "$(DEFAULT_MENU)"'; \ echo '#define DEFAULTSTYLE "$(DEFAULT_STYLE)"'; \ echo '#define DEFAULTKEYSFILE "$(DEFAULT_KEYSFILE)"'; \ echo '#define DEFAULT_INITFILE "$(DEFAULT_INITFILE)"'; \ + echo '#define PROGRAM_PREFIX "$(PROGRAM_PREFIX:NONE=)"'; \ + echo '#define PROGRAM_SUFFIX "$(PROGRAM_SUFFIX:NONE=)"'; \ + echo 'std::string realProgramName(std::string name);'; \ echo 'const char* svnversion(void);' ) > defaults.hh defaults.cc: force @( \ + echo '#include "defaults.hh"'; \ + echo ''; \ + echo 'std::string realProgramName(std::string name) {'; \ + echo ' return PROGRAM_PREFIX + name + PROGRAM_SUFFIX;'; \ + echo '}'; \ + echo ''; \ echo 'const char* svnversion(void) {'; \ echo ' return "'`(svnversion . | sed "s/[^0-9].*//") 2> /dev/null`'";';\ echo '}' ) > defaults_tmp.cc
@@ -24,6 +24,7 @@ // $Id$
#include "MenuCreator.hh" +#include "defaults.hh" #include "Screen.hh" #include "CommandParser.hh" #include "fluxbox.hh"@@ -349,7 +350,7 @@ } // end of themesdir
else if (str_key == "wallpapers" || str_key == "wallpapermenu" || str_key == "rootcommands") { createRootCmdMenu(menu, str_label, str_label, - str_cmd == "" ? "fbsetbg" : str_cmd); + str_cmd == "" ? realProgramName("fbsetbg") : str_cmd); } // end of wallpapers else if (str_key == "workspaces") { BScreen *screen = Fluxbox::instance()->findScreen(screen_number);
@@ -23,6 +23,7 @@ // $Id$
#include "RootCmdMenuItem.hh" +#include "defaults.hh" #include "FbCommands.hh" #include "fluxbox.hh"@@ -33,9 +34,10 @@ const std::string &filename,
const std::string &cmd): FbTk::MenuItem(label), m_filename(filename) { - - FbTk::RefCount<FbTk::Command> - setwp_cmd(new FbCommands::ExecuteCmd(cmd + " \"" + m_filename + "\"")); + + std::string prog = cmd.empty() ? realProgramName("fbsetbg") : cmd; + FbTk::RefCount<FbTk::Command> + setwp_cmd(new FbCommands::ExecuteCmd(prog + " \"" + m_filename + "\"")); setCommand(setwp_cmd); setToggleItem(true); }
@@ -31,7 +31,7 @@ class RootCmdMenuItem: public FbTk::MenuItem {
public: RootCmdMenuItem(const FbTk::FbString &label, const std::string &filename, - const std::string &cmd = "fbsetbg"); + const std::string &cmd = ""); bool isSelected() const; private: const std::string m_filename;
@@ -23,6 +23,7 @@ // $Id$
#include "RootTheme.hh" +#include "defaults.hh" #include "FbRootWindow.hh" #include "FbCommands.hh" #include "Screen.hh"@@ -212,7 +213,8 @@ if (strstr(m_background->options().c_str(), "aspect") != 0)
options = "-A "; // compose wallpaper application "fbsetbg" with argumetns - std::string commandargs = "fbsetbg " + options + filename; + std::string commandargs = realProgramName("fbsetbg") + " " + options + + filename; // call command with options FbCommands::ExecuteCmd exec(commandargs, screenNum());@@ -220,7 +222,8 @@ exec.execute();
} else if (FbTk::FileUtil::isDirectory(filename.c_str()) && strstr(m_background->options().c_str(), "random") != 0) { - std::string commandargs = "fbsetbg -R " + filename; + std::string commandargs = realProgramName("fbsetbg") + " -R " + + filename; FbCommands::ExecuteCmd exec(commandargs, screenNum()); exec.execute(); } else {@@ -251,7 +254,7 @@ else if ((*m_background)->type() & FbTk::Texture::GRADIENT) {
options += "-gradient '" + m_background->options() + "'"; } - std::string commandargs = "fbsetroot " + options; + std::string commandargs = realProgramName("fbsetroot") + " " + options; FbCommands::ExecuteCmd exec(commandargs, screenNum()); exec.execute();
@@ -371,6 +371,8 @@
void Workspace::setName(const string &name) { if (!name.empty() && name != "") { + if (name == m_name) + return; m_name = name; } else { //if name == 0 then set default name from nls _FB_USES_NLS;
@@ -202,12 +202,12 @@ "session.colorsPerChannel", "Session.ColorsPerChannel"),
m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"), m_rc_tabs_padding(m_resourcemanager, 0, "session.tabPadding", "Session.TabPadding"), m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"), - m_rc_styleoverlayfile(m_resourcemanager, "~/.fluxbox/overlay", "session.styleOverlay", "Session.StyleOverlay"), + m_rc_styleoverlayfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/overlay", "session.styleOverlay", "Session.StyleOverlay"), m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"), m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"), - m_rc_slitlistfile(m_resourcemanager, "~/.fluxbox/slitlist", "session.slitlistFile", "Session.SlitlistFile"), - m_rc_groupfile(m_resourcemanager, "~/.fluxbox/groups", "session.groupFile", "Session.GroupFile"), - m_rc_appsfile(m_resourcemanager, "~/.fluxbox/apps", "session.appsFile", "Session.AppsFile"), + m_rc_slitlistfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/slitlist", "session.slitlistFile", "Session.SlitlistFile"), + m_rc_groupfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/groups", "session.groupFile", "Session.GroupFile"), + m_rc_appsfile(m_resourcemanager, "~/." + realProgramName("fluxbox") + "/apps", "session.appsFile", "Session.AppsFile"), m_rc_tabs_attach_area(m_resourcemanager, ATTACH_AREA_WINDOW, "session.tabsAttachArea", "Session.TabsAttachArea"), m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"),@@ -227,7 +227,7 @@ m_restarting(false),
m_shutdown(false), m_server_grabs(0), m_randr_event_type(0), - m_RC_PATH("fluxbox"), + m_RC_PATH(realProgramName("fluxbox")), m_RC_INIT_FILE("init") { _FB_USES_NLS;@@ -588,7 +588,7 @@ void Fluxbox::setupConfigFiles() {
bool create_init = false, create_keys = false, create_menu = false; - string dirname = getenv("HOME") + string("/.") + string(m_RC_PATH) + "/"; + string dirname = getenv("HOME") + string("/.") + m_RC_PATH + "/"; string init_file, keys_file, menu_file, slitlist_file; init_file = dirname + m_RC_INIT_FILE; keys_file = dirname + "keys";@@ -645,8 +645,8 @@ "session.configVersion", "Session.ConfigVersion");
if (*config_version < CONFIG_VERSION) { // configs are out of date, so run fluxbox-update_configs - string commandargs = "fluxbox-update_configs -rc "; - commandargs += init_file; + string commandargs = realProgramName("fluxbox-update_configs"); + commandargs += " -rc " + init_file; #ifdef HAVE_GETPID // add the fluxbox pid so fbuc can have us reload rc if necessary@@ -1084,7 +1084,7 @@ case SIGUSR1:
load_rc(); break; case SIGUSR2: - reload_rc(); + reconfigure(); break; case SIGSEGV: abort();@@ -1559,13 +1559,8 @@ cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;
} } -void Fluxbox::reload_rc() { +void Fluxbox::reconfigure() { load_rc(); - reconfigure(); -} - - -void Fluxbox::reconfigure() { m_reconfigure_wait = true; m_reconfig_timer.start(); }
@@ -216,7 +216,6 @@
std::string getRcFilename(); void load_rc(); - void reload_rc(); void real_rereadMenu(); void real_reconfigure();@@ -305,7 +304,7 @@ int m_server_grabs;
int m_randr_event_type; ///< the type number of randr event int m_shape_eventbase; ///< event base for shape events bool m_have_shape; ///< if shape is supported by server - const char *m_RC_PATH; + std::string m_RC_PATH; const char *m_RC_INIT_FILE; Atom m_kwm1_dockwindow, m_kwm2_dockwindow;
@@ -41,6 +41,8 @@ -chmod 755 startfluxbox
fluxbox-generate_menu: fluxbox-generate_menu.in @regex_cmd@ -e "s,@PREFIX@,$(prefix),g" \ + -e "s,@pkgprefix@,$(PROGRAM_PREFIX:NONE=),g" \ + -e "s,@pkgsuffix@,$(PROGRAM_SUFFIX:NONE=),g" \ $(srcdir)/fluxbox-generate_menu.in \ > fluxbox-generate_menu -chmod 755 fluxbox-generate_menu
@@ -2,7 +2,8 @@ #!/bin/sh
# $Id$ command="`basename \"$0\"`" -startup="$HOME/.fluxbox/startup" +fluxdir="$HOME/.@pkgprefix@fluxbox@pkgsuffix@" +startup="$fluxdir/startup" while [ $# -gt 0 ]; do case "$1" in@@ -28,8 +29,8 @@ exec "$startup"
elif [ -r "$startup" ]; then exec sh "$startup" else - if [ ! -d "$HOME/.fluxbox" ]; then - mkdir -p "$HOME/.fluxbox/backgrounds" "$HOME/.fluxbox/styles" "$HOME/.fluxbox/pixmaps" + if [ ! -d $fluxdir ]; then + mkdir -p "$fluxdir/backgrounds" "$fluxdir/styles" "$fluxdir/pixmaps" fi if [ ! -r "$startup" ]; then ( cat << EOF@@ -81,7 +82,7 @@ # Because it is the last app you have to run it with ''exec'' before it.
exec @pkgbindir@/@pkgprefix@fluxbox@pkgsuffix@ # or if you want to keep a log: -# exec @pkgbindir@/@pkgprefix@fluxbox@pkgsuffix@ -log "$HOME/.fluxbox/log" +# exec @pkgbindir@/@pkgprefix@fluxbox@pkgsuffix@ -log "$fluxdir/log" EOF ) > "$startup" fi