[hackers] [wmii] Fix crash when resizing managed windows on non-primary screen || Kris Maglione

From: <hg_AT_suckless.org>
Date: Tue, 21 Oct 2008 15:19:13 +0000 (UTC)

changeset: 2399:a3d399b276d4
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Oct 21 11:19:12 2008 -0400
files: cmd/wmii/div.c cmd/wmii/layout.c cmd/wmii/mouse.c cmd/wmii/screen.c cmd/wmii/view.c
description:
Fix crash when resizing managed windows on non-primary screen

diff -r 33ae11099c04 -r a3d399b276d4 cmd/wmii/div.c
--- a/cmd/wmii/div.c Sun Oct 19 21:18:35 2008 -0400
+++ b/cmd/wmii/div.c Tue Oct 21 11:19:12 2008 -0400
@@ -125,7 +125,7 @@
 
         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 -r 33ae11099c04 -r a3d399b276d4 cmd/wmii/layout.c
--- a/cmd/wmii/layout.c Sun Oct 19 21:18:35 2008 -0400
+++ b/cmd/wmii/layout.c Tue Oct 21 11:19:12 2008 -0400
@@ -452,6 +452,7 @@
                         }
                                 
 
+ /* XXX: Multihead. */
                          if(!a->frame && !a->floating && f->view->firstarea->next)
                                  area_destroy(a);
                         goto done;
diff -r 33ae11099c04 -r a3d399b276d4 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Sun Oct 19 21:18:35 2008 -0400
+++ b/cmd/wmii/mouse.c Tue Oct 21 11:19:12 2008 -0400
@@ -210,6 +210,7 @@
         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 @@
 
         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 @@
         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 -r 33ae11099c04 -r a3d399b276d4 cmd/wmii/screen.c
--- a/cmd/wmii/screen.c Sun Oct 19 21:18:35 2008 -0400
+++ b/cmd/wmii/screen.c Tue Oct 21 11:19:12 2008 -0400
@@ -162,6 +162,12 @@
         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 @@
         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 -r 33ae11099c04 -r a3d399b276d4 cmd/wmii/view.c
--- a/cmd/wmii/view.c Sun Oct 19 21:18:35 2008 -0400
+++ b/cmd/wmii/view.c Tue Oct 21 11:19:12 2008 -0400
@@ -348,7 +348,7 @@
         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;
         }
Received on Tue Oct 21 2008 - 15:19:13 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 21 2008 - 15:24:05 UTC