From e74fd7633058414179d56cb5587d65ddcb7f6532 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 6 Aug 2003 04:10:34 +0000 Subject: [PATCH] remove the option from the resistance plugin since window and edge resistance have been separated, a 0 value will work now --- data/rc3 | 1 - plugins/resistance/resistance.c | 48 ++++++++++++++++----------------- plugins/resistance/resistance.h | 1 - 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/data/rc3 b/data/rc3 index ccfa25e5..50efc16e 100644 --- a/data/rc3 +++ b/data/rc3 @@ -8,7 +8,6 @@ 10 10 - yes diff --git a/plugins/resistance/resistance.c b/plugins/resistance/resistance.c index f9f00a6b..0c07ef25 100644 --- a/plugins/resistance/resistance.c +++ b/plugins/resistance/resistance.c @@ -9,7 +9,6 @@ static int win_resistance; static int edge_resistance; -static gboolean resist_windows; static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d) { @@ -20,14 +19,11 @@ static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d) win_resistance = parse_int(doc, n); if ((n = parse_find_node("screen_edge_strength", node))) edge_resistance = parse_int(doc, n); - if ((n = parse_find_node("windows", node))) - resist_windows = parse_bool(doc, n); } void plugin_setup_config() { win_resistance = edge_resistance = DEFAULT_RESISTANCE; - resist_windows = DEFAULT_RESIST_WINDOWS; parse_register("resistance", parse_xml, NULL); } @@ -57,7 +53,7 @@ static void resist_move(ObClient *c, int *x, int *y) cb = ct + c->frame->area.height - 1; /* snap to other clients */ - if (resist_windows) + if (win_resistance) for (it = stacking_list; it != NULL; it = it->next) { ObClient *target; int tl, tt, tr, tb; /* 1 past the target's edges on each side */ @@ -112,26 +108,28 @@ static void resist_move(ObClient *c, int *x, int *y) } /* get the screen boundaries */ - for (i = 0; i < screen_num_monitors; ++i) { - area = screen_area_monitor(c->desktop, i); - - if (!RECT_INTERSECTS_RECT(*area, c->frame->area)) - continue; - - al = area->x; - at = area->y; - ar = al + area->width - 1; - ab = at + area->height - 1; - - /* snap to screen edges */ - if (cl >= al && l < al && l >= al - edge_resistance) - *x = al; - else if (cr <= ar && r > ar && r <= ar + edge_resistance) - *x = ar - w + 1; - if (ct >= at && t < at && t >= at - edge_resistance) - *y = at; - else if (cb <= ab && b > ab && b < ab + edge_resistance) - *y = ab - h + 1; + if (edge_resistance) { + for (i = 0; i < screen_num_monitors; ++i) { + area = screen_area_monitor(c->desktop, i); + + if (!RECT_INTERSECTS_RECT(*area, c->frame->area)) + continue; + + al = area->x; + at = area->y; + ar = al + area->width - 1; + ab = at + area->height - 1; + + /* snap to screen edges */ + if (cl >= al && l < al && l >= al - edge_resistance) + *x = al; + else if (cr <= ar && r > ar && r <= ar + edge_resistance) + *x = ar - w + 1; + if (ct >= at && t < at && t >= at - edge_resistance) + *y = at; + else if (cb <= ab && b > ab && b < ab + edge_resistance) + *y = ab - h + 1; + } } } diff --git a/plugins/resistance/resistance.h b/plugins/resistance/resistance.h index 5bec224b..3479389f 100644 --- a/plugins/resistance/resistance.h +++ b/plugins/resistance/resistance.h @@ -1,2 +1 @@ #define DEFAULT_RESISTANCE 10 -#define DEFAULT_RESIST_WINDOWS TRUE -- 2.45.2