Merge pull request #47 from linkdd/master

Add padding option
This commit is contained in:
Martin Duquesnoy 2012-05-02 01:19:18 -07:00
commit 5dc6199cac
6 changed files with 48 additions and 22 deletions

View File

@ -1090,18 +1090,22 @@ client_winsize(struct client *c, struct geo *g)
{ {
int ow, oh; int ow, oh;
struct geo og = c->wgeo; struct geo og = c->wgeo;
struct geo tmp = *g;
tmp.w -= W->padding >> 1;
tmp.h -= W->padding >> 1;
/* Window geo */ /* Window geo */
c->wgeo.x = c->border; c->wgeo.x = c->border;
c->wgeo.y = c->tbarw; c->wgeo.y = c->tbarw;
c->wgeo.h = oh = g->h - (c->border + c->tbarw); c->wgeo.h = oh = tmp.h - (c->border + c->tbarw);
c->wgeo.w = ow = g->w - (c->border << 1); c->wgeo.w = ow = tmp.w - (c->border << 1);
client_geo_hints(&c->wgeo, (int*)c->sizeh); client_geo_hints(&c->wgeo, (int*)c->sizeh);
/* Check possible problem for tile integration */ /* Check possible problem for tile integration */
if(ow < c->sizeh[MINW] || oh < c->sizeh[MINH]) 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; c->wgeo = og;
return true; return true;
@ -1171,6 +1175,11 @@ client_moveresize(struct client *c, struct geo *g)
c->rgeo.x += c->screen->ugeo.x; c->rgeo.x += c->screen->ugeo.x;
c->rgeo.y += c->screen->ugeo.y; 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, XMoveResizeWindow(W->dpy, c->frame,

View File

@ -192,7 +192,8 @@ config_tag(void)
ks = fetch_section(sec, "tag"); ks = fetch_section(sec, "tag");
n = fetch_section_count(ks); n = fetch_section_count(ks);
W->tag_circular = fetch_opt_first(sec, "1", "circular").boolean; if (fetch_opt_first(sec, "1", "circular").boolean)
W->flags |= WMFS_TAGCIRC;
/* [mouse] */ /* [mouse] */
if((mb = fetch_section(sec, "mouse"))) if((mb = fetch_section(sec, "mouse")))
@ -236,6 +237,7 @@ config_client(void)
/* [client] */ /* [client] */
sec = fetch_section_first(NULL, "client"); sec = fetch_section_first(NULL, "client");
W->padding = fetch_opt_first(sec, "0", "padding").num;
W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str); W->client_mod = modkey_keysym(fetch_opt_first(sec, "Super", "key_modifier").str);
/* Get theme */ /* Get theme */

View File

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

View File

@ -170,7 +170,7 @@ uicb_tag_next(Uicb cmd)
if((t = TAILQ_NEXT(W->screen->seltag, next))) if((t = TAILQ_NEXT(W->screen->seltag, next)))
tag_screen(W->screen, t); tag_screen(W->screen, t);
else if(W->tag_circular) else if(W->flags & WMFS_TAGCIRC)
tag_screen(W->screen, TAILQ_FIRST(&W->screen->tags)); tag_screen(W->screen, TAILQ_FIRST(&W->screen->tags));
} }
@ -182,7 +182,7 @@ uicb_tag_prev(Uicb cmd)
if((t = TAILQ_PREV(W->screen->seltag, tsub, next))) if((t = TAILQ_PREV(W->screen->seltag, tsub, next)))
tag_screen(W->screen, t); tag_screen(W->screen, t);
else if(W->tag_circular) else if(W->flags & WMFS_TAGCIRC)
tag_screen(W->screen, TAILQ_LAST(&W->screen->tags, tsub)); tag_screen(W->screen, TAILQ_LAST(&W->screen->tags, tsub));
} }
@ -214,7 +214,7 @@ uicb_tag_move_client_next(Uicb cmd)
if((t = TAILQ_NEXT(W->screen->seltag, next))) if((t = TAILQ_NEXT(W->screen->seltag, next)))
tag_client(t, W->client); tag_client(t, W->client);
else if(W->tag_circular) else if(W->flags & WMFS_TAGCIRC)
tag_client(TAILQ_FIRST(&W->screen->tags), W->client); tag_client(TAILQ_FIRST(&W->screen->tags), W->client);
} }
@ -229,7 +229,7 @@ uicb_tag_move_client_prev(Uicb cmd)
if((t = TAILQ_PREV(W->screen->seltag, tsub, next))) if((t = TAILQ_PREV(W->screen->seltag, tsub, next)))
tag_client(t, W->client); tag_client(t, W->client);
else if(W->tag_circular) else if(W->flags & WMFS_TAGCIRC)
tag_client(TAILQ_LAST(&W->screen->tags, tsub), W->client); tag_client(TAILQ_LAST(&W->screen->tags, tsub), W->client);
} }

View File

@ -335,14 +335,15 @@ struct wmfs
int nscreen; int nscreen;
unsigned int client_mod; unsigned int client_mod;
Flags numlockmask; Flags numlockmask;
#define WMFS_SCAN 0x01 #define WMFS_SCAN 0x001
#define WMFS_RUNNING 0x02 #define WMFS_RUNNING 0x002
#define WMFS_RELOAD 0x04 #define WMFS_RELOAD 0x004
#define WMFS_SYSTRAY 0x08 #define WMFS_SYSTRAY 0x008
#define WMFS_LOG 0x10 #define WMFS_LOG 0x010
#define WMFS_LAUNCHER 0x20 #define WMFS_LAUNCHER 0x020
#define WMFS_SIGCHLD 0x40 #define WMFS_SIGCHLD 0x040
#define WMFS_TABNOC 0x80 /* tab next opened client */ #define WMFS_TABNOC 0x080 /* tab next opened client */
#define WMFS_TAGCIRC 0x100 /* tab_next on last tag -> go to first tag / tab_prev on first tag -> go to last tag */
Flags flags; Flags flags;
GC gc, rgc; GC gc, rgc;
Atom *net_atom; Atom *net_atom;
@ -354,7 +355,7 @@ struct wmfs
#define CFOCUS_CLICK 0x02 #define CFOCUS_CLICK 0x02
Flags cfocus; /* Focus configuration, can be set to 0, CFOCUS_ENTER or CFOCUS_CLICK*/ Flags cfocus; /* Focus configuration, can be set to 0, CFOCUS_ENTER or CFOCUS_CLICK*/
bool tag_circular; int padding;
/* Log file */ /* Log file */
FILE *log; FILE *log;

3
wmfsrc
View File

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