Fixed #1223878, Style reloading on USR2 (patch from Zan)
cosmetic stuff in StringUtil.cc/hh
This commit is contained in:
parent
254dcb1bcc
commit
f14c73ed33
4 changed files with 102 additions and 94 deletions
|
@ -1,5 +1,8 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 0.9.15:
|
Changes for 0.9.15:
|
||||||
|
*05/10/21:
|
||||||
|
* Fixed #1223878, Style reloading on USR2 (thanx Zan)
|
||||||
|
Screen.cc
|
||||||
*05/10/20:
|
*05/10/20:
|
||||||
* Fixed bug #1327878. (Henrik)
|
* Fixed bug #1327878. (Henrik)
|
||||||
Appending backslash to () and [] characters in the apps file
|
Appending backslash to () and [] characters in the apps file
|
||||||
|
@ -2157,7 +2160,7 @@ Changes for 0.9.6:
|
||||||
IconbarTool.cc
|
IconbarTool.cc
|
||||||
*03/09/14:
|
*03/09/14:
|
||||||
* Fixed minor bug in stick pressed button (Henrik)
|
* Fixed minor bug in stick pressed button (Henrik)
|
||||||
WinButton.cc
|
Button.cc
|
||||||
* Focus fixes (Simon)
|
* Focus fixes (Simon)
|
||||||
Hopefully fixes mysterious instances of focus not being set right.
|
Hopefully fixes mysterious instances of focus not being set right.
|
||||||
Window.cc fluxbox.cc
|
Window.cc fluxbox.cc
|
||||||
|
|
|
@ -50,7 +50,8 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
using std::string;
|
||||||
|
using std::transform;
|
||||||
|
|
||||||
namespace FbTk {
|
namespace FbTk {
|
||||||
|
|
||||||
|
@ -92,10 +93,10 @@ const char *strcasestr(const char *str, const char *ptn) {
|
||||||
if ~ then expand it to home of user
|
if ~ then expand it to home of user
|
||||||
returns expanded filename
|
returns expanded filename
|
||||||
*/
|
*/
|
||||||
string expandFilename(const std::string &filename) {
|
string expandFilename(const string &filename) {
|
||||||
string retval;
|
string retval;
|
||||||
size_t pos = filename.find_first_not_of(" \t");
|
size_t pos = filename.find_first_not_of(" \t");
|
||||||
if (pos != std::string::npos && filename[pos] == '~') {
|
if (pos != string::npos && filename[pos] == '~') {
|
||||||
retval = getenv("HOME");
|
retval = getenv("HOME");
|
||||||
if (pos != filename.size()) {
|
if (pos != filename.size()) {
|
||||||
// copy from the character after '~'
|
// copy from the character after '~'
|
||||||
|
@ -110,16 +111,16 @@ string expandFilename(const std::string &filename) {
|
||||||
/**
|
/**
|
||||||
@return string from last "." to end of string
|
@return string from last "." to end of string
|
||||||
*/
|
*/
|
||||||
string findExtension(const std::string &filename) {
|
string findExtension(const string &filename) {
|
||||||
//get start of extension
|
//get start of extension
|
||||||
std::string::size_type start_pos = filename.find_last_of(".");
|
string::size_type start_pos = filename.find_last_of(".");
|
||||||
if (start_pos == std::string::npos && start_pos != filename.size())
|
if (start_pos == string::npos && start_pos != filename.size())
|
||||||
return "";
|
return "";
|
||||||
// return from last . to end of string
|
// return from last . to end of string
|
||||||
return filename.substr(start_pos + 1);
|
return filename.substr(start_pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
string replaceString(const std::string &original,
|
string replaceString(const string &original,
|
||||||
const char *findthis,
|
const char *findthis,
|
||||||
const char *replace) {
|
const char *replace) {
|
||||||
int i=0;
|
int i=0;
|
||||||
|
@ -128,7 +129,7 @@ string replaceString(const std::string &original,
|
||||||
string ret_str(original);
|
string ret_str(original);
|
||||||
while (i < ret_str.size()) {
|
while (i < ret_str.size()) {
|
||||||
i = ret_str.find(findthis, i);
|
i = ret_str.find(findthis, i);
|
||||||
if (i == std::string::npos)
|
if (i == string::npos)
|
||||||
break;
|
break;
|
||||||
// erase old string and insert replacement
|
// erase old string and insert replacement
|
||||||
ret_str.erase(i, size_of_find);
|
ret_str.erase(i, size_of_find);
|
||||||
|
@ -150,31 +151,31 @@ string replaceString(const std::string &original,
|
||||||
for the position + 1 in the in-string where the "last"-char value
|
for the position + 1 in the in-string where the "last"-char value
|
||||||
was found.
|
was found.
|
||||||
*/
|
*/
|
||||||
int getStringBetween(std::string& out, const char *instr, const char first, const char last,
|
int getStringBetween(string& out, const char *instr, const char first, const char last,
|
||||||
const char *ok_chars, bool allow_nesting) {
|
const char *ok_chars, bool allow_nesting) {
|
||||||
assert(first);
|
assert(first);
|
||||||
assert(last);
|
assert(last);
|
||||||
assert(instr);
|
assert(instr);
|
||||||
|
|
||||||
std::string::size_type i = 0,
|
string::size_type i = 0;
|
||||||
total_add=0; //used to add extra if there is a \last to skip
|
string::size_type total_add=0; //used to add extra if there is a \last to skip
|
||||||
std::string in(instr);
|
string in(instr);
|
||||||
|
|
||||||
// eat leading whitespace
|
// eat leading whitespace
|
||||||
i = in.find_first_not_of(ok_chars);
|
i = in.find_first_not_of(ok_chars);
|
||||||
if (i == std::string::npos)
|
if (i == string::npos)
|
||||||
return -in.size(); // nothing left but whitespace
|
return -in.size(); // nothing left but whitespace
|
||||||
|
|
||||||
if (in[i]!=first)
|
if (in[i]!=first)
|
||||||
return -i; //return position to error
|
return -i; //return position to error
|
||||||
|
|
||||||
// find the end of the token
|
// find the end of the token
|
||||||
std::string::size_type j = i, k;
|
string::size_type j = i, k;
|
||||||
int nesting = 0;
|
int nesting = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
k = in.find_first_of(first, j+1);
|
k = in.find_first_of(first, j+1);
|
||||||
j = in.find_first_of(last, j+1);
|
j = in.find_first_of(last, j+1);
|
||||||
if (j==std::string::npos)
|
if (j==string::npos)
|
||||||
return -in.size(); //send negative size
|
return -in.size(); //send negative size
|
||||||
|
|
||||||
if (allow_nesting && k < j && in[k-1] != '\\') {
|
if (allow_nesting && k < j && in[k-1] != '\\') {
|
||||||
|
@ -199,26 +200,26 @@ int getStringBetween(std::string& out, const char *instr, const char first, cons
|
||||||
return (j+1+total_add);
|
return (j+1+total_add);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string toLower(const std::string &conv) {
|
string toLower(const string &conv) {
|
||||||
std::string ret = conv;
|
string ret = conv;
|
||||||
std::transform(ret.begin(), ret.end(), ret.begin(), tolower);
|
transform(ret.begin(), ret.end(), ret.begin(), tolower);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string toUpper(const std::string &conv) {
|
string toUpper(const string &conv) {
|
||||||
std::string ret = conv;
|
string ret = conv;
|
||||||
std::transform(ret.begin(), ret.end(), ret.begin(), toupper);
|
transform(ret.begin(), ret.end(), ret.begin(), toupper);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string basename(const std::string &filename) {
|
string basename(const string &filename) {
|
||||||
std::string::size_type first_pos = filename.find_last_of("/");
|
string::size_type first_pos = filename.find_last_of("/");
|
||||||
if (first_pos != std::string::npos)
|
if (first_pos != string::npos)
|
||||||
return filename.substr(first_pos + 1);
|
return filename.substr(first_pos + 1);
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
string::size_type removeFirstWhitespace(std::string &str) {
|
string::size_type removeFirstWhitespace(string &str) {
|
||||||
string::size_type first_pos = str.find_first_not_of(" \t");
|
string::size_type first_pos = str.find_first_not_of(" \t");
|
||||||
if (first_pos != string::npos)
|
if (first_pos != string::npos)
|
||||||
str.erase(0, first_pos);
|
str.erase(0, first_pos);
|
||||||
|
@ -226,7 +227,7 @@ string::size_type removeFirstWhitespace(std::string &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string::size_type removeTrailingWhitespace(std::string &str) {
|
string::size_type removeTrailingWhitespace(string &str) {
|
||||||
// strip trailing whitespace
|
// strip trailing whitespace
|
||||||
string::size_type first_pos = str.find_last_not_of(" \t");
|
string::size_type first_pos = str.find_last_not_of(" \t");
|
||||||
if (first_pos != string::npos) {
|
if (first_pos != string::npos) {
|
||||||
|
|
|
@ -683,6 +683,7 @@ void BScreen::hideWindowMenus(const FluxboxWindow* except) {
|
||||||
|
|
||||||
|
|
||||||
void BScreen::reconfigure() {
|
void BScreen::reconfigure() {
|
||||||
|
Fluxbox *fluxbox = Fluxbox::instance();
|
||||||
|
|
||||||
m_windowtheme->setFocusedAlpha(*resource.focused_alpha);
|
m_windowtheme->setFocusedAlpha(*resource.focused_alpha);
|
||||||
m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha);
|
m_windowtheme->setUnfocusedAlpha(*resource.unfocused_alpha);
|
||||||
|
@ -786,6 +787,9 @@ void BScreen::reconfigure() {
|
||||||
// notify objects that the screen is reconfigured
|
// notify objects that the screen is reconfigured
|
||||||
m_reconfigure_sig.notify();
|
m_reconfigure_sig.notify();
|
||||||
|
|
||||||
|
// Reload style
|
||||||
|
FbTk::ThemeManager::instance().load(fluxbox->getStyleFilename(),
|
||||||
|
m_root_theme->screenNum());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue