mirror of git://git.suckless.org/dwm
removed Geom stuff, introduced updategeom() again, still view is somewhat broken?
This commit is contained in:
parent
93a4fe1052
commit
7eb26288fc
12
config.def.h
12
config.def.h
|
@ -18,17 +18,8 @@ Rule rules[] = {
|
||||||
{ "Gimp", NULL, NULL, NULL, True },
|
{ "Gimp", NULL, NULL, NULL, True },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* geometries, s{x,y,w,h} and bh are already initualized here */
|
|
||||||
/* func name bx by bw wx wy ww wh mx my mw mh tx ty tw th mox moy mow moh */
|
|
||||||
#define MFACT 0.55 /* master width factor [0.1 .. 0.9] */
|
|
||||||
DEFGEOM(single, 0, 0, sw, 0, bh, sw, sh-bh, wx, wy, mfact*ww, wh, mx+mw, wy, ww-mw, wh, wx, wy, ww, wh)
|
|
||||||
|
|
||||||
Geom geoms[] = {
|
|
||||||
/* symbol function */
|
|
||||||
{ "[]", single }, /* first entry is default */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
|
#define MFACT 0.55 /* master width factor [0.1 .. 0.9] */
|
||||||
#define RESIZEHINTS True /* False - respect size hints in tiled resizals */
|
#define RESIZEHINTS True /* False - respect size hints in tiled resizals */
|
||||||
#define SNAP 32 /* snap pixel */
|
#define SNAP 32 /* snap pixel */
|
||||||
|
|
||||||
|
@ -58,7 +49,6 @@ Key keys[] = {
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, NULL },
|
{ MODKEY|ShiftMask, XK_c, killclient, NULL },
|
||||||
{ MODKEY, XK_space, setlayout, NULL },
|
{ MODKEY, XK_space, setlayout, NULL },
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, NULL },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, NULL },
|
||||||
{ MODKEY|ControlMask, XK_space, setgeom, NULL },
|
|
||||||
{ MODKEY, XK_0, view, NULL },
|
{ MODKEY, XK_0, view, NULL },
|
||||||
{ MODKEY, XK_1, view, tags[0] },
|
{ MODKEY, XK_1, view, tags[0] },
|
||||||
{ MODKEY, XK_2, view, tags[1] },
|
{ MODKEY, XK_2, view, tags[1] },
|
||||||
|
|
3
dwm.1
3
dwm.1
|
@ -60,9 +60,6 @@ Start
|
||||||
.B Mod1\-space
|
.B Mod1\-space
|
||||||
Toggles between layouts.
|
Toggles between layouts.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Control\-space
|
|
||||||
Toggles between geometries.
|
|
||||||
.TP
|
|
||||||
.B Mod1\-j
|
.B Mod1\-j
|
||||||
Focus next window.
|
Focus next window.
|
||||||
.TP
|
.TP
|
||||||
|
|
108
dwm.c
108
dwm.c
|
@ -48,14 +48,6 @@
|
||||||
#define LENGTH(x) (sizeof x / sizeof x[0])
|
#define LENGTH(x) (sizeof x / sizeof x[0])
|
||||||
#define MAXTAGLEN 16
|
#define MAXTAGLEN 16
|
||||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||||
#define DEFGEOM(GEONAME,BX,BY,BW,WX,WY,WW,WH,MX,MY,MW,MH,TX,TY,TW,TH,MOX,MOY,MOW,MOH) \
|
|
||||||
void GEONAME(void) { \
|
|
||||||
bx = (BX); by = (BY); bw = (BW); \
|
|
||||||
wx = (WX); wy = (WY); ww = (WW); wh = (WH); \
|
|
||||||
mx = (MX); my = (MY); mw = (MW); mh = (MH); \
|
|
||||||
tx = (TX); ty = (TY); tw = (TW); th = (TH); \
|
|
||||||
mox = (MOX); moy = (MOY); mow = (MOW); moh = (MOH); \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* enums */
|
/* enums */
|
||||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||||
|
@ -96,11 +88,6 @@ typedef struct {
|
||||||
} font;
|
} font;
|
||||||
} DC; /* draw context */
|
} DC; /* draw context */
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const char *symbol;
|
|
||||||
void (*apply)(void);
|
|
||||||
} Geom;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned long mod;
|
unsigned long mod;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
|
@ -178,7 +165,6 @@ void restack(void);
|
||||||
void run(void);
|
void run(void);
|
||||||
void scan(void);
|
void scan(void);
|
||||||
void setclientstate(Client *c, long state);
|
void setclientstate(Client *c, long state);
|
||||||
void setgeom(const char *arg);
|
|
||||||
void setlayout(const char *arg);
|
void setlayout(const char *arg);
|
||||||
void setmfact(const char *arg);
|
void setmfact(const char *arg);
|
||||||
void setup(void);
|
void setup(void);
|
||||||
|
@ -198,7 +184,8 @@ void toggleview(const char *arg);
|
||||||
void unban(Client *c);
|
void unban(Client *c);
|
||||||
void unmanage(Client *c);
|
void unmanage(Client *c);
|
||||||
void unmapnotify(XEvent *e);
|
void unmapnotify(XEvent *e);
|
||||||
void updatebarpos(void);
|
void updatebar(void);
|
||||||
|
void updategeom(void);
|
||||||
void updatesizehints(Client *c);
|
void updatesizehints(Client *c);
|
||||||
void updatetitle(Client *c);
|
void updatetitle(Client *c);
|
||||||
void updatewmhints(Client *c);
|
void updatewmhints(Client *c);
|
||||||
|
@ -213,7 +200,7 @@ void zoom(const char *arg);
|
||||||
char stext[256];
|
char stext[256];
|
||||||
int screen, sx, sy, sw, sh;
|
int screen, sx, sy, sw, sh;
|
||||||
int (*xerrorxlib)(Display *, XErrorEvent *);
|
int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh;
|
int bx, by, bw, bh, blw, mx, my, mw, mh, tx, ty, tw, th, wx, wy, ww, wh;
|
||||||
int seltags = 0;
|
int seltags = 0;
|
||||||
double mfact;
|
double mfact;
|
||||||
unsigned int numlockmask = 0;
|
unsigned int numlockmask = 0;
|
||||||
|
@ -241,8 +228,6 @@ Client *stack = NULL;
|
||||||
Cursor cursor[CurLast];
|
Cursor cursor[CurLast];
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
DC dc = {0};
|
DC dc = {0};
|
||||||
Geom geoms[];
|
|
||||||
Geom *geom = geoms;
|
|
||||||
Layout layouts[];
|
Layout layouts[];
|
||||||
Layout *lt = layouts;
|
Layout *lt = layouts;
|
||||||
Window root, barwin;
|
Window root, barwin;
|
||||||
|
@ -330,14 +315,10 @@ buttonpress(XEvent *e) {
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
XButtonPressedEvent *ev = &e->xbutton;
|
||||||
|
|
||||||
if(ev->window == barwin) {
|
if(ev->window == barwin) {
|
||||||
if((ev->x < bgw) && ev->button == Button1) {
|
x = 0;
|
||||||
setgeom(NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
x = bgw;
|
|
||||||
for(i = 0; i < LENGTH(tags); i++) {
|
for(i = 0; i < LENGTH(tags); i++) {
|
||||||
x += textw(tags[i]);
|
x += textw(tags[i]);
|
||||||
if(ev->x >= bgw && ev->x < x) {
|
if(ev->x < x) {
|
||||||
if(ev->button == Button1) {
|
if(ev->button == Button1) {
|
||||||
if(ev->state & MODKEY)
|
if(ev->state & MODKEY)
|
||||||
tag(tags[i]);
|
tag(tags[i]);
|
||||||
|
@ -440,7 +421,9 @@ configurenotify(XEvent *e) {
|
||||||
if(ev->window == root && (ev->width != sw || ev->height != sh)) {
|
if(ev->window == root && (ev->width != sw || ev->height != sh)) {
|
||||||
sw = ev->width;
|
sw = ev->width;
|
||||||
sh = ev->height;
|
sh = ev->height;
|
||||||
setgeom(geom->symbol);
|
updategeom();
|
||||||
|
updatebar();
|
||||||
|
arrange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,11 +514,6 @@ drawbar(void) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
dc.x = 0;
|
dc.x = 0;
|
||||||
if(bgw > 0) {
|
|
||||||
dc.w = bgw;
|
|
||||||
drawtext(geom->symbol, dc.norm, False);
|
|
||||||
dc.x += bgw;
|
|
||||||
}
|
|
||||||
for(c = stack; c && !isvisible(c, NULL); c = c->snext);
|
for(c = stack; c && !isvisible(c, NULL); c = c->snext);
|
||||||
for(i = 0; i < LENGTH(tags); i++) {
|
for(i = 0; i < LENGTH(tags); i++) {
|
||||||
dc.w = textw(tags[i]);
|
dc.w = textw(tags[i]);
|
||||||
|
@ -1064,7 +1042,7 @@ monocle(void) {
|
||||||
|
|
||||||
for(c = clients; c; c = c->next)
|
for(c = clients; c; c = c->next)
|
||||||
if((lt->isfloating || !c->isfloating) && isvisible(c, NULL))
|
if((lt->isfloating || !c->isfloating) && isvisible(c, NULL))
|
||||||
resize(c, mox, moy, mow - 2 * c->bw, moh - 2 * c->bw, RESIZEHINTS);
|
resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, RESIZEHINTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1398,27 +1376,6 @@ setclientstate(Client *c, long state) {
|
||||||
PropModeReplace, (unsigned char *)data, 2);
|
PropModeReplace, (unsigned char *)data, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
setgeom(const char *arg) {
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
if(!arg) {
|
|
||||||
if(++geom == &geoms[LENGTH(geoms)])
|
|
||||||
geom = &geoms[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for(i = 0; i < LENGTH(geoms); i++)
|
|
||||||
if(!strcmp(geoms[i].symbol, arg))
|
|
||||||
break;
|
|
||||||
if(i == LENGTH(geoms))
|
|
||||||
return;
|
|
||||||
geom = &geoms[i];
|
|
||||||
}
|
|
||||||
geom->apply();
|
|
||||||
updatebarpos();
|
|
||||||
arrange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
setlayout(const char *arg) {
|
setlayout(const char *arg) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -1457,7 +1414,8 @@ setmfact(const char *arg) {
|
||||||
return;
|
return;
|
||||||
mfact = d;
|
mfact = d;
|
||||||
}
|
}
|
||||||
setgeom(geom->symbol);
|
updategeom();
|
||||||
|
arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1469,15 +1427,14 @@ setup(void) {
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(dpy);
|
||||||
root = RootWindow(dpy, screen);
|
root = RootWindow(dpy, screen);
|
||||||
initfont(FONT);
|
initfont(FONT);
|
||||||
|
|
||||||
/* apply default geometry */
|
|
||||||
sx = 0;
|
sx = 0;
|
||||||
sy = 0;
|
sy = 0;
|
||||||
sw = DisplayWidth(dpy, screen);
|
sw = DisplayWidth(dpy, screen);
|
||||||
sh = DisplayHeight(dpy, screen);
|
sh = DisplayHeight(dpy, screen);
|
||||||
bh = dc.font.height + 2;
|
bh = dc.font.height + 2;
|
||||||
mfact = MFACT;
|
|
||||||
geom->apply();
|
/* update geometry */
|
||||||
|
updategeom();
|
||||||
|
|
||||||
/* init atoms */
|
/* init atoms */
|
||||||
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
||||||
|
@ -1517,10 +1474,6 @@ setup(void) {
|
||||||
w = textw(layouts[i].symbol);
|
w = textw(layouts[i].symbol);
|
||||||
blw = MAX(blw, w);
|
blw = MAX(blw, w);
|
||||||
}
|
}
|
||||||
for(bgw = i = 0; LENGTH(geoms) > 1 && i < LENGTH(geoms); i++) {
|
|
||||||
w = textw(geoms[i].symbol);
|
|
||||||
bgw = MAX(bgw, w);
|
|
||||||
}
|
|
||||||
|
|
||||||
wa.override_redirect = 1;
|
wa.override_redirect = 1;
|
||||||
wa.background_pixmap = ParentRelative;
|
wa.background_pixmap = ParentRelative;
|
||||||
|
@ -1633,7 +1586,7 @@ tilemaster(unsigned int n) {
|
||||||
Client *c = nexttiled(clients);
|
Client *c = nexttiled(clients);
|
||||||
|
|
||||||
if(n == 1)
|
if(n == 1)
|
||||||
tileresize(c, mox, moy, mow - 2 * c->bw, moh - 2 * c->bw);
|
tileresize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw);
|
||||||
else
|
else
|
||||||
tileresize(c, mx, my, mw - 2 * c->bw, mh - 2 * c->bw);
|
tileresize(c, mx, my, mw - 2 * c->bw, mh - 2 * c->bw);
|
||||||
return c;
|
return c;
|
||||||
|
@ -1751,7 +1704,7 @@ unmapnotify(XEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updatebarpos(void) {
|
updatebar(void) {
|
||||||
|
|
||||||
if(dc.drawable != 0)
|
if(dc.drawable != 0)
|
||||||
XFreePixmap(dpy, dc.drawable);
|
XFreePixmap(dpy, dc.drawable);
|
||||||
|
@ -1759,6 +1712,34 @@ updatebarpos(void) {
|
||||||
XMoveResizeWindow(dpy, barwin, bx, by, bw, bh);
|
XMoveResizeWindow(dpy, barwin, bx, by, bw, bh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
updategeom(void) {
|
||||||
|
|
||||||
|
/* bar geometry */
|
||||||
|
bx = 0;
|
||||||
|
by = 0;
|
||||||
|
bw = sw;
|
||||||
|
|
||||||
|
/* window area geometry */
|
||||||
|
wx = sx;
|
||||||
|
wy = sy;
|
||||||
|
ww = sw;
|
||||||
|
sh = sh - bh;
|
||||||
|
|
||||||
|
/* master area geometry */
|
||||||
|
mfact = MFACT;
|
||||||
|
mx = wx;
|
||||||
|
my = wy;
|
||||||
|
mw = mfact * ww;
|
||||||
|
mh = wh;
|
||||||
|
|
||||||
|
/* tile area geometry */
|
||||||
|
tx = mx + mw;
|
||||||
|
ty = wy;
|
||||||
|
tw = ww - mw;
|
||||||
|
th = wh;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updatesizehints(Client *c) {
|
updatesizehints(Client *c) {
|
||||||
long msize;
|
long msize;
|
||||||
|
@ -1912,4 +1893,3 @@ main(int argc, char *argv[]) {
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue