commit 708db8d88c9fd13d8b61adc54e03c28162f33de8
parent 68673eb2b969ccf4540b7fdc838a614bd5fe4c5f
Author: Kris Maglione <kris@suckless.org>
Date: Thu, 15 Sep 2011 13:22:17 -0400
Allow changing screen boundaries with Mod+Mouse3.
Diffstat:
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/cmd/wmii/column.c b/cmd/wmii/column.c
@@ -577,10 +577,14 @@ column_resizeframe(Frame *f, Rectangle r) {
if(al) {
al->r.max.x = a->r.min.x;
column_arrange(al, false);
+ }else {
+ v->pad[a->screen].min.x = r.min.x - v->r[a->screen].min.x;
}
if(ar) {
ar->r.min.x = a->r.max.x;
column_arrange(ar, false);
+ }else {
+ v->pad[a->screen].max.x = r.max.x - v->r[a->screen].max.x;
}
column_resizeframe_h(f, r);
diff --git a/cmd/wmii/frame.c b/cmd/wmii/frame.c
@@ -643,13 +643,16 @@ constrain(Rectangle r, int inset) {
for(sp=screens; (s = *sp); sp++) {
if(!screen->showing)
continue;
+
isect = rect_intersection(r, insetrect(s->r, inset));
if(Dx(isect) >= 0 && Dy(isect) >= 0)
return r;
+
if(Dx(isect) <= 0 && Dy(isect) <= 0)
n = max(Dx(isect), Dy(isect));
else
n = min(Dx(isect), Dy(isect));
+
if(!sbest || n > best) {
sbest = s;
best = n;
diff --git a/cmd/wmii/mouse.c b/cmd/wmii/mouse.c
@@ -251,22 +251,26 @@ mouse_resizecolframe(Frame *f, Align align) {
min.x = column_minwidth();
min.y = /*frame_delta_h() +*/ labelh(def.font);
/* Set the limits of where this box may be dragged. */
-#define frob(pred, f, aprev, rmin, rmax, plus, minus, xy) BLOCK( \
+#define frob(pred, f, aprev, rmin, rmax, plus, minus, xy, use_screen) BLOCK( \
if(pred) { \
r.rmin.xy = f->aprev->r.rmin.xy plus min.xy; \
r.rmax.xy = f->r.rmax.xy minus min.xy; \
+ }else if(use_screen) { \
+ r.rmin.xy = v->r[f->screen].rmin.xy plus 1; \
+ r.rmax.xy = a->r.rmax.xy minus min.xy; \
}else { \
r.rmin.xy = a->r.rmin.xy; \
r.rmax.xy = r.rmin.xy plus 1; \
})
- if(align&North)
- frob(f->aprev, f, aprev, min, max, +, -, y);
+
+ if(align & North)
+ frob(f->aprev, f, aprev, min, max, +, -, y, false);
else
- frob(f->anext, f, anext, max, min, -, +, y);
- if(align&West)
- frob(a->prev, a, prev, min, max, +, -, x);
+ frob(f->anext, f, anext, max, min, -, +, y, false);
+ if(align & West)
+ frob(a->prev, a, prev, min, max, +, -, x, true);
else
- frob(a->next, a, next, max, min, -, +, x);
+ frob(a->next, a, next, max, min, -, +, x, true);
#undef frob
cwin = constraintwin(r);
@@ -415,6 +419,7 @@ mouse_resize(Client *c, Align align, bool grabmod) {
SET(hrx);
SET(hry);
+
if(align != Center) {
hr = subpt(frect.max, frect.min);
hr = divpt(hr, Pt(2, 2));