]> Dogcows Code - chaz/openbox/blobdiff - plugins/resistance/resistance.c
rename 'xinerama' stuff to 'monitors' to be more generic and descriptive.
[chaz/openbox] / plugins / resistance / resistance.c
index 91c10c0e54d468856b16e13661d06e8c31f80c97..318447527ef0500fe2888e8f5c90a4cc4f03c888 100644 (file)
@@ -32,6 +32,7 @@ static void resist_move(Client *c, int *x, int *y)
 {
     GList *it;
     Rect *area;
+    guint i;
     int l, t, r, b; /* requested edges */
     int al, at, ar, ab; /* screen area edges */
     int cl, ct, cr, cb; /* current edges */
@@ -107,21 +108,27 @@ static void resist_move(Client *c, int *x, int *y)
         }
 
     /* get the screen boundaries */
-    area = screen_area(c->desktop);
-    al = area->x;
-    at = area->y;
-    ar = al + area->width - 1;
-    ab = at + area->height - 1;
+    for (i = 0; i < screen_num_monitors; ++i) {
+        area = screen_area_monitor(c->desktop, i);
 
-    /* snap to screen edges */
-    if (cl >= al && l < al && l >= al - resistance)
-        *x = al;
-    else if (cr <= ar && r > ar && r <= ar + resistance)
+        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 - resistance)
+            *x = al;
+        else if (cr <= ar && r > ar && r <= ar + resistance)
             *x = ar - w + 1;
-    if (ct >= at && t < at && t >= at - resistance)
-        *y = at;
-    else if (cb <= ab && b > ab && b < ab + resistance)
-        *y = ab - h + 1;
+        if (ct >= at && t < at && t >= at - resistance)
+            *y = at;
+        else if (cb <= ab && b > ab && b < ab + resistance)
+            *y = ab - h + 1;
+    }
 }
 
 static void resist_size(Client *c, int *w, int *h, Corner corn)
This page took 0.021731 seconds and 4 git commands to generate.