summaryrefslogtreecommitdiff
path: root/src/Remember.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Remember.cc')
-rw-r--r--src/Remember.cc218
1 files changed, 109 insertions, 109 deletions
diff --git a/src/Remember.cc b/src/Remember.cc
index 97d1e35..0b4b248 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.25 2003/07/04 01:03:40 rathnor Exp $ 24// $Id: Remember.cc,v 1.26 2003/07/04 14:06:20 rathnor Exp $
25 25
26#include "Remember.hh" 26#include "Remember.hh"
27#include "ClientPattern.hh" 27#include "ClientPattern.hh"
@@ -216,94 +216,94 @@ int Remember::parseApp(ifstream &file, Application &app, string *first_line) {
216 } 216 }
217 217
218 row++; 218 row++;
219 if (line[0] != '#') { //the line is commented 219 if (line[0] == '#')
220 int parse_pos = 0, err = 0; 220 continue; //the line is commented
221 string str_key, str_label; 221 int parse_pos = 0, err = 0;
222 err = FbTk::StringUtil::getStringBetween(str_key, 222 string str_key, str_label;
223 line.c_str(), 223 err = FbTk::StringUtil::getStringBetween(str_key,
224 '[', ']'); 224 line.c_str(),
225 if (err > 0 ) { 225 '[', ']');
226 if (err > 0 ) {
227 parse_pos += err;
228 err = FbTk::StringUtil::getStringBetween(str_label,
229 line.c_str() + parse_pos,
230 '{', '}');
231 if (err>0) {
226 parse_pos += err; 232 parse_pos += err;
227 err = FbTk::StringUtil::getStringBetween(str_label, 233 }
228 line.c_str() + parse_pos, 234 } else
229 '{', '}'); 235 continue; //read next line
230 if (err>0) { 236
231 parse_pos += err; 237 if (!str_key.size())
232 } 238 continue; //read next line
233 } else 239 if (str_key == "Workspace") {
234 continue; //read next line 240 unsigned int w;
235 241 istringstream iss(str_label.c_str());
236 if (!str_key.size()) 242 iss >> w;
237 continue; //read next line 243 app.rememberWorkspace(w);
238 if (str_key == "Workspace") { 244 } else if (str_key == "Layer") {
239 unsigned int w; 245 unsigned int l;
240 istringstream iss(str_label.c_str()); 246 istringstream iss(str_label.c_str());
241 iss >> w; 247 iss >> l;
242 app.rememberWorkspace(w); 248 app.rememberLayer(l);
243 } else if (str_key == "Layer") { 249 } else if (str_key == "Dimensions") {
244 unsigned int l; 250 unsigned int h,w;
245 istringstream iss(str_label.c_str()); 251 istringstream iss(str_label.c_str());
246 iss >> l; 252 iss >> w >> h;
247 app.rememberLayer(l); 253 app.rememberDimensions(w,h);
248 } else if (str_key == "Dimensions") { 254 } else if (str_key == "Position") {
249 unsigned int h,w; 255 unsigned int x,y;
250 istringstream iss(str_label.c_str()); 256 istringstream iss(str_label);
251 iss >> w >> h; 257 iss >> x >> y;
252 app.rememberDimensions(w,h); 258 app.rememberPosition(x,y);
253 } else if (str_key == "Position") { 259 } else if (str_key == "Shaded") {
254 unsigned int x,y; 260 app.rememberShadedstate((str_label=="yes"));
255 istringstream iss(str_label); 261 } else if (str_key == "Tab") {
256 iss >> x >> y; 262 app.rememberTabstate((str_label=="yes"));
257 app.rememberPosition(x,y); 263 } else if (str_key == "Deco") {
258 } else if (str_key == "Shaded") { 264 if (str_label == "NONE") {
259 app.rememberShadedstate((str_label=="yes")); 265 app.rememberDecostate((unsigned int) 0);
260 } else if (str_key == "Tab") { 266 } else if (str_label == "NORMAL") {
261 app.rememberTabstate((str_label=="yes")); 267 app.rememberDecostate((unsigned int) 0xfffffff);
262 } else if (str_key == "Deco") { 268 } else if (str_label == "TINY") {
263 if (str_label == "NONE") { 269 app.rememberDecostate((unsigned int)
264 app.rememberDecostate((unsigned int) 0); 270 FluxboxWindow::DECORM_TITLEBAR
265 } else if (str_label == "NORMAL") { 271 | FluxboxWindow::DECORM_ICONIFY
266 app.rememberDecostate((unsigned int) 0xfffffff); 272 | FluxboxWindow::DECORM_MENU
267 } else if (str_label == "TINY") { 273 );
268 app.rememberDecostate((unsigned int) 274 } else if (str_label == "TOOL") {
269 FluxboxWindow::DECORM_TITLEBAR 275 app.rememberDecostate((unsigned int)
270 | FluxboxWindow::DECORM_ICONIFY 276 FluxboxWindow::DECORM_TITLEBAR
271 | FluxboxWindow::DECORM_MENU 277 | FluxboxWindow::DECORM_MENU
272 ); 278 );
273 } else if (str_label == "TOOL") { 279 } else if (str_label == "BORDER") {
274 app.rememberDecostate((unsigned int) 280 app.rememberDecostate((unsigned int)
275 FluxboxWindow::DECORM_TITLEBAR 281 FluxboxWindow::DECORM_BORDER
276 | FluxboxWindow::DECORM_MENU 282 | FluxboxWindow::DECORM_MENU
277 ); 283 );
278 } else if (str_label == "BORDER") {
279 app.rememberDecostate((unsigned int)
280 FluxboxWindow::DECORM_BORDER
281 | FluxboxWindow::DECORM_MENU
282 );
283 } else {
284 unsigned int mask;
285 const char * str = str_label.c_str();
286 // it'll have at least one char and \0, so this is safe
287 istringstream iss(str);
288 // check for hex
289 if (str[0] == '0' && str[1] == 'x') {
290 iss.seekg(2);
291 iss >> hex;
292 }
293 iss >> mask ;
294 app.rememberDecostate(mask);
295 }
296 } else if (str_key == "Sticky") {
297 app.rememberStuckstate((str_label=="yes"));
298 } else if (str_key == "Jump") {
299 app.rememberJumpworkspace((str_label=="yes"));
300 } else if (str_key == "Close") {
301 app.rememberSaveOnClose((str_label=="yes"));
302 } else if (str_key == "end") {
303 return row;
304 } else { 284 } else {
305 cerr << "Unsupported apps key = " << str_key << endl; 285 unsigned int mask;
286 const char * str = str_label.c_str();
287 // it'll have at least one char and \0, so this is safe
288 istringstream iss(str);
289 // check for hex
290 if (str[0] == '0' && str[1] == 'x') {
291 iss.seekg(2);
292 iss >> hex;
293 }
294 iss >> mask ;
295 app.rememberDecostate(mask);
306 } 296 }
297 } else if (str_key == "Sticky") {
298 app.rememberStuckstate((str_label=="yes"));
299 } else if (str_key == "Jump") {
300 app.rememberJumpworkspace((str_label=="yes"));
301 } else if (str_key == "Close") {
302 app.rememberSaveOnClose((str_label=="yes"));
303 } else if (str_key == "end") {
304 return row;
305 } else {
306 cerr << "Unsupported apps key = " << str_key << endl;
307 } 307 }
308 } 308 }
309 } 309 }
@@ -684,35 +684,35 @@ void Remember::setupClient(WinClient &winclient) {
684 } 684 }
685} 685}
686 686
687void Remember::updateWindowClose(FluxboxWindow &win) { 687void Remember::updateClientClose(WinClient &winclient) {
688 // This doesn't work at present since fluxbox.cc is missing the windowclose stuff. 688 Application *app = find(winclient);
689 // I don't trust it (particularly winClient()) while this is the case 689
690 if (app && (app->save_on_close_remember && app->save_on_close)) {
690 691
691 // scan all winclients and remove this fbw 692 for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) {
692 Patterns::iterator it = m_pats.begin(); 693 if (isRemembered(winclient, (Attribute) attrib)) {
693 while (it != m_pats.end()) { 694 rememberAttrib(winclient, (Attribute) attrib);
694 if (&win == it->second->group) 695 }
695 it->second->group = 0; 696 }
696 ++it;
697 }
698 697
699 return; 698 save();
699 }
700 700
701 WinClient &winclient = win.winClient(); 701 // we need to get rid of references to this client
702 Application *app = find(winclient); 702 Clients::iterator wc_it = m_clients.find(&winclient);
703 Clients::iterator wc_it = m_clients.find(&win.winClient());
704 703
705 if (wc_it != m_clients.end()) 704 if (wc_it != m_clients.end()) {
706 m_clients.erase(wc_it); 705 m_clients.erase(wc_it);
706 }
707 707
708 if (!app || !(app->save_on_close_remember && app->save_on_close)) 708}
709 return;
710 709
711 for (int attrib = 0; attrib <= REM_LASTATTRIB; attrib++) { 710void Remember::updateFrameClose(FluxboxWindow &win) {
712 if (isRemembered(winclient, (Attribute) attrib)) { 711 // scan all applications and remove this fbw if it is a recorded group
713 rememberAttrib(winclient, (Attribute) attrib); 712 Patterns::iterator it = m_pats.begin();
714 } 713 while (it != m_pats.end()) {
714 if (&win == it->second->group)
715 it->second->group = 0;
716 ++it;
715 } 717 }
716
717 save();
718} 718}