From 20de4fde38970202f512245786cb9e001af0d9cc Mon Sep 17 00:00:00 2001 From: Christopher Meng Date: Apr 25 2014 01:41:23 +0000 Subject: Fetch all patches from upstream. --- diff --git a/0016-remove-_POSIX_C_SOURCE-cflag.patch b/0016-remove-_POSIX_C_SOURCE-cflag.patch new file mode 100644 index 0000000..849f7a7 --- /dev/null +++ b/0016-remove-_POSIX_C_SOURCE-cflag.patch @@ -0,0 +1,28 @@ +From 7707111c109f105b8b404c3250dca879bb94407c Mon Sep 17 00:00:00 2001 +From: Connor Lane Smith +Date: Wed, 18 Jan 2012 23:56:13 +0000 +Subject: [PATCH 16/28] remove _POSIX_C_SOURCE cflag + +--- + config.mk | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/config.mk b/config.mk +index 725e28e..ca89fd6 100644 +--- a/config.mk ++++ b/config.mk +@@ -17,9 +17,8 @@ INCS = -I${X11INC} + LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} + + # flags +-CPPFLAGS = -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +-#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} +-CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} ++CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ++CFLAGS = -ansi -pedantic -Wall -Os ${INCS} ${CPPFLAGS} + LDFLAGS = -s ${LIBS} + + # compiler and linker +-- +1.9.0 + diff --git a/0017-add-G-escape-keybinding.patch b/0017-add-G-escape-keybinding.patch new file mode 100644 index 0000000..d7927db --- /dev/null +++ b/0017-add-G-escape-keybinding.patch @@ -0,0 +1,39 @@ +From 50145384c821bb05f5497e80a006fee2db9f145b Mon Sep 17 00:00:00 2001 +From: Karl F +Date: Thu, 19 Jan 2012 22:52:17 +0000 +Subject: [PATCH 17/28] add ^G escape keybinding + +--- + dmenu.1 | 3 +++ + dmenu.c | 1 + + 2 files changed, 4 insertions(+) + +diff --git a/dmenu.1 b/dmenu.1 +index 0784cd9..3a0f4ef 100644 +--- a/dmenu.1 ++++ b/dmenu.1 +@@ -107,6 +107,9 @@ End + C\-f + Right + .TP ++C\-g ++Escape ++.TP + C\-h + Backspace + .TP +diff --git a/dmenu.c b/dmenu.c +index 4ea95f8..fad4443 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -251,6 +251,7 @@ keypress(XKeyEvent *ev) { + case XK_d: ksym = XK_Delete; break; + case XK_e: ksym = XK_End; break; + case XK_f: ksym = XK_Right; break; ++ case XK_g: ksym = XK_Escape; break; + case XK_h: ksym = XK_BackSpace; break; + case XK_i: ksym = XK_Tab; break; + case XK_j: ksym = XK_Return; break; +-- +1.9.0 + diff --git a/0018-listen-for-C-S-jm.patch b/0018-listen-for-C-S-jm.patch new file mode 100644 index 0000000..d4f1a8f --- /dev/null +++ b/0018-listen-for-C-S-jm.patch @@ -0,0 +1,29 @@ +From 1f11faf7b505ac94bee1242e90dbd3ae37a086b4 Mon Sep 17 00:00:00 2001 +From: Connor Lane Smith +Date: Fri, 10 Feb 2012 00:37:42 +0000 +Subject: [PATCH 18/28] listen for C-S-[jm] + +--- + dmenu.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/dmenu.c b/dmenu.c +index fad4443..f7eba87 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -254,8 +254,10 @@ keypress(XKeyEvent *ev) { + case XK_g: ksym = XK_Escape; break; + case XK_h: ksym = XK_BackSpace; break; + case XK_i: ksym = XK_Tab; break; +- case XK_j: ksym = XK_Return; break; +- case XK_m: ksym = XK_Return; break; ++ case XK_j: /* fallthrough */ ++ case XK_J: ksym = XK_Return; break; ++ case XK_m: /* fallthrough */ ++ case XK_M: ksym = XK_Return; break; + case XK_n: ksym = XK_Down; break; + case XK_p: ksym = XK_Up; break; + +-- +1.9.0 + diff --git a/0019-_POSIX_C_SOURCE-200809L.patch b/0019-_POSIX_C_SOURCE-200809L.patch new file mode 100644 index 0000000..6a6918c --- /dev/null +++ b/0019-_POSIX_C_SOURCE-200809L.patch @@ -0,0 +1,25 @@ +From 38fccafada4eee3e4e0301d7c6eadd3c5788b305 Mon Sep 17 00:00:00 2001 +From: Connor Lane Smith +Date: Fri, 6 Apr 2012 16:38:01 +0100 +Subject: [PATCH 19/28] _POSIX_C_SOURCE=200809L + +--- + config.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config.mk b/config.mk +index ca89fd6..c0d466b 100644 +--- a/config.mk ++++ b/config.mk +@@ -17,7 +17,7 @@ INCS = -I${X11INC} + LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} + + # flags +-CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} ++CPPFLAGS = -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} + CFLAGS = -ansi -pedantic -Wall -Os ${INCS} ${CPPFLAGS} + LDFLAGS = -s ${LIBS} + +-- +1.9.0 + diff --git a/0020-ignore-prompt-if-it-is-empty-in-addition-to-NULL.patch b/0020-ignore-prompt-if-it-is-empty-in-addition-to-NULL.patch new file mode 100644 index 0000000..c9316a2 --- /dev/null +++ b/0020-ignore-prompt-if-it-is-empty-in-addition-to-NULL.patch @@ -0,0 +1,34 @@ +From 1299e41447fe5850d127857a68f37c5badd491ce Mon Sep 17 00:00:00 2001 +From: Moritz Wilhelmy +Date: Tue, 15 May 2012 11:47:54 +0200 +Subject: [PATCH 20/28] ignore prompt if it is empty in addition to NULL + +--- + dmenu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dmenu.c b/dmenu.c +index f7eba87..3962801 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -169,7 +169,7 @@ drawmenu(void) { + dc->h = bh; + drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol)); + +- if(prompt) { ++ if(prompt && *prompt) { + dc->w = promptw; + drawtext(dc, prompt, selcol); + dc->x = dc->w; +@@ -579,7 +579,7 @@ setup(void) { + y = topbar ? 0 : DisplayHeight(dc->dpy, screen) - mh; + mw = DisplayWidth(dc->dpy, screen); + } +- promptw = prompt ? textw(dc, prompt) : 0; ++ promptw = (prompt && *prompt) ? textw(dc, prompt) : 0; + inputw = MIN(inputw, mw/3); + match(); + +-- +1.9.0 + diff --git a/0021-dmenu_run-Split-cache-logic-to-dmenu_path-again.patch b/0021-dmenu_run-Split-cache-logic-to-dmenu_path-again.patch new file mode 100644 index 0000000..61d2b39 --- /dev/null +++ b/0021-dmenu_run-Split-cache-logic-to-dmenu_path-again.patch @@ -0,0 +1,89 @@ +From dec9a28863f388072be105e0950deb72ac719d48 Mon Sep 17 00:00:00 2001 +From: Quentin Glidic +Date: Mon, 30 Jul 2012 17:02:12 +0200 +Subject: [PATCH 21/28] dmenu_run: Split cache logic to dmenu_path again + +This allows to run dmenu_path to update the cache using +a packager manager hook system +--- + Makefile | 6 ++++-- + dmenu_path | 13 +++++++++++++ + dmenu_run | 15 +-------------- + 3 files changed, 18 insertions(+), 16 deletions(-) + create mode 100644 dmenu_path + +diff --git a/Makefile b/Makefile +index c127f6a..f011ad7 100644 +--- a/Makefile ++++ b/Makefile +@@ -35,7 +35,7 @@ clean: + dist: clean + @echo creating dist tarball + @mkdir -p dmenu-${VERSION} +- @cp LICENSE Makefile README config.mk dmenu.1 draw.h dmenu_run stest.1 ${SRC} dmenu-${VERSION} ++ @cp LICENSE Makefile README config.mk dmenu.1 draw.h dmenu_path dmenu_run stest.1 ${SRC} dmenu-${VERSION} + @tar -cf dmenu-${VERSION}.tar dmenu-${VERSION} + @gzip dmenu-${VERSION}.tar + @rm -rf dmenu-${VERSION} +@@ -43,8 +43,9 @@ dist: clean + install: all + @echo installing executables to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin +- @cp -f dmenu dmenu_run stest ${DESTDIR}${PREFIX}/bin ++ @cp -f dmenu dmenu_path dmenu_run stest ${DESTDIR}${PREFIX}/bin + @chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu ++ @chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu_path + @chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu_run + @chmod 755 ${DESTDIR}${PREFIX}/bin/stest + @echo installing manual pages to ${DESTDIR}${MANPREFIX}/man1 +@@ -57,6 +58,7 @@ install: all + uninstall: + @echo removing executables from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/dmenu ++ @rm -f ${DESTDIR}${PREFIX}/bin/dmenu_path + @rm -f ${DESTDIR}${PREFIX}/bin/dmenu_run + @rm -f ${DESTDIR}${PREFIX}/bin/stest + @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 +diff --git a/dmenu_path b/dmenu_path +new file mode 100644 +index 0000000..338bac4 +--- /dev/null ++++ b/dmenu_path +@@ -0,0 +1,13 @@ ++#!/bin/sh ++cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} ++if [ -d "$cachedir" ]; then ++ cache=$cachedir/dmenu_run ++else ++ cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~ ++fi ++IFS=: ++if stest -dqr -n "$cache" $PATH; then ++ stest -flx $PATH | sort -u | tee "$cache" ++else ++ cat "$cache" ++fi +diff --git a/dmenu_run b/dmenu_run +index 052e51b..834ede5 100755 +--- a/dmenu_run ++++ b/dmenu_run +@@ -1,15 +1,2 @@ + #!/bin/sh +-cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} +-if [ -d "$cachedir" ]; then +- cache=$cachedir/dmenu_run +-else +- cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~ +-fi +-( +- IFS=: +- if stest -dqr -n "$cache" $PATH; then +- stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@" +- else +- dmenu "$@" < "$cache" +- fi +-) | ${SHELL:-"/bin/sh"} & ++dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} & +-- +1.9.0 + diff --git a/0022-applied-multisel-patch-to-mainline.patch b/0022-applied-multisel-patch-to-mainline.patch new file mode 100644 index 0000000..916dcf9 --- /dev/null +++ b/0022-applied-multisel-patch-to-mainline.patch @@ -0,0 +1,111 @@ +From 0d12a47415edba5db73f56dba76f123394581387 Mon Sep 17 00:00:00 2001 +From: Anselm R Garbe +Date: Wed, 17 Apr 2013 20:56:54 +0200 +Subject: [PATCH 22/28] applied multisel patch to mainline + +--- + dmenu.1 | 3 +++ + dmenu.c | 21 ++++++++++++++++++--- + 2 files changed, 21 insertions(+), 3 deletions(-) + +diff --git a/dmenu.1 b/dmenu.1 +index 3a0f4ef..88f77de 100644 +--- a/dmenu.1 ++++ b/dmenu.1 +@@ -83,6 +83,9 @@ Copy the selected item to the input field. + Confirm selection. Prints the selected item to stdout and exits, returning + success. + .TP ++.B Ctrl-Return ++Confirm selection. Prints the selected item to stdout and continues. ++.TP + .B Shift\-Return + Confirm input. Prints the input text to stdout and exits, returning success. + .TP +diff --git a/dmenu.c b/dmenu.c +index 3962801..efc1e54 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -22,6 +22,7 @@ typedef struct Item Item; + struct Item { + char *text; + Item *left, *right; ++ Bool out; + }; + + static void appenditem(Item *item, Item **list, Item **last); +@@ -49,9 +50,12 @@ static const char *normbgcolor = "#222222"; + static const char *normfgcolor = "#bbbbbb"; + static const char *selbgcolor = "#005577"; + static const char *selfgcolor = "#eeeeee"; ++static const char *outbgcolor = "#00ffff"; ++static const char *outfgcolor = "#000000"; + static unsigned int lines = 0; + static unsigned long normcol[ColLast]; + static unsigned long selcol[ColLast]; ++static unsigned long outcol[ColLast]; + static Atom clip, utf8; + static Bool topbar = True; + static DC *dc; +@@ -185,7 +189,8 @@ drawmenu(void) { + dc->w = mw - dc->x; + for(item = curr; item != next; item = item->right) { + dc->y += dc->h; +- drawtext(dc, item->text, (item == sel) ? selcol : normcol); ++ drawtext(dc, item->text, (item == sel) ? selcol : ++ (item->out) ? outcol : normcol); + } + } + else if(matches) { +@@ -197,7 +202,8 @@ drawmenu(void) { + for(item = curr; item != next; item = item->right) { + dc->x += dc->w; + dc->w = MIN(textw(dc, item->text), mw - dc->x - textw(dc, ">")); +- drawtext(dc, item->text, (item == sel) ? selcol : normcol); ++ drawtext(dc, item->text, (item == sel) ? selcol : ++ (item->out) ? outcol : normcol); + } + dc->w = textw(dc, ">"); + dc->x = mw - dc->w; +@@ -278,6 +284,9 @@ keypress(XKeyEvent *ev) { + XConvertSelection(dc->dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, + utf8, utf8, win, CurrentTime); + return; ++ case XK_Return: ++ case XK_KP_Enter: ++ break; + default: + return; + } +@@ -362,7 +371,10 @@ keypress(XKeyEvent *ev) { + case XK_Return: + case XK_KP_Enter: + puts((sel && !(ev->state & ShiftMask)) ? sel->text : text); +- exit(EXIT_SUCCESS); ++ if(!(ev->state & ControlMask)) ++ exit(EXIT_SUCCESS); ++ sel->out = True; ++ break; + case XK_Right: + if(text[cursor] != '\0') { + cursor = nextrune(+1); +@@ -480,6 +492,7 @@ readstdin(void) { + *p = '\0'; + if(!(items[i].text = strdup(buf))) + eprintf("cannot strdup %u bytes:", strlen(buf)+1); ++ items[i].out = False; + if(strlen(items[i].text) > max) + max = strlen(maxstr = items[i].text); + } +@@ -531,6 +544,8 @@ setup(void) { + normcol[ColFG] = getcolor(dc, normfgcolor); + selcol[ColBG] = getcolor(dc, selbgcolor); + selcol[ColFG] = getcolor(dc, selfgcolor); ++ outcol[ColBG] = getcolor(dc, outbgcolor); ++ outcol[ColFG] = getcolor(dc, outfgcolor); + + clip = XInternAtom(dc->dpy, "CLIPBOARD", False); + utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False); +-- +1.9.0 + diff --git a/0023-applied-Alex-Sedov-s-Tab-buffer-termination-patch-th.patch b/0023-applied-Alex-Sedov-s-Tab-buffer-termination-patch-th.patch new file mode 100644 index 0000000..16f44d0 --- /dev/null +++ b/0023-applied-Alex-Sedov-s-Tab-buffer-termination-patch-th.patch @@ -0,0 +1,27 @@ +From ec64f273fb7660d3746eb765dc02e40726a54294 Mon Sep 17 00:00:00 2001 +From: Anselm R Garbe +Date: Wed, 17 Apr 2013 20:59:12 +0200 +Subject: [PATCH 23/28] applied Alex Sedov's Tab buffer termination patch, + thanks + +--- + dmenu.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dmenu.c b/dmenu.c +index efc1e54..c25dc82 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -392,7 +392,8 @@ keypress(XKeyEvent *ev) { + case XK_Tab: + if(!sel) + return; +- strncpy(text, sel->text, sizeof text); ++ strncpy(text, sel->text, sizeof text - 1); ++ text[sizeof text - 1] = '\0'; + cursor = strlen(text); + match(); + break; +-- +1.9.0 + diff --git a/0024-adopted-Alex-Sedov-s-config.h-revival-patch-to-tip.patch b/0024-adopted-Alex-Sedov-s-config.h-revival-patch-to-tip.patch new file mode 100644 index 0000000..61759d5 --- /dev/null +++ b/0024-adopted-Alex-Sedov-s-config.h-revival-patch-to-tip.patch @@ -0,0 +1,64 @@ +From 14f72a276334de4a46543cf648a4922bc54f1e9f Mon Sep 17 00:00:00 2001 +From: Anselm R Garbe +Date: Wed, 17 Apr 2013 21:04:05 +0200 +Subject: [PATCH 24/28] adopted Alex Sedov's config.h revival patch to tip + +--- + Makefile | 6 +++++- + dmenu.c | 12 ++---------- + 2 files changed, 7 insertions(+), 11 deletions(-) + +diff --git a/Makefile b/Makefile +index f011ad7..0f7dfbd 100644 +--- a/Makefile ++++ b/Makefile +@@ -18,7 +18,11 @@ options: + @echo CC -c $< + @${CC} -c $< ${CFLAGS} + +-${OBJ}: config.mk draw.h ++config.h: ++ @echo creating $@ from config.def.h ++ @cp config.def.h $@ ++ ++${OBJ}: config.h config.mk draw.h + + dmenu: dmenu.o draw.o + @echo CC -o $@ +diff --git a/dmenu.c b/dmenu.c +index c25dc82..a06ae15 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -44,20 +44,10 @@ static char text[BUFSIZ] = ""; + static int bh, mw, mh; + static int inputw, promptw; + static size_t cursor = 0; +-static const char *font = NULL; +-static const char *prompt = NULL; +-static const char *normbgcolor = "#222222"; +-static const char *normfgcolor = "#bbbbbb"; +-static const char *selbgcolor = "#005577"; +-static const char *selfgcolor = "#eeeeee"; +-static const char *outbgcolor = "#00ffff"; +-static const char *outfgcolor = "#000000"; +-static unsigned int lines = 0; + static unsigned long normcol[ColLast]; + static unsigned long selcol[ColLast]; + static unsigned long outcol[ColLast]; + static Atom clip, utf8; +-static Bool topbar = True; + static DC *dc; + static Item *items = NULL; + static Item *matches, *matchend; +@@ -65,6 +55,8 @@ static Item *prev, *curr, *next, *sel; + static Window win; + static XIC xic; + ++#include "config.h" ++ + static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; + static char *(*fstrstr)(const char *, const char *) = strstr; + +-- +1.9.0 + diff --git a/0025-forgot-to-add-config.def.h-thanks-William.patch b/0025-forgot-to-add-config.def.h-thanks-William.patch new file mode 100644 index 0000000..09523c9 --- /dev/null +++ b/0025-forgot-to-add-config.def.h-thanks-William.patch @@ -0,0 +1,36 @@ +From 55c9be06ca5a527e14e3f0b5b08845f0fcbf4999 Mon Sep 17 00:00:00 2001 +From: Anselm R Garbe +Date: Wed, 17 Apr 2013 21:16:51 +0200 +Subject: [PATCH 25/28] forgot to add config.def.h, thanks William + +--- + config.def.h | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + create mode 100644 config.def.h + +diff --git a/config.def.h b/config.def.h +new file mode 100644 +index 0000000..c2a23fa +--- /dev/null ++++ b/config.def.h +@@ -0,0 +1,17 @@ ++/* See LICENSE file for copyright and license details. */ ++/* vim: expandtab ++ */ ++/* Default settings; can be overrided by command line. */ ++ ++static Bool topbar = True; /* -b option; if False, dmenu appears at bottom */ ++static const char *font = NULL; /* -fn option; default X11 font or font set */ ++static const char *prompt = NULL; /* -p option; prompt to the elft of input field */ ++static const char *normbgcolor = "#222222"; /* -nb option; normal background */ ++static const char *normfgcolor = "#bbbbbb"; /* -nf option; normal foreground */ ++static const char *selbgcolor = "#005577"; /* -sb option; selected background */ ++static const char *selfgcolor = "#eeeeee"; /* -sf option; selected foreground */ ++static const char *outbgcolor = "#00ffff"; ++static const char *outfgcolor = "#000000"; ++/* -l option; if nonzero, dmenu uses vertical list with given number of lines */ ++static unsigned int lines = 0; ++ +-- +1.9.0 + diff --git a/0026-accepted-vi-is-exit-approach-suggested-by-Arkaduisz.patch b/0026-accepted-vi-is-exit-approach-suggested-by-Arkaduisz.patch new file mode 100644 index 0000000..46bec81 --- /dev/null +++ b/0026-accepted-vi-is-exit-approach-suggested-by-Arkaduisz.patch @@ -0,0 +1,26 @@ +From 597d4b43379433a5bf86d490f747c0eeda38bba8 Mon Sep 17 00:00:00 2001 +From: Anselm R Garbe +Date: Fri, 28 Jun 2013 22:06:02 +0200 +Subject: [PATCH 26/28] accepted vi'is exit approach ^[ (suggested by + Arkaduisz) + +--- + dmenu.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/dmenu.c b/dmenu.c +index a06ae15..5e0a19c 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -279,6 +279,8 @@ keypress(XKeyEvent *ev) { + case XK_Return: + case XK_KP_Enter: + break; ++ case XK_bracketleft: ++ exit(EXIT_FAILURE); + default: + return; + } +-- +1.9.0 + diff --git a/0027-applied-Martti-K-hne-s-dmenu-monitor-patch.patch b/0027-applied-Martti-K-hne-s-dmenu-monitor-patch.patch new file mode 100644 index 0000000..b746f1f --- /dev/null +++ b/0027-applied-Martti-K-hne-s-dmenu-monitor-patch.patch @@ -0,0 +1,106 @@ +From 13f787306f46a5f838987e3b546d85d1bb1c3c01 Mon Sep 17 00:00:00 2001 +From: Anselm R Garbe +Date: Fri, 2 Aug 2013 22:30:20 +0200 +Subject: [PATCH 27/28] =?UTF-8?q?applied=20Martti=20K=C3=BChne's=20dmenu?= + =?UTF-8?q?=20monitor=20patch=20https://gist.github.com/mar77i/3349298/raw?= + =?UTF-8?q?/f6581ca96627f4c71c0bd1faf531daaf2a613b95/monarg.patch=20become?= + =?UTF-8?q?s=20upstream=20now?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + LICENSE | 2 +- + dmenu.1 | 5 +++++ + dmenu.c | 11 ++++++++--- + 3 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/LICENSE b/LICENSE +index e2bfc83..0df62c6 100644 +--- a/LICENSE ++++ b/LICENSE +@@ -1,7 +1,7 @@ + MIT/X Consortium License + ++© 2006-2013 Anselm R Garbe + © 2010-2012 Connor Lane Smith +-© 2006-2012 Anselm R Garbe + © 2009 Gottox + © 2009 Markus Schnalke + © 2009 Evan Gates +diff --git a/dmenu.1 b/dmenu.1 +index 88f77de..bbee17d 100644 +--- a/dmenu.1 ++++ b/dmenu.1 +@@ -7,6 +7,8 @@ dmenu \- dynamic menu + .RB [ \-f ] + .RB [ \-i ] + .RB [ \-l ++.RB [ \-m ++.IR monitor ] + .IR lines ] + .RB [ \-p + .IR prompt ] +@@ -49,6 +51,9 @@ dmenu matches menu items case insensitively. + .BI \-l " lines" + dmenu lists items vertically, with the given number of lines. + .TP ++.BI \-m " monitor" ++dmenu is displayed on the monitor supplied. ++.TP + .BI \-p " prompt" + defines the prompt to be displayed to the left of the input field. + .TP +diff --git a/dmenu.c b/dmenu.c +index 5e0a19c..8d9bbb6 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -54,6 +54,7 @@ static Item *matches, *matchend; + static Item *prev, *curr, *next, *sel; + static Window win; + static XIC xic; ++static int mon = -1; + + #include "config.h" + +@@ -84,6 +85,8 @@ main(int argc, char *argv[]) { + /* these options take one argument */ + else if(!strcmp(argv[i], "-l")) /* number of lines in vertical list */ + lines = atoi(argv[++i]); ++ else if(!strcmp(argv[i], "-m")) ++ mon = atoi(argv[++i]); + else if(!strcmp(argv[i], "-p")) /* adds prompt to left of input field */ + prompt = argv[++i]; + else if(!strcmp(argv[i], "-fn")) /* font or font set */ +@@ -557,7 +560,9 @@ setup(void) { + XWindowAttributes wa; + + XGetInputFocus(dc->dpy, &w, &di); +- if(w != root && w != PointerRoot && w != None) { ++ if(mon != -1 && mon < n) ++ i = mon; ++ if(!i && w != root && w != PointerRoot && w != None) { + /* find top-level window containing current input focus */ + do { + if(XQueryTree(dc->dpy, (pw = w), &dw, &w, &dws, &du) && dws) +@@ -572,7 +577,7 @@ setup(void) { + } + } + /* no focused window is on screen, so use pointer location instead */ +- if(!area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du)) ++ if(mon == -1 && !area && XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du)) + for(i = 0; i < n; i++) + if(INTERSECT(x, y, 1, 1, info[i])) + break; +@@ -614,7 +619,7 @@ setup(void) { + + void + usage(void) { +- fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font]\n" ++ fputs("usage: dmenu [-b] [-f] [-i] [-l lines] [-p prompt] [-fn font] [-m monitor]\n" + " [-nb color] [-nf color] [-sb color] [-sf color] [-v]\n", stderr); + exit(EXIT_FAILURE); + } +-- +1.9.0 + diff --git a/0028-applied-Martin-K-hl-s-inverse-matching-flag-to-stest.patch b/0028-applied-Martin-K-hl-s-inverse-matching-flag-to-stest.patch new file mode 100644 index 0000000..6fb10fe --- /dev/null +++ b/0028-applied-Martin-K-hl-s-inverse-matching-flag-to-stest.patch @@ -0,0 +1,71 @@ +From 5ed5e90bfb7760f24661281cf7156087afbe49d3 Mon Sep 17 00:00:00 2001 +From: Anselm R Garbe +Date: Tue, 13 Aug 2013 19:15:04 +0200 +Subject: [PATCH 28/28] =?UTF-8?q?applied=20Martin=20K=C3=BChl's=20inverse?= + =?UTF-8?q?=20matching=20flag=20to=20stest?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + stest.1 | 3 +++ + stest.c | 8 ++++---- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/stest.1 b/stest.1 +index bb48f45..2667d8a 100644 +--- a/stest.1 ++++ b/stest.1 +@@ -67,6 +67,9 @@ Test that files are not empty. + .B \-u + Test that files have their set-user-ID flag set. + .TP ++.B \-v ++Invert the sense of tests, only failing files pass. ++.TP + .B \-w + Test that files are writable. + .TP +diff --git a/stest.c b/stest.c +index e1dcf36..8fac42a 100644 +--- a/stest.c ++++ b/stest.c +@@ -22,7 +22,7 @@ main(int argc, char *argv[]) { + DIR *dir; + int opt; + +- while((opt = getopt(argc, argv, "abcdefghln:o:pqrsuwx")) != -1) ++ while((opt = getopt(argc, argv, "abcdefghln:o:pqrsuvwx")) != -1) + switch(opt) { + case 'n': /* newer than file */ + case 'o': /* older than file */ +@@ -33,7 +33,7 @@ main(int argc, char *argv[]) { + FLAG(opt) = true; + break; + case '?': /* error: unknown flag */ +- fprintf(stderr, "usage: %s [-abcdefghlpqrsuwx] [-n file] [-o file] [file...]\n", argv[0]); ++ fprintf(stderr, "usage: %s [-abcdefghlpqrsuvwx] [-n file] [-o file] [file...]\n", argv[0]); + exit(2); + } + if(optind == argc) +@@ -60,7 +60,7 @@ void + test(const char *path, const char *name) { + struct stat st, ln; + +- if(!stat(path, &st) && (FLAG('a') || name[0] != '.') /* hidden files */ ++ if((!stat(path, &st) && (FLAG('a') || name[0] != '.') /* hidden files */ + && (!FLAG('b') || S_ISBLK(st.st_mode)) /* block special */ + && (!FLAG('c') || S_ISCHR(st.st_mode)) /* character special */ + && (!FLAG('d') || S_ISDIR(st.st_mode)) /* directory */ +@@ -75,7 +75,7 @@ test(const char *path, const char *name) { + && (!FLAG('s') || st.st_size > 0) /* not empty */ + && (!FLAG('u') || st.st_mode & S_ISUID) /* set-user-id flag */ + && (!FLAG('w') || access(path, W_OK) == 0) /* writable */ +- && (!FLAG('x') || access(path, X_OK) == 0)) { /* executable */ ++ && (!FLAG('x') || access(path, X_OK) == 0)) != FLAG('v')) { /* executable */ + if(FLAG('q')) + exit(0); + match = true; +-- +1.9.0 + diff --git a/dmenu.spec b/dmenu.spec index e2eb908..465414a 100644 --- a/dmenu.spec +++ b/dmenu.spec @@ -1,12 +1,25 @@ Name: dmenu Version: 4.5 -Release: 4%{?dist} +Release: 5.20140425git%{?dist} Summary: Generic menu for X -Group: User Interface/Desktops License: MIT -URL: http://www.suckless.org/programs/%{name}.html +URL: http://tools.suckless.org/dmenu Source0: http://dl.suckless.org/tools/%{name}-%{version}.tar.gz -Patch0: dmenu-4.5-make.patch +# git format-patch from upstream git repository: +# git://git.suckless.org/dmenu +Patch1: 0016-remove-_POSIX_C_SOURCE-cflag.patch +Patch2: 0017-add-G-escape-keybinding.patch +Patch3: 0018-listen-for-C-S-jm.patch +Patch4: 0019-_POSIX_C_SOURCE-200809L.patch +Patch5: 0020-ignore-prompt-if-it-is-empty-in-addition-to-NULL.patch +Patch6: 0021-dmenu_run-Split-cache-logic-to-dmenu_path-again.patch +Patch7: 0022-applied-multisel-patch-to-mainline.patch +Patch8: 0023-applied-Alex-Sedov-s-Tab-buffer-termination-patch-th.patch +Patch9: 0024-adopted-Alex-Sedov-s-config.h-revival-patch-to-tip.patch +Patch10: 0025-forgot-to-add-config.def.h-thanks-William.patch +Patch11: 0026-accepted-vi-is-exit-approach-suggested-by-Arkaduisz.patch +Patch12: 0027-applied-Martti-K-hne-s-dmenu-monitor-patch.patch +Patch13: 0028-applied-Martin-K-hl-s-inverse-matching-flag-to-stest.patch BuildRequires: libX11-devel BuildRequires: libXinerama-devel Requires: terminus-fonts @@ -19,20 +32,23 @@ Dynamic menu is a generic menu for X, originally designed for dwm. It manages huge amounts (up to 10.000 and more) of user defined menu items efficiently. %prep -%setup -q -%patch0 -p1 +%autosetup +# Nuke the silent build. sed -i -e 's|\t@|\t|' Makefile +# Insert optflags. +sed -i -e 's|-Os|%{optflags}|' config.mk +# No strip for debuginfo, and insert ldflags to enhance the security. +sed -i -e 's|-s ${LIBS}|%{?__global_ldflags} ${LIBS}|' config.mk +# X includedir path fix +sed -i -e 's|X11INC = .*|X11INC = %{_includedir}|' config.mk +# libdir path fix +sed -i -e 's|X11LIB = .*|X11LIB = %{_libdir}|' config.mk %build -make \ - X11INC=%{_includedir} \ - X11LIB=%{_libdir} \ +make %{?_smp_mflags} %install -make install \ - DESTDIR=%{buildroot} \ - PREFIX=%{_prefix} \ - MANPREFIX=%{_mandir} +%make_install PREFIX=%{_prefix} %files %doc LICENSE README @@ -42,6 +58,9 @@ make install \ %{_mandir}/man*/stest.* %changelog +* Fri Apr 25 2014 Christopher Meng - 4.5-5.20140425git +- Fetch patches from upstream since 4.5 version. + * Sat Aug 03 2013 Fedora Release Engineering - 4.5-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild