X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fparser.cc;h=f6ed589e4ed8449eb67b28e6e7339f63ccab1667;hb=f1b9e2168d8c1b03b0fcf0b6dd70aa46c513059d;hp=00be5d7e9fe8da72f6b0183a29a5bcccaf410ea1;hpb=18f704edd0938355622049d853c1ce3cdfaee168;p=chaz%2Fopenbox diff --git a/util/epist/parser.cc b/util/epist/parser.cc index 00be5d7e..f6ed589e 100644 --- a/util/epist/parser.cc +++ b/util/epist/parser.cc @@ -54,13 +54,29 @@ void parser::parse(string rc_file) yyin = fopen(rc_file.c_str(), "r"); - yyparse(this); + if (yyin) { + yyparse(this); + fclose(yyin); + } else { + std::cerr << "ERROR: Configuration file could not be opened/found.\n"; + } - fclose(yyin); _kt->reset(); _kt->initialize(); } +void parser::setKey(string key) +{ + KeySym sym = XStringToKeysym(key.c_str()); + + if (sym == 0) { + std::cerr << "ERROR: Invalid key (" << key << ")! This may cause odd behavior.\n"; + _add = false; + } else { + _key = key; + } +} + void parser::setAction(string act) { struct { @@ -189,14 +205,11 @@ void parser::endChain() void parser::setChainBinding() { - if (_mask != 0 && _key != "") { - if (!_add) { - cout << "Error: Bad modifier detected on chain's root key.\n"; - _add = true; - } + if (_add) _kt->setCurrentNodeProps(Action::noaction, _mask, _key, ""); - reset(); - } + + _add = true; + reset(); } void parser::reset()