applied Peter Hartlich's simplification patch of setmfact and his revival of MFACT, appliead Janness Hofmann's simplification of grabbuttons() -- thanks guys!
This commit is contained in:
parent
6cf73e706a
commit
c982bb1389
|
@ -20,7 +20,7 @@ Rule rules[] = {
|
||||||
|
|
||||||
/* geometries, s{x,y,w,h} and bh are already initualized here */
|
/* 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 */
|
/* func name bx by bw wx wy ww wh mx my mw mh tx ty tw th mox moy mow moh */
|
||||||
double mfact = 0.55;
|
#define MFACT 0.55 /* master width factor [0.1 .. 0.9] */
|
||||||
DEFGEOM(single, 0, 0, sw, 0, bh, sw, sh-bh, wx, wy, mfact*sw, wh, mx+mw, wy, ww-mw, wh, wx, wy, ww, wh)
|
DEFGEOM(single, 0, 0, sw, 0, bh, sw, sh-bh, wx, wy, mfact*sw, wh, mx+mw, wy, ww-mw, wh, wx, wy, ww, wh)
|
||||||
DEFGEOM(dual, 0, 0,1280, 0, bh, ww, wh-bh, wx, wy, 1280,800-bh, 1280, 0, ww-mw, sh, mx, my, mw, mh)
|
DEFGEOM(dual, 0, 0,1280, 0, bh, ww, wh-bh, wx, wy, 1280,800-bh, 1280, 0, ww-mw, sh, mx, my, mw, mh)
|
||||||
|
|
||||||
|
|
64
dwm.c
64
dwm.c
|
@ -212,6 +212,7 @@ char stext[256], buf[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, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh;
|
||||||
|
double mfact;
|
||||||
unsigned int numlockmask = 0;
|
unsigned int numlockmask = 0;
|
||||||
void (*handler[LASTEvent]) (XEvent *) = {
|
void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[ButtonPress] = buttonpress,
|
[ButtonPress] = buttonpress,
|
||||||
|
@ -805,39 +806,20 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size) {
|
||||||
|
|
||||||
void
|
void
|
||||||
grabbuttons(Client *c, Bool focused) {
|
grabbuttons(Client *c, Bool focused) {
|
||||||
|
int i, j;
|
||||||
|
unsigned int buttons[] = { Button1, Button2, Button3 };
|
||||||
|
unsigned int modifiers[] = { MODKEY, MODKEY|LockMask, MODKEY|numlockmask,
|
||||||
|
MODKEY|numlockmask|LockMask} ;
|
||||||
|
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
|
if(focused)
|
||||||
if(focused) {
|
for(i = 0; i < LENGTH(buttons); i++)
|
||||||
XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK,
|
for(j = 0; j < LENGTH(modifiers); j++)
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
XGrabButton(dpy, buttons[i], modifiers[j], c->win, False,
|
||||||
XGrabButton(dpy, Button1, MODKEY|LockMask, c->win, False, BUTTONMASK,
|
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(dpy, Button1, MODKEY|numlockmask, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(dpy, Button1, MODKEY|numlockmask|LockMask, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
|
|
||||||
XGrabButton(dpy, Button2, MODKEY, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(dpy, Button2, MODKEY|LockMask, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(dpy, Button2, MODKEY|numlockmask, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(dpy, Button2, MODKEY|numlockmask|LockMask, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
|
|
||||||
XGrabButton(dpy, Button3, MODKEY, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(dpy, Button3, MODKEY|LockMask, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(dpy, Button3, MODKEY|numlockmask, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
XGrabButton(dpy, Button3, MODKEY|numlockmask|LockMask, c->win, False, BUTTONMASK,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK,
|
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1467,20 +1449,19 @@ setlayout(const char *arg) {
|
||||||
|
|
||||||
void
|
void
|
||||||
setmfact(const char *arg) {
|
setmfact(const char *arg) {
|
||||||
double delta;
|
double d;
|
||||||
|
|
||||||
if(!arg || lt->isfloating)
|
if(lt->isfloating)
|
||||||
return;
|
return;
|
||||||
delta = strtod(arg, NULL);
|
if(!arg)
|
||||||
if(arg[0] == '-' || arg[0] == '+') {
|
mfact = MFACT;
|
||||||
if(mfact + delta < 0.1 || mfact + delta > 0.9)
|
|
||||||
return;
|
|
||||||
mfact += delta;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
if(delta < 0.1 || delta > 0.9)
|
d = strtod(arg, NULL);
|
||||||
|
if(arg[0] == '-' || arg[0] == '+')
|
||||||
|
d += mfact;
|
||||||
|
if(d < 0.1 || d > 0.9)
|
||||||
return;
|
return;
|
||||||
mfact = delta;
|
mfact = d;
|
||||||
}
|
}
|
||||||
setgeom(geom->symbol);
|
setgeom(geom->symbol);
|
||||||
}
|
}
|
||||||
|
@ -1501,6 +1482,7 @@ setup(void) {
|
||||||
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 = &geoms[0];
|
geom = &geoms[0];
|
||||||
geom->apply();
|
geom->apply();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue