From a2d56f6dcef7adb1a85951871cb51a052709241a Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Thu, 3 Aug 2006 15:36:13 +0200 Subject: [PATCH 01/16] make config.h not a time dependence --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4df8e9a..b7db7cc 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ options: ${OBJ}: dwm.h config.h -config.h: ${CONFIG} +config.h: @echo creating $@ from ${CONFIG} @cp ${CONFIG} $@ -- 2.20.1 From 99b126d0afe461960d001385c9ee13295c8ed543 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Thu, 3 Aug 2006 17:08:43 +0200 Subject: [PATCH 02/16] removed CONFIG --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b7db7cc..342a9c2 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ include config.mk SRC = client.c draw.c event.c main.c tag.c util.c OBJ = ${SRC:.c=.o} -CONFIG ?= config.default.h all: options dwm @echo finished @@ -23,8 +22,8 @@ options: ${OBJ}: dwm.h config.h config.h: - @echo creating $@ from ${CONFIG} - @cp ${CONFIG} $@ + @echo creating $@ from config.default.h + @cp config.default.h $@ dwm: ${OBJ} @echo LD $@ -- 2.20.1 From 8f698bd4ccea058019f9ca89ca19add300064b15 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 10:27:16 +0200 Subject: [PATCH 03/16] small stylistic fix --- util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util.c b/util.c index 7aff2aa..e29d8b0 100644 --- a/util.c +++ b/util.c @@ -30,7 +30,8 @@ emallocz(unsigned int size) } void -eprint(const char *errstr, ...) { +eprint(const char *errstr, ...) +{ va_list ap; va_start(ap, errstr); -- 2.20.1 From 0dfe729f90069de070495c82ddc72cc476a4f3ab Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 10:36:22 +0200 Subject: [PATCH 04/16] added dmenu to dwm.html --- dwm.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dwm.html b/dwm.html index d856913..f816387 100644 --- a/dwm.html +++ b/dwm.html @@ -100,6 +100,7 @@

Download

Development

@@ -108,6 +109,9 @@

hg clone http://10kloc.org/cgi-bin/hgwebdir.cgi/dwm

+

+ hg clone http://10kloc.org/cgi-bin/hgwebdir.cgi/dmenu +

Miscellaneous

You can purchase this tricot -- 2.20.1 From 9955ddc978c2e6acfe246f29f1d317b55d860757 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 12:00:55 +0200 Subject: [PATCH 05/16] using execl now, argv changed, using cmd and const char defs directly in the KEYS struct --- config.arg.h | 17 ++++++----------- config.default.h | 6 ++++-- dwm.h | 2 +- util.c | 11 +++++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/config.arg.h b/config.arg.h index 0c39d3b..05b350f 100644 --- a/config.arg.h +++ b/config.arg.h @@ -17,13 +17,6 @@ const char *tags[] = { "fnord", "dev", "net", "work", "misc", NULL }; #define MASTERW 60 /* percent */ #define KEYS \ - const char *browse[] = { "firefox", NULL }; \ - const char *gimp[] = { "gimp", NULL }; \ - const char *term[] = { \ - "urxvt", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", \ - "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL \ - }; \ - const char *xlock[] = { "xlock", NULL }; \ static Key key[] = { \ /* modifier key function arguments */ \ { MODKEY, XK_0, view, { .i = 0 } }, \ @@ -50,10 +43,12 @@ static Key key[] = { \ { MODKEY|ShiftMask, XK_4, replacetag, { .i = 5 } }, \ { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ - { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, \ - { MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } }, \ - { MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } }, \ - { MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } }, \ + { MODKEY|ShiftMask, XK_x, spawn, \ + { .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" \ + " awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, \ + { MODKEY|ShiftMask, XK_Return, spawn, \ + { .cmd = "exec urxvt -tr +sb -bg black -fg white -cr white " \ + "-fn '-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*'" } }, \ }; #define RULES \ diff --git a/config.default.h b/config.default.h index 14f33ec..cefb7f7 100644 --- a/config.default.h +++ b/config.default.h @@ -17,7 +17,6 @@ const char *tags[] = { "0", "1", "2", "3", "4", NULL }; #define MASTERW 60 /* percent */ #define KEYS \ - const char *term[] = { "xterm", NULL }; \ static Key key[] = { \ /* modifier key function arguments */ \ { MODKEY, XK_0, view, { .i = 0 } }, \ @@ -44,7 +43,10 @@ static Key key[] = { \ { MODKEY|ShiftMask, XK_4, replacetag, { .i = 4 } }, \ { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ - { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, \ + /* { MODKEY|ShiftMask, XK_x, spawn, */ \ + /* { .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" */ \ + /* " awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, */ \ + { MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \ }; #define RULES \ diff --git a/dwm.h b/dwm.h index 25971ac..939b546 100644 --- a/dwm.h +++ b/dwm.h @@ -17,7 +17,7 @@ typedef struct DC DC; typedef struct Fnt Fnt; union Arg { - const char **argv; + const char *cmd; int i; }; diff --git a/util.c b/util.c index e29d8b0..990ad28 100644 --- a/util.c +++ b/util.c @@ -43,17 +43,20 @@ eprint(const char *errstr, ...) void spawn(Arg *arg) { - char **argv = (char **)arg->argv; + static char *shell = NULL; - if(!argv || !argv[0]) + if(!shell && !(shell = getenv("SHELL"))) + shell = "/bin/sh"; + + if(!arg->cmd) return; if(fork() == 0) { if(fork() == 0) { if(dpy) close(ConnectionNumber(dpy)); setsid(); - execvp(argv[0], argv); - fprintf(stderr, "dwm: execvp %s", argv[0]); + execl(shell, shell, "-c", arg->cmd, NULL); + fprintf(stderr, "dwm: execl '%s'", arg->cmd); perror(" failed"); } exit(0); -- 2.20.1 From f504aea13289c7fd25d499d2582558d4e311bfbf Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 13:42:40 +0200 Subject: [PATCH 06/16] fixed a bug in dmenu call --- config.arg.h | 6 +++--- config.default.h | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/config.arg.h b/config.arg.h index 05b350f..4297376 100644 --- a/config.arg.h +++ b/config.arg.h @@ -29,6 +29,9 @@ static Key key[] = { \ { MODKEY, XK_k, focusprev, { 0 } }, \ { MODKEY, XK_l, viewnext, { 0 } }, \ { MODKEY, XK_m, togglemax, { 0 } }, \ + { MODKEY, XK_p, spawn, \ + { .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" \ + " awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, \ { MODKEY, XK_space, togglemode, { 0 } }, \ { MODKEY, XK_Return, zoom, { 0 } }, \ { MODKEY|ControlMask, XK_0, appendtag, { .i = 0 } }, \ @@ -43,9 +46,6 @@ static Key key[] = { \ { MODKEY|ShiftMask, XK_4, replacetag, { .i = 5 } }, \ { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ - { MODKEY|ShiftMask, XK_x, spawn, \ - { .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" \ - " awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, \ { MODKEY|ShiftMask, XK_Return, spawn, \ { .cmd = "exec urxvt -tr +sb -bg black -fg white -cr white " \ "-fn '-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*'" } }, \ diff --git a/config.default.h b/config.default.h index cefb7f7..f3fd7b7 100644 --- a/config.default.h +++ b/config.default.h @@ -43,9 +43,6 @@ static Key key[] = { \ { MODKEY|ShiftMask, XK_4, replacetag, { .i = 4 } }, \ { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ - /* { MODKEY|ShiftMask, XK_x, spawn, */ \ - /* { .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null |" */ \ - /* " awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, */ \ { MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \ }; -- 2.20.1 From e21d93b7bd5d34f31bc09a576b7d449df5b68c07 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 14:40:32 +0200 Subject: [PATCH 07/16] switched to regexp matching for Rules --- config.arg.h | 11 ++++---- config.default.h | 7 +++-- config.mk | 8 +++--- dwm.h | 1 + main.c | 1 + tag.c | 68 ++++++++++++++++++++++++++++++++++++------------ 6 files changed, 65 insertions(+), 31 deletions(-) diff --git a/config.arg.h b/config.arg.h index 4297376..d391f9e 100644 --- a/config.arg.h +++ b/config.arg.h @@ -52,11 +52,10 @@ static Key key[] = { \ }; #define RULES \ - const unsigned int two[] = { 2 }; \ static Rule rule[] = { \ - /* class:instance tags isfloat */ \ - { "Firefox.*", two, False }, \ - { "Gimp.*", NULL, True}, \ - { "MPlayer.*", NULL, True}, \ - { "Acroread.*", NULL, True}, \ + /* class:instance regex tags regex isfloat */ \ + { "Firefox.*", "net", False }, \ + { "Gimp.*", NULL, True}, \ + { "MPlayer.*", NULL, True}, \ + { "Acroread.*", NULL, True}, \ }; diff --git a/config.default.h b/config.default.h index f3fd7b7..3847ff8 100644 --- a/config.default.h +++ b/config.default.h @@ -47,9 +47,8 @@ static Key key[] = { \ }; #define RULES \ - const unsigned int two[] = { 2 }; \ static Rule rule[] = { \ - /* class:instance tags isfloat */ \ - { "Firefox.*", two, False }, \ - { "Gimp.*", NULL, True}, \ + /* class:instance regex tags regex isfloat */ \ + { "Firefox.*", "2", False }, \ + { "Gimp.*", NULL, True}, \ }; diff --git a/config.mk b/config.mk index 4657aff..92e244e 100644 --- a/config.mk +++ b/config.mk @@ -15,10 +15,10 @@ INCS = -I/usr/lib -I${X11INC} LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 # flags -CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\" -LDFLAGS = ${LIBS} -#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" -#LDFLAGS = -g ${LIBS} +#CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\" +#LDFLAGS = ${LIBS} +CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" +LDFLAGS = -g ${LIBS} # compiler CC = cc diff --git a/dwm.h b/dwm.h index 939b546..57d628a 100644 --- a/dwm.h +++ b/dwm.h @@ -121,6 +121,7 @@ extern int xerror(Display *dsply, XErrorEvent *ee); extern void appendtag(Arg *arg); extern void dofloat(Arg *arg); extern void dotile(Arg *arg); +extern void initrregs(); extern Client *getnext(Client *c); extern Client *getprev(Client *c); extern void replacetag(Arg *arg); diff --git a/main.c b/main.c index 9ea09bf..633966b 100644 --- a/main.c +++ b/main.c @@ -210,6 +210,7 @@ main(int argc, char *argv[]) cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); grabkeys(); + initrregs(); for(ntags = 0; tags[ntags]; ntags++); diff --git a/tag.c b/tag.c index b20e71e..015a06a 100644 --- a/tag.c +++ b/tag.c @@ -5,21 +5,31 @@ #include "dwm.h" #include #include +#include #include #include #include -/* static */ typedef struct { - const char *pattern; - const unsigned int *tags; + const char *clpattern; + const char *tpattern; Bool isfloat; } Rule; +typedef struct { + regex_t *clregex; + regex_t *tregex; +} RReg; + +/* static */ + TAGS RULES +static RReg *rreg = NULL; +static unsigned int len = 0; + void (*arrange)(Arg *) = DEFMODE; /* extern */ @@ -137,6 +147,35 @@ getprev(Client *c) return c; } +void +initrregs() +{ + unsigned int i; + regex_t *reg; + + if(rreg) + return; + len = sizeof(rule) / sizeof(rule[0]); + rreg = emallocz(len * sizeof(RReg)); + + for(i = 0; i < len; i++) { + if(rule[i].clpattern) { + reg = emallocz(sizeof(regex_t)); + if(regcomp(reg, rule[i].clpattern, 0)) + free(reg); + else + rreg[i].clregex = reg; + } + if(rule[i].tpattern) { + reg = emallocz(sizeof(regex_t)); + if(regcomp(reg, rule[i].tpattern, 0)) + free(reg); + else + rreg[i].tregex = reg; + } + } +} + void replacetag(Arg *arg) { @@ -154,9 +193,7 @@ void settags(Client *c) { char classinst[256]; - static unsigned int len = sizeof(rule) / sizeof(rule[0]); - unsigned int i, j, n; - regex_t regex; + unsigned int i, j; regmatch_t tmp; Bool matched = False; XClassHint ch; @@ -165,19 +202,16 @@ settags(Client *c) snprintf(classinst, sizeof(classinst), "%s:%s", ch.res_class ? ch.res_class : "", ch.res_name ? ch.res_name : ""); - for(i = 0; !matched && i < len; i++) { - if(!regcomp(®ex, rule[i].pattern, 0)) { - if(!regexec(®ex, classinst, 1, &tmp, 0)) { - n = rule[i].tags ? - sizeof(rule[i].tags) / sizeof(rule[i].tags[0]) : 0; - matched = n != 0; - for(j = 0; j < n; j++) - c->tags[rule[i].tags[j]] = True; - c->isfloat = rule[i].isfloat; + for(i = 0; !matched && i < len; i++) + if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) { + c->isfloat = rule[i].isfloat; + for(j = 0; rreg[i].tregex && j < ntags; j++) { + if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { + matched = True; + c->tags[j] = True; + } } - regfree(®ex); } - } if(ch.res_class) XFree(ch.res_class); if(ch.res_name) -- 2.20.1 From 1076161bf353aa1eba056980b8e5544651036da4 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 15:47:50 +0200 Subject: [PATCH 08/16] fixed dmenu link (thx to deifl) --- dwm.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwm.html b/dwm.html index f816387..ce4a44a 100644 --- a/dwm.html +++ b/dwm.html @@ -100,7 +100,7 @@

Download

Development

-- 2.20.1 From 12b1d439e46e7881942a6d378b3b874c4c9f7555 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 17:04:50 +0200 Subject: [PATCH 09/16] no need for -g anymore, regexp matching works now --- config.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config.mk b/config.mk index 92e244e..4657aff 100644 --- a/config.mk +++ b/config.mk @@ -15,10 +15,10 @@ INCS = -I/usr/lib -I${X11INC} LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 # flags -#CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\" -#LDFLAGS = ${LIBS} -CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" -LDFLAGS = -g ${LIBS} +CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\" +LDFLAGS = ${LIBS} +#CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" +#LDFLAGS = -g ${LIBS} # compiler CC = cc -- 2.20.1 From 3d73084b5ef25bca354b32e049b2904aa9519c09 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 18:17:02 +0200 Subject: [PATCH 10/16] fixed view-change bug reported on the list --- tag.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/tag.c b/tag.c index 015a06a..72d87d3 100644 --- a/tag.c +++ b/tag.c @@ -57,14 +57,12 @@ dofloat(Arg *arg) else ban(c); } - if(sel && !sel->tags[tsel]) { - if((sel = getnext(clients))) { - higher(sel); - focus(sel); - } - else - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + if((sel = getnext(clients))) { + higher(sel); + focus(sel); } + else + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); drawall(); } @@ -122,14 +120,12 @@ dotile(Arg *arg) else ban(c); } - if(!sel || (sel && !sel->tags[tsel])) { - if((sel = getnext(clients))) { - higher(sel); - focus(sel); - } - else - XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + if((sel = getnext(clients))) { + higher(sel); + focus(sel); } + else + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); drawall(); } -- 2.20.1 From 6a39a496d06f5631a1617fe68729cbde4c24318c Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 18:25:40 +0200 Subject: [PATCH 11/16] fixed xterm font change (all other related apps should work fine with this fix as well) --- event.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/event.c b/event.c index 88e1b10..a266ffa 100644 --- a/event.c +++ b/event.c @@ -156,22 +156,17 @@ configurerequest(XEvent *e) if((c = getclient(ev->window))) { gravitate(c, True); - if(c->isfloat) { - if(ev->value_mask & CWX) - c->x = ev->x; - if(ev->value_mask & CWY) - c->y = ev->y; - if(ev->value_mask & CWWidth) - c->w = ev->width; - if(ev->value_mask & CWHeight) - c->h = ev->height; - } + if(ev->value_mask & CWX) + c->x = ev->x; + if(ev->value_mask & CWY) + c->y = ev->y; + if(ev->value_mask & CWWidth) + c->w = ev->width; + if(ev->value_mask & CWHeight) + c->h = ev->height; if(ev->value_mask & CWBorderWidth) c->border = ev->border_width; gravitate(c, False); - - resize(c, True, TopLeft); - wc.x = c->x; wc.y = c->y; wc.width = c->w; @@ -193,6 +188,9 @@ configurerequest(XEvent *e) /* Send synthetic ConfigureNotify */ XSendEvent(dpy, c->win, True, NoEventMask, &synev); } + XSync(dpy, False); + arrange(NULL); + drawall(); } else { wc.x = ev->x; @@ -203,8 +201,8 @@ configurerequest(XEvent *e) wc.sibling = ev->above; wc.stack_mode = ev->detail; XConfigureWindow(dpy, ev->window, ev->value_mask, &wc); + XSync(dpy, False); } - XSync(dpy, False); } static void -- 2.20.1 From b098c94ed44495957de11a6160fa0560abbe944f Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Fri, 4 Aug 2006 18:34:40 +0200 Subject: [PATCH 12/16] small performance tweak ;) --- event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/event.c b/event.c index a266ffa..69a628e 100644 --- a/event.c +++ b/event.c @@ -189,8 +189,10 @@ configurerequest(XEvent *e) XSendEvent(dpy, c->win, True, NoEventMask, &synev); } XSync(dpy, False); - arrange(NULL); - drawall(); + if(c->isfloat) + resize(c, False, TopLeft); + else + arrange(NULL); } else { wc.x = ev->x; -- 2.20.1 From 86d12249dd3b63c9312f3a938b20985abc2a3364 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Sat, 5 Aug 2006 13:10:09 +0200 Subject: [PATCH 13/16] slight fix --- main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 633966b..b1372d0 100644 --- a/main.c +++ b/main.c @@ -178,15 +178,14 @@ main(int argc, char *argv[]) dpy = XOpenDisplay(0); if(!dpy) - eprint("dwm: cannot connect X server\n"); + eprint("dwm: cannot open display\n"); screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); - /* check if another WM is already running */ otherwm = False; XSetErrorHandler(xerrorstart); - /* this causes an error if some other WM is running */ + /* this causes an error if some other window manager is running */ XSelectInput(dpy, root, SubstructureRedirectMask); XSync(dpy, False); -- 2.20.1 From a207949b6503546379e3ab727cecc2f3e0cff78d Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Sat, 5 Aug 2006 14:02:25 +0200 Subject: [PATCH 14/16] mouse grab needs also to grab for combinations of numlock/lockmask --- client.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/client.c b/client.c index 91d031e..7c3b28b 100644 --- a/client.c +++ b/client.c @@ -245,10 +245,30 @@ manage(Window w, XWindowAttributes *wa) XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); + XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK, + 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); settags(c); if(!c->isfloat) -- 2.20.1 From ecc95c903ba6c9a548588a79c1093e6372555f2c Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Sat, 5 Aug 2006 14:56:32 +0200 Subject: [PATCH 15/16] using -Os again, zoom is ignored in floating mode or on floating clients --- client.c | 2 +- config.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client.c b/client.c index 7c3b28b..589b73e 100644 --- a/client.c +++ b/client.c @@ -466,7 +466,7 @@ zoom(Arg *arg) { Client *c; - if(!sel) + if(!sel || arrange != dotile) return; if(sel == getnext(clients) && sel->next) { diff --git a/config.mk b/config.mk index 4657aff..164fe73 100644 --- a/config.mk +++ b/config.mk @@ -15,7 +15,7 @@ INCS = -I/usr/lib -I${X11INC} LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 # flags -CFLAGS = -O3 ${INCS} -DVERSION=\"${VERSION}\" +CFLAGS = -Os ${INCS} -DVERSION=\"${VERSION}\" LDFLAGS = ${LIBS} #CFLAGS = -g -Wall -O2 ${INCS} -DVERSION=\"${VERSION}\" #LDFLAGS = -g ${LIBS} -- 2.20.1 From f4208e7cacd56de70d50218a0b5ace83e39b76a6 Mon Sep 17 00:00:00 2001 From: "arg@10ksloc.org" Date: Sat, 5 Aug 2006 14:57:26 +0200 Subject: [PATCH 16/16] small fix of the last commit --- client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.c b/client.c index 589b73e..6531410 100644 --- a/client.c +++ b/client.c @@ -466,7 +466,7 @@ zoom(Arg *arg) { Client *c; - if(!sel || arrange != dotile) + if(!sel || (arrange != dotile) || sel->isfloat) return; if(sel == getnext(clients) && sel->next) { -- 2.20.1