diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-05-24 15:35:26 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-05-24 15:35:26 +0000 |
| commit | d2857b11944146e2e6973b7f7280cb57e1ee260b (patch) | |
| tree | 51bf06d58f90953842b0e6babc9493f04934d7d9 /plugins/keyboard | |
| parent | f7df74b9cc9369fe401d5622c097e258a124f742 (diff) | |
ECKS EM ELL
Diffstat (limited to 'plugins/keyboard')
| -rw-r--r-- | plugins/keyboard/Makefile.am | 5 | ||||
| -rw-r--r-- | plugins/keyboard/keyboard.c | 62 |
2 files changed, 63 insertions, 4 deletions
diff --git a/plugins/keyboard/Makefile.am b/plugins/keyboard/Makefile.am index ffcd104b..4b1e850a 100644 --- a/plugins/keyboard/Makefile.am +++ b/plugins/keyboard/Makefile.am @@ -1,6 +1,7 @@ plugindir=$(libdir)/openbox/plugins -CPPFLAGS=$(XFT_CFLAGS) $(GLIB_CFLAGS) $(LIBSN_CFLAGS) $(GL_CFLAGS) @CPPFLAGS@ \ +CPPFLAGS=$(XFT_CFLAGS) $(GLIB_CFLAGS) $(LIBSN_CFLAGS) $(GL_CFLAGS) \ + $(XML_CFLAGS) @CPPFLAGS@ \ -DG_LOG_DOMAIN=\"Plugin-Keyboard\" INCLUDES=-I../.. @@ -8,7 +9,7 @@ INCLUDES=-I../.. plugin_LTLIBRARIES=keyboard.la keyboard_la_LDFLAGS=-module -avoid-version -keyboard_la_SOURCES=keyboard.c keyparse.c translate.c tree.c +keyboard_la_SOURCES=keyboard.c translate.c tree.c noinst_HEADERS=keyboard.h keyparse.h translate.h tree.h diff --git a/plugins/keyboard/keyboard.c b/plugins/keyboard/keyboard.c index 5991606a..d1d93241 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/prop.h" #include "kernel/parse.h" #include "kernel/timer.h" #include "tree.h" #include "keyboard.h" -#include "keyparse.h" #include "translate.h" #include <glib.h> +/* + +<keybind key="C-x"> + <action name="ChangeDesktop"> + <desktop>3</desktop> + </action> +</keybind> + +*/ + +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 = parse_action(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,6 +217,7 @@ static void event(ObEvent *e, void *foo) act->data.cycle.cancel = FALSE; } + act->data.any.c = focus_client; act->func(&act->data); if (act->func == action_cycle_windows && |
