}
void resist_size_windows(ObClient *c, gint resist, gint *w, gint *h,
- ObCorner corn)
+ ObDirection dir)
{
GList *it;
ObClient *target; /* target */
if (snapx == NULL) {
/* horizontal snapping */
if (t < tb && b > tt) {
- switch (corn) {
- case OB_CORNER_TOPLEFT:
- case OB_CORNER_BOTTOMLEFT:
+ switch (dir) {
+ case OB_DIRECTION_EAST:
+ case OB_DIRECTION_NORTHEAST:
+ case OB_DIRECTION_SOUTHEAST:
dlt = l;
drb = r + *w - c->frame->area.width;
if (r < tl && drb >= tl &&
drb < tl + resist)
*w = tl - l, snapx = target;
break;
- case OB_CORNER_TOPRIGHT:
- case OB_CORNER_BOTTOMRIGHT:
+ case OB_DIRECTION_WEST:
+ case OB_DIRECTION_NORTHWEST:
+ case OB_DIRECTION_SOUTHWEST:
dlt = l - *w + c->frame->area.width;
drb = r;
if (l > tr && dlt <= tr &&
dlt > tr - resist)
*w = r - tr, snapx = target;
break;
+ case OB_DIRECTION_NORTH:
+ case OB_DIRECTION_SOUTH:
+ break;
}
}
}
if (snapy == NULL) {
/* vertical snapping */
if (l < tr && r > tl) {
- switch (corn) {
- case OB_CORNER_TOPLEFT:
- case OB_CORNER_TOPRIGHT:
+ switch (dir) {
+ case OB_DIRECTION_SOUTH:
+ case OB_DIRECTION_SOUTHWEST:
+ case OB_DIRECTION_SOUTHEAST:
dlt = t;
drb = b + *h - c->frame->area.height;
if (b < tt && drb >= tt &&
drb < tt + resist)
*h = tt - t, snapy = target;
break;
- case OB_CORNER_BOTTOMLEFT:
- case OB_CORNER_BOTTOMRIGHT:
+ case OB_DIRECTION_NORTH:
+ case OB_DIRECTION_NORTHWEST:
+ case OB_DIRECTION_NORTHEAST:
dlt = t - *h + c->frame->area.height;
drb = b;
if (t > tb && dlt <= tb &&
dlt > tb - resist)
*h = b - tb, snapy = target;
break;
+ case OB_DIRECTION_EAST:
+ case OB_DIRECTION_WEST:
+ break;
}
}
}
}
void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h,
- ObCorner corn)
+ ObDirection dir)
{
gint l, t, r, b; /* my left, top, right and bottom sides */
gint dlt, drb; /* my destination left/top and right/bottom sides */
pb = RECT_BOTTOM(*parea);
/* horizontal snapping */
- switch (corn) {
- case OB_CORNER_TOPLEFT:
- case OB_CORNER_BOTTOMLEFT:
+ switch (dir) {
+ case OB_DIRECTION_EAST:
+ case OB_DIRECTION_NORTHEAST:
+ case OB_DIRECTION_SOUTHEAST:
dlt = l;
drb = r + *w - c->frame->area.width;
if (r <= ar && drb > ar && drb <= ar + resist)
else if (r <= pr && drb > pr && drb <= pr + resist)
*w = pr - l + 1;
break;
- case OB_CORNER_TOPRIGHT:
- case OB_CORNER_BOTTOMRIGHT:
+ case OB_DIRECTION_WEST:
+ case OB_DIRECTION_NORTHWEST:
+ case OB_DIRECTION_SOUTHWEST:
dlt = l - *w + c->frame->area.width;
drb = r;
if (l >= al && dlt < al && dlt >= al - resist)
else if (l >= pl && dlt < pl && dlt >= pl - resist)
*w = r - pl + 1;
break;
+ case OB_DIRECTION_NORTH:
+ case OB_DIRECTION_SOUTH:
+ break;
}
/* vertical snapping */
- switch (corn) {
- case OB_CORNER_TOPLEFT:
- case OB_CORNER_TOPRIGHT:
+ switch (dir) {
+ case OB_DIRECTION_SOUTH:
+ case OB_DIRECTION_SOUTHWEST:
+ case OB_DIRECTION_SOUTHEAST:
dlt = t;
drb = b + *h - c->frame->area.height;
if (b <= ab && drb > ab && drb <= ab + resist)
else if (b <= pb && drb > pb && drb <= pb + resist)
*h = pb - t + 1;
break;
- case OB_CORNER_BOTTOMLEFT:
- case OB_CORNER_BOTTOMRIGHT:
+ case OB_DIRECTION_NORTH:
+ case OB_DIRECTION_NORTHWEST:
+ case OB_DIRECTION_NORTHEAST:
dlt = t - *h + c->frame->area.height;
drb = b;
if (t >= at && dlt < at && dlt >= at - resist)
else if (t >= pt && dlt < pt && dlt >= pt - resist)
*h = b - pt + 1;
break;
+ case OB_DIRECTION_WEST:
+ case OB_DIRECTION_EAST:
+ break;
}
g_free(area);