]> Dogcows Code - chaz/openbox/commitdiff
more fixes, better sanity detection and error messages. it shouldn't hog the keyboard...
authorMarius Nita <marius@cs.pdx.edu>
Mon, 14 Oct 2002 05:03:15 +0000 (05:03 +0000)
committerMarius Nita <marius@cs.pdx.edu>
Mon, 14 Oct 2002 05:03:15 +0000 (05:03 +0000)
util/epist/keytree.cc
util/epist/parser.cc
util/epist/parser.hh

index 5a3515eab449ff3d567a9ba55ef6efbbf211c4e1..94b542b0e3c057a59826e2d27520fd276101e7c5 100644 (file)
@@ -195,13 +195,8 @@ void keytree::addAction(Action::ActionType action, unsigned int mask,
   }
 
   KeySym sym = XStringToKeysym(key.c_str());
-
-  if (sym == 0) {
-    std::cerr << "Key " << key << " is invalid! (Action ignored)\n";
-    return;
-  }
-
   keynode *tmp = new keynode;
+
   tmp->action = new Action(action,
                            XKeysymToKeycode(_display, sym),
                            mask, arg);
@@ -229,10 +224,10 @@ void keytree::setCurrentNodeProps(Action::ActionType action, unsigned int mask,
 {
   if (_current->action)
     delete _current->action;
-  
+
+  KeySym sym = XStringToKeysym(key.c_str());
   _current->action = new Action(action,
-                                XKeysymToKeycode(_display,
-                                                 XStringToKeysym(key.c_str())),
+                                XKeysymToKeycode(_display, sym),
                                 mask, arg);
 }
 
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()
index b1c02a319a0d03c397be3d49ea34a66958078c6e..d106f16d669d9c0c52a241d202c353614cf3a166 100644 (file)
@@ -36,9 +36,6 @@ public:
 
   void parse(std::string);
 
-  void setKey(std::string key)
-  {  _key = key; }
-
   void setArgumentNum(std::string arg)
   { _arg = arg; }
 
@@ -57,6 +54,7 @@ public:
   void setOption(std::string opt)
   { _config->addOption(opt, _arg); }
 
+  void setKey(std::string);
   void setAction(std::string);
   void addModifier(std::string);
   void endAction();
This page took 0.030678 seconds and 4 git commands to generate.