diff options
Diffstat (limited to 'openbox/resist.c')
| -rw-r--r-- | openbox/resist.c | 64 |
1 files changed, 42 insertions, 22 deletions
diff --git a/openbox/resist.c b/openbox/resist.c index fcd12ab4..a3eee7b9 100644 --- a/openbox/resist.c +++ b/openbox/resist.c @@ -192,7 +192,7 @@ void resist_move_monitors(ObClient *c, gint resist, gint *x, gint *y) } void resist_size_windows(ObClient *c, gint resist, gint *w, gint *h, - ObCorner corn) + ObDirection dir) { GList *it; ObClient *target; /* target */ @@ -230,23 +230,28 @@ void resist_size_windows(ObClient *c, gint resist, gint *w, gint *h, 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; } } } @@ -254,23 +259,28 @@ void resist_size_windows(ObClient *c, gint resist, gint *w, gint *h, 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; } } } @@ -281,7 +291,7 @@ void resist_size_windows(ObClient *c, gint resist, gint *w, gint *h, } 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 */ @@ -326,9 +336,10 @@ void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h, 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) @@ -336,8 +347,9 @@ void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h, 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) @@ -345,12 +357,16 @@ void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h, 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) @@ -358,8 +374,9 @@ void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h, 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) @@ -367,6 +384,9 @@ void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h, 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); |
