Allow changing screen boundaries with Mod+Mouse3.

This commit is contained in:
Kris Maglione 2011-09-15 13:22:17 -04:00
parent 68673eb2b9
commit 708db8d88c
3 changed files with 19 additions and 7 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);
frob(f->aprev, f, aprev, min, max, +, -, y, false);
else
frob(f->anext, f, anext, max, min, -, +, y);
frob(f->anext, f, anext, max, min, -, +, y, false);
if(align & West)
frob(a->prev, a, prev, min, max, +, -, x);
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));