X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fconfig.c;h=54ae4c33dbdf060b03931a28ce718fa7ce995c94;hb=75e948b1972a26c73b07f1706a0fcc54c594dba2;hp=a3c236fc2cbd96415c3122d72efb48ff69845eb3;hpb=1045079482453424f8320de99639390e3020eb72;p=chaz%2Fopenbox diff --git a/openbox/config.c b/openbox/config.c index a3c236fc..54ae4c33 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -36,7 +36,10 @@ guint config_keyboard_reset_state; gint config_mouse_threshold; gint config_mouse_dclicktime; -gchar *config_menu_path; +GSList *config_menu_files; + +gint config_resist_win; +gint config_resist_edge; gchar *expand_tilde(const gchar *f) { @@ -89,7 +92,7 @@ static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, if (keylist) { nact = parse_find_node("action", node); while (nact) { - if ((action = action_parse(doc, 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 != @@ -162,7 +165,7 @@ static void parse_mouse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, goto next_nbut; nact = parse_find_node("action", nbut->xmlChildrenNode); while (nact) { - if ((action = action_parse(doc, 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 || @@ -225,10 +228,14 @@ static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, node = node->xmlChildrenNode; if ((n = parse_find_node("theme", node))) { + gchar *c; + g_free(config_theme); - config_theme = parse_string(doc, n); + c = parse_string(doc, n); + config_theme = expand_tilde(c); + g_free(c); } - if ((n = parse_find_node("titlelayout", node))) { + if ((n = parse_find_node("titleLayout", node))) { g_free(config_title_layout); config_title_layout = parse_string(doc, n); } @@ -335,19 +342,31 @@ static void parse_dock(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, void *d) } static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, void *d) +{ + for (node = node->xmlChildrenNode; node; node = node->next) { + if (!xmlStrcasecmp(node->name, (const xmlChar*) "file")) { + gchar *c; + + c = parse_string(doc, node); + config_menu_files = g_slist_append(config_menu_files, + expand_tilde(c)); + g_free(c); + } + } +} + +static void parse_resistance(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, + void *d) { xmlNodePtr n; node = node->xmlChildrenNode; - if ((n = parse_find_node("location", node))) { - gchar *c; - - c = parse_string(doc, n); - config_menu_path = expand_tilde(c); - g_free(c); - } + if ((n = parse_find_node("strength", node))) + config_resist_win = parse_int(doc, n); + if ((n = parse_find_node("screen_edge_strength", node))) + config_resist_edge = parse_int(doc, n); } - + void config_startup(ObParseInst *i) { config_focus_new = TRUE; @@ -395,7 +414,12 @@ void config_startup(ObParseInst *i) parse_register(i, "mouse", parse_mouse, NULL); - config_menu_path = NULL; + config_resist_win = 10; + config_resist_edge = 10; + + parse_register(i, "resistance", parse_resistance, NULL); + + config_menu_files = NULL; parse_register(i, "menu", parse_menu, NULL); } @@ -406,7 +430,11 @@ void config_shutdown() g_free(config_theme); - for (it = config_desktops_names; it; it = it->next) + for (it = config_desktops_names; it; it = g_slist_next(it)) g_free(it->data); g_slist_free(config_desktops_names); + + for (it = config_menu_files; it; it = g_slist_next(it)) + g_free(it->data); + g_slist_free(config_menu_files); }