[wiki] [sites] update dmenu patches || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Fri, 17 Jun 2016 15:44:18 +0200

commit 22285bc9747c55ca8e8da2b219ae1300bf76220f
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Fri Jun 17 15:41:38 2016 +0200

    update dmenu patches
    
    - remove patches that were merged upstream such as xft, monitor patch.
    - remove pre-4.6 patches, update a few to 4.6 or git.
    - remove legacy directory.
    - remove some crappy patches, feel free to update against the latest 4.6 stable
      and add it again.

diff --git a/tools.suckless.org/dmenu/patches/dmenu-4.1.1-xmms.diff b/tools.suckless.org/dmenu/patches/dmenu-4.1.1-xmms.diff
deleted file mode 100644
index ccc1b94..0000000
--- a/tools.suckless.org/dmenu/patches/dmenu-4.1.1-xmms.diff
+++ /dev/null
_AT_@ -1,130 +0,0 @@
---- dmenu-4.1.1/config.def.h 2010-08-04 14:21:27.468630995 +0100
-+++ dmenu-4.1.1/config.def.h 2010-08-04 15:33:31.475940022 +0100
-_AT_@ -7,3 +7,4 @@
- static const char *selbgcolor = "#0066ff";
- static const char *selfgcolor = "#ffffff";
- static unsigned int spaceitem = 30; /* px between menu items */
-+static unsigned int maxtokens = 16; /* max. tokens for pattern matching */
---- dmenu-4.1.1/dmenu.1 2010-08-04 14:21:27.468630995 +0100
-+++ dmenu-4.1.1/dmenu.1 2010-08-04 15:18:35.557920858 +0100
-_AT_@ -12,6 +12,7 @@
- .RB [ \-p " <prompt>"]
- .RB [ \-sb " <color>"]
- .RB [ \-sf " <color>"]
-+.RB [ \-xs ]
- .RB [ \-v ]
- .SH DESCRIPTION
- .SS Overview
-_AT_@ -49,6 +50,9 @@
- .B \-sf <color>
- defines the selected foreground color (#RGB, #RRGGBB, and color names are supported).
- .TP
-+.B \-xs
-+xmms-like pattern matching.
-+.TP
- .B \-v
- prints version information to standard output, then exits.
- .SH USAGE
---- dmenu-4.1.1/dmenu.c 2010-08-04 14:21:27.468630995 +0100
-+++ dmenu-4.1.1/dmenu.c 2010-08-04 15:18:35.557920858 +0100
-_AT_@ -75,6 +75,7 @@
- /* variables */
- static char *maxname = NULL;
- static char *prompt = NULL;
-+static char **tokens = NULL;
- static char text[4096];
- static int cmdw = 0;
- static int promptw = 0;
-_AT_@ -84,6 +85,7 @@
- static unsigned int mw, mh;
- static unsigned int numlockmask = 0;
- static Bool running = True;
-+static Bool xmms = False;
- static Display *dpy;
- static DC dc;
- static Item *allitems = NULL; /* first of all items */
-_AT_@ -578,22 +580,55 @@
- drawmenu();
- }
-
-+unsigned int tokenize(char *pat, char **tok)
-+{
-+ unsigned int i = 0;
-+ char tmp[4096] = {0};
-+
-+ strncpy(tmp, pat, strlen(pat));
-+ tok[0] = strtok(tmp, " ");
-+
-+ while(tok[i] && i < maxtokens)
-+ tok[++i] = strtok(NULL, " ");
-+ return i;
-+}
-+
- void
- match(char *pattern) {
-- unsigned int plen;
-+ unsigned int plen, tokencnt = 0;
-+ char append = 0;
- Item *i, *itemend, *lexact, *lprefix, *lsubstr, *exactend, *prefixend, *substrend;
-
- if(!pattern)
- return;
-- plen = strlen(pattern);
-+
-+ if(!xmms)
-+ tokens[(tokencnt = 1)-1] = pattern;
-+ else
-+ if(!(tokencnt = tokenize(pattern, tokens)))
-+ tokens[(tokencnt = 1)-1] = "";
- item = lexact = lprefix = lsubstr = itemend = exactend = prefixend = substrend = NULL;
-- for(i = allitems; i; i = i->next)
-- if(!fstrncmp(pattern, i->text, plen + 1))
-+ for(i = allitems; i; i = i->next) {
-+ for(int j = 0; j < tokencnt; ++j) {
-+ plen = strlen(tokens[j]);
-+ if(!fstrncmp(tokens[j], i->text, plen + 1))
-+ append = !append || append > 1 ? 1 : append;
-+ else if(!fstrncmp(tokens[j], i->text, plen ))
-+ append = !append || append > 2 ? 2 : append;
-+ else if(fstrstr(i->text, tokens[j]))
-+ append = append > 0 && append < 3 ? append : 3;
-+ else {
-+ append = 0;
-+ break;
-+ }
-+ }
-+ if(append == 1)
- appenditem(i, &lexact, &exactend);
-- else if(!fstrncmp(pattern, i->text, plen))
-+ else if(append == 2)
- appenditem(i, &lprefix, &prefixend);
-- else if(fstrstr(i->text, pattern))
-+ else if(append == 3)
- appenditem(i, &lsubstr, &substrend);
-+ }
- if(lexact) {
- item = lexact;
- itemend = exactend;
-_AT_@ -748,6 +783,7 @@
- if(prompt)
- promptw = MIN(textw(prompt), mw / 5);
- text[0] = '
Received on Fri Jun 17 2016 - 15:44:18 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 17 2016 - 15:48:13 CEST