- cl = c->frame->area.x;
- ct = c->frame->area.y;
- cr = cl + c->frame->area.width - 1;
- cb = ct + c->frame->area.height - 1;
-
- if (config_resist_win)
- 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 */
-
- if (!WINDOW_IS_CLIENT(it->data))
- continue;
- target = it->data;
- /* don't snap to self or non-visibles */
- if (!target->frame->visible || target == c) continue;
-
- tl = target->frame->area.x - 1;
- tt = target->frame->area.y - 1;
- tr = tl + target->frame->area.width + 1;
- tb = tt + target->frame->area.height + 1;
-
- /* snapx and snapy ensure that the window snaps to the top-most
- window edge available, without going all the way from
- bottom-to-top in the stacking list
- */
- if (snapx == NULL) {
- if (ct < tb && cb > tt) {
- if (cl >= tr && l < tr && l >= tr - config_resist_win)
- *x = tr, snapx = target;
- else if (cr <= tl && r > tl &&
- r <= tl + config_resist_win)
- *x = tl - w + 1, snapx = target;
- if (snapx != NULL) {
- /* try to corner snap to the window */
- if (ct > tt && t <= tt &&
- t > tt - config_resist_win)
- *y = tt + 1, snapy = target;
- else if (cb < tb && b >= tb &&
- b < tb + config_resist_win)
- *y = tb - h, snapy = target;
- }
- }
+ cl = RECT_LEFT(window);
+ ct = RECT_TOP(window);
+ cr = RECT_RIGHT(window);
+ cb = RECT_BOTTOM(window);
+
+ tl = RECT_LEFT(target) - 1;
+ tt = RECT_TOP(target) - 1;
+ tr = RECT_RIGHT(target) + 1;
+ tb = RECT_BOTTOM(target) + 1;
+
+ /* snapx and snapy ensure that the window snaps to the top-most
+ window edge available, without going all the way from
+ bottom-to-top in the stacking list
+ */
+ if (!snapx) {
+ if (ct < tb && cb > tt) {
+ if (cl >= tr && l < tr && l >= tr - resist)
+ *x = tr, snapx = TRUE;
+ else if (cr <= tl && r > tl &&
+ r <= tl + resist)
+ *x = tl - w + 1, snapx = TRUE;
+ if (snapx) {
+ /* try to corner snap to the window */
+ if (ct > tt && t <= tt &&
+ t > tt - resist)
+ *y = tt + 1, snapy = TRUE;
+ else if (cb < tb && b >= tb &&
+ b < tb + resist)
+ *y = tb - h, snapy = TRUE;