X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fconfig.c;h=e0c984934e95f03536023bb9e754618125e76a9d;hb=10a833b2cba11349a57071a7538cae9a560b8cc9;hp=0d9eb689f2e7f4e7ad8ecc4073529413c1541371;hpb=dc4cfa94c9cd7bd30cdc87a6e4ab8174d8a9703f;p=chaz%2Fopenbox diff --git a/openbox/config.c b/openbox/config.c index 0d9eb689..e0c98493 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -37,7 +37,6 @@ gboolean config_focus_under_mouse; gboolean config_unfocus_leave; ObPlacePolicy config_place_policy; -gboolean config_place_center; ObPlaceMonitor config_place_monitor; guint config_primary_monitor_index; @@ -154,6 +153,14 @@ void config_app_settings_copy_non_defaults(const ObAppSettings *src, dst->position = src->position; /* monitor is copied above */ } + + if (src->size_given) { + dst->size_given = TRUE; + dst->width_num = src->width_num; + dst->width_denom = src->width_denom; + dst->height_num = src->height_num; + dst->height_denom = src->height_denom; + } } void config_parse_relative_number(gchar *s, gint *num, gint *denom) @@ -215,16 +222,20 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) { xmlNodePtr app = obt_xml_find_node(node->children, "application"); gchar *name = NULL, *class = NULL, *role = NULL, *title = NULL, - *type_str = NULL; - gboolean name_set, class_set, type_set, role_set, title_set; + *type_str = NULL, *group_name = NULL, *group_class = NULL; + gboolean name_set, class_set, type_set, role_set, title_set, + group_name_set, group_class_set; ObClientType type; gboolean x_pos_given; + gboolean width_given; while (app) { - x_pos_given = FALSE; + x_pos_given = width_given = FALSE; class_set = obt_xml_attr_string(app, "class", &class); name_set = obt_xml_attr_string(app, "name", &name); + group_class_set = obt_xml_attr_string(app, "groupclass", &group_class); + group_name_set = obt_xml_attr_string(app, "groupname", &group_name); type_set = obt_xml_attr_string(app, "type", &type_str); role_set = obt_xml_attr_string(app, "role", &role); title_set = obt_xml_attr_string(app, "title", &title); @@ -251,7 +262,9 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) type_set = FALSE; /* not valid! */ } - if (class_set || name_set || role_set || title_set || type_set) { + if (class_set || name_set || role_set || title_set || type_set || + group_class_set || group_name_set) + { xmlNodePtr n, c; ObAppSettings *settings = config_create_app_settings(); @@ -261,6 +274,12 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) if (class_set) settings->class = g_pattern_spec_new(class); + if (group_name_set) + settings->group_name = g_pattern_spec_new(group_name); + + if (group_class_set) + settings->group_class = g_pattern_spec_new(group_class); + if (role_set) settings->role = g_pattern_spec_new(role); @@ -312,6 +331,40 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) 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); @@ -377,10 +430,13 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d) (gpointer) settings); g_free(name); g_free(class); + g_free(group_name); + g_free(group_class); g_free(role); g_free(title); g_free(type_str); - name = class = role = title = type_str = NULL; + name = class = group_name = group_class = role = title = type_str = + NULL; } app = obt_xml_find_node(app->next, "application"); @@ -584,8 +640,6 @@ static void parse_placement(xmlNodePtr node, gpointer d) if ((n = obt_xml_find_node(node, "policy"))) if (obt_xml_node_contains(n, "UnderMouse")) config_place_policy = OB_PLACE_POLICY_MOUSE; - if ((n = obt_xml_find_node(node, "center"))) - config_place_center = obt_xml_node_bool(n); if ((n = obt_xml_find_node(node, "monitor"))) { if (obt_xml_node_contains(n, "active")) config_place_monitor = OB_PLACE_MONITOR_ACTIVE; @@ -1013,7 +1067,6 @@ void config_startup(ObtXmlInst *i) obt_xml_register(i, "focus", parse_focus, NULL); config_place_policy = OB_PLACE_POLICY_SMART; - config_place_center = TRUE; config_place_monitor = OB_PLACE_MONITOR_PRIMARY; config_primary_monitor_index = 1; @@ -1132,10 +1185,12 @@ void config_shutdown(void) for (it = config_per_app_settings; it; it = g_slist_next(it)) { ObAppSettings *itd = (ObAppSettings *)it->data; - if (itd->name) g_pattern_spec_free(itd->name); - if (itd->role) g_pattern_spec_free(itd->role); + if (itd->name) g_pattern_spec_free(itd->name); + if (itd->role) g_pattern_spec_free(itd->role); if (itd->title) g_pattern_spec_free(itd->title); if (itd->class) g_pattern_spec_free(itd->class); + if (itd->group_name) g_pattern_spec_free(itd->group_name); + if (itd->group_class) g_pattern_spec_free(itd->group_class); g_slice_free(ObAppSettings, it->data); } g_slist_free(config_per_app_settings);