]> Dogcows Code - chaz/openbox/blobdiff - util/epist/parser.cc
more fixes, better sanity detection and error messages. it shouldn't hog the keyboard...
[chaz/openbox] / util / epist / parser.cc
index 00be5d7e9fe8da72f6b0183a29a5bcccaf410ea1..5c953aaec39992acb343440d763724f2a4ad6d3c 100644 (file)
@@ -61,6 +61,18 @@ void parser::parse(string rc_file)
   _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 +201,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()
This page took 0.020461 seconds and 4 git commands to generate.