X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fconfig.c;h=420ac5532fc574ce25e95d9883218e65f1374bb0;hb=0667bbc3e2fbd3fa39206e843560735524840d35;hp=058536665b20b90f22002266efdf008c47f0357d;hpb=17bc51aab8be25cd44c55eb0a652c92518bd9b0f;p=chaz%2Fopenbox diff --git a/openbox/config.c b/openbox/config.c index 05853666..420ac553 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -21,7 +21,6 @@ #include "keyboard.h" #include "mouse.h" #include "actions.h" -#include "prop.h" #include "translate.h" #include "client.h" #include "screen.h" @@ -61,15 +60,9 @@ guint config_screen_firstdesk; guint config_desktop_popup_time; gboolean config_resize_redraw; -gboolean config_resize_four_corners; gint config_resize_popup_show; ObResizePopupPos config_resize_popup_pos; -gboolean config_resize_popup_x_center; -gboolean config_resize_popup_y_center; -gboolean config_resize_popup_x_opposite; -gboolean config_resize_popup_y_opposite; -gint config_resize_popup_x; -gint config_resize_popup_y; +GravityPoint config_resize_popup_fixed; ObStackingLayer config_dock_layer; gboolean config_dock_floating; @@ -143,16 +136,28 @@ void config_app_settings_copy_non_defaults(const ObAppSettings *src, if (src->pos_given) { dst->pos_given = TRUE; - dst->center_x = src->center_x; - dst->center_y = src->center_y; - dst->opposite_x = src->opposite_x; - dst->opposite_y = src->opposite_y; - dst->position.x = src->position.x; - dst->position.y = src->position.y; + dst->position = src->position; dst->monitor = src->monitor; } } +static void config_parse_gravity_coord(xmlDocPtr doc, xmlNodePtr node, + GravityCoord *c) +{ + gchar *s = parse_string(doc, node); + if (!g_ascii_strcasecmp(s, "center")) + c->center = TRUE; + else { + if (s[0] == '-') + c->opposite = TRUE; + if (s[0] == '-' || s[0] == '+') + c->pos = atoi(s+1); + else + c->pos = atoi(s); + } + g_free(s); +} + /* @@ -218,38 +223,16 @@ static void parse_per_app_settings(ObParseInst *inst, xmlDocPtr doc, if ((n = parse_find_node("position", app->children))) { if ((c = parse_find_node("x", n->children))) if (!parse_contains("default", doc, c)) { - gchar *s = parse_string(doc, c); - if (!g_ascii_strcasecmp(s, "center")) { - settings->center_x = TRUE; - x_pos_given = TRUE; - } else { - if (s[0] == '-') - settings->opposite_x = TRUE; - if (s[0] == '-' || s[0] == '+') - settings->position.x = atoi(s+1); - else - settings->position.x = atoi(s); - x_pos_given = TRUE; - } - g_free(s); + config_parse_gravity_coord(doc, c, + &settings->position.x); + x_pos_given = TRUE; } if (x_pos_given && (c = parse_find_node("y", n->children))) if (!parse_contains("default", doc, c)) { - gchar *s = parse_string(doc, c); - if (!g_ascii_strcasecmp(s, "center")) { - settings->center_y = TRUE; - settings->pos_given = TRUE; - } else { - if (s[0] == '-') - settings->opposite_y = TRUE; - if (s[0] == '-' || s[0] == '+') - settings->position.y = atoi(s+1); - else - settings->position.y = atoi(s); - settings->pos_given = TRUE; - } - g_free(s); + config_parse_gravity_coord(doc, c, + &settings->position.y); + settings->pos_given = TRUE; } if (settings->pos_given && @@ -677,34 +660,12 @@ static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, if ((n = parse_find_node("popupFixedPosition", node))) { xmlNodePtr n2; - if ((n2 = parse_find_node("x", n->children))) { - gchar *s = parse_string(doc, n2); - if (!g_ascii_strcasecmp(s, "center")) - config_resize_popup_x_center = TRUE; - else { - if (s[0] == '-') - config_resize_popup_x_opposite = TRUE; - if (s[0] == '-' || s[0] == '+') - config_resize_popup_x = atoi(s+1); - else - config_resize_popup_x = atoi(s); - } - } - if ((n2 = parse_find_node("y", n->children))) { - gchar *s = parse_string(doc, n2); - if (!g_ascii_strcasecmp(s, "center")) - config_resize_popup_y_center = TRUE; - else { - if (s[0] == '-') - config_resize_popup_y_opposite = TRUE; - if (s[0] == '-' || s[0] == '+') - config_resize_popup_y = atoi(s+1); - else - config_resize_popup_y = atoi(s); - } - } - g_print("X %d %d %d\n", config_resize_popup_x_center, config_resize_popup_x_opposite, config_resize_popup_x); - g_print("Y %d %d %d\n", config_resize_popup_y_center, config_resize_popup_y_opposite, config_resize_popup_y); + if ((n2 = parse_find_node("x", n->children))) + config_parse_gravity_coord(doc, n2, + &config_resize_popup_fixed.x); + if ((n2 = parse_find_node("y", n->children))) + config_parse_gravity_coord(doc, n2, + &config_resize_popup_fixed.y); } } } @@ -953,15 +914,10 @@ void config_startup(ObParseInst *i) parse_register(i, "desktops", parse_desktops, NULL); config_resize_redraw = TRUE; - config_resize_four_corners = FALSE; config_resize_popup_show = 1; /* nonpixel increments */ config_resize_popup_pos = OB_RESIZE_POS_CENTER; - config_resize_popup_x_center = FALSE; - config_resize_popup_x_opposite = FALSE; - config_resize_popup_x = 0; - config_resize_popup_y_center = FALSE; - config_resize_popup_y_opposite = FALSE; - config_resize_popup_y = 0; + GRAVITY_COORD_SET(config_resize_popup_fixed.x, 0, FALSE, FALSE); + GRAVITY_COORD_SET(config_resize_popup_fixed.y, 0, FALSE, FALSE); parse_register(i, "resize", parse_resize, NULL);