From: Charles McGarvey Date: Fri, 26 Oct 2012 19:03:24 +0000 (-0600) Subject: Merge branch 'master' into chaz X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=9325c92056ff4268db2263cdf8c07bb529e158aa;p=chaz%2Fopenbox Merge branch 'master' into chaz Conflicts: openbox/config.c --- 9325c92056ff4268db2263cdf8c07bb529e158aa diff --cc openbox/config.c index f0f6c7b3,03fc96b3..c21b47d8 --- a/openbox/config.c +++ b/openbox/config.c @@@ -204,6 -207,144 +211,148 @@@ void config_parse_gravity_coord(xmlNode */ + static void parse_single_per_app_settings(xmlNodePtr app, + ObAppSettings *settings) + { + xmlNodePtr n, c; + gboolean x_pos_given = FALSE; + gboolean width_given = FALSE; + + if ((n = obt_xml_find_node(app->children, "decor"))) + if (!obt_xml_node_contains(n, "default")) + settings->decor = obt_xml_node_bool(n); + + if ((n = obt_xml_find_node(app->children, "shade"))) + if (!obt_xml_node_contains(n, "default")) + settings->shade = obt_xml_node_bool(n); + + if ((n = obt_xml_find_node(app->children, "position"))) { + if ((c = obt_xml_find_node(n->children, "x"))) { + if (!obt_xml_node_contains(c, "default")) { + config_parse_gravity_coord(c, &settings->position.x); + x_pos_given = TRUE; + } + } + + if (x_pos_given && (c = obt_xml_find_node(n->children, "y"))) { + if (!obt_xml_node_contains(c, "default")) { + config_parse_gravity_coord(c, &settings->position.y); + settings->pos_given = TRUE; + } + } + + /* monitor can be set without setting x or y */ + if ((c = obt_xml_find_node(n->children, "monitor"))) { + if (!obt_xml_node_contains(c, "default")) { + gchar *s = obt_xml_node_string(c); + if (!g_ascii_strcasecmp(s, "mouse")) + settings->monitor_type = OB_PLACE_MONITOR_MOUSE; + else if (!g_ascii_strcasecmp(s, "active")) + settings->monitor_type = OB_PLACE_MONITOR_ACTIVE; + else if (!g_ascii_strcasecmp(s, "primary")) + settings->monitor_type = OB_PLACE_MONITOR_PRIMARY; + else + settings->monitor = obt_xml_node_int(c); + g_free(s); + } + } + + obt_xml_attr_bool(n, "force", &settings->pos_force); + } + + if ((n = obt_xml_find_node(app->children, "size"))) { + if ((c = obt_xml_find_node(n->children, "width"))) { + if (!obt_xml_node_contains(c, "default")) { + gchar *s = obt_xml_node_string(c); + config_parse_relative_number(s, + &settings->width_num, + &settings->width_denom); + if (settings->width_num > 0 && settings->width_denom >= 0) + width_given = TRUE; + g_free(s); + } + } + + if (width_given && (c = obt_xml_find_node(n->children, "height"))) { + gchar *s = obt_xml_node_string(c); + config_parse_relative_number(s, + &settings->height_num, + &settings->height_denom); + if (settings->height_num > 0 && settings->height_denom >= 0) + settings->size_given = TRUE; + g_free(s); + } + } + + if ((n = obt_xml_find_node(app->children, "focus"))) { + if (!obt_xml_node_contains(n, "default")) + settings->focus = obt_xml_node_bool(n); + } + + if ((n = obt_xml_find_node(app->children, "desktop"))) { + if (!obt_xml_node_contains(n, "default")) { + gchar *s = obt_xml_node_string(n); + if (!g_ascii_strcasecmp(s, "all")) + settings->desktop = DESKTOP_ALL; + else { + gint i = obt_xml_node_int(n); + if (i > 0) + settings->desktop = i; + } + g_free(s); + } + } + + if ((n = obt_xml_find_node(app->children, "layer"))) { + if (!obt_xml_node_contains(n, "default")) { + gchar *s = obt_xml_node_string(n); + if (!g_ascii_strcasecmp(s, "above")) + settings->layer = 1; + else if (!g_ascii_strcasecmp(s, "below")) + settings->layer = -1; + else + settings->layer = 0; + g_free(s); + } + } + + if ((n = obt_xml_find_node(app->children, "iconic"))) + if (!obt_xml_node_contains(n, "default")) + settings->iconic = obt_xml_node_bool(n); + + if ((n = obt_xml_find_node(app->children, "skip_pager"))) + if (!obt_xml_node_contains(n, "default")) + settings->skip_pager = obt_xml_node_bool(n); + + if ((n = obt_xml_find_node(app->children, "skip_taskbar"))) + if (!obt_xml_node_contains(n, "default")) + settings->skip_taskbar = obt_xml_node_bool(n); + + if ((n = obt_xml_find_node(app->children, "fullscreen"))) + if (!obt_xml_node_contains(n, "default")) + settings->fullscreen = obt_xml_node_bool(n); + + if ((n = obt_xml_find_node(app->children, "maximized"))) { + if (!obt_xml_node_contains(n, "default")) { + gchar *s = obt_xml_node_string(n); + if (!g_ascii_strcasecmp(s, "horizontal")) { + settings->max_horz = TRUE; + settings->max_vert = FALSE; + } else if (!g_ascii_strcasecmp(s, "vertical")) { + settings->max_horz = FALSE; + settings->max_vert = TRUE; + } else + settings->max_horz = settings->max_vert = + obt_xml_node_bool(n); + g_free(s); + } + } ++ ++ if ((n = obt_xml_find_node(app->children, "opacity"))) ++ if (!obt_xml_node_contains(n, "default")) ++ settings->opacity = obt_xml_node_int(n); + } + /* Manages settings for individual applications. Some notes: monitor is the screen number in a multi monitor (Xinerama) setup (starting from 0), or mouse: the monitor the pointer