aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-01-09 21:36:21 (GMT)
committerfluxgen <fluxgen>2004-01-09 21:36:21 (GMT)
commit1a2acd2ba7c50cadd390c1d6841c2aaabc1af550 (patch)
tree3744785301cadeef360051c9c90fe994d781cb84
parentb1c9243ea4ee0d9623ce5e8ccb41f8e1bb8c4bfa (diff)
downloadfluxbox_pavel-1a2acd2ba7c50cadd390c1d6841c2aaabc1af550.zip
fluxbox_pavel-1a2acd2ba7c50cadd390c1d6841c2aaabc1af550.tar.bz2
remove first and trailing white space in color string
-rw-r--r--src/FbTk/Color.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/FbTk/Color.cc b/src/FbTk/Color.cc
index c33e692..d969a43 100644
--- a/src/FbTk/Color.cc
+++ b/src/FbTk/Color.cc
@@ -19,11 +19,12 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Color.cc,v 1.7 2004/01/09 01:54:37 fluxgen Exp $ 22// $Id: Color.cc,v 1.8 2004/01/09 21:36:21 fluxgen Exp $
23 23
24#include "Color.hh" 24#include "Color.hh"
25 25
26#include "App.hh" 26#include "App.hh"
27#include "StringUtil.hh"
27 28
28#include <iostream> 29#include <iostream>
29using namespace std; 30using namespace std;
@@ -80,13 +81,16 @@ bool Color::setFromString(const char *color_string, int screen) {
80 free(); 81 free();
81 return false; 82 return false;
82 } 83 }
84 string color_string_tmp = color_string;
85 StringUtil::removeFirstWhitespace(color_string_tmp);
86 StringUtil::removeTrailingWhitespace(color_string_tmp);
83 87
84 Display *disp = App::instance()->display(); 88 Display *disp = App::instance()->display();
85 Colormap colm = DefaultColormap(disp, screen); 89 Colormap colm = DefaultColormap(disp, screen);
86 90
87 XColor color; 91 XColor color;
88 92
89 if (! XParseColor(disp, colm, color_string, &color)) 93 if (! XParseColor(disp, colm, color_string_tmp.c_str(), &color))
90 return false; 94 return false;
91 else if (! XAllocColor(disp, colm, &color)) 95 else if (! XAllocColor(disp, colm, &color))
92 return false; 96 return false;