More work on Xinerama

This commit is contained in:
Kris Maglione 2008-10-14 04:54:35 -04:00
parent 5bcd1393b8
commit 5db3cf60bd
11 changed files with 59 additions and 35 deletions

View File

@ -163,10 +163,6 @@ _backtrace(int pid, char *btarg) {
goto done;
}
/* Why? Because gdb freezes waiting for user input
* if its stdout is a tty.
* Might be easier to pipe to sed 2,4d here.
*/
Biobuf bp;
char *s;

View File

@ -102,6 +102,7 @@ area_create(View *v, Area *pos, int scrn, uint width) {
if(!v->floating) {
v->floating = a;
a->floating = true;
a->screen = -1;
}
else if(pos) {
a->next = pos->next;

View File

@ -108,6 +108,7 @@ client_create(XWindow w, XWindowAttributes *wa) {
depth = scr.depth;
vis = scr.visual;
/* XXX: Multihead. */
c->ibuf = &screen->ibuf;
if(render_argb_p(wa->visual)) {
depth = 32;

View File

@ -117,12 +117,13 @@ div_update_all(void) {
Divide **dp, *d;
Area *a;
View *v;
int s;
update_imgs();
v = screen->sel;
dp = &divs;
for(a = v->firstarea; a; a = a->next) {
foreach_area(v, s, a) {
d = getdiv(dp);
dp = &d->next;
div_set(d, a->r.min.x);

View File

@ -91,16 +91,16 @@ ewmh_updatestacking(void) {
Frame *f;
Area *a;
View *v;
int i;
int s;
vector_linit(&vec);
for(v=view; v; v=v->next) /* Wow... */
for(i=0; i < nscreens; i++)
for(a=v->areas[i]; a; a=a->next)
for(f=a->frame; f; f=f->anext)
if(f->client->sel == f)
vector_lpush(&vec, f->client->w.w);
for(v=view; v; v=v->next) {
foreach_column(v, s, a)
for(f=a->frame; f; f=f->anext)
if(f->client->sel == f)
vector_lpush(&vec, f->client->w.w);
}
for(v=view; v; v=v->next) {
for(f=v->floating->stack; f; f=f->snext)
if(!f->snext) break;

View File

@ -13,6 +13,21 @@
# pragma varargck type "r" void
#endif
#define foreach_area(v, s, a) \
Area *__anext; /* Getting ugly... */ \
for(s=0; s <= nscreens; s++) \
for((a)=(s < nscreens ? (v)->areas[s] : v->floating), __anext=(a)->next; (a); (void)(((a)=__anext) && (__anext=(a)->next)))
#define foreach_column(v, s, a) \
Area *__anext; /* Getting ugly... */ \
for(s=0; s < nscreens; s++) \
for((a)=(v)->areas[s], __anext=(a)->next; (a); (void)(((a)=__anext) && (__anext=(a)->next)))
#define foreach_frame(v, s, a, f) \
Frame *__fnext; \
foreach_area(v, s, a) \
for((void)(((f)=(a)->frame) && (__fnext=(f)->anext)); (f); (void)(((f)=__fnext) && (__fnext=(f)->anext)))
#define btassert(arg, cond) \
(cond ? fprint(1, __FILE__":%d: failed assertion: " #cond "\n", __LINE__), backtrace(arg), true : false)

View File

@ -125,13 +125,20 @@ vplace(Framewin *fw, Point pt) {
Area *a;
View *v;
long l;
int hr;
int hr, s;
v = screen->sel;
for(a = v->firstarea; a->next; a = a->next)
if(pt.x < a->r.max.x)
break;
/* XXX: Multihead. Check this over. */
for(s=0; s < nscreens; s++) {
if(!rect_haspoint_p(pt, screen[s].r))
continue;
for(a=v->areas[s]; a; a=a->next)
if(pt.x < a->r.max.x)
goto found;
}
return; /* XXX: Multihead. */
found:
fw->ra = a;
pt.x = a->r.min.x;
@ -175,12 +182,13 @@ static void
hplace(Framewin *fw, Point pt) {
Area *a;
View *v;
int minw;
int minw, s;
v = screen->sel;
minw = Dx(v->r)/NCOL;
for(a = v->firstarea; a->next; a = a->next)
/* XXX: Multihead. Check this over. */
foreach_column(v, s, a)
if(pt.x < a->r.max.x)
break;
@ -254,6 +262,8 @@ mouse_movegrabbox(Client *c, bool grabmod) {
f = c->sel;
SET(x);
SET(y);
if(grabmod) {
p = querypointer(f->client->framewin);
x = (float)p.x / Dx(f->r);
@ -400,6 +410,9 @@ thcol(Frame *f) {
case ButtonRelease:
if(button != 1)
continue;
SET(collapsed);
SET(fp);
SET(fn);
a = f->area;
if(a->floating)
area_detach(f);
@ -416,7 +429,7 @@ thcol(Frame *f) {
}
column_drop(fw->ra, f, fw->pt.y);
if(collapsed) {
if(!a->floating && collapsed) {
/* XXX */
for(; fn && fn->collapsed; fn=fn->anext)
;

View File

@ -171,12 +171,12 @@ init_screens(void) {
rects = xinerama_screens(&n);
m = max(n, nscreens);
screens = erealloc(screens, m * sizeof *screens);
for(v=view; v; v=v->next)
v->areas = erealloc(v->areas, m * sizeof *v->areas);
for(i=nscreens; i < m; i++) {
screens[i] = (WMScreen){0};
for(v=view; v; v=v->next) {
v->areas = erealloc(v->areas, m * sizeof *v->areas);
for(v=view; v; v=v->next)
view_init(v, i);
}
}
nscreens = m;

View File

@ -845,12 +845,14 @@ msg_selectarea(Area *a, IxpMsg *m) {
case LCLIENT:
return msg_selectframe(a->sel, m, sym);
case LLEFT:
/* XXX: Multihead. */
if(a->floating)
return Ebadvalue;
for(ap=v->firstarea; ap->next; ap=ap->next)
if(ap->next == a) break;
break;
case LRIGHT:
/* XXX: Multihead. */
if(a->floating)
return Ebadvalue;
ap = a->next;
@ -866,6 +868,7 @@ msg_selectarea(Area *a, IxpMsg *m) {
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)
@ -913,7 +916,7 @@ msg_selectframe(Frame *f, IxpMsg *m, int sym) {
SET(fp);
switch(sym) {
case LUP:
/* XXX */
/* XXX: Stack. */
if(stack) {
for(; f->aprev && f->aprev->collapsed; f=f->aprev)
;
@ -926,7 +929,7 @@ msg_selectframe(Frame *f, IxpMsg *m, int sym) {
if(fp->anext == f) break;
break;
case LDOWN:
/* XXX */
/* XXX: Stack. */
if(stack) {
for(fp=f->anext; fp && fp->collapsed; fp=fp->anext)
;
@ -1006,6 +1009,7 @@ msg_sendclient(View *v, IxpMsg *m, bool swap) {
case LLEFT:
if(a->floating)
return Ebadvalue;
/* XXX: Multihead. */
if(a->prev)
to = a->prev;
a = v->floating;
@ -1013,6 +1017,7 @@ msg_sendclient(View *v, IxpMsg *m, bool swap) {
case LRIGHT:
if(a->floating)
return Ebadvalue;
/* XXX: Multihead. */
to = a->next;
break;
case LTOGGLE:
@ -1063,6 +1068,7 @@ msg_sendframe(Frame *f, int sym, bool swap) {
c = f->client;
switch(sym) {
case LUP:
/* XXX: Multihead. */
fp = f->aprev;
if(!fp)
return Ebadvalue;
@ -1070,6 +1076,7 @@ msg_sendframe(Frame *f, int sym, bool swap) {
fp = fp->aprev;
break;
case LDOWN:
/* XXX: Multihead. */
fp = f->anext;
if(!fp)
return Ebadvalue;

View File

@ -5,16 +5,6 @@
#include "dat.h"
#include "fns.h"
#define foreach_area(v, s, a) \
Area *__anext; /* Getting ugly... */ \
for(s=0; s <= nscreens; s++) \
for((a)=(s < nscreens ? (v)->areas[s] : v->floating), __anext=(a)->next; (a); (void)(((a)=__anext) && (__anext=(a)->next)))
#define foreach_frame(v, s, a, f) \
Frame *__fnext; \
foreach_area(v, s, a) \
for((void)(((f)=(a)->frame) && (__fnext=(f)->anext)); (f); (void)(((f)=__fnext) && (__fnext=(f)->anext)))
static bool
empty_p(View *v) {
Frame *f;

View File

@ -14,7 +14,7 @@ LIBS = -L/usr/lib -L$(ROOT)/lib
# Flags
include $(ROOT)/mk/gcc.mk
CFLAGS += $(DEBUGCFLAGS) -O1
CFLAGS += $(DEBUGCFLAGS) -O0
LDFLAGS += -g $(LIBS)
SOLDFLAGS += $(LDFLAGS)
SHARED = -shared -Wl,-soname=$(SONAME)