changeset: 2377:9b29b22043d5
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Thu Oct 16 16:48:25 2008 -0400
files: cmd/wmii/bar.c cmd/wmii/client.c cmd/wmii/dat.h cmd/wmii/event.c cmd/wmii/frame.c cmd/wmii/main.c cmd/wmii/message.c cmd/wmii/view.c cmd/wmii/xext.c rc/rc.wmii.rc
description:
Fix XRandR, especially with relation to Xinerama
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/bar.c Thu Oct 16 16:48:25 2008 -0400
@@ -42,13 +42,9 @@
bar_resize(WMScreen *s) {
s->brect = s->r;
- s->brect.max.y = labelh(def.font);
-
- /* Not guarangeed to exist on xinerama displays, for the
- * moment;
- */
- if(screen->sel)
- view_update(screen->sel);
+ s->brect.min.y = s->r.max.y - labelh(def.font);
+ reshapewin(s->barwin, s->brect);
+ /* FIXME: view_arrange. */
}
void
@@ -77,7 +73,7 @@
Bar*
bar_create(Bar **bp, const char *name) {
static uint id = 1;
- WMScreen *s;
+ WMScreen *s, **sp;
Bar *b;
uint i;
@@ -91,7 +87,7 @@
b->col = def.normcolor;
/* FIXME: Kludge. */
- for(s=screens; s < screens+nscreens; s++) {
+ for(sp=screens; (s = *sp); sp++) {
i = bp - s->bar;
if(i < nelem(s->bar))
b->bar = i;
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/client.c
--- a/cmd/wmii/client.c Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/client.c Thu Oct 16 16:48:25 2008 -0400
@@ -110,11 +110,11 @@
depth = scr.depth;
vis = scr.visual;
/* XXX: Multihead. */
- c->ibuf = &screen->ibuf;
+ c->ibuf = &ibuf;
if(render_argb_p(wa->visual)) {
depth = 32;
vis = render_visual;
- c->ibuf = &screen->ibuf32;
+ c->ibuf = &ibuf32;
}
client_prop(c, xatom("WM_PROTOCOLS"));
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/dat.h Thu Oct 16 16:48:25 2008 -0400
@@ -330,12 +330,13 @@
Window* barwin;
Image* ibuf;
Image* ibuf32;
+ bool showing;
int barpos;
int idx;
Rectangle r;
Rectangle brect;
-} *screens, *screen;
+} **screens, *screen;
EXTERN Client* client;
EXTERN View* view;
@@ -364,6 +365,8 @@
EXTERN uint valid_mask;
EXTERN uint numlock_mask;
EXTERN bool sel_screen;
+EXTERN Image* ibuf;
+EXTERN Image* ibuf32;
EXTERN Cursor cursor[CurLast];
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/event.c
--- a/cmd/wmii/event.c Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/event.c Thu Oct 16 16:48:25 2008 -0400
@@ -367,7 +367,9 @@
XEvent ev;
USED(c);
- while(XCheckMaskEvent(display, ~0, &ev))
+ while(XPending(display)) {
+ XNextEvent(display, &ev);
dispatch_event(&ev);
+ }
}
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/frame.c Thu Oct 16 16:48:25 2008 -0400
@@ -654,7 +654,7 @@
bestx = nil;
besty = nil;
for(i=0; i < nscreens; i++) {
- s = &screens[i];
+ s = screens[i];
isect = rect_intersection(r, s->r);
if(!bestx || Dx(isect) > nbestx && Dy(isect) > 0) {
bestx = s;
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/main.c
--- a/cmd/wmii/main.c Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/main.c Thu Oct 16 16:48:25 2008 -0400
@@ -155,7 +155,6 @@
init_screens(void) {
Rectangle *rects;
View *v;
- static Image *ibuf, *ibuf32;
int i, n, m;
#ifdef notdef
@@ -170,14 +169,15 @@
/* Reallocate screens, zero any new ones. */
rects = xinerama_screens(&n);
m = max(n, nscreens);
- screens = erealloc(screens, m * sizeof *screens);
+ screens = erealloc(screens, (m + 1) * sizeof *screens);
+ screens[m] = nil;
for(v=view; v; v=v->next) {
v->areas = erealloc(v->areas, m * sizeof *v->areas);
v->r = erealloc(v->r, m * sizeof *v->r);
}
for(i=nscreens; i < m; i++) {
- screens[i] = (WMScreen){0};
+ screens[i] = emallocz(sizeof *screens[i]);
for(v=view; v; v=v->next)
view_init(v, i);
}
@@ -193,18 +193,23 @@
ibuf32 = allocimage(Dx(scr.rect), Dy(scr.rect), 32);
/* Resize and initialize screens. */
- for(i=0; i < n; i++) {
- screen = &screens[i];
+ for(i=0; i < nscreens; i++) {
+ screen = screens[i];
screen->idx = i;
- screen->r = rects[i];
- def.snap = Dy(rects[i]) / 63;
+ screen->showing = i < n;
+ if(screen->showing)
+ screen->r = rects[i];
+ else
+ screen->r = rectsetorigin(screen->r, scr.rect.max);
+ def.snap = Dy(screen->r) / 63;
screen->ibuf = ibuf;
screen->ibuf32 = ibuf32;
-
- bar_init(screen);
+ bar_init(screens[i]);
}
- screen = &screens[0];
+ screen = screens[0];
+ if(screen->sel)
+ view_update(screen->sel);
}
static void
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/message.c
--- a/cmd/wmii/message.c Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/message.c Thu Oct 16 16:48:25 2008 -0400
@@ -475,7 +475,7 @@
freefont(def.font);
def.font = fn;
for(n=0; n < nscreens; n++)
- bar_resize(&screens[n]);
+ bar_resize(screens[n]);
}else
ret = "can't load font";
view_update(screen->sel);
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/view.c
--- a/cmd/wmii/view.c Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/view.c Thu Oct 16 16:48:25 2008 -0400
@@ -104,6 +104,7 @@
void
view_init(View *v, int iscreen) {
+ v->areas[iscreen] = nil;
column_new(v, nil, iscreen, 0);
}
@@ -237,7 +238,7 @@
v->floating->r = scr.rect;
for(s=0; s < nscreens; s++) {
- scrn = &screens[s];
+ scrn = screens[s];
r = fix_rect(scrn->r, scrnr);
if(scrn->barpos == BTop) {
@@ -501,7 +502,7 @@
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; /* XXX: Multihead. */
+ a->r.max.x = v->r[s].min.x + w;
xoff = a->r.max.x;
}
}
@@ -559,7 +560,7 @@
vector_rpush(&result, f->r);
for(i=0; i < nscreens; i++) {
vector_rpush(&result, v->r[i]);
- vector_rpush(&result, screens[i].r);
+ vector_rpush(&result, screens[i]->r);
}
*num = result.n;
diff -r cdadf0439cda -r 9b29b22043d5 cmd/wmii/xext.c
--- a/cmd/wmii/xext.c Thu Oct 16 15:34:56 2008 -0400
+++ b/cmd/wmii/xext.c Thu Oct 16 16:48:25 2008 -0400
@@ -124,8 +124,11 @@
int base;
have_xinerama = XineramaQueryExtension(display, &base, &base);
- if(have_xinerama)
- have_xinerama = XineramaIsActive(display);
+}
+
+static bool
+xinerama_active(void) {
+ return have_xinerama && XineramaIsActive(display);
}
Rectangle*
@@ -134,7 +137,7 @@
XineramaScreenInfo *res;
int i, n;
- if(!have_xinerama) {
+ if(!xinerama_active()) {
*np = 1;
return &scr.rect;
}
diff -r cdadf0439cda -r 9b29b22043d5 rc/rc.wmii.rc
--- a/rc/rc.wmii.rc Thu Oct 16 15:34:56 2008 -0400
+++ b/rc/rc.wmii.rc Thu Oct 16 16:48:25 2008 -0400
@@ -251,7 +251,6 @@
progs_file=`{namespace}^/proglist.$pid
hist=`{namespace}^/history
histlen=5000
-touch $progs_hist
Action status &
Action rehash &
Received on Thu Oct 16 2008 - 20:48:27 UTC
This archive was generated by hypermail 2.2.0 : Thu Oct 16 2008 - 21:00:08 UTC