[wiki] [sites] fix nonblocking patch against git, proper revision for pipeout patch || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sat, 02 Jul 2016 14:11:08 +0200

commit 6c5dd13aa4a5d3561921f6220f69f20e6b22ffd4
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Sat Jul 2 14:07:12 2016 +0200

    fix nonblocking patch against git, proper revision for pipeout patch
    
    all dmenu patches are working now.

diff --git a/tools.suckless.org/dmenu/patches/dmenu-nonblockingstdin-20160702-3c91eed.diff b/tools.suckless.org/dmenu/patches/dmenu-nonblockingstdin-20160702-3c91eed.diff
index 8bae1e6..cd3e51f 100644
--- a/tools.suckless.org/dmenu/patches/dmenu-nonblockingstdin-20160702-3c91eed.diff
+++ b/tools.suckless.org/dmenu/patches/dmenu-nonblockingstdin-20160702-3c91eed.diff
_AT_@ -22,7 +22,7 @@ index d3ab805..00958cf 100644
  dmenu matches menu items case insensitively.
  .TP
 diff --git a/dmenu.c b/dmenu.c
-index e0c2f80..f819d67 100644
+index e926eca..dc81ef2 100644
 --- a/dmenu.c
 +++ b/dmenu.c
 _AT_@ -1,12 +1,15 @@
_AT_@ -41,7 +41,7 @@ index e0c2f80..f819d67 100644
  #include <X11/Xlib.h>
  #include <X11/Xatom.h>
  #include <X11/Xutil.h>
-_AT_@ -31,6 +34,7 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
+_AT_@ -30,6 +33,7 @@ enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
  struct item {
          char *text;
          struct item *left, *right;
_AT_@ -49,7 +49,7 @@ index e0c2f80..f819d67 100644
          int out;
  };
  
-_AT_@ -181,6 +185,7 @@ drawmenu(void)
+_AT_@ -172,6 +176,7 @@ drawmenu(void)
                  }
          }
          drw_map(drw, win, 0, 0, mw, mh);
_AT_@ -57,7 +57,7 @@ index e0c2f80..f819d67 100644
  }
  
  static void
-_AT_@ -209,6 +214,7 @@ match(void)
+_AT_@ -200,6 +205,7 @@ match(void)
          int i, tokc = 0;
          size_t len, textsize;
          struct item *item, *lprefix, *lsubstr, *prefixend, *substrend;
_AT_@ -65,7 +65,7 @@ index e0c2f80..f819d67 100644
  
          strcpy(buf, text);
          /* separate input text into tokens to be matched individually */
-_AT_@ -219,19 +225,24 @@ match(void)
+_AT_@ -210,19 +216,24 @@ match(void)
  
          matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL;
          textsize = strlen(text);
_AT_@ -94,7 +94,7 @@ index e0c2f80..f819d67 100644
          }
          if (lprefix) {
                  if (matches) {
-_AT_@ -249,7 +260,9 @@ match(void)
+_AT_@ -240,7 +251,9 @@ match(void)
                          matches = lsubstr;
                  matchend = substrend;
          }
_AT_@ -105,14 +105,15 @@ index e0c2f80..f819d67 100644
          calcoffsets();
  }
  
-_AT_@ -467,36 +480,11 @@ paste(void)
+_AT_@ -456,36 +469,7 @@ paste(void)
  }
  
  static void
 -readstdin(void)
 -{
-- char buf[sizeof text], *p, *maxstr = NULL;
-- size_t i, max = 0, size = 0;
+- char buf[sizeof text], *p;
+- size_t i, imax = 0, size = 0;
+- unsigned int tmpmax = 0;
 -
 - /* read each line from stdin and add it to the item list */
 - for (i = 0; fgets(buf, sizeof buf, stdin); i++) {
_AT_@ -124,12 +125,15 @@ index e0c2f80..f819d67 100644
 - if (!(items[i].text = strdup(buf)))
 - die("cannot strdup %u bytes:", strlen(buf) + 1);
 - items[i].out = 0;
-- if (strlen(items[i].text) > max)
-- max = strlen(maxstr = items[i].text);
+- drw_font_getexts(drw->fonts, buf, strlen(buf), &tmpmax, NULL);
+- if (tmpmax > inputw) {
+- inputw = tmpmax;
+- imax = i;
+- }
 - }
 - if (items)
 - items[i].text = NULL;
-- inputw = maxstr ? TEXTW(maxstr) : 0;
+- inputw = items ? TEXTW(items[imax].text) : 0;
 - lines = MIN(lines, i);
 -}
 -
_AT_@ -139,16 +143,12 @@ index e0c2f80..f819d67 100644
  {
          XEvent ev;
  
-- while (!XNextEvent(dpy, &ev)) {
-+ while(XPending(dpy) && !XNextEvent(dpy, &ev)) {
- if (XFilterEvent(&ev, win))
- continue;
- switch(ev.type) {
-_AT_@ -520,6 +508,58 @@ run(void)
+_AT_@ -513,6 +497,60 @@ run(void)
  }
  
  static void
-+readstdin(void) {
++readstdin(void)
++{
 + static size_t max = 0;
 + static struct item **end = &items;
 +
_AT_@ -156,16 +156,16 @@ index e0c2f80..f819d67 100644
 + struct item *item;
 +
 + /* read each line from stdin and add it to the item list */
-+ while(fgets(buf, sizeof buf, stdin)) {
-+ if(!(item = malloc(sizeof *item)))
++ while (fgets(buf, sizeof buf, stdin)) {
++ if (!(item = malloc(sizeof *item)))
 + die("cannot malloc %u bytes:", sizeof *item);
-+ if((p = strchr(buf, '
')))
++ if ((p = strchr(buf, '
')))
 + *p = '
Received on Sat Jul 02 2016 - 14:11:08 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 02 2016 - 14:12:14 CEST