diff options
author | okan | 2010-01-27 03:04:50 +0000 |
---|---|---|
committer | okan | 2010-01-27 03:04:50 +0000 |
commit | cf907fa95c4a6c1fa13ad717089fa5d0cb099350 (patch) | |
tree | 6b333345d88e56bcf35f7f67aee73831f5790560 | |
parent | fb3ff22ef266df7aab2945a994a190f507cdfc51 (diff) | |
download | cwm-cf907fa95c4a6c1fa13ad717089fa5d0cb099350.tar.gz |
- allow per-screen gap; not (yet) user configurable.
- teach _NET_WORKAREA about gap.
ok oga@
-rw-r--r-- | calmwm.c | 3 | ||||
-rw-r--r-- | calmwm.h | 12 | ||||
-rw-r--r-- | client.c | 42 | ||||
-rw-r--r-- | conf.c | 9 | ||||
-rw-r--r-- | parse.y | 13 | ||||
-rw-r--r-- | screen.c | 12 |
6 files changed, 53 insertions, 38 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.c,v 1.51 2009/12/15 04:10:42 okan Exp $ + * $Id: calmwm.c,v 1.52 2010/01/27 03:04:50 okan Exp $ */ #include <sys/param.h> @@ -159,6 +159,7 @@ x_setupscreen(struct screen_ctx *sc, u_int which) sc->which = which; sc->rootwin = RootWindow(X_Dpy, sc->which); + conf_gap(&Conf, sc); screen_update_geometry(sc, DisplayWidth(X_Dpy, sc->which), DisplayHeight(X_Dpy, sc->which)); @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.h,v 1.114 2009/12/15 04:10:42 okan Exp $ + * $Id: calmwm.h,v 1.115 2010/01/27 03:04:50 okan Exp $ */ #ifndef _CALMWM_H_ @@ -65,6 +65,12 @@ struct color { unsigned long pixel; char *name; }; +struct gap { + int top; + int bottom; + int left; + int right; +}; struct client_ctx; @@ -97,6 +103,7 @@ struct screen_ctx { int xmax; int ymax; + struct gap gap; struct cycle_entry_q mruq; XftDraw *xftdraw; @@ -284,6 +291,7 @@ struct conf { int bwidth; #define CONF_MAMOUNT 1 int mamount; + struct gap gap; #define CONF_COLOR_ACTIVEBORDER "#CCCCCC" #define CONF_COLOR_INACTIVEBORDER "#666666" @@ -298,7 +306,6 @@ struct conf { #define DEFAULTFONTNAME "sans-serif:pixelsize=14:bold" char *DefaultFontName; - int gap_top, gap_bottom, gap_left, gap_right; }; /* Menu stuff */ @@ -423,6 +430,7 @@ void conf_bindname(struct conf *, char *, char *); void conf_mousebind(struct conf *, char *, char *); void conf_grab_mouse(struct client_ctx *); void conf_reload(struct conf *); +void conf_gap(struct conf *, struct screen_ctx *); void conf_font(struct conf *, struct screen_ctx *); void conf_color(struct conf *, struct screen_ctx *); void conf_init(struct conf *); @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: client.c,v 1.72 2009/12/15 04:10:42 okan Exp $ + * $Id: client.c,v 1.73 2010/01/27 03:04:50 okan Exp $ */ #include <sys/param.h> @@ -294,10 +294,10 @@ client_maximize(struct client_ctx *cc) ymax = xine->height; } calc: - cc->geom.x = x_org + Conf.gap_left; - cc->geom.y = y_org + Conf.gap_top; - cc->geom.height = ymax - (Conf.gap_top + Conf.gap_bottom); - cc->geom.width = xmax - (Conf.gap_left + Conf.gap_right); + cc->geom.x = x_org + sc->gap.left; + cc->geom.y = y_org + sc->gap.top; + cc->geom.height = ymax - (sc->gap.top + sc->gap.bottom); + cc->geom.width = xmax - (sc->gap.left + sc->gap.right); cc->flags |= CLIENT_DOMAXIMIZE; } @@ -326,9 +326,9 @@ client_vertmaximize(struct client_ctx *cc) ymax = xine->height; } calc: - cc->geom.y = y_org + Conf.gap_top; - cc->geom.height = ymax - (cc->bwidth * 2) - (Conf.gap_top + - Conf.gap_bottom); + cc->geom.y = y_org + sc->gap.top; + cc->geom.height = ymax - (cc->bwidth * 2) - (sc->gap.top + + sc->gap.bottom); cc->flags |= CLIENT_DOVMAXIMIZE; } @@ -357,9 +357,9 @@ client_horizmaximize(struct client_ctx *cc) xmax = xine->width; } calc: - cc->geom.x = x_org + Conf.gap_left; - cc->geom.width = xmax - (cc->bwidth * 2) - (Conf.gap_left + - Conf.gap_right); + cc->geom.x = x_org + sc->gap.left; + cc->geom.width = xmax - (cc->bwidth * 2) - (sc->gap.left + + sc->gap.right); cc->flags |= CLIENT_DOHMAXIMIZE; } @@ -672,21 +672,21 @@ noxine: if (xslack >= xorig) { cc->geom.x = MAX(MIN(xmouse, xslack), - xorig + Conf.gap_left); - if (cc->geom.x > (xslack - Conf.gap_right)) - cc->geom.x -= Conf.gap_right; + xorig + sc->gap.left); + if (cc->geom.x > (xslack - sc->gap.right)) + cc->geom.x -= sc->gap.right; } else { - cc->geom.x = xorig + Conf.gap_left; - cc->geom.width = xmax - Conf.gap_left; + cc->geom.x = xorig + sc->gap.left; + cc->geom.width = xmax - sc->gap.left; } if (yslack >= yorig) { cc->geom.y = MAX(MIN(ymouse, yslack), - yorig + Conf.gap_top); - if (cc->geom.y > (yslack - Conf.gap_bottom)) - cc->geom.y -= Conf.gap_bottom; + yorig + sc->gap.top); + if (cc->geom.y > (yslack - sc->gap.bottom)) + cc->geom.y -= sc->gap.bottom; } else { - cc->geom.y = yorig + Conf.gap_top; - cc->geom.height = ymax - Conf.gap_top; + cc->geom.y = yorig + sc->gap.top; + cc->geom.height = ymax - sc->gap.top; } } } @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: conf.c,v 1.75 2009/12/15 04:10:42 okan Exp $ + * $Id: conf.c,v 1.76 2010/01/27 03:04:50 okan Exp $ */ #include <sys/param.h> @@ -61,6 +61,12 @@ conf_cmd_add(struct conf *c, char *image, char *label, int flags) } void +conf_gap(struct conf *c, struct screen_ctx *sc) +{ + sc->gap = c->gap; +} + +void conf_font(struct conf *c, struct screen_ctx *sc) { sc->font = font_make(sc, c->DefaultFontName); @@ -92,6 +98,7 @@ conf_reload(struct conf *c) TAILQ_FOREACH(cc, &Clientq, entry) client_draw_border(cc); TAILQ_FOREACH(sc, &Screenq, entry) { + conf_gap(c, sc); conf_color(c, sc); conf_font(c, sc); } @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.24 2009/12/15 04:10:42 okan Exp $ */ +/* $OpenBSD: parse.y,v 1.25 2010/01/27 03:04:50 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -150,10 +150,10 @@ main : FONTNAME STRING { free($3); } | GAP NUMBER NUMBER NUMBER NUMBER { - conf->gap_top = $2; - conf->gap_bottom = $3; - conf->gap_left = $4; - conf->gap_right = $5; + conf->gap.top = $2; + conf->gap.bottom = $3; + conf->gap.left = $4; + conf->gap.right = $5; } | MOUSEBIND STRING string { conf_mousebind(conf, $2, $3); @@ -522,6 +522,7 @@ parse_config(const char *filename, struct conf *xconf) xconf->flags = conf->flags; xconf->bwidth = conf->bwidth; xconf->mamount = conf->mamount; + xconf->gap = conf->gap; while ((cmd = TAILQ_FIRST(&conf->cmdq)) != NULL) { TAILQ_REMOVE(&conf->cmdq, cmd, entry); @@ -557,8 +558,6 @@ parse_config(const char *filename, struct conf *xconf) xconf->color[i].name = conf->color[i].name; xconf->DefaultFontName = conf->DefaultFontName; - - bcopy(&(conf->gap_top), &(xconf->gap_top), sizeof(int) * 4); } free(conf); @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: screen.c,v 1.25 2009/12/15 04:10:42 okan Exp $ + * $Id: screen.c,v 1.26 2010/01/27 03:04:50 okan Exp $ */ #include <sys/param.h> @@ -119,12 +119,12 @@ screen_update_geometry(struct screen_ctx *sc, int width, int height) XChangeProperty(X_Dpy, sc->rootwin, _NET_DESKTOP_GEOMETRY, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)geom , 2); - /* x, y, width, height. XXX gap */ + /* x, y, width, height. */ for (i = 0; i < CALMWM_NGROUPS; i++) { - workareas[i][0] = 0; - workareas[i][1] = 0; - workareas[i][2] = width; - workareas[i][3] = height; + workareas[i][0] = sc->gap.left; + workareas[i][1] = sc->gap.top; + workareas[i][2] = width - (sc->gap.left + sc->gap.right); + workareas[i][3] = height - (sc->gap.top + sc->gap.bottom); } XChangeProperty(X_Dpy, sc->rootwin, _NET_WORKAREA, |