Remove wmenu -P flag - wmenu - 🔧 fork of wmenu
(HTM) git clone git@git.drkhsh.at/wmenu.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit c05ab7520b452ee3b8bd974a18511dc370cbeabe
(DIR) parent 81d46e39120bcb7c24cec2105e05f3524e8bd548
(HTM) Author: adnano <me@adnano.co>
Date: Sat, 4 May 2024 21:41:21 -0400
Remove wmenu -P flag
This flag causes some issues with wmenu-run. It will be revisited in the
next release.
Diffstat:
M docs/wmenu.1.scd | 6 +-----
M menu.c | 5 +----
M menu.h | 2 --
M render.c | 18 ++----------------
M wmenu.c | 4 +---
5 files changed, 5 insertions(+), 30 deletions(-)
---
(DIR) diff --git a/docs/wmenu.1.scd b/docs/wmenu.1.scd
@@ -6,7 +6,7 @@ wmenu - dynamic menu for Wayland
# SYNOPSIS
-*wmenu* [-biPv] \
+*wmenu* [-biv] \
[-f _font_] \
[-l _lines_] \
[-o _output_] \
@@ -35,10 +35,6 @@ $PATH and runs the result.
*-i*
wmenu matches menu items case insensitively.
-*-P*
- wmenu will not directly display the keyboard input, but instead replace it
- with asterisks. All data from stdin will be ignored.
-
*-v*
prints version information to stdout, then exits.
(DIR) diff --git a/menu.c b/menu.c
@@ -89,7 +89,7 @@ void menu_getopts(struct menu *menu, int argc, char *argv[]) {
"\t[-N color] [-n color] [-M color] [-m color] [-S color] [-s color]\n";
int opt;
- while ((opt = getopt(argc, argv, "bhiPvf:l:o:p:N:n:M:m:S:s:")) != -1) {
+ while ((opt = getopt(argc, argv, "bhivf:l:o:p:N:n:M:m:S:s:")) != -1) {
switch (opt) {
case 'b':
menu->bottom = true;
@@ -97,9 +97,6 @@ void menu_getopts(struct menu *menu, int argc, char *argv[]) {
case 'i':
menu->strncmp = strncasecmp;
break;
- case 'P':
- menu->passwd = true;
- break;
case 'v':
puts("wmenu " VERSION);
exit(EXIT_SUCCESS);
(DIR) diff --git a/menu.h b/menu.h
@@ -30,8 +30,6 @@ struct menu {
bool bottom;
// The function used to match menu items
int (*strncmp)(const char *, const char *, size_t);
- // Whether the input is a password
- bool passwd;
// The font used to display the menu
char *font;
// The number of lines to list items vertically
(DIR) diff --git a/render.c b/render.c
@@ -79,22 +79,8 @@ static void render_prompt(struct menu *menu, cairo_t *cairo) {
// Renders the input text.
static void render_input(struct menu *menu, cairo_t *cairo) {
- char *censort = NULL;
-
- if (menu->passwd) {
- censort = calloc(1, sizeof(menu->input));
- if (!censort) {
- return;
- }
- memset(censort, '*', strlen(menu->input));
- }
-
- render_text(menu, cairo, menu->passwd ? censort : menu->input,
- menu->promptw, 0, 0, 0, menu->normalfg, menu->padding, menu->padding);
-
- if (censort) {
- free(censort);
- }
+ render_text(menu, cairo, menu->input, menu->promptw, 0, 0,
+ 0, menu->normalfg, menu->padding, menu->padding);
}
// Renders a cursor for the input field.
(DIR) diff --git a/wmenu.c b/wmenu.c
@@ -19,9 +19,7 @@ static void read_items(struct menu *menu) {
int main(int argc, char *argv[]) {
struct menu *menu = menu_create();
menu_getopts(menu, argc, argv);
- if (!menu->passwd) {
- read_items(menu);
- }
+ read_items(menu);
int status = menu_run(menu);
menu_destroy(menu);
return status;