wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit cadc01b5c19b715c767553ea93149c399ea300ad
parent f87657989e5b8dda7626d39b970b4c51508b49ad
Author: Kris Maglione <jg@suckless.org>
Date:   Sat, 18 Oct 2008 20:03:59 -0400

Fix some Xinerama managed-mode bugs

Diffstat:
cmd/wmii/area.c | 3++-
cmd/wmii/column.c | 2+-
cmd/wmii/fns.h | 3++-
cmd/wmii/main.c | 8+++++++-
cmd/wmii/message.c | 5++---
cmd/wmii/view.c | 54+++++++++++++++++++++++++-----------------------------
6 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/cmd/wmii/area.c b/cmd/wmii/area.c @@ -58,6 +58,7 @@ area_create(View *v, Area *pos, int scrn, uint width) { int numcols; Area *a; + assert(!pos || pos->screen == scrn); SET(i); if(v->areas) { /* Creating a column. */ minwidth = Dx(v->r[scrn])/NCOL; @@ -83,7 +84,7 @@ area_create(View *v, Area *pos, int scrn, uint width) { if(numcols && (numcols * minwidth + width) > Dx(v->r[scrn])) return nil; - view_scale(v, Dx(v->r[scrn]) - width); + view_scale(v, scrn, Dx(v->r[scrn]) - width); } a = emallocz(sizeof *a); diff --git a/cmd/wmii/column.c b/cmd/wmii/column.c @@ -80,7 +80,7 @@ Area* column_new(View *v, Area *pos, int scrn, uint w) { Area *a; - assert(!pos || !pos->floating); + assert(!pos || !pos->floating && pos->screen == scrn); a = area_create(v, pos, scrn, w); return a; #if 0 diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h @@ -206,6 +206,7 @@ bool getulong(const char*, ulong*); char* message_client(Client*, IxpMsg*); char* message_root(void*, IxpMsg*); char* message_view(View*, IxpMsg*); +char* msg_debug(IxpMsg*); char* msg_getword(IxpMsg*); char* msg_parsecolors(IxpMsg*, CTuple*); char* msg_selectarea(Area*, IxpMsg*); @@ -260,7 +261,7 @@ void view_init(View*, int iscreen); char** view_names(void); uint view_newcolwidth(View*, int i); void view_restack(View*); -void view_scale(View*, int w); +void view_scale(View*, int, int); Client* view_selclient(View*); void view_select(const char*); void view_update(View*); diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c @@ -317,8 +317,9 @@ closedisplay(IxpConn *c) { int main(int argc, char *argv[]) { + IxpMsg m; char **oargv; - char *wmiirc; + char *wmiirc, *s; int i; quotefmtinstall(); @@ -341,6 +342,11 @@ extern int fmtevent(Fmt*); case 'v': print("%s", version); exit(0); + case 'D': + s = EARGF(usage()); + m = ixp_message(s, strlen(s), 0); + msg_debug(&m); + break; default: usage(); break; diff --git a/cmd/wmii/message.c b/cmd/wmii/message.c @@ -5,7 +5,6 @@ #include <ctype.h> #include "fns.h" -static char* msg_debug(IxpMsg*); static char* msg_grow(View*, IxpMsg*); static char* msg_nudge(View*, IxpMsg*); static char* msg_selectframe(Frame*, IxpMsg*, int); @@ -654,7 +653,7 @@ readctl_view(View *v) { return buffer; } -static char* +char* msg_debug(IxpMsg *m) { char *opt; int d; @@ -1039,7 +1038,7 @@ msg_sendclient(View *v, IxpMsg *m, bool swap) { } if(!to && !swap && (f->anext || f != f->area->frame)) - to = column_new(v, a, screen->idx, 0); + to = column_new(v, a, f->area->screen, 0); if(!to) return Ebadvalue; diff --git a/cmd/wmii/view.c b/cmd/wmii/view.c @@ -459,53 +459,48 @@ view_restack(View *v) { XRestackWindows(display, (ulong*)wins.ary, wins.n); } -/* XXX: Multihead. */ void -view_scale(View *v, int w) { +view_scale(View *v, int scrn, int width) { uint xoff, numcol; uint minwidth; Area *a; float scale; - int dx, s; + int dx; - minwidth = Dx(v->screenr)/NCOL; /* XXX: Multihead. */ + minwidth = Dx(v->r[scrn])/NCOL; /* XXX: Multihead. */ - if(!v->firstarea) + if(!v->areas[scrn]) return; numcol = 0; dx = 0; - for(a=v->firstarea; a; a=a->next) { + for(a=v->areas[scrn]; a; a=a->next) { numcol++; dx += Dx(a->r); } - scale = (float)w / dx; - for(s=0; s < nscreens; s++) { - xoff = v->r[s].min.x; - for(a=v->areas[s]; a; a=a->next) { - a->r.max.x = xoff + Dx(a->r) * scale; - a->r.min.x = xoff; - if(!a->next) - a->r.max.x = v->r[s].min.x + w; - xoff = a->r.max.x; - } + scale = (float)width / dx; + xoff = v->r[scrn].min.x; + for(a=v->areas[scrn]; a; a=a->next) { + a->r.max.x = xoff + Dx(a->r) * scale; + a->r.min.x = xoff; + if(!a->next) + a->r.max.x = v->r[scrn].min.x + width; + xoff = a->r.max.x; } - if(numcol * minwidth > w) + if(numcol * minwidth > width) return; - for(s=0; s < nscreens; s++) { - xoff = v->r[s].min.x; - for(a=v->areas[s]; a; a=a->next) { - a->r.min.x = xoff; - - if(Dx(a->r) < minwidth) - a->r.max.x = xoff + minwidth; - if(!a->next) - a->r.max.x = v->r[s].min.x + w; - xoff = a->r.max.x; - } + xoff = v->r[scrn].min.x; + for(a=v->areas[scrn]; a; a=a->next) { + a->r.min.x = xoff; + + if(Dx(a->r) < minwidth) + a->r.max.x = xoff + minwidth; + if(!a->next) + a->r.max.x = v->r[scrn].min.x + width; + xoff = a->r.max.x; } } @@ -519,7 +514,8 @@ view_arrange(View *v) { return; view_update_rect(v); - view_scale(v, Dx(v->screenr)); + for(s=0; s < nscreens; s++) + view_scale(v, s, Dx(v->r[s])); foreach_area(v, s, a) { if(a->floating) continue;