Fix some Xinerama managed-mode bugs

This commit is contained in:
Kris Maglione 2008-10-18 20:03:59 -04:00
parent f87657989e
commit cadc01b5c1
6 changed files with 38 additions and 35 deletions

View File

@ -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);

View File

@ -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

View File

@ -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*);

View File

@ -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;

View File

@ -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;

View File

@ -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;
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[s].min.x + w;
xoff = a->r.max.x;
}
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;