]> Dogcows Code - chaz/openbox/blobdiff - plugins/resistance/resistance.c
adjust for changes to the parsing api.
[chaz/openbox] / plugins / resistance / resistance.c
index 0c07ef25fe0302548b2b0305746df1ae7b27a73b..f5e68052051e795a5cee139729ebfab6c57ece98 100644 (file)
@@ -10,7 +10,7 @@
 static int win_resistance;
 static int edge_resistance;
 
-static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d)
+static void parse_xml(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, void *d)
 {
     xmlNodePtr n;
 
@@ -21,11 +21,11 @@ static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d)
         edge_resistance = parse_int(doc, n);
 }
 
-void plugin_setup_config()
+void plugin_setup_config(ObParseInst *i)
 {
     win_resistance = edge_resistance = DEFAULT_RESISTANCE;
 
-    parse_register("resistance", parse_xml, NULL);
+    parse_register(i, "resistance", parse_xml, NULL);
 }
 
 static void resist_move(ObClient *c, int *x, int *y)
@@ -161,7 +161,7 @@ static void resist_size(ObClient *c, int *w, int *h, ObCorner corn)
     ab = at + area->height - 1;
 
     /* snap to other windows */
-    if (resist_windows) {
+    if (win_resistance) {
         for (it = stacking_list; it != NULL; it = it->next) {
             if (!WINDOW_IS_CLIENT(it->data))
                 continue;
@@ -225,41 +225,43 @@ static void resist_size(ObClient *c, int *w, int *h, ObCorner corn)
     }
 
     /* snap to screen edges */
-    
-    /* horizontal snapping */
-    switch (corn) {
-    case OB_CORNER_TOPLEFT:
-    case OB_CORNER_BOTTOMLEFT:
-        dlt = l;
-        drb = r + *w - c->frame->area.width;
-        if (r <= ar && drb > ar && drb <= ar + edge_resistance)
-            *w = ar - l + 1;
-        break;
-    case OB_CORNER_TOPRIGHT:
-    case OB_CORNER_BOTTOMRIGHT:
-        dlt = l - *w + c->frame->area.width;
-        drb = r;
-        if (l >= al && dlt < al && dlt >= al - edge_resistance)
-            *w = r - al + 1;
-        break;
-    }
 
-    /* vertical snapping */
-    switch (corn) {
-    case OB_CORNER_TOPLEFT:
-    case OB_CORNER_TOPRIGHT:
-        dlt = t;
-        drb = b + *h - c->frame->area.height;
-        if (b <= ab && drb > ab && drb <= ab + edge_resistance)
-            *h = ab - t + 1;
-        break;
-    case OB_CORNER_BOTTOMLEFT:
-    case OB_CORNER_BOTTOMRIGHT:
-        dlt = t - *h + c->frame->area.height;
-        drb = b;
-        if (t >= at && dlt < at && dlt >= at - edge_resistance)
-            *h = b - at + 1;
-        break;
+    if (edge_resistance) {
+        /* horizontal snapping */
+        switch (corn) {
+        case OB_CORNER_TOPLEFT:
+        case OB_CORNER_BOTTOMLEFT:
+            dlt = l;
+            drb = r + *w - c->frame->area.width;
+            if (r <= ar && drb > ar && drb <= ar + edge_resistance)
+                *w = ar - l + 1;
+            break;
+        case OB_CORNER_TOPRIGHT:
+        case OB_CORNER_BOTTOMRIGHT:
+            dlt = l - *w + c->frame->area.width;
+            drb = r;
+            if (l >= al && dlt < al && dlt >= al - edge_resistance)
+                *w = r - al + 1;
+            break;
+        }
+
+        /* vertical snapping */
+        switch (corn) {
+        case OB_CORNER_TOPLEFT:
+        case OB_CORNER_TOPRIGHT:
+            dlt = t;
+            drb = b + *h - c->frame->area.height;
+            if (b <= ab && drb > ab && drb <= ab + edge_resistance)
+                *h = ab - t + 1;
+            break;
+        case OB_CORNER_BOTTOMLEFT:
+        case OB_CORNER_BOTTOMRIGHT:
+            dlt = t - *h + c->frame->area.height;
+            drb = b;
+            if (t >= at && dlt < at && dlt >= at - edge_resistance)
+                *h = b - at + 1;
+            break;
+        }
     }
 }
 
This page took 0.028455 seconds and 4 git commands to generate.