+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->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(i, 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)
+ 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->xmlChildrenNode, 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;
+ ObMouseAction mact;
+ ObAction *action;
+
+ node = node->xmlChildrenNode;
+
+ 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->xmlChildrenNode);
+ while (nbut) {
+ if (!parse_attr_string("button", nbut, &buttonstr))
+ goto next_nbut;
+ if (parse_attr_contains("press", nbut, "action"))
+ mact = OB_MOUSE_ACTION_PRESS;
+ else if (parse_attr_contains("release", nbut, "action"))
+ mact = OB_MOUSE_ACTION_RELEASE;
+ else if (parse_attr_contains("click", nbut, "action"))
+ mact = OB_MOUSE_ACTION_CLICK;
+ else if (parse_attr_contains("doubleclick", nbut,"action"))
+ mact = OB_MOUSE_ACTION_DOUBLE_CLICK;
+ else if (parse_attr_contains("drag", nbut, "action"))
+ mact = OB_MOUSE_ACTION_MOTION;
+ else
+ goto next_nbut;
+ nact = parse_find_node("action", nbut->xmlChildrenNode);
+ while (nact) {
+ if ((action = action_parse(i, doc, nact))) {
+ /* validate that its okay for a mouse binding*/
+ if (mact == OB_MOUSE_ACTION_MOTION) {
+ 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;
+ }
+ } else {
+ 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)
+ 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)