diff options
author | fluxgen <fluxgen> | 2003-06-16 14:54:18 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-06-16 14:54:18 (GMT) |
commit | c9f128447e967b572285c076c3a4af808b367fb3 (patch) | |
tree | 52e22c5e97c71f3e4793d249d8c9d17f2e6e4f8d /src/Workspace.cc | |
parent | 2f7ad1cade602187d41c1e4c95fa127cb0608ee1 (diff) | |
download | fluxbox-c9f128447e967b572285c076c3a4af808b367fb3.zip fluxbox-c9f128447e967b572285c076c3a4af808b367fb3.tar.bz2 |
cleaning and fixed trailing whitespace in group file loading
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r-- | src/Workspace.cc | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc index 4b75803..ac28ac9 100644 --- a/src/Workspace.cc +++ b/src/Workspace.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Workspace.cc,v 1.73 2003/06/15 19:34:34 fluxgen Exp $ | 25 | // $Id: Workspace.cc,v 1.74 2003/06/16 14:54:18 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Workspace.hh" | 27 | #include "Workspace.hh" |
28 | 28 | ||
@@ -158,46 +158,6 @@ int Workspace::addWindow(FluxboxWindow &w, bool place) { | |||
158 | if (place) | 158 | if (place) |
159 | placeWindow(w); | 159 | placeWindow(w); |
160 | 160 | ||
161 | |||
162 | //insert window after the currently focused window | ||
163 | //FluxboxWindow *focused = Fluxbox::instance()->getFocusedWindow(); | ||
164 | |||
165 | //if there isn't any window that's focused, just add it to the end of the list | ||
166 | /* | ||
167 | if (focused == 0) { | ||
168 | m_windowlist.push_back(w); | ||
169 | //Add client to clientmenu | ||
170 | m_clientmenu.insert(w->getTitle().c_str()); | ||
171 | } else { | ||
172 | Windows::iterator it = m_windowlist.begin(); | ||
173 | size_t client_insertpoint=0; | ||
174 | for (; it != m_windowlist.end(); ++it, ++client_insertpoint) { | ||
175 | if (*it == focused) { | ||
176 | ++it; | ||
177 | break; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | m_windowlist.insert(it, w); | ||
182 | //Add client to clientmenu | ||
183 | m_clientmenu.insert(w->getTitle().c_str(), client_insertpoint); | ||
184 | |||
185 | |||
186 | } | ||
187 | */ | ||
188 | |||
189 | // find focused window position | ||
190 | /* Windows::iterator insert_point_it = m_windowlist.begin(); | ||
191 | for (;insert_point_it != m_windowlist.end(); ++insert_point_it) { | ||
192 | if ((*insert_point_it)->isFocused()) { | ||
193 | break; | ||
194 | } | ||
195 | } | ||
196 | // if we found focused window, insert our window directly after it | ||
197 | if (insert_point_it != m_windowlist.end()) | ||
198 | m_windowlist.insert(insert_point_it, w); | ||
199 | else // we didn't find it, so we just add it to stack | ||
200 | */ | ||
201 | m_windowlist.push_back(&w); | 161 | m_windowlist.push_back(&w); |
202 | updateClientmenu(); | 162 | updateClientmenu(); |
203 | 163 | ||
@@ -397,9 +357,19 @@ bool Workspace::checkGrouping(FluxboxWindow &win) { | |||
397 | } | 357 | } |
398 | 358 | ||
399 | bool Workspace::loadGroups(const std::string &filename) { | 359 | bool Workspace::loadGroups(const std::string &filename) { |
400 | ifstream infile(filename.c_str()); | 360 | string real_filename = filename; |
361 | // strip trailing whitespace | ||
362 | string::size_type first_pos = real_filename.find_first_not_of(" \t"); | ||
363 | if (first_pos != string::npos) { | ||
364 | string::size_type last_pos = real_filename.find_first_of(" \t", last_pos); | ||
365 | if (last_pos != string::npos) | ||
366 | real_filename.erase(last_pos); | ||
367 | } | ||
368 | |||
369 | ifstream infile(real_filename.c_str()); | ||
401 | if (!infile) | 370 | if (!infile) |
402 | return false; | 371 | return false; |
372 | |||
403 | m_groups.clear(); // erase old groups | 373 | m_groups.clear(); // erase old groups |
404 | 374 | ||
405 | // load new groups | 375 | // load new groups |