X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=plugins%2Fkeyboard%2Fkeyboard.c;h=3a663dfa4862f3fd1252756a36d79cf00a58f34d;hb=9232682ad64c6ee0956a748312b9ca8136434bf3;hp=5991606adc52e8514179589653214f896b87cb0a;hpb=ebb97c189adde498cfd64d4183289c0e2645f8d8;p=chaz%2Fopenbox diff --git a/plugins/keyboard/keyboard.c b/plugins/keyboard/keyboard.c index 5991606a..3a663dfa 100644 --- a/plugins/keyboard/keyboard.c +++ b/plugins/keyboard/keyboard.c @@ -4,17 +4,74 @@ #include "kernel/event.h" #include "kernel/grab.h" #include "kernel/action.h" -#include "kernel/parse.h" +#include "kernel/prop.h" #include "kernel/timer.h" +#include "parser/parse.h" #include "tree.h" #include "keyboard.h" -#include "keyparse.h" #include "translate.h" #include +/* + + + + 3 + + + +*/ + +static void parse_key(xmlDocPtr doc, xmlNodePtr node, GList *keylist) +{ + char *key; + Action *action; + xmlNodePtr n, nact; + GList *it; + + n = parse_find_node("keybind", node); + while (n) { + if (parse_attr_string("key", n, &key)) { + keylist = g_list_append(keylist, key); + + parse_key(doc, n->xmlChildrenNode, keylist); + + it = g_list_last(keylist); + g_free(it->data); + keylist = g_list_delete_link(keylist, it); + } + n = parse_find_node("keybind", n->next); + } + if (keylist) { + nact = parse_find_node("action", node); + while (nact) { + if ((action = action_parse(doc, nact))) { + /* validate that its okay for a key binding */ + if (action->func == action_moveresize && + action->data.moveresize.corner != + prop_atoms.net_wm_moveresize_move_keyboard && + action->data.moveresize.corner != + prop_atoms.net_wm_moveresize_size_keyboard) { + action_free(action); + action = NULL; + } + + if (action) + kbind(keylist, action); + } + nact = parse_find_node("action", nact->next); + } + } +} + +static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d) +{ + parse_key(doc, node, NULL); +} + void plugin_setup_config() { - parse_reg_section("keyboard", keyparse, NULL); + parse_register("keyboard", parse_xml, NULL); } KeyBindingTree *firstnode = NULL; @@ -160,14 +217,14 @@ static void event(ObEvent *e, void *foo) act->data.cycle.cancel = FALSE; } - act->func(&act->data); - if (act->func == action_cycle_windows && !grabbed_key) { grabbed_key = p; grab_keyboard(TRUE); - break; } + + act->data.any.c = focus_client; + act->func(&act->data); } }