summaryrefslogtreecommitdiff
path: root/dmenu-no-input-5.2.diff
diff options
context:
space:
mode:
authorozpv <39195175+ozpv@users.noreply.github.com>2024-03-03 19:37:15 +0000
committerGitHub <noreply@github.com>2024-03-03 19:37:15 +0000
commit5fa5574930db8151265951251db144fa045d2991 (patch)
treece5bf341853c87155e76813d5f28d418732d620c /dmenu-no-input-5.2.diff
parent834cada626cdc3aa6838e1e7423e7128d2ec0e40 (diff)
custom patches
Diffstat (limited to 'dmenu-no-input-5.2.diff')
-rw-r--r--dmenu-no-input-5.2.diff148
1 files changed, 0 insertions, 148 deletions
diff --git a/dmenu-no-input-5.2.diff b/dmenu-no-input-5.2.diff
deleted file mode 100644
index aa6239a..0000000
--- a/dmenu-no-input-5.2.diff
+++ /dev/null
@@ -1,148 +0,0 @@
-diff -up dmenu/config.def.h dmenu-no-input/config.def.h
---- dmenu/config.def.h 2024-03-03 12:12:57.801296496 -0600
-+++ dmenu-no-input/config.def.h 2024-03-03 10:00:59.974900500 -0600
-@@ -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 int draw_input = 1; /* -noi option; if 0, the input will not be drawn by default */
- /* -fn option overrides fonts[0]; default X11 font or font set */
- static const char *fonts[] = {
- "monospace:size=10"
-Only in dmenu-no-input: config.h
-diff -up dmenu/dmenu.c dmenu-no-input/dmenu.c
---- dmenu/dmenu.c 2024-03-03 12:12:57.802296502 -0600
-+++ dmenu-no-input/dmenu.c 2024-03-03 12:15:44.416277776 -0600
-@@ -147,7 +147,7 @@ drawmenu(void)
- {
- unsigned int curpos;
- struct item *item;
-- int x = 0, y = 0, w;
-+ int x = 0, y = 0, w = 0;
-
- drw_setscheme(drw, scheme[SchemeNorm]);
- drw_rect(drw, 0, 0, mw, mh, 1, 1);
-@@ -156,15 +156,17 @@ drawmenu(void)
- drw_setscheme(drw, scheme[SchemeSel]);
- x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0);
- }
-- /* draw input field */
-- w = (lines > 0 || !matches) ? mw - x : inputw;
-- drw_setscheme(drw, scheme[SchemeNorm]);
-- drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
-
-- curpos = TEXTW(text) - TEXTW(&text[cursor]);
-- if ((curpos += lrpad / 2 - 1) < w) {
-+ if (draw_input) {
-+ w = (lines > 0 || !matches) ? mw - x : inputw;
- drw_setscheme(drw, scheme[SchemeNorm]);
-- drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
-+ drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
-+
-+ curpos = TEXTW(text) - TEXTW(&text[cursor]);
-+ if ((curpos += lrpad / 2 - 1) < w) {
-+ drw_setscheme(drw, scheme[SchemeNorm]);
-+ drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
-+ }
- }
-
- if (lines > 0) {
-@@ -178,8 +180,8 @@ drawmenu(void)
- if (curr->left) {
- drw_setscheme(drw, scheme[SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, "<", 0);
-+ x += w;
- }
-- x += w;
- for (item = curr; item != next; item = item->right)
- x = drawitem(item, x, 0, textw_clamp(item->text, mw - x - TEXTW(">")));
- if (next) {
-@@ -358,16 +360,19 @@ keypress(XKeyEvent *ev)
- case XK_p: ksym = XK_Up; break;
-
- case XK_k: /* delete right */
-- text[cursor] = '\0';
-- match();
-+ if (draw_input) {
-+ text[cursor] = '\0';
-+ match();
-+ }
- break;
- case XK_u: /* delete left */
-- insert(NULL, 0 - cursor);
-+ if (draw_input)
-+ insert(NULL, 0 - cursor);
- break;
- case XK_w: /* delete word */
-- while (cursor > 0 && strchr(worddelimiters, text[nextrune(-1)]))
-+ while (cursor > 0 && strchr(worddelimiters, text[nextrune(-1)]) && draw_input)
- insert(NULL, nextrune(-1) - cursor);
-- while (cursor > 0 && !strchr(worddelimiters, text[nextrune(-1)]))
-+ while (cursor > 0 && !strchr(worddelimiters, text[nextrune(-1)]) && draw_input)
- insert(NULL, nextrune(-1) - cursor);
- break;
- case XK_y: /* paste selection */
-@@ -414,23 +419,23 @@ keypress(XKeyEvent *ev)
- switch(ksym) {
- default:
- insert:
-- if (!iscntrl((unsigned char)*buf))
-+ if (!iscntrl((unsigned char)*buf) && draw_input)
- insert(buf, len);
- break;
- case XK_Delete:
- case XK_KP_Delete:
-- if (text[cursor] == '\0')
-+ if (text[cursor] == '\0' || !draw_input)
- return;
- cursor = nextrune(+1);
- /* fallthrough */
- case XK_BackSpace:
-- if (cursor == 0)
-+ if (cursor == 0 || !draw_input)
- return;
- insert(NULL, nextrune(-1) - cursor);
- break;
- case XK_End:
- case XK_KP_End:
-- if (text[cursor] != '\0') {
-+ if (text[cursor] != '\0' && draw_input) {
- cursor = strlen(text);
- break;
- }
-@@ -514,7 +519,7 @@ insert:
- }
- break;
- case XK_Tab:
-- if (!sel)
-+ if (!sel || !draw_input)
- return;
- cursor = strnlen(sel->text, sizeof text - 1);
- memcpy(text, sel->text, cursor);
-@@ -677,7 +682,7 @@ setup(void)
- mw = wa.width;
- }
- promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
-- inputw = mw / 3; /* input width: ~33% of monitor width */
-+ inputw = !draw_input ? 0 : mw / 3; /* input width: ~33% of monitor width */
- match();
-
- /* create menu window */
-@@ -715,7 +720,7 @@ setup(void)
- static void
- usage(void)
- {
-- die("usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
-+ die("usage: dmenu [-bfiv] [-noi] [-l lines] [-p prompt] [-fn font] [-m monitor]\n"
- " [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]");
- }
-
-@@ -734,6 +739,8 @@ main(int argc, char *argv[])
- topbar = 0;
- else if (!strcmp(argv[i], "-f")) /* grabs keyboard before reading stdin */
- fast = 1;
-+ else if (!strcmp(argv[i], "-noi")) /* no input field. intended to be used with a prompt */
-+ draw_input = 0;
- else if (!strcmp(argv[i], "-i")) { /* case-insensitive item matching */
- fstrncmp = strncasecmp;
- fstrstr = cistrstr;