changeset: 2387:ac847b22405c
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Oct 18 09:27:34 2008 -0400
files: cmd/wmii/fns.h cmd/wmii/frame.c cmd/wmii/message.c
description:
Fix some Xinerama-related off-by-ones for area indexes in the FS.
diff -r 403e508074cc -r ac847b22405c cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Fri Oct 17 17:09:46 2008 -0400
+++ b/cmd/wmii/fns.h Sat Oct 18 09:27:34 2008 -0400
@@ -212,7 +212,7 @@
char* msg_sendclient(View*, IxpMsg*, bool swap);
char* readctl_root(void);
char* readctl_view(View*);
-Area* strarea(View*, const char*);
+Area* strarea(View*, int, const char*);
void warning(const char*, ...);
/* debug */
void debug(int, const char*, ...);
diff -r 403e508074cc -r ac847b22405c cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Fri Oct 17 17:09:46 2008 -0400
+++ b/cmd/wmii/frame.c Sat Oct 18 09:27:34 2008 -0400
@@ -639,7 +639,7 @@
constrain(Rectangle r, int inset) {
WMScreen **sp;
WMScreen *s, *sbest;
- Rectangle isect, rbest;
+ Rectangle isect;
Point p;
int best, n;
@@ -650,9 +650,8 @@
* D(r) < 2 * isect
*/
+ SET(best);
sbest = nil;
- rbest = ZR; /* SET(rbest) */
- SET(best);
for(sp=screens; (s = *sp); sp++) {
isect = rect_intersection(r, insetrect(s->r, inset));
if(Dx(isect) >= 0 && Dy(isect) >= 0)
@@ -667,12 +666,11 @@
}
}
- p = ZP;
- rbest = insetrect(sbest->r, inset);
- p.x -= min(r.max.x - rbest.min.x, 0);
- p.x -= max(r.min.x - rbest.max.x, 0);
- p.y -= min(r.max.y - rbest.min.y, 0);
- p.y -= max(r.min.y - rbest.max.y, 0);
+ isect = insetrect(sbest->r, inset);
+ p.x = min(r.max.x - isect.min.x, 0);
+ p.x -= max(r.min.x - isect.max.x, 0);
+ p.y = min(r.max.y - isect.min.y, 0);
+ p.y -= max(r.min.y - isect.max.y, 0);
return rectaddpt(r, p);
}
diff -r 403e508074cc -r ac847b22405c cmd/wmii/message.c
--- a/cmd/wmii/message.c Fri Oct 17 17:09:46 2008 -0400
+++ b/cmd/wmii/message.c Sat Oct 18 09:27:34 2008 -0400
@@ -312,7 +312,7 @@
}
Area*
-strarea(View *v, const char *s) {
+strarea(View *v, int scrn, const char *s) {
Area *a;
long i;
@@ -331,22 +331,21 @@
/* FIXME: Very broken! */
if(i > 0) {
- for(a = v->firstarea; a; a = a->next)
- if(i-- == 0) break;
+ for(a = v->areas[scrn]; a; a = a->next)
+ if(i-- == 1) break;
}
else {
- for(a = v->firstarea; a->next; a = a->next)
+ /* FIXME: Switch to circularly linked list. */
+ for(a = v->areas[scrn]; a->next; a = a->next)
;
- for(; a != v->firstarea; a = a->prev)
+ for(; a; a = a->prev)
if(++i == 0) break;
- if(a == v->firstarea)
- a = nil;
}
return a;
}
static Frame*
-getframe(View *v, IxpMsg *m) {
+getframe(View *v, int scrn, IxpMsg *m) {
Client *c;
Frame *f;
Area *a;
@@ -361,7 +360,7 @@
return client_viewframe(c, v);
}
- a = strarea(v, s);
+ a = strarea(v, scrn, s);
if(a == nil) {
fprint(2, "a == nil\n");
return nil;
@@ -603,7 +602,7 @@
switch(getsym(s)) {
case LCOLMODE:
s = msg_getword(m);
- a = strarea(v, s);
+ a = strarea(v, screen->idx, s);
if(a == nil) /* || a->floating) */
return Ebadvalue;
@@ -711,7 +710,7 @@
Point amount;
int dir;
- f = getframe(v, m);
+ f = getframe(v, screen->idx, m);
if(f == nil)
return "bad frame";
c = f->client;
@@ -757,7 +756,7 @@
Point amount;
int dir;
- f = getframe(v, m);
+ f = getframe(v, screen->idx, m);
if(f == nil)
return "bad frame";
@@ -870,17 +869,9 @@
ap = v->floating;
break;
default:
- if(!strcmp(s, "sel"))
- ap = v->sel;
- else {
- if(!getulong(s, &i) || i == 0)
- return Ebadvalue;
- /* XXX: Multihead. */
- for(ap=v->firstarea; ap; ap=ap->next)
- if(--i == 0) break;
- if(i != 0)
- return Ebadvalue;
- }
+ ap = strarea(v, a->screen, s);
+ if(!ap || ap->floating)
+ return Ebadvalue;
if((s = msg_getword(m))) {
if(!getulong(s, &i))
return Ebadvalue;
Received on Sat Oct 18 2008 - 13:27:40 UTC
This archive was generated by hypermail 2.2.0 : Sat Oct 18 2008 - 13:36:05 UTC