aboutsummaryrefslogtreecommitdiff
path: root/src/Remember.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-06-27 08:54:24 (GMT)
committersimonb <simonb>2006-06-27 08:54:24 (GMT)
commit6dc5ca4e60b80a1d900f87a4e70954cd29cfcee4 (patch)
tree772fa725f48f376a627670ded338a78363302dd9 /src/Remember.cc
parentb79d7ee745256eb14d664dcc1a6dac8520c9f490 (diff)
downloadfluxbox-6dc5ca4e60b80a1d900f87a4e70954cd29cfcee4.zip
fluxbox-6dc5ca4e60b80a1d900f87a4e70954cd29cfcee4.tar.bz2
some minor code cleanups thanks Slava Semushin (php-coder), who also thanks Mikhail Gusarov
Diffstat (limited to 'src/Remember.cc')
-rw-r--r--src/Remember.cc26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/Remember.cc b/src/Remember.cc
index 99a0d1d..eace6bc 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -61,7 +61,7 @@ using namespace std;
61namespace { 61namespace {
62 62
63bool getuint(const char *val, unsigned int &ret) { 63bool getuint(const char *val, unsigned int &ret) {
64 return (sscanf(val, "%ui", &ret) == 1); 64 return (sscanf(val, "%u", &ret) == 1);
65} 65}
66 66
67class RememberMenuItem : public FbTk::MenuItem { 67class RememberMenuItem : public FbTk::MenuItem {
@@ -263,9 +263,8 @@ Remember::~Remember() {
263 } 263 }
264 264
265 std::set<Application *>::iterator ait = all_apps.begin(); // no duplicates 265 std::set<Application *>::iterator ait = all_apps.begin(); // no duplicates
266 while (ait != all_apps.end()) { 266 for (; ait != all_apps.end(); ++ait) {
267 delete (*ait); 267 delete (*ait);
268 ++ait;
269 } 268 }
270 269
271 s_instance = 0; 270 s_instance = 0;
@@ -380,7 +379,7 @@ int Remember::parseApp(std::ifstream &file, Application &app, std::string *first
380 app.rememberLayer(l); 379 app.rememberLayer(l);
381 } else if (strcasecmp(str_key.c_str(), "Dimensions") == 0) { 380 } else if (strcasecmp(str_key.c_str(), "Dimensions") == 0) {
382 unsigned int h,w; 381 unsigned int h,w;
383 if (sscanf(str_label.c_str(), "%i %i", &w, &h) == 2) 382 if (sscanf(str_label.c_str(), "%u %u", &w, &h) == 2)
384 app.rememberDimensions(w, h); 383 app.rememberDimensions(w, h);
385 else 384 else
386 had_error = true; 385 had_error = true;
@@ -404,7 +403,7 @@ int Remember::parseApp(std::ifstream &file, Application &app, std::string *first
404 } 403 }
405 } 404 }
406 405
407 if (!had_error && sscanf(str_label.c_str(), "%i %i", &x, &y) == 2) 406 if (!had_error && sscanf(str_label.c_str(), "%u %u", &x, &y) == 2)
408 app.rememberPosition(x, y, r); 407 app.rememberPosition(x, y, r);
409 else 408 else
410 had_error = true; 409 had_error = true;
@@ -501,12 +500,11 @@ Application *Remember::findMatchingPatterns(ClientPattern *pat, Patterns *patlis
501 } 500 }
502 501
503 // forward 502 // forward
504 while (it != it_end && it->second == ret) { 503 for(; it != it_end && it->second == ret; ++it) {
505 tmpit = it; 504 delete it->first;
506 ++it;
507 delete tmpit->first;
508 patlist->erase(tmpit);
509 } 505 }
506 patlist->erase(patlist->begin(), it);
507
510 return ret; 508 return ret;
511 } 509 }
512 } 510 }
@@ -643,9 +641,8 @@ void Remember::reconfigure() {
643 } 641 }
644 642
645 std::set<Application *>::iterator ait = old_apps.begin(); // no duplicates 643 std::set<Application *>::iterator ait = old_apps.begin(); // no duplicates
646 while (ait != old_apps.end()) { 644 for (; ait != old_apps.end(); ++ait) {
647 delete (*ait); 645 delete (*ait);
648 ++ait;
649 } 646 }
650 647
651 delete old_pats; 648 delete old_pats;
@@ -1062,7 +1059,7 @@ void Remember::updateClientClose(WinClient &winclient) {
1062 1059
1063 if (app && (app->save_on_close_remember && app->save_on_close)) { 1060 if (app && (app->save_on_close_remember && app->save_on_close)) {
1064 1061
1065 for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) { 1062 for (int attrib = 0; attrib < REM_LASTATTRIB; attrib++) {
1066 if (isRemembered(winclient, (Attribute) attrib)) { 1063 if (isRemembered(winclient, (Attribute) attrib)) {
1067 rememberAttrib(winclient, (Attribute) attrib); 1064 rememberAttrib(winclient, (Attribute) attrib);
1068 } 1065 }
@@ -1091,9 +1088,8 @@ void Remember::initForScreen(BScreen &screen) {
1091void Remember::updateFrameClose(FluxboxWindow &win) { 1088void Remember::updateFrameClose(FluxboxWindow &win) {
1092 // scan all applications and remove this fbw if it is a recorded group 1089 // scan all applications and remove this fbw if it is a recorded group
1093 Patterns::iterator it = m_pats->begin(); 1090 Patterns::iterator it = m_pats->begin();
1094 while (it != m_pats->end()) { 1091 for (; it != m_pats->end(); ++it) {
1095 if (&win == it->second->group) 1092 if (&win == it->second->group)
1096 it->second->group = 0; 1093 it->second->group = 0;
1097 ++it;
1098 } 1094 }
1099} 1095}