diff options
author | adnano <me@adnano.co> | 2024-05-04 21:44:59 -0400 |
---|---|---|
committer | adnano <me@adnano.co> | 2024-05-04 21:44:59 -0400 |
commit | 15d7c7bcc29e66f174c4de2420d371a9737ac6e4 (patch) | |
tree | 3be3d17ffb062e95f92d90dbdd7fb74fa6e4f538 /render.c | |
parent | 963a677631f00b9b259e101a5e3dad85da6ccbf2 (diff) | |
download | wmenu-15d7c7bcc29e66f174c4de2420d371a9737ac6e4.tar.gz |
Revert "Remove wmenu -P flag"
This reverts commit c05ab7520b452ee3b8bd974a18511dc370cbeabe.
Diffstat (limited to 'render.c')
-rw-r--r-- | render.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -79,8 +79,22 @@ static void render_prompt(struct menu *menu, cairo_t *cairo) { // Renders the input text. static void render_input(struct menu *menu, cairo_t *cairo) { - render_text(menu, cairo, menu->input, menu->promptw, 0, 0, - 0, menu->normalfg, menu->padding, menu->padding); + 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); + } } // Renders a cursor for the input field. |