Merge branch 'master' into michael
This commit is contained in:
commit
6a1016e830
25
dmenu.c
25
dmenu.c
@ -517,9 +517,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;
|
||||||
}
|
}
|
||||||
@ -549,18 +549,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)
|
||||||
@ -710,9 +710,8 @@ 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"
|
||||||
" [-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
|
||||||
|
14
drw.c
14
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;
|
||||||
@ -368,7 +355,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||||||
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
||||||
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
||||||
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
||||||
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
|
||||||
|
|
||||||
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
||||||
FcDefaultSubstitute(fcpattern);
|
FcDefaultSubstitute(fcpattern);
|
||||||
|
23
util.c
23
util.c
@ -6,18 +6,9 @@
|
|||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void *
|
|
||||||
ecalloc(size_t nmemb, size_t size)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
if (!(p = calloc(nmemb, size)))
|
|
||||||
die("calloc:");
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
die(const char *fmt, ...) {
|
die(const char *fmt, ...)
|
||||||
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
@ -33,3 +24,13 @@ die(const char *fmt, ...) {
|
|||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
ecalloc(size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
if (!(p = calloc(nmemb, size)))
|
||||||
|
die("calloc:");
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user