Update code to newest version

This commit is contained in:
BitHeaven-Official 2023-03-08 14:11:41 +05:00
parent c1d0361d24
commit 0e98ef6239
3 changed files with 14 additions and 28 deletions

View File

@ -1,5 +1,5 @@
# dmenu version
VERSION = 5.1
VERSION = bit_1.0
# paths
PREFIX = /usr/local

27
dmenu.c
View File

@ -520,9 +520,9 @@ insert:
case XK_Tab:
if (!sel)
return;
strncpy(text, sel->text, sizeof text - 1);
text[sizeof text - 1] = '\0';
cursor = strlen(text);
cursor = strnlen(sel->text, sizeof text - 1);
memcpy(text, sel->text, cursor);
text[cursor] = '\0';
match();
break;
}
@ -552,18 +552,18 @@ paste(void)
static void
readstdin(void)
{
char buf[sizeof text], *p;
size_t i, size = 0;
char *line = NULL;
size_t i, junk, size = 0;
ssize_t len;
/* 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 (!(items = realloc(items, (size += BUFSIZ))))
die("cannot realloc %zu bytes:", size);
if ((p = strchr(buf, '\n')))
*p = '\0';
if (!(items[i].text = strdup(buf)))
die("cannot strdup %zu bytes:", strlen(buf) + 1);
if (line[len - 1] == '\n')
line[len - 1] = '\0';
items[i].text = line;
items[i].out = 0;
}
if (items)
@ -719,10 +719,9 @@ setup(void)
static void
usage(void)
{
fputs("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
" [-g gap] [-bw borderwidth] [-bv bordervisible]\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]\n", stderr);
exit(1);
die("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
" [-g gap] [-bw borderwidth] [-bv bordervisible]\n"
" [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]");
}
int

13
drw.c
View File

@ -133,19 +133,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
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->xfont = xfont;
font->pattern = pattern;