From 22333336d3ba36784955c67444f996b557f3838a Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 11 Jan 2008 19:32:45 -0500 Subject: add an option for window placement, to try force new windows on the active monitor (for xinerama) --- openbox/config.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'openbox/config.c') diff --git a/openbox/config.c b/openbox/config.c index ff4c542b..25e30fff 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -38,6 +38,7 @@ gboolean config_focus_under_mouse; ObPlacePolicy config_place_policy; gboolean config_place_center; +gboolean config_place_active; StrutPartial config_margins; @@ -500,6 +501,8 @@ static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, config_place_policy = OB_PLACE_POLICY_MOUSE; if ((n = parse_find_node("center", node))) config_place_center = parse_bool(doc, n); + if ((n = parse_find_node("active", node))) + config_place_active = parse_bool(doc, n); } static void parse_margins(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, @@ -880,6 +883,7 @@ void config_startup(ObParseInst *i) config_place_policy = OB_PLACE_POLICY_SMART; config_place_center = TRUE; + config_place_active = FALSE; parse_register(i, "placement", parse_placement, NULL); -- cgit v1.2.3 From 17bc51aab8be25cd44c55eb0a652c92518bd9b0f Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 11 Jan 2008 20:24:16 -0500 Subject: let you specify the resize popup to be in a fixed place --- openbox/config.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 8 deletions(-) (limited to 'openbox/config.c') diff --git a/openbox/config.c b/openbox/config.c index 25e30fff..05853666 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -60,10 +60,16 @@ GSList *config_desktops_names; guint config_screen_firstdesk; guint config_desktop_popup_time; -gboolean config_resize_redraw; -gboolean config_resize_four_corners; -gint config_resize_popup_show; -gint config_resize_popup_pos; +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; ObStackingLayer config_dock_layer; gboolean config_dock_floating; @@ -661,11 +667,46 @@ static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, config_resize_popup_show = 1; } if ((n = parse_find_node("popupPosition", node))) { - config_resize_popup_pos = parse_int(doc, n); if (parse_contains("Top", doc, n)) - config_resize_popup_pos = 1; + config_resize_popup_pos = OB_RESIZE_POS_TOP; else if (parse_contains("Center", doc, n)) - config_resize_popup_pos = 0; + config_resize_popup_pos = OB_RESIZE_POS_CENTER; + else if (parse_contains("Fixed", doc, n)) { + config_resize_popup_pos = OB_RESIZE_POS_FIXED; + + 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); + } + } } } @@ -914,7 +955,13 @@ void config_startup(ObParseInst *i) config_resize_redraw = TRUE; config_resize_four_corners = FALSE; config_resize_popup_show = 1; /* nonpixel increments */ - config_resize_popup_pos = 0; /* center of client */ + 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; parse_register(i, "resize", parse_resize, NULL); -- cgit v1.2.3 From c2e495c720d93521bdb0e1bfd7e76584a1b329b7 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 11 Jan 2008 20:58:03 -0500 Subject: make a GravityPoint and GravityCoord data structures for those --x, ++y type values --- openbox/config.c | 107 +++++++++++++++++-------------------------------------- 1 file changed, 33 insertions(+), 74 deletions(-) (limited to 'openbox/config.c') diff --git a/openbox/config.c b/openbox/config.c index 05853666..7ec2b3e0 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -64,12 +64,7 @@ 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 +138,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 +225,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); + settings->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 +662,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); } } } @@ -956,12 +919,8 @@ void config_startup(ObParseInst *i) 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); -- cgit v1.2.3 From 5d533d9fe2139bb0096482201e765c0905de5152 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 11 Jan 2008 21:33:46 -0500 Subject: fix a small bug introduced that broke per-app placement --- openbox/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openbox/config.c') diff --git a/openbox/config.c b/openbox/config.c index 7ec2b3e0..c094732e 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -227,7 +227,7 @@ static void parse_per_app_settings(ObParseInst *inst, xmlDocPtr doc, if (!parse_contains("default", doc, c)) { config_parse_gravity_coord(doc, c, &settings->position.x); - settings->pos_given = TRUE; + x_pos_given = TRUE; } if (x_pos_given && (c = parse_find_node("y", n->children))) -- cgit v1.2.3 From d3c1117fb4c0916c1d28b6bf91288a68c9712d53 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 16 Jan 2008 15:58:24 +0100 Subject: Remove leftover config_four_corners from config.c. --- openbox/config.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'openbox/config.c') diff --git a/openbox/config.c b/openbox/config.c index c094732e..867dfb51 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -61,7 +61,6 @@ 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; GravityPoint config_resize_popup_fixed; @@ -916,7 +915,6 @@ 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; GRAVITY_COORD_SET(config_resize_popup_fixed.x, 0, FALSE, FALSE); -- cgit v1.2.3