aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-05-10 22:47:55 (GMT)
committerfluxgen <fluxgen>2003-05-10 22:47:55 (GMT)
commit8142aae84e5577c7dbbd908e4477c0d9b61f27ae (patch)
treeb3dc22981459e5a0e7c74627906e32cea5204bf6 /src
parent161be32b3a281eef35544cec40dc185dfadfb2d5 (diff)
downloadfluxbox-8142aae84e5577c7dbbd908e4477c0d9b61f27ae.zip
fluxbox-8142aae84e5577c7dbbd908e4477c0d9b61f27ae.tar.bz2
minor cleaning
Diffstat (limited to 'src')
-rw-r--r--src/Remember.cc59
-rw-r--r--src/Remember.hh5
2 files changed, 35 insertions, 29 deletions
diff --git a/src/Remember.cc b/src/Remember.cc
index 9e1fa68..e2729d7 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -1,6 +1,7 @@
1// Remember.cc for Fluxbox Window Manager 1// Remember.cc for Fluxbox Window Manager
2// Copyright (c) 2002 Xavier Brouckaert 2// Copyright (c) 2002 Xavier Brouckaert
3// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) 3// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
4// and Simon Bowden (rathnor at users.sourceforge.net)
4// 5//
5// Permission is hereby granted, free of charge, to any person obtaining a 6// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"), 7// copy of this software and associated documentation files (the "Software"),
@@ -20,7 +21,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
22 23
23// $Id: Remember.cc,v 1.11 2003/05/08 10:55:33 fluxgen Exp $ 24// $Id: Remember.cc,v 1.12 2003/05/10 22:47:55 fluxgen Exp $
24 25
25#include "Remember.hh" 26#include "Remember.hh"
26#include "StringUtil.hh" 27#include "StringUtil.hh"
@@ -192,13 +193,13 @@ Application* Remember::find(const char* app_name) {
192 if (!app_name) 193 if (!app_name)
193 return 0; 194 return 0;
194 Apps::iterator i = apps.find(app_name); 195 Apps::iterator i = apps.find(app_name);
195 if (i!=apps.end()) 196 if (i != apps.end())
196 return i->second; 197 return i->second;
197 else 198 else
198 return 0; 199 return 0;
199} 200}
200 201
201int Remember::parseApp(ifstream &file, Application *a) { 202int Remember::parseApp(ifstream &file, Application &app) {
202 string line; 203 string line;
203 int row = 0; 204 int row = 0;
204 while (! file.eof()) { 205 while (! file.eof()) {
@@ -220,45 +221,46 @@ int Remember::parseApp(ifstream &file, Application *a) {
220 } 221 }
221 } else 222 } else
222 continue; //read next line 223 continue; //read next line
224
223 if (!str_key.size()) 225 if (!str_key.size())
224 continue; //read next line 226 continue; //read next line
225 if (str_key == "Workspace") { 227 if (str_key == "Workspace") {
226 unsigned int w; 228 unsigned int w;
227 istringstream iss(str_label.c_str()); 229 istringstream iss(str_label.c_str());
228 iss >> w; 230 iss >> w;
229 a->rememberWorkspace(w); 231 app.rememberWorkspace(w);
230 } else if (str_key == "Layer") { 232 } else if (str_key == "Layer") {
231 unsigned int l; 233 unsigned int l;
232 istringstream iss(str_label.c_str()); 234 istringstream iss(str_label.c_str());
233 iss >> l; 235 iss >> l;
234 a->rememberLayer(l); 236 app.rememberLayer(l);
235 } else if (str_key == "Dimensions") { 237 } else if (str_key == "Dimensions") {
236 unsigned int h,w; 238 unsigned int h,w;
237 istringstream iss(str_label.c_str()); 239 istringstream iss(str_label.c_str());
238 iss >> w >> h; 240 iss >> w >> h;
239 a->rememberDimensions(w,h); 241 app.rememberDimensions(w,h);
240 } else if (str_key == "Position") { 242 } else if (str_key == "Position") {
241 unsigned int x,y; 243 unsigned int x,y;
242 istringstream iss(str_label); 244 istringstream iss(str_label);
243 iss >> x >> y; 245 iss >> x >> y;
244 a->rememberPosition(x,y); 246 app.rememberPosition(x,y);
245 } else if (str_key == "Shaded") { 247 } else if (str_key == "Shaded") {
246 a->rememberShadedstate((str_label=="yes")); 248 app.rememberShadedstate((str_label=="yes"));
247 } else if (str_key == "Tab") { 249 } else if (str_key == "Tab") {
248 a->rememberTabstate((str_label=="yes")); 250 app.rememberTabstate((str_label=="yes"));
249 } else if (str_key == "Deco") { 251 } else if (str_key == "Deco") {
250 if (str_label == "NONE") { 252 if (str_label == "NONE") {
251 a->rememberDecostate((unsigned int) 0); 253 app.rememberDecostate((unsigned int) 0);
252 } else if (str_label == "NORMAL") { 254 } else if (str_label == "NORMAL") {
253 a->rememberDecostate((unsigned int) 0xfffffff); 255 app.rememberDecostate((unsigned int) 0xfffffff);
254 } else if (str_label == "TINY") { 256 } else if (str_label == "TINY") {
255 a->rememberDecostate((unsigned int) 257 app.rememberDecostate((unsigned int)
256 FluxboxWindow::DECORM_TITLEBAR 258 FluxboxWindow::DECORM_TITLEBAR
257 | FluxboxWindow::DECORM_ICONIFY 259 | FluxboxWindow::DECORM_ICONIFY
258 | FluxboxWindow::DECORM_MENU 260 | FluxboxWindow::DECORM_MENU
259 ); 261 );
260 } else if (str_label == "TOOL") { 262 } else if (str_label == "TOOL") {
261 a->rememberDecostate((unsigned int) 263 app.rememberDecostate((unsigned int)
262 FluxboxWindow::DECORM_TITLEBAR 264 FluxboxWindow::DECORM_TITLEBAR
263 | FluxboxWindow::DECORM_MENU 265 | FluxboxWindow::DECORM_MENU
264 ); 266 );
@@ -273,14 +275,14 @@ int Remember::parseApp(ifstream &file, Application *a) {
273 iss >> hex; 275 iss >> hex;
274 } 276 }
275 iss >> mask ; 277 iss >> mask ;
276 a->rememberDecostate(mask); 278 app.rememberDecostate(mask);
277 } 279 }
278 } else if (str_key == "Sticky") { 280 } else if (str_key == "Sticky") {
279 a->rememberStuckstate((str_label=="yes")); 281 app.rememberStuckstate((str_label=="yes"));
280 } else if (str_key == "Jump") { 282 } else if (str_key == "Jump") {
281 a->rememberJumpworkspace((str_label=="yes")); 283 app.rememberJumpworkspace((str_label=="yes"));
282 } else if (str_key == "Close") { 284 } else if (str_key == "Close") {
283 a->rememberSaveOnClose((str_label=="yes")); 285 app.rememberSaveOnClose((str_label=="yes"));
284 } else if (str_key == "end") { 286 } else if (str_key == "end") {
285 return row; 287 return row;
286 } else { 288 } else {
@@ -314,21 +316,21 @@ void Remember::load() {
314 line.c_str(), 316 line.c_str(),
315 '[', ']'); 317 '[', ']');
316 318
317 if (err >0 && key == "app") { 319 if (err > 0 && key == "app") {
318 pos += err; 320 pos += err;
319 string label; 321 string label;
320 err = FbTk::StringUtil::getStringBetween(label, 322 err = FbTk::StringUtil::getStringBetween(label,
321 line.c_str()+pos, 323 line.c_str()+pos,
322 '(', ')'); 324 '(', ')');
323 if (err>0) { 325 if (err>0) {
324 Application *a; 326 Application *app = 0;
325 Apps::iterator i = apps.find(label); 327 Apps::iterator i = apps.find(label);
326 if (i==apps.end()) { 328 if (i == apps.end()) {
327 a = new Application(); 329 app = new Application();
328 apps[label] = a; 330 apps[label] = app;
329 } else 331 } else
330 a = i->second; 332 app = i->second;
331 row += parseApp(apps_file, a); 333 row += parseApp(apps_file, *app);
332 } else 334 } else
333 cerr<<"Error1 in apps file. Line("<<row<<")"<<endl; 335 cerr<<"Error1 in apps file. Line("<<row<<")"<<endl;
334 } else 336 } else
@@ -546,7 +548,9 @@ void Remember::setupWindow(FluxboxWindow &win) {
546 // we don't touch the window if it is a transient 548 // we don't touch the window if it is a transient
547 // of something else 549 // of something else
548 int menupos = win.getWindowmenu().numberOfItems()-2; 550 int menupos = win.getWindowmenu().numberOfItems()-2;
549 if (menupos < -1) menupos = -1; 551 if (menupos < -1)
552 menupos = -1;
553
550 if (winclient.transientFor()) { 554 if (winclient.transientFor()) {
551 // still put something in the menu so people don't get confused 555 // still put something in the menu so people don't get confused
552 // so, we add a disabled item... 556 // so, we add a disabled item...
@@ -563,10 +567,11 @@ void Remember::setupWindow(FluxboxWindow &win) {
563 win.getWindowmenu().insert("Remember...", 567 win.getWindowmenu().insert("Remember...",
564 createRememberMenu(*this, win), 568 createRememberMenu(*this, win),
565 menupos); 569 menupos);
566 win.getWindowmenu().update(); 570 win.getWindowmenu().reconfigure();
567 571
568 Application *app = find(winclient); 572 Application *app = find(winclient);
569 if (!app) return; // nothing to do 573 if (app == 0)
574 return; // nothing to do
570 575
571 BScreen &screen = win.getScreen(); 576 BScreen &screen = win.getScreen();
572 577
diff --git a/src/Remember.hh b/src/Remember.hh
index 59d6d22..6e2c3b3 100644
--- a/src/Remember.hh
+++ b/src/Remember.hh
@@ -1,6 +1,7 @@
1// Remember.hh for Fluxbox Window Manager 1// Remember.hh for Fluxbox Window Manager
2// Copyright (c) 2002 Xavier Brouckaert 2// Copyright (c) 2002 Xavier Brouckaert
3// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) 3// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
4// and Simon Bowden (rathnor at users.sourceforge.net)
4// 5//
5// Permission is hereby granted, free of charge, to any person obtaining a 6// Permission is hereby granted, free of charge, to any person obtaining a
6// copy of this software and associated documentation files (the "Software"), 7// copy of this software and associated documentation files (the "Software"),
@@ -20,7 +21,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
22 23
23// $Id: Remember.hh,v 1.4 2003/04/26 13:47:53 rathnor Exp $ 24// $Id: Remember.hh,v 1.5 2003/05/10 22:47:15 fluxgen Exp $
24 25
25/* Based on the original "Remember patch" by Xavier Brouckaert */ 26/* Based on the original "Remember patch" by Xavier Brouckaert */
26 27
@@ -171,7 +172,7 @@ public:
171private: 172private:
172 173
173 // returns number of lines read 174 // returns number of lines read
174 int parseApp(std::ifstream &file, Application *a); 175 int parseApp(std::ifstream &file, Application &app);
175 Apps apps; 176 Apps apps;
176 177
177}; 178};