+guint config_keyboard_reset_keycode;
+guint config_keyboard_reset_state;
+
+gint config_mouse_threshold;
+gint config_mouse_dclicktime;
+
+GSList *config_menu_files;
+
+gint config_resist_win;
+gint config_resist_edge;
+
+/*
+
+<keybind key="C-x">
+ <action name="ChangeDesktop">
+ <desktop>3</desktop>
+ </action>
+</keybind>
+
+*/
+
+static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ GList *keylist)
+{
+ char *key;
+ ObAction *action;
+ xmlNodePtr n, nact;
+ GList *it;
+
+ if ((n = parse_find_node("chainQuitKey", node))) {
+ key = parse_string(doc, n);
+ translate_key(key, &config_keyboard_reset_state,
+ &config_keyboard_reset_keycode);
+ g_free(key);
+ }
+
+ n = parse_find_node("keybind", node);
+ while (n) {
+ if (parse_attr_string("key", n, &key)) {
+ keylist = g_list_append(keylist, key);
+
+ parse_key(i, doc, n->children, 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(i, doc, nact,
+ OB_USER_ACTION_KEYBOARD_KEY)))
+ keyboard_bind(keylist, action);
+ nact = parse_find_node("action", nact->next);
+ }
+ }
+}
+
+static void parse_keyboard(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ void *d)
+{
+ parse_key(i, doc, node->children, NULL);
+}
+
+/*
+
+<context name="Titlebar">
+ <mousebind button="Left" action="Press">
+ <action name="Raise"></action>
+ </mousebind>
+</context>
+
+*/
+
+static void parse_mouse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ void *d)
+{
+ xmlNodePtr n, nbut, nact;
+ char *buttonstr;
+ char *contextstr;
+ ObUserAction uact;
+ ObMouseAction mact;
+ ObAction *action;
+
+ node = node->children;
+
+ if ((n = parse_find_node("dragThreshold", node)))
+ config_mouse_threshold = parse_int(doc, n);
+ if ((n = parse_find_node("doubleClickTime", node)))
+ config_mouse_dclicktime = parse_int(doc, n);
+
+ n = parse_find_node("context", node);
+ while (n) {
+ if (!parse_attr_string("name", n, &contextstr))
+ goto next_n;
+ nbut = parse_find_node("mousebind", n->children);
+ while (nbut) {
+ if (!parse_attr_string("button", nbut, &buttonstr))
+ goto next_nbut;
+ if (parse_attr_contains("press", nbut, "action")) {
+ uact = OB_USER_ACTION_MOUSE_PRESS;
+ mact = OB_MOUSE_ACTION_PRESS;
+ } else if (parse_attr_contains("release", nbut, "action")) {
+ uact = OB_USER_ACTION_MOUSE_RELEASE;
+ mact = OB_MOUSE_ACTION_RELEASE;
+ } else if (parse_attr_contains("click", nbut, "action")) {
+ uact = OB_USER_ACTION_MOUSE_CLICK;
+ mact = OB_MOUSE_ACTION_CLICK;
+ } else if (parse_attr_contains("doubleclick", nbut,"action")) {
+ uact = OB_USER_ACTION_MOUSE_DOUBLE_CLICK;
+ mact = OB_MOUSE_ACTION_DOUBLE_CLICK;
+ } else if (parse_attr_contains("drag", nbut, "action")) {
+ uact = OB_USER_ACTION_MOUSE_MOTION;
+ mact = OB_MOUSE_ACTION_MOTION;
+ } else
+ goto next_nbut;
+ nact = parse_find_node("action", nbut->children);
+ while (nact) {
+ if ((action = action_parse(i, doc, nact, uact)))
+ mouse_bind(buttonstr, contextstr, mact, action);
+ nact = parse_find_node("action", nact->next);
+ }
+ g_free(buttonstr);
+ next_nbut:
+ nbut = parse_find_node("mousebind", nbut->next);
+ }
+ g_free(contextstr);
+ next_n:
+ n = parse_find_node("context", n->next);
+ }
+}
+
+static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
+ void *d)