]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/conf-bindings.c
Imported Upstream version 20090110
[ion3.git] / ioncore / conf-bindings.c
index e39b81101e0708236c86e0b3ba459314b6cb06d1..154d94bf1e2b9c39656f96351487e437863d8cdc 100644 (file)
@@ -1,12 +1,9 @@
 /*
  * ion/ioncore/conf-bindings.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2006
+ * Copyright (c) Tuomo Valkonen 1999-2009
  *
- * Ion is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * See the included file LICENSE for details.
  */
 
 #include <string.h>
@@ -23,6 +20,7 @@
 #include <libextl/extl.h>
 #include "conf-bindings.h"
 #include "bindmaps.h"
+#include "ioncore.h"
 
 
 /*{{{ parse_keybut */
@@ -97,7 +95,8 @@ bool ioncore_parse_keybut(const char *str, uint *mod_ret, uint *ksb_ret,
                 break;
             }
             if(XKeysymToKeycode(ioncore_g.dpy, keysym)==0){
-                warn_obj(str, TR("Could not convert keysym to keycode."));
+                ioncore_warn_nolog("%s: %s", str, 
+                                   TR("Could not convert keysym to keycode."));
                 break;
             }
             *ksb_ret=keysym;
@@ -188,7 +187,7 @@ static bool do_action(WBindmap *bindmap, const char *str,
         binding.func=func;
         if(bindmap_remove_binding(bindmap, &binding))
             return TRUE;
-        warn(TR("Unable to remove binding %s."), str);
+        /*warn(TR("Unable to remove binding %s."), str);*/
     }
 
     return FALSE;
@@ -199,12 +198,13 @@ static bool do_submap(WBindmap *bindmap, const char *str,
                       ExtlTab subtab, uint action, uint mod, uint ksb)
 {
     WBinding binding, *bnd;
-    uint kcb;
+    uint kcb=0;
 
     if(action!=BINDING_KEYPRESS)
         return FALSE;
     
     kcb=XKeysymToKeycode(ioncore_g.dpy, ksb);
+    
     bnd=bindmap_lookup_binding(bindmap, action, mod, kcb);
     
     if(bnd!=NULL && bnd->submap!=NULL && bnd->state==mod)
@@ -239,6 +239,9 @@ static StringIntMap action_map[]={
     {"mclick", BINDING_BUTTONCLICK},
     {"mdblclick", BINDING_BUTTONDBLCLICK},
     {"mdrag", BINDING_BUTTONMOTION},
+    {"submap_enter", BINDING_SUBMAP_ENTER},
+    {"submap_wait", BINDING_SUBMAP_RELEASEMOD},
+    /*{"submap_leave", BINDING_SUBMAP_LEAVE},*/
     {NULL, 0}
 };
 
@@ -271,14 +274,16 @@ static bool do_entry(WBindmap *bindmap, ExtlTab tab,
             goto fail;
         }
     }
+    
+    if(!BINDING_IS_PSEUDO(action)){
+        if(!extl_table_gets_s(tab, "kcb", &ksb_str))
+            goto fail;
 
-    if(!extl_table_gets_s(tab, "kcb", &ksb_str))
-        goto fail;
-
-    if(!ioncore_parse_keybut(ksb_str, &mod, &ksb,
-                             (action!=BINDING_KEYPRESS && action!=-1), 
-                             init_any)){
-        goto fail;
+        if(!ioncore_parse_keybut(ksb_str, &mod, &ksb,
+                                 (action!=BINDING_KEYPRESS && action!=-1), 
+                                 init_any)){
+            goto fail;
+        }
     }
     
     if(extl_table_gets_t(tab, "submap", &subtab)){