]> Dogcows Code - chaz/openbox/commitdiff
remove the <windows> option from the resistance plugin since window and edge resistan...
authorDana Jansens <danakj@orodu.net>
Wed, 6 Aug 2003 04:10:34 +0000 (04:10 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 6 Aug 2003 04:10:34 +0000 (04:10 +0000)
data/rc3
plugins/resistance/resistance.c
plugins/resistance/resistance.h

index ccfa25e54f8d52418aa7ef93d260427559b93b21..50efc16eb6d7dc67ea1c31c05e2f63c380f51441 100644 (file)
--- a/data/rc3
+++ b/data/rc3
@@ -8,7 +8,6 @@
 <resistance>
   <strength>10</strength>
   <screen_edge_strength>10</screen_edge_strength>
-  <windows>yes</windows>
 </resistance>
 
 <placement>
index f9f00a6b4a442a05f60227eb3b7934e128210086..0c07ef25fe0302548b2b0305746df1ae7b27a73b 100644 (file)
@@ -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;
+        }
     }
 }
 
index 5bec224bf3515f6accd3127eaf807f2685df6232..3479389f1cd9726c37b32a5e59000ff8bab8f1b4 100644 (file)
@@ -1,2 +1 @@
 #define DEFAULT_RESISTANCE 10
-#define DEFAULT_RESIST_WINDOWS TRUE
This page took 0.027336 seconds and 4 git commands to generate.