summaryrefslogtreecommitdiff
path: root/app/cwm
diff options
context:
space:
mode:
Diffstat (limited to 'app/cwm')
-rw-r--r--app/cwm/calmwm.c3
-rw-r--r--app/cwm/calmwm.h12
-rw-r--r--app/cwm/client.c42
-rw-r--r--app/cwm/conf.c9
-rw-r--r--app/cwm/parse.y13
-rw-r--r--app/cwm/screen.c12
6 files changed, 53 insertions, 38 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c
index d04d861f2..17d283a67 100644
--- a/app/cwm/calmwm.c
+++ b/app/cwm/calmwm.c
@@ -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));
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index dc664a59e..565c37926 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -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 *);
diff --git a/app/cwm/client.c b/app/cwm/client.c
index 659141ca5..1c4bb5dc8 100644
--- a/app/cwm/client.c
+++ b/app/cwm/client.c
@@ -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;
}
}
}
diff --git a/app/cwm/conf.c b/app/cwm/conf.c
index 6b3ed5464..7272eb86e 100644
--- a/app/cwm/conf.c
+++ b/app/cwm/conf.c
@@ -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);
}
diff --git a/app/cwm/parse.y b/app/cwm/parse.y
index a7407e0b7..7a89663e9 100644
--- a/app/cwm/parse.y
+++ b/app/cwm/parse.y
@@ -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);
diff --git a/app/cwm/screen.c b/app/cwm/screen.c
index e5793a5c5..9a5ad56f5 100644
--- a/app/cwm/screen.c
+++ b/app/cwm/screen.c
@@ -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,