Fix bugs in padding option (Closes #19)

This commit is contained in:
David Delassus 2012-05-02 10:17:25 +02:00
parent f031d1560c
commit 3721ed582e
3 changed files with 32 additions and 12 deletions

View File

@ -1090,18 +1090,22 @@ client_winsize(struct client *c, struct geo *g)
{
int ow, oh;
struct geo og = c->wgeo;
struct geo tmp = *g;
tmp.w -= W->padding >> 1;
tmp.h -= W->padding >> 1;
/* Window geo */
c->wgeo.x = c->border;
c->wgeo.y = c->tbarw;
c->wgeo.h = oh = g->h - (c->border + c->tbarw);
c->wgeo.w = ow = g->w - (c->border << 1);
c->wgeo.h = oh = tmp.h - (c->border + c->tbarw);
c->wgeo.w = ow = tmp.w - (c->border << 1);
client_geo_hints(&c->wgeo, (int*)c->sizeh);
/* Check possible problem for tile integration */
if(ow < c->sizeh[MINW] || oh < c->sizeh[MINH])
if(g->w < c->geo.w || g->h < c->geo.h)
if(tmp.w < c->geo.w || tmp.h < c->geo.h)
{
c->wgeo = og;
return true;
@ -1171,16 +1175,21 @@ client_moveresize(struct client *c, struct geo *g)
c->rgeo.x += c->screen->ugeo.x;
c->rgeo.y += c->screen->ugeo.y;
c->rgeo.x += W->padding >> 2;
c->rgeo.y += W->padding >> 2;
c->rgeo.w -= W->padding >> 1;
c->rgeo.h -= W->padding >> 1;
}
XMoveResizeWindow(W->dpy, c->frame,
c->rgeo.x + W->padding / 4, c->rgeo.y + W->padding / 4,
c->rgeo.w - W->padding / 2, c->rgeo.h - W->padding / 2);
c->rgeo.x, c->rgeo.y,
c->rgeo.w, c->rgeo.h);
if(!(c->flags & CLIENT_FULLSCREEN))
XMoveResizeWindow(W->dpy, c->win,
c->wgeo.x, c->wgeo.y,
c->wgeo.w - W->padding / 2, c->wgeo.h - W->padding / 2);
c->wgeo.w, c->wgeo.h);
c->flags &= ~CLIENT_DID_WINSIZE;

View File

@ -76,12 +76,23 @@ draw_reversed_rect(Drawable dr, struct client *c, bool t)
struct geo *ug = &c->screen->ugeo;
int i = c->theme->client_border_width;
if(c->flags & CLIENT_FREE)
{
XDrawRectangle(W->dpy, dr, W->rgc,
ug->x + g->x + i,
ug->y + g->y + i,
g->w - (i << 1),
g->h - (i << 1));
}
else
{
XDrawRectangle(W->dpy, dr, W->rgc,
ug->x + g->x + i + W->padding >> 2,
ug->y + g->y + i + W->padding >> 2,
g->w - (i << 1) - W->padding >> 1,
g->h - (i << 1) - W->padding >> 1);
}
}
static inline void
draw_line(Drawable d, int x1, int y1, int x2, int y2)

2
wmfsrc
View File

@ -118,7 +118,7 @@
[client]
# Padding betwen clients (default: 0) :
# padding = 75
padding = 75
theme = "default"
key_modifier = "Super"