c->win = win;
c->x = attr->x;
c->y = attr->y;
- c->w = attr->width;
- c->h = attr->height;
+ c->w = attr->width + 2*BORDER_WIDTH - 2;
+ c->h = attr->height + 2*BORDER_WIDTH + TITLE_HEIGHT - 2;
client_readprops(c);
/* Reparent the window if applicable */
- c->frame = XCreateSimpleWindow(X.disp, X.root,
- c->x - BORDER_WIDTH,
- c->y - TITLE_HEIGHT - BORDER_WIDTH,
- c->w + (2 * BORDER_WIDTH),
- c->h + TITLE_HEIGHT + 2*BORDER_WIDTH,
- 1, X.black, X.gray);
+ c->frame = XCreateSimpleWindow(X.disp, X.root, c->x, c->y, c->w, c->h, 1, X.black, X.gray);
XSelectInput(X.disp, c->frame,
ExposureMask | EnterWindowMask |
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
wa.event_mask = EnterWindowMask | PropertyChangeMask | FocusChangeMask;
wa.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
XChangeWindowAttributes(X.disp, c->win, CWEventMask | CWDontPropagate, &wa);
- XReparentWindow(X.disp, c->win, c->frame, BORDER_WIDTH, BORDER_WIDTH + TITLE_HEIGHT);
+ XReparentWindow(X.disp, c->win, c->frame,
+ BORDER_WIDTH, BORDER_WIDTH + TITLE_HEIGHT
+ );
/* Map the window and draw the frame */
XAddToSaveSet(X.disp, c->win);
{
c->x += xdiff;
c->y += ydiff;
- XMoveWindow(X.disp, c->frame,
- c->x - BORDER_WIDTH,
- c->y - TITLE_HEIGHT - BORDER_WIDTH);
+ XMoveWindow(X.disp, c->frame, c->x, c->y);
mons_place(c);
}
c->h += ydiff;
if (c->w < 50) c->w = 50;
if (c->h < 50) c->h = 50;
- XResizeWindow(X.disp, c->win, c->w, c->h);
- XResizeWindow(X.disp, c->frame,
- c->w + 2*BORDER_WIDTH,
- c->h + 2*BORDER_WIDTH + TITLE_HEIGHT);
+ XResizeWindow(X.disp, c->frame, c->w, c->h);
+ XResizeWindow(X.disp, c->win,
+ c->w - 2*BORDER_WIDTH - 2,
+ c->h - 2*BORDER_WIDTH - TITLE_HEIGHT - 2
+ );
mons_place(c);
}
static void coldims(Monitor* mon, Column* col, int *x, int *y, int *w, int *h)
{
- *x = mon->x, *y = mon->y, *w = col->width, *h = mon->h;
+ *x = mon->x, *y = mon->y, *w = col->width-2, *h = mon->h-2;
// printf("bef: %d %d %d %d\n", mon->x, mon->y, col->width, mon->h);
// printf("mon: %d %d %d %d\n", mon->x, mon->y, mon->w, mon->h);
for (Column* c = mon->cspace->columns; c != col; *x += c->width, c = c->next);
- *x += BORDER_WIDTH;
- *y += BORDER_WIDTH + TITLE_HEIGHT;
- *w -= (2*BORDER_WIDTH) + 2;
- *h -= (2*BORDER_WIDTH + TITLE_HEIGHT) + 2;
// printf("%d %d %d %d\n", *x, *y, *w, *h);
}
{
c->next = mon->cspace->floating;
mon->cspace->floating = c;
- int cw = c->w + 2*BORDER_WIDTH;
- int ch = c->h + 2*BORDER_WIDTH + TITLE_HEIGHT;
- c->x = mon->midx - cw/2;
- c->y = mon->midy - ch/2;
+ c->x = mon->midx - c->w/2;
+ c->y = mon->midy - c->h/2;
client_adjust(c);
}
else