mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
- allow per-screen gap; not (yet) user configurable.
- teach _NET_WORKAREA about gap. ok oga@
This commit is contained in:
parent
ccb207a8a8
commit
e88bda0df5
1
calmwm.c
1
calmwm.c
@ -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));
|
||||
|
||||
|
10
calmwm.h
10
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 *);
|
||||
|
40
client.c
40
client.c
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
conf.c
7
conf.c
@ -60,6 +60,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)
|
||||
{
|
||||
@ -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);
|
||||
}
|
||||
|
11
parse.y
11
parse.y
@ -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);
|
||||
|
10
screen.c
10
screen.c
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user