improved the relaxing code

This commit is contained in:
Anselm R. Garbe 2006-03-01 16:20:02 +01:00
parent 01572b1897
commit f028b5eb5e
5 changed files with 19 additions and 19 deletions

View File

@ -359,7 +359,7 @@ attach_client2page(Page *p, Client *c)
if(p->sel > 0) /* column mode */
arrange_column(a);
else /* normal mode */
resize_client(c, &c->frame.rect, nil);
resize_client(c, &c->frame.rect, nil, False);
map_client(c);
XMapWindow(dpy, c->frame.win);
}
@ -485,7 +485,7 @@ match_sizehints(Client *c, unsigned int tabh, unsigned int bw)
}
void
resize_client(Client *c, XRectangle *r, XPoint *pt)
resize_client(Client *c, XRectangle *r, XPoint *pt, Bool ignore_xcall)
{
unsigned int bh = bar_height();
unsigned int bw = def.border;
@ -501,8 +501,9 @@ resize_client(Client *c, XRectangle *r, XPoint *pt)
if((c->area->mode != COL_STACK) || (c->area->sel == client2index(c)))
match_sizehints(c, bh, bw);
XMoveResizeWindow(dpy, c->frame.win, px - (pi * rect.width) + c->frame.rect.x, c->frame.rect.y,
c->frame.rect.width, c->frame.rect.height);
if(!ignore_xcall)
XMoveResizeWindow(dpy, c->frame.win, px - (pi * rect.width) + c->frame.rect.x, c->frame.rect.y,
c->frame.rect.width, c->frame.rect.height);
if((c->area->mode != COL_STACK) || (c->area->sel == client2index(c))) {
c->rect.x = bw;
@ -622,7 +623,7 @@ resize_all_clients()
unsigned int i;
for(i = 0; i < nclient; i++)
if(client[i]->area)
resize_client(client[i], &client[i]->frame.rect, 0);
resize_client(client[i], &client[i]->frame.rect, 0, False);
}
/* convenience function */

View File

@ -54,7 +54,7 @@ arrange_column(Area *col)
else
c->frame.rect.height =
col->rect.height - c->frame.rect.y + col->rect.y;
resize_client(c, &c->frame.rect, 0);
resize_client(c, &c->frame.rect, 0, True);
}
break;
case COL_STACK:
@ -69,14 +69,14 @@ arrange_column(Area *col)
else
c->frame.rect.height = bar_height();
yoff += c->frame.rect.height;
resize_client(c, &c->frame.rect, 0);
resize_client(c, &c->frame.rect, 0, True);
}
break;
case COL_MAX:
for(i = 0; i < col->nclient; i++) {
Client *c = col->client[i];
c->frame.rect = col->rect;
resize_client(c, &c->frame.rect, 0);
resize_client(c, &c->frame.rect, 0, True);
}
break;
default:
@ -101,8 +101,7 @@ arrange_column(Area *col)
c->frame.rect.x += wdiff;
c->frame.rect.y = yoff;
yoff = c->frame.rect.y + c->frame.rect.height + hdiff;
XMoveWindow(dpy, col->client[i]->frame.win, col->client[i]->frame.rect.x,
col->client[i]->frame.rect.y);
resize_client(c, &c->frame.rect, 0, False);
}
}
@ -136,7 +135,7 @@ match_horiz(Area *col, XRectangle *r)
Client *c = col->client[i];
c->frame.rect.x = r->x;
c->frame.rect.width = r->width;
resize_client(c, &c->frame.rect, nil);
resize_client(c, &c->frame.rect, nil, False);
}
}
@ -178,16 +177,16 @@ drop_resize(Client *c, XRectangle *new)
north->frame.rect.height = new->y - north->frame.rect.y;
c->frame.rect.height += c->frame.rect.y - new->y;
c->frame.rect.y = new->y;
resize_client(north, &north->frame.rect, nil);
resize_client(c, &c->frame.rect, nil);
resize_client(north, &north->frame.rect, nil, False);
resize_client(c, &c->frame.rect, nil, False);
}
if(south && (new->y + new->height != c->frame.rect.y + c->frame.rect.height)) {
south->frame.rect.height -= new->y + new->height - south->frame.rect.y;
south->frame.rect.y = new->y + new->height;
c->frame.rect.y = new->y;
c->frame.rect.height = new->height;
resize_client(c, &c->frame.rect, nil);
resize_client(south, &south->frame.rect, nil);
resize_client(c, &c->frame.rect, nil, False);
resize_client(south, &south->frame.rect, nil, False);
}
}

View File

@ -1107,7 +1107,7 @@ xwrite(IXPConn *c, Fcall *fcall)
memcpy(buf, fcall->data, fcall->count);
buf[fcall->count] = 0;
blitz_strtorect(&rect, &cl->frame.rect, buf);
resize_client(cl, &cl->frame.rect, 0);
resize_client(cl, &cl->frame.rect, 0, False);
break;
case Fexpand:
{

View File

@ -335,7 +335,7 @@ mouse_move(Client *c)
case ButtonRelease:
if(!first) {
draw_pseudo_border(&frect);
resize_client(c, &frect, &pt);
resize_client(c, &frect, &pt, False);
}
free(rects);
XUngrabPointer(dpy, CurrentTime /* ev.xbutton.time */ );
@ -580,7 +580,7 @@ mouse_resize(Client *c, Align align)
draw_pseudo_border(&frect);
pt.x = px;
pt.y = py;
resize_client(c, &frect, &pt);
resize_client(c, &frect, &pt, False);
}
XUngrabPointer(dpy, CurrentTime /* ev.xbutton.time */ );
XUngrabServer(dpy);

View File

@ -223,7 +223,7 @@ Client *sel_client();
Client *sel_client_of_page(Page *p);
void focus_client(Client *c);
Client *win2clientframe(Window w);
void resize_client(Client *c, XRectangle *r, XPoint *pt);
void resize_client(Client *c, XRectangle *r, XPoint *pt, Bool ignore_xcall);
int cid2index(Area *a, unsigned short id);
int client2index(Client *c);
void select_client(Client *c, char *arg);