all repos — fluxbox @ e5d43edb8ebd472b680a5b4a96dfa1fcf1ef2260

custom fork of the fluxbox windowmanager

update keys file for changes to NextWindow syntax
Mark Tiefenbruck mark@fluxbox.org
commit

e5d43edb8ebd472b680a5b4a96dfa1fcf1ef2260

parent

18ae02875fbe67b375bbc5a8d3ac84771d0767c1

3 files changed, 55 insertions(+), 2 deletions(-)

jump to
M data/init.indata/init.in

@@ -29,4 +29,4 @@ session.colorsPerChannel: 4

session.doubleClickInterval: 250 session.cacheMax: 200 session.imageDither: True -session.configVersion: 9 +session.configVersion: 10
M src/fluxbox.ccsrc/fluxbox.cc

@@ -595,7 +595,7 @@

if (create_windowmenu) FbTk::FileUtil::copyFile(DEFAULT_WINDOWMENU, windowmenu_file.c_str()); -#define CONFIG_VERSION 9 +#define CONFIG_VERSION 10 FbTk::Resource<int> config_version(m_resourcemanager, 0, "session.configVersion", "Session.ConfigVersion"); if (*config_version < CONFIG_VERSION) {
M util/fluxbox-update_configs.ccutil/fluxbox-update_configs.cc

@@ -323,6 +323,59 @@ }

new_version = 9; } + if (old_version < 10) { // update keys file for NextWindow syntax changes + string whole_keyfile = read_file(keyfilename); + + size_t pos = 0; + while (true) { + const char *keyfile = whole_keyfile.c_str(); + const char *loc = 0; + size_t old_pos = pos; + // find the first position that matches any of next/prevwindow/group + if ((loc = FbTk::StringUtil::strcasestr(keyfile + old_pos, + "nextwindow"))) + pos = (loc - keyfile) + 10; + if ((loc = FbTk::StringUtil::strcasestr(keyfile + old_pos, + "prevwindow"))) + pos = (pos > old_pos && keyfile + pos < loc) ? + pos : (loc - keyfile) + 10; + if ((loc = FbTk::StringUtil::strcasestr(keyfile + old_pos, + "nextgroup"))) + pos = (pos > old_pos && keyfile + pos < loc) ? + pos : (loc - keyfile) + 9; + if ((loc = FbTk::StringUtil::strcasestr(keyfile + old_pos, + "prevgroup"))) + pos = (pos > old_pos && keyfile + pos < loc) ? + pos : (loc - keyfile) + 9; + if (pos == old_pos) + break; + + pos = whole_keyfile.find_first_not_of(" \t", pos); + if (pos != std::string::npos && isdigit(whole_keyfile[pos])) { + char *endptr = 0; + unsigned int mask = strtoul(keyfile + pos, &endptr, 0); + string insert = ""; + if ((mask & 9) == 9) + insert = "{static groups}"; + else if (mask & 1) + insert = "{groups}"; + else if (mask & 8) + insert = "{static}"; + if (mask & 2) + insert += " (stuck=no)"; + if (mask & 4) + insert += " (shaded=no)"; + if (mask & 16) + insert += " (minimized=no)"; + if (mask) + whole_keyfile.replace(pos, endptr - keyfile - pos, insert); + } + } + + write_file(keyfilename, whole_keyfile); + new_version = 10; + } + return new_version; }