Update code to newest version
This commit is contained in:
parent
c1d0361d24
commit
0e98ef6239
|
@ -1,5 +1,5 @@
|
||||||
# dmenu version
|
# dmenu version
|
||||||
VERSION = 5.1
|
VERSION = bit_1.0
|
||||||
|
|
||||||
# paths
|
# paths
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
|
25
dmenu.c
25
dmenu.c
|
@ -520,9 +520,9 @@ insert:
|
||||||
case XK_Tab:
|
case XK_Tab:
|
||||||
if (!sel)
|
if (!sel)
|
||||||
return;
|
return;
|
||||||
strncpy(text, sel->text, sizeof text - 1);
|
cursor = strnlen(sel->text, sizeof text - 1);
|
||||||
text[sizeof text - 1] = '\0';
|
memcpy(text, sel->text, cursor);
|
||||||
cursor = strlen(text);
|
text[cursor] = '\0';
|
||||||
match();
|
match();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -552,18 +552,18 @@ paste(void)
|
||||||
static void
|
static void
|
||||||
readstdin(void)
|
readstdin(void)
|
||||||
{
|
{
|
||||||
char buf[sizeof text], *p;
|
char *line = NULL;
|
||||||
size_t i, size = 0;
|
size_t i, junk, size = 0;
|
||||||
|
ssize_t len;
|
||||||
|
|
||||||
/* read each line from stdin and add it to the item list */
|
/* read each line from stdin and add it to the item list */
|
||||||
for (i = 0; fgets(buf, sizeof buf, stdin); i++) {
|
for (i = 0; (len = getline(&line, &junk, stdin)) != -1; i++, line = NULL) {
|
||||||
if (i + 1 >= size / sizeof *items)
|
if (i + 1 >= size / sizeof *items)
|
||||||
if (!(items = realloc(items, (size += BUFSIZ))))
|
if (!(items = realloc(items, (size += BUFSIZ))))
|
||||||
die("cannot realloc %zu bytes:", size);
|
die("cannot realloc %zu bytes:", size);
|
||||||
if ((p = strchr(buf, '\n')))
|
if (line[len - 1] == '\n')
|
||||||
*p = '\0';
|
line[len - 1] = '\0';
|
||||||
if (!(items[i].text = strdup(buf)))
|
items[i].text = line;
|
||||||
die("cannot strdup %zu bytes:", strlen(buf) + 1);
|
|
||||||
items[i].out = 0;
|
items[i].out = 0;
|
||||||
}
|
}
|
||||||
if (items)
|
if (items)
|
||||||
|
@ -719,10 +719,9 @@ setup(void)
|
||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
|
die("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
|
||||||
" [-g gap] [-bw borderwidth] [-bv bordervisible]\n"
|
" [-g gap] [-bw borderwidth] [-bv bordervisible]\n"
|
||||||
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
|
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
13
drw.c
13
drw.c
|
@ -133,19 +133,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
||||||
die("no font specified.");
|
die("no font specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not allow using color fonts. This is a workaround for a BadLength
|
|
||||||
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
|
||||||
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
|
||||||
* https://lists.suckless.org/dev/1701/30932.html
|
|
||||||
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
|
||||||
* and lots more all over the internet.
|
|
||||||
*/
|
|
||||||
FcBool iscol;
|
|
||||||
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
|
||||||
XftFontClose(drw->dpy, xfont);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
font = ecalloc(1, sizeof(Fnt));
|
font = ecalloc(1, sizeof(Fnt));
|
||||||
font->xfont = xfont;
|
font->xfont = xfont;
|
||||||
font->pattern = pattern;
|
font->pattern = pattern;
|
||||||
|
|
Loading…
Reference in New Issue