MULTI_SELECT_PATCH --> MULTI_SELECTION_PATCH

This commit is contained in:
bakkeby 2020-08-08 13:49:00 +02:00
parent 240cce1c1a
commit 1f6c8c1e7c
5 changed files with 36 additions and 36 deletions

View File

@ -93,7 +93,7 @@ static int histnodup = 1; /* if 0, record repeated histories */
* Characters not considered part of a word while deleting words
* for example: " /?\"&[]"
*/
#if PIPEOUT_PATCH && !MULTI_SELECT_PATCH
#if PIPEOUT_PATCH && !MULTI_SELECTION_PATCH
static const char startpipe[] = "#";
#endif // PIPEOUT_PATCH
static const char worddelimiters[] = " ";

42
dmenu.c
View File

@ -59,11 +59,11 @@ struct item {
#if NON_BLOCKING_STDIN_PATCH
struct item *next;
#endif // NON_BLOCKING_STDIN_PATCH
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
int id; /* for multiselect */
#else
int out;
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
#if HIGHPRIORITY_PATCH
int hp;
#endif // HIGHPRIORITY_PATCH
@ -73,7 +73,7 @@ struct item {
};
static char text[BUFSIZ] = "";
#if PIPEOUT_PATCH && !MULTI_SELECT_PATCH
#if PIPEOUT_PATCH && !MULTI_SELECTION_PATCH
static char pipeout[8] = " | dmenu";
#endif // PIPEOUT_PATCH
static char *embed;
@ -98,11 +98,11 @@ static int mon = -1, screen;
#if MANAGED_PATCH
static int managed = 0;
#endif // MANAGED_PATCH
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
static int *selid = NULL;
static unsigned int selidsize = 0;
#endif // MULTI_SELECT_PATCH
#if PRINTINPUTTEXT_PATCH && !MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
#if PRINTINPUTTEXT_PATCH && !MULTI_SELECTION_PATCH
static int use_text_input = 0;
#endif // PRINTINPUTTEXT_PATCH
#if PRESELECT_PATCH
@ -225,9 +225,9 @@ cleanup(void)
drw_free(drw);
XSync(dpy, False);
XCloseDisplay(dpy);
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
free(selid);
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
}
static char *
@ -255,11 +255,11 @@ drawitem(struct item *item, int x, int y, int w)
else if (item->left == sel || item->right == sel)
drw_setscheme(drw, scheme[SchemeMid]);
#endif // MORECOLOR_PATCH
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
else if (issel(item->id))
#else
else if (item->out)
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
drw_setscheme(drw, scheme[SchemeOut]);
else
drw_setscheme(drw, scheme[SchemeNorm]);
@ -770,9 +770,9 @@ keypress(XKeyEvent *ev)
goto draw;
case XK_Return:
case XK_KP_Enter:
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
selsel();
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
break;
case XK_bracketleft:
cleanup();
@ -874,7 +874,7 @@ insert:
break;
case XK_Return:
case XK_KP_Enter:
#if !MULTI_SELECT_PATCH
#if !MULTI_SELECTION_PATCH
#if PIPEOUT_PATCH
#if PRINTINPUTTEXT_PATCH
if (sel && (
@ -905,22 +905,22 @@ insert:
#else
puts((sel && !(ev->state & ShiftMask)) ? sel->text : text);
#endif // PIPEOUT_PATCH
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
if (!(ev->state & ControlMask)) {
#if NAVHISTORY_PATCH
savehistory((sel && !(ev->state & ShiftMask))
? sel->text : text);
#endif // NAVHISTORY_PATCH
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
printsel(ev->state);
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
cleanup();
exit(0);
}
#if !MULTI_SELECT_PATCH
#if !MULTI_SELECTION_PATCH
if (sel)
sel->out = 1;
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
break;
case XK_Right:
if (text[cursor] != '\0') {
@ -1051,7 +1051,7 @@ readstdin(void)
*p = '\0';
if (!(items[i].text = strdup(buf)))
die("cannot strdup %u bytes:", strlen(buf) + 1);
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
items[i].id = i; /* for multiselect */
#else
items[i].out = 0;
@ -1388,7 +1388,7 @@ usage(void)
#if INSTANT_PATCH
"n"
#endif // INSTANT_PATCH
#if PRINTINPUTTEXT_PATCH && !MULTI_SELECT_PATCH
#if PRINTINPUTTEXT_PATCH && !MULTI_SELECTION_PATCH
"t"
#endif // PRINTINPUTTEXT_PATCH
#if PREFIXCOMPLETION_PATCH
@ -1494,7 +1494,7 @@ main(int argc, char *argv[])
} else if (!strcmp(argv[i], "-n")) { /* instant select only match */
instant = !instant;
#endif // INSTANT_PATCH
#if PRINTINPUTTEXT_PATCH && !MULTI_SELECT_PATCH
#if PRINTINPUTTEXT_PATCH && !MULTI_SELECTION_PATCH
} else if (!strcmp(argv[i], "-t")) { /* favors text input over selection */
use_text_input = 1;
#endif // PRINTINPUTTEXT_PATCH

View File

@ -15,7 +15,7 @@
#if HIGHPRIORITY_PATCH
#include "highpriority.c"
#endif
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
#include "multiselect.c"
#endif
#if MOUSE_SUPPORT_PATCH

View File

@ -71,24 +71,24 @@ buttonpress(XEvent *e)
for (item = curr; item != next; item = item->right) {
y += h;
if (ev->y >= y && ev->y <= (y + h)) {
#if !MULTI_SELECT_PATCH
#if !MULTI_SELECTION_PATCH
puts(item->text);
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
if (!(ev->state & ControlMask)) {
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
sel = item;
selsel();
printsel(ev->state);
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
exit(0);
}
sel = item;
if (sel) {
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
selsel();
#else
sel->out = 1;
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
drawmenu();
}
return;
@ -119,24 +119,24 @@ buttonpress(XEvent *e)
w = MIN(TEXTW(item->text), mw - x - TEXTW(">"));
#endif // SYMBOLS_PATCH
if (ev->x >= x && ev->x <= x + w) {
#if !MULTI_SELECT_PATCH
#if !MULTI_SELECTION_PATCH
puts(item->text);
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
if (!(ev->state & ControlMask)) {
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
sel = item;
selsel();
printsel(ev->state);
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
exit(0);
}
sel = item;
if (sel) {
#if MULTI_SELECT_PATCH
#if MULTI_SELECTION_PATCH
selsel();
#else
sel->out = 1;
#endif // MULTI_SELECT_PATCH
#endif // MULTI_SELECTION_PATCH
drawmenu();
}
return;

View File

@ -120,7 +120,7 @@
*
* https://tools.suckless.org/dmenu/patches/multi-selection/
*/
#define MULTI_SELECT_PATCH 0
#define MULTI_SELECTION_PATCH 0
/* This patch provides dmenu the ability for history navigation similar to that of bash.
* https://tools.suckless.org/dmenu/patches/navhistory/