diff options
| -rw-r--r-- | dmenu-5.0/patches/dmenu-alpha-20210605-1a13d04.diff | 267 | ||||
| -rw-r--r-- | dmenu-5.1/LICENSE (renamed from dmenu-5.0/LICENSE) | 2 | ||||
| -rw-r--r-- | dmenu-5.1/Makefile (renamed from dmenu-5.0/Makefile) | 1 | ||||
| -rw-r--r-- | dmenu-5.1/README (renamed from dmenu-5.0/README) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/arg.h (renamed from dmenu-5.0/arg.h) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/config.def.h (renamed from dmenu-5.0/config.def.h) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/config.h (renamed from dmenu-5.0/config.h) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/config.mk (renamed from dmenu-5.0/config.mk) | 6 | ||||
| -rw-r--r-- | dmenu-5.1/dmenu-allow-color-font-5.0.diff (renamed from dmenu-5.0/dmenu-allow-color-font-5.0.diff) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/dmenu.1 (renamed from dmenu-5.0/dmenu.1) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/dmenu.c (renamed from dmenu-5.0/dmenu.c) | 28 | ||||
| -rwxr-xr-x | dmenu-5.1/dmenu_path (renamed from dmenu-5.0/dmenu_path) | 0 | ||||
| -rwxr-xr-x | dmenu-5.1/dmenu_run (renamed from dmenu-5.0/dmenu_run) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/drw.c (renamed from dmenu-5.0/drw.c) | 9 | ||||
| -rw-r--r-- | dmenu-5.1/drw.h (renamed from dmenu-5.0/drw.h) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/stest.1 (renamed from dmenu-5.0/stest.1) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/stest.c (renamed from dmenu-5.0/stest.c) | 2 | ||||
| -rw-r--r-- | dmenu-5.1/util.c (renamed from dmenu-5.0/util.c) | 0 | ||||
| -rw-r--r-- | dmenu-5.1/util.h (renamed from dmenu-5.0/util.h) | 0 |
19 files changed, 28 insertions, 287 deletions
diff --git a/dmenu-5.0/patches/dmenu-alpha-20210605-1a13d04.diff b/dmenu-5.0/patches/dmenu-alpha-20210605-1a13d04.diff deleted file mode 100644 index 51679f7..0000000 --- a/dmenu-5.0/patches/dmenu-alpha-20210605-1a13d04.diff +++ /dev/null @@ -1,267 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 1edb647..697d511 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -2,6 +2,7 @@ - /* Default settings; can be overriden by command line. */ - - static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ -+static const unsigned int alpha = 0xf0; - /* -fn option overrides fonts[0]; default X11 font or font set */ - static const char *fonts[] = { - "monospace:size=10" -@@ -13,6 +14,13 @@ static const char *colors[SchemeLast][2] = { - [SchemeSel] = { "#eeeeee", "#005577" }, - [SchemeOut] = { "#000000", "#00ffff" }, - }; -+ -+static const unsigned int alphas[SchemeLast][2] = { -+ [SchemeNorm] = { OPAQUE, alpha }, -+ [SchemeSel] = { OPAQUE, alpha }, -+ [SchemeOut] = { OPAQUE, alpha }, -+}; -+ - /* -l option; if nonzero, dmenu uses vertical list with given number of lines */ - static unsigned int lines = 0; - -diff --git a/dmenu.c b/dmenu.c -index 65f25ce..3e56e1a 100644 ---- a/dmenu.c -+++ b/dmenu.c -@@ -10,6 +10,7 @@ - - #include <X11/Xlib.h> - #include <X11/Xatom.h> -+#include <X11/Xproto.h> - #include <X11/Xutil.h> - #ifdef XINERAMA - #include <X11/extensions/Xinerama.h> -@@ -25,6 +26,8 @@ - #define LENGTH(X) (sizeof X / sizeof X[0]) - #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) - -+#define OPAQUE 0xffU -+ - /* enums */ - enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ - -@@ -53,10 +56,16 @@ static XIC xic; - static Drw *drw; - static Clr *scheme[SchemeLast]; - -+static int useargb = 0; -+static Visual *visual; -+static int depth; -+static Colormap cmap; -+ - #include "config.h" - - static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; - static char *(*fstrstr)(const char *, const char *) = strstr; -+static void xinitvisual(); - - static void - appenditem(struct item *item, struct item **list, struct item **last) -@@ -602,7 +611,7 @@ setup(void) - #endif - /* init appearance */ - for (j = 0; j < SchemeLast; j++) -- scheme[j] = drw_scm_create(drw, colors[j], 2); -+ scheme[j] = drw_scm_create(drw, colors[j], alphas[i], 2); - - clip = XInternAtom(dpy, "CLIPBOARD", False); - utf8 = XInternAtom(dpy, "UTF8_STRING", False); -@@ -640,6 +649,7 @@ setup(void) - x = info[i].x_org; - y = info[i].y_org + (topbar ? 0 : info[i].height - mh); - mw = info[i].width; -+ - XFree(info); - } else - #endif -@@ -657,11 +667,13 @@ setup(void) - - /* create menu window */ - swa.override_redirect = True; -- swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; -+ swa.background_pixel = 0; -+ swa.border_pixel = 0; -+ swa.colormap = cmap; - swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; -- win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, -- CopyFromParent, CopyFromParent, CopyFromParent, -- CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); -+ win = XCreateWindow(dpy, parentwin, x, y, mw, mh, border_width, -+ depth, CopyFromParent, visual, -+ CWOverrideRedirect | CWBackPixel | CWBorderPixel | CWColormap | CWEventMask, &swa); - XSetClassHint(dpy, win, &ch); - - -@@ -747,7 +759,8 @@ main(int argc, char *argv[]) - if (!XGetWindowAttributes(dpy, parentwin, &wa)) - die("could not get embedding window attributes: 0x%lx", - parentwin); -- drw = drw_create(dpy, screen, root, wa.width, wa.height); -+ xinitvisual(); -+ drw = drw_create(dpy, screen, root, wa.width, wa.height, visual, depth, cmap); - if (!drw_fontset_create(drw, fonts, LENGTH(fonts))) - die("no fonts could be loaded."); - lrpad = drw->fonts->h; -@@ -769,3 +782,40 @@ main(int argc, char *argv[]) - - return 1; /* unreachable */ - } -+ -+ void -+xinitvisual() -+{ -+ XVisualInfo *infos; -+ XRenderPictFormat *fmt; -+ int nitems; -+ int i; -+ -+ XVisualInfo tpl = { -+ .screen = screen, -+ .depth = 32, -+ .class = TrueColor -+ }; -+ long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; -+ -+ infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); -+ visual = NULL; -+ for(i = 0; i < nitems; i ++) { -+ fmt = XRenderFindVisualFormat(dpy, infos[i].visual); -+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { -+ visual = infos[i].visual; -+ depth = infos[i].depth; -+ cmap = XCreateColormap(dpy, root, visual, AllocNone); -+ useargb = 1; -+ break; -+ } -+ } -+ -+ XFree(infos); -+ -+ if (! visual) { -+ visual = DefaultVisual(dpy, screen); -+ depth = DefaultDepth(dpy, screen); -+ cmap = DefaultColormap(dpy, screen); -+ } -+} -diff --git a/drw.c b/drw.c -index 4cdbcbe..fe3aadd 100644 ---- a/drw.c -+++ b/drw.c -@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen) - } - - Drw * --drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h) -+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap) - { - Drw *drw = ecalloc(1, sizeof(Drw)); - -@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h - drw->root = root; - drw->w = w; - drw->h = h; -- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen)); -- drw->gc = XCreateGC(dpy, root, 0, NULL); -+ drw->visual = visual; -+ drw->depth = depth; -+ drw->cmap = cmap; -+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth); -+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL); - XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter); - - return drw; -@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h) - drw->h = h; - if (drw->drawable) - XFreePixmap(drw->dpy, drw->drawable); -- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen)); -+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth); - } - - void -@@ -194,21 +197,22 @@ drw_fontset_free(Fnt *font) - } - - void --drw_clr_create(Drw *drw, Clr *dest, const char *clrname) -+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha) - { - if (!drw || !dest || !clrname) - return; - -- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), -- DefaultColormap(drw->dpy, drw->screen), -+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap, - clrname, dest)) - die("error, cannot allocate color '%s'", clrname); -+ -+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24); - } - - /* Wrapper to create color schemes. The caller has to call free(3) on the - * returned color scheme when done using it. */ - Clr * --drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) -+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount) - { - size_t i; - Clr *ret; -@@ -218,7 +222,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount) - return NULL; - - for (i = 0; i < clrcount; i++) -- drw_clr_create(drw, &ret[i], clrnames[i]); -+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]); - return ret; - } - -@@ -274,9 +278,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp - } else { - XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel); - XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); -- d = XftDrawCreate(drw->dpy, drw->drawable, -- DefaultVisual(drw->dpy, drw->screen), -- DefaultColormap(drw->dpy, drw->screen)); -+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap); - x += lpad; - w -= lpad; - } -diff --git a/drw.h b/drw.h -index 4c67419..f6fa5cd 100644 ---- a/drw.h -+++ b/drw.h -@@ -20,6 +20,9 @@ typedef struct { - Display *dpy; - int screen; - Window root; -+ Visual *visual; -+ unsigned int depth; -+ Colormap cmap; - Drawable drawable; - GC gc; - Clr *scheme; -@@ -27,7 +30,7 @@ typedef struct { - } Drw; - - /* Drawable abstraction */ --Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h); -+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual*, unsigned int, Colormap); - void drw_resize(Drw *drw, unsigned int w, unsigned int h); - void drw_free(Drw *drw); - -@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text); - void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h); - - /* Colorscheme abstraction */ --void drw_clr_create(Drw *drw, Clr *dest, const char *clrname); --Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount); -+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha); -+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount); - - /* Cursor abstraction */ - Cur *drw_cur_create(Drw *drw, int shape); diff --git a/dmenu-5.0/LICENSE b/dmenu-5.1/LICENSE index 3afd28e..2a64b28 100644 --- a/dmenu-5.0/LICENSE +++ b/dmenu-5.1/LICENSE @@ -8,7 +8,7 @@ MIT/X Consortium License © 2009 Markus Schnalke <meillo@marmaro.de> © 2009 Evan Gates <evan.gates@gmail.com> © 2010-2012 Connor Lane Smith <cls@lubutu.com> -© 2014-2020 Hiltjo Posthuma <hiltjo@codemadness.org> +© 2014-2022 Hiltjo Posthuma <hiltjo@codemadness.org> © 2015-2019 Quentin Rameau <quinq@fifth.space> Permission is hereby granted, free of charge, to any person obtaining a diff --git a/dmenu-5.0/Makefile b/dmenu-5.1/Makefile index 6b49acc..a03a95c 100644 --- a/dmenu-5.0/Makefile +++ b/dmenu-5.1/Makefile @@ -2,7 +2,6 @@ # See LICENSE file for copyright and license details. include config.mk -include ../config.mk SRC = drw.c dmenu.c stest.c util.c OBJ = $(SRC:.c=.o) diff --git a/dmenu-5.0/README b/dmenu-5.1/README index a8fcdfe..a8fcdfe 100644 --- a/dmenu-5.0/README +++ b/dmenu-5.1/README diff --git a/dmenu-5.0/arg.h b/dmenu-5.1/arg.h index e94e02b..e94e02b 100644 --- a/dmenu-5.0/arg.h +++ b/dmenu-5.1/arg.h diff --git a/dmenu-5.0/config.def.h b/dmenu-5.1/config.def.h index 1edb647..1edb647 100644 --- a/dmenu-5.0/config.def.h +++ b/dmenu-5.1/config.def.h diff --git a/dmenu-5.0/config.h b/dmenu-5.1/config.h index 2085cc2..2085cc2 100644 --- a/dmenu-5.0/config.h +++ b/dmenu-5.1/config.h diff --git a/dmenu-5.0/config.mk b/dmenu-5.1/config.mk index 2cd7c46..0df3fc8 100644 --- a/dmenu-5.0/config.mk +++ b/dmenu-5.1/config.mk @@ -1,8 +1,8 @@ -include ../config.mk # dmenu version -VERSION = 5.0 +VERSION = 5.1 # paths +PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man X11INC = /usr/X11R6/include @@ -24,7 +24,7 @@ LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) # flags CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS) -CFLAGS = -std=c99 -pedantic -Wall -Ofast $(INCS) $(CPPFLAGS) +CFLAGS = -std=c99 -pedantic -Wall -Os $(INCS) $(CPPFLAGS) LDFLAGS = $(LIBS) # compiler and linker diff --git a/dmenu-5.0/dmenu-allow-color-font-5.0.diff b/dmenu-5.1/dmenu-allow-color-font-5.0.diff index 767b466..767b466 100644 --- a/dmenu-5.0/dmenu-allow-color-font-5.0.diff +++ b/dmenu-5.1/dmenu-allow-color-font-5.0.diff diff --git a/dmenu-5.0/dmenu.1 b/dmenu-5.1/dmenu.1 index 323f93c..323f93c 100644 --- a/dmenu-5.0/dmenu.1 +++ b/dmenu-5.1/dmenu.1 diff --git a/dmenu-5.0/dmenu.c b/dmenu-5.1/dmenu.c index 65f25ce..d95e6c6 100644 --- a/dmenu-5.0/dmenu.c +++ b/dmenu-5.1/dmenu.c @@ -103,13 +103,20 @@ cleanup(void) } static char * -cistrstr(const char *s, const char *sub) +cistrstr(const char *h, const char *n) { - size_t len; + size_t i; + + if (!n[0]) + return (char *)h; - for (len = strlen(sub); *s; s++) - if (!strncasecmp(s, sub, len)) - return (char *)s; + for (; *h; ++h) { + for (i = 0; n[i] && tolower((unsigned char)n[i]) == + tolower((unsigned char)h[i]); ++i) + ; + if (n[i] == '\0') + return (char *)h; + } return NULL; } @@ -360,9 +367,11 @@ keypress(XKeyEvent *ev) utf8, utf8, win, CurrentTime); return; case XK_Left: + case XK_KP_Left: movewordedge(-1); goto draw; case XK_Right: + case XK_KP_Right: movewordedge(+1); goto draw; case XK_Return: @@ -400,6 +409,7 @@ insert: insert(buf, len); break; case XK_Delete: + case XK_KP_Delete: if (text[cursor] == '\0') return; cursor = nextrune(+1); @@ -410,6 +420,7 @@ insert: insert(NULL, nextrune(-1) - cursor); break; case XK_End: + case XK_KP_End: if (text[cursor] != '\0') { cursor = strlen(text); break; @@ -429,6 +440,7 @@ insert: cleanup(); exit(1); case XK_Home: + case XK_KP_Home: if (sel == matches) { cursor = 0; break; @@ -437,6 +449,7 @@ insert: calcoffsets(); break; case XK_Left: + case XK_KP_Left: if (cursor > 0 && (!sel || !sel->left || lines > 0)) { cursor = nextrune(-1); break; @@ -445,18 +458,21 @@ insert: return; /* fallthrough */ case XK_Up: + case XK_KP_Up: if (sel && sel->left && (sel = sel->left)->right == curr) { curr = prev; calcoffsets(); } break; case XK_Next: + case XK_KP_Next: if (!next) return; sel = curr = next; calcoffsets(); break; case XK_Prior: + case XK_KP_Prior: if (!prev) return; sel = curr = prev; @@ -473,6 +489,7 @@ insert: sel->out = 1; break; case XK_Right: + case XK_KP_Right: if (text[cursor] != '\0') { cursor = nextrune(+1); break; @@ -481,6 +498,7 @@ insert: return; /* fallthrough */ case XK_Down: + case XK_KP_Down: if (sel && sel->right && (sel = sel->right) == next) { curr = next; calcoffsets(); diff --git a/dmenu-5.0/dmenu_path b/dmenu-5.1/dmenu_path index 3a7cda7..3a7cda7 100755 --- a/dmenu-5.0/dmenu_path +++ b/dmenu-5.1/dmenu_path diff --git a/dmenu-5.0/dmenu_run b/dmenu-5.1/dmenu_run index 834ede5..834ede5 100755 --- a/dmenu-5.0/dmenu_run +++ b/dmenu-5.1/dmenu_run diff --git a/dmenu-5.0/drw.c b/dmenu-5.1/drw.c index e9c408d..7a5bc0d 100644 --- a/dmenu-5.0/drw.c +++ b/dmenu-5.1/drw.c @@ -133,14 +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. - */ - font = ecalloc(1, sizeof(Fnt)); font->xfont = xfont; font->pattern = pattern; @@ -346,7 +338,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp fcpattern = FcPatternDuplicate(drw->fonts->pattern); FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset); FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue); - FcPatternAddBool(fcpattern, FC_COLOR, FcFalse); FcConfigSubstitute(NULL, fcpattern, FcMatchPattern); FcDefaultSubstitute(fcpattern); diff --git a/dmenu-5.0/drw.h b/dmenu-5.1/drw.h index 4c67419..4c67419 100644 --- a/dmenu-5.0/drw.h +++ b/dmenu-5.1/drw.h diff --git a/dmenu-5.0/stest.1 b/dmenu-5.1/stest.1 index 2667d8a..2667d8a 100644 --- a/dmenu-5.0/stest.1 +++ b/dmenu-5.1/stest.1 diff --git a/dmenu-5.0/stest.c b/dmenu-5.1/stest.c index 7a7b0bc..e27d3a5 100644 --- a/dmenu-5.0/stest.c +++ b/dmenu-5.1/stest.c @@ -84,7 +84,7 @@ main(int argc, char *argv[]) if (!argc) { /* read list from stdin */ while ((n = getline(&line, &linesiz, stdin)) > 0) { - if (n && line[n - 1] == '\n') + if (line[n - 1] == '\n') line[n - 1] = '\0'; test(line, line); } diff --git a/dmenu-5.0/util.c b/dmenu-5.1/util.c index fe044fc..fe044fc 100644 --- a/dmenu-5.0/util.c +++ b/dmenu-5.1/util.c diff --git a/dmenu-5.0/util.h b/dmenu-5.1/util.h index f633b51..f633b51 100644 --- a/dmenu-5.0/util.h +++ b/dmenu-5.1/util.h |