commit dbebda0ef2f48e67df452812b0baa1c63ce21240
parent d21e159f36bef9477440db635939b31fee6995d2
Author: Kris Maglione <jg@suckless.org>
Date: Tue, 21 Oct 2008 11:19:12 -0400
Fix crash when resizing managed windows on non-primary screen
Diffstat:
5 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/cmd/wmii/div.c b/cmd/wmii/div.c
@@ -125,7 +125,7 @@ div_update_all(void) {
v = selview;
dp = &divs;
- foreach_area(v, s, a) {
+ foreach_column(v, s, a) {
d = getdiv(dp);
dp = &d->next;
div_set(d, a->r.min.x);
diff --git a/cmd/wmii/layout.c b/cmd/wmii/layout.c
@@ -452,6 +452,7 @@ thcol(Frame *f) {
}
+ /* XXX: Multihead. */
if(!a->frame && !a->floating && f->view->firstarea->next)
area_destroy(a);
goto done;
diff --git a/cmd/wmii/mouse.c b/cmd/wmii/mouse.c
@@ -210,6 +210,7 @@ mouse_resizecolframe(Frame *f, Align align) {
Area *a;
Rectangle r;
Point pt, min;
+ int s;
assert((align&(East|West)) != (East|West));
assert((align&(North|South)) != (North|South));
@@ -218,8 +219,11 @@ mouse_resizecolframe(Frame *f, Align align) {
v = selview;
d = divs;
- for(a=v->firstarea; a != f->area; a=a->next)
+ foreach_column(v, s, a) {
+ if(a == f->area)
+ break;
d = d->next;
+ }
if(align&East)
d = d->next;
@@ -316,12 +320,16 @@ mouse_resizecol(Divide *d) {
Area *a;
Rectangle r;
Point pt;
- uint minw;
+ int minw, s;
v = selview;
- for(a = v->firstarea, dp = divs; a; a = a->next, dp = dp->next)
- if(dp->next == d) break;
+ dp = divs;
+ foreach_column(v, s, a) {
+ if(dp->next == d)
+ break;
+ dp = dp->next;
+ }
/* Fix later */
if(a == nil || a->next == nil)
diff --git a/cmd/wmii/screen.c b/cmd/wmii/screen.c
@@ -162,6 +162,12 @@ findthing(Rectangle rect, int direction, Vector_ptr *vec, Rectangle (*key)(void*
return best;
}
+static int
+area(Rectangle r) {
+ return Dx(r) * Dy(r) *
+ (Dx(r) < 0 && Dy(r) < 0 ? -1 : 1);
+}
+
int
ownerscreen(Rectangle r) {
Rectangle isect;
@@ -170,8 +176,10 @@ ownerscreen(Rectangle r) {
SET(besta);
best = -1;
for(s=0; s < nscreens; s++) {
+ if(!screens[s]->showing)
+ continue;
isect = rect_intersection(r, screens[s]->r);
- a = Dx(isect) * Dy(isect);
+ a = area(isect);
if(best < 0 || a > besta) {
besta = a;
best = s;
diff --git a/cmd/wmii/view.c b/cmd/wmii/view.c
@@ -348,7 +348,7 @@ view_attach(View *v, Frame *f) {
oldsel = v->oldsel;
a = v->sel;
if(client_floats_p(c)) {
- if(v->sel != v->floating)
+ if(v->sel != v->floating && c->fullscreen < 0)
oldsel = v->sel;
a = v->floating;
}