aboutsummaryrefslogtreecommitdiff
path: root/src/Remember.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Remember.cc')
-rw-r--r--src/Remember.cc64
1 files changed, 58 insertions, 6 deletions
diff --git a/src/Remember.cc b/src/Remember.cc
index 812b109..43647a0 100644
--- a/src/Remember.cc
+++ b/src/Remember.cc
@@ -21,7 +21,7 @@
21// 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
22// DEALINGS IN THE SOFTWARE. 22// DEALINGS IN THE SOFTWARE.
23 23
24// $Id: Remember.cc,v 1.31 2003/12/10 23:08:03 fluxgen Exp $ 24// $Id: Remember.cc,v 1.32 2003/12/11 15:23:14 fluxgen Exp $
25 25
26#include "Remember.hh" 26#include "Remember.hh"
27#include "ClientPattern.hh" 27#include "ClientPattern.hh"
@@ -291,10 +291,18 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
291 if (line[0] == '#') 291 if (line[0] == '#')
292 continue; //the line is commented 292 continue; //the line is commented
293 int parse_pos = 0, err = 0; 293 int parse_pos = 0, err = 0;
294 string str_key, str_label; 294 string str_key, str_option, str_label;
295 err = FbTk::StringUtil::getStringBetween(str_key, 295 err = FbTk::StringUtil::getStringBetween(str_key,
296 line.c_str(), 296 line.c_str(),
297 '[', ']'); 297 '[', ']');
298 if (err > 0) {
299 int tmp;
300 tmp= FbTk::StringUtil::getStringBetween(str_option,
301 line.c_str() + err,
302 '(', ')');
303 if (tmp>0)
304 err += tmp;
305 }
298 if (err > 0 ) { 306 if (err > 0 ) {
299 parse_pos += err; 307 parse_pos += err;
300 err = FbTk::StringUtil::getStringBetween(str_label, 308 err = FbTk::StringUtil::getStringBetween(str_label,
@@ -324,10 +332,30 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
324 iss >> w >> h; 332 iss >> w >> h;
325 app.rememberDimensions(w,h); 333 app.rememberDimensions(w,h);
326 } else if (str_key == "Position") { 334 } else if (str_key == "Position") {
327 unsigned int x,y; 335 FB_istringstream iss;
328 FB_istringstream iss(str_label.c_str()); 336 unsigned int r= 0;
337 unsigned int x= 0;
338 unsigned int y= 0;
339 // more info about the parameter
340 // in ::rememberPosition
341
342 if ( str_option.length() )
343 {
344 if ( str_option == "UPPERLEFT" ) r= POS_UPPERLEFT;
345 else if ( str_option == "UPPERRIGHT" ) r= POS_UPPERRIGHT;
346 else if ( str_option == "LOWERLEFT" ) r= POS_LOWERLEFT;
347 else if ( str_option == "LOWERRIGHT" ) r= POS_LOWERRIGHT;
348 else if ( str_option == "CENTER" ) r= POS_CENTER;
349 else if ( str_option == "WINCENTER" ) r= POS_WINCENTER;
350 else {
351 iss.str(str_option);
352 iss >> r;
353 }
354 }
355
356 iss.str(str_label.c_str());
329 iss >> x >> y; 357 iss >> x >> y;
330 app.rememberPosition(x,y); 358 app.rememberPosition(x, y, r);
331 } else if (str_key == "Shaded") { 359 } else if (str_key == "Shaded") {
332 app.rememberShadedstate((str_label=="yes")); 360 app.rememberShadedstate((str_label=="yes"));
333 } else if (str_key == "Tab") { 361 } else if (str_key == "Tab") {
@@ -719,8 +747,32 @@ void Remember::setupFrame(FluxboxWindow &win) {
719 if (app->dimensions_remember) 747 if (app->dimensions_remember)
720 win.resize(app->w, app->h); 748 win.resize(app->w, app->h);
721 749
722 if (app->position_remember) 750 if (app->position_remember) {
751 switch (app->refc) {
752 default:
753 case POS_UPPERLEFT: // upperleft corner
723 win.move(app->x, app->y); 754 win.move(app->x, app->y);
755 break;
756 case POS_UPPERRIGHT: // upperright corner
757 win.move(screen.width() - win.width() - app->x, app->y);
758 break;
759 case POS_LOWERLEFT: // lowerleft corner
760 win.move(app->x, screen.height() - win.height() - app->y);
761 break;
762 case POS_LOWERRIGHT: // lowerright corner
763 win.move(screen.width() - win.width() - app->x,
764 screen.height() - win.height() - app->y);
765 break;
766 case POS_CENTER: // center of the screen, windows topleft corner is on the center
767 win.move((screen.width() / 2) + app->x,
768 (screen.height() / 2) + app->y);
769 break;
770 case POS_WINCENTER: // the window is centered REALLY upon the center
771 win.move((screen.width() / 2) - ( win.width() / 2 ) + app->x,
772 (screen.height() / 2) - ( win.height() / 2 ) + app->y);
773 break;
774 };
775 }
724 776
725 if (app->shadedstate_remember) 777 if (app->shadedstate_remember)
726 // if inconsistent... 778 // if inconsistent...