diff --git a/input_bar.c b/input_bar.c index a774f4e8..69807f96 100644 --- a/input_bar.c +++ b/input_bar.c @@ -29,6 +29,12 @@ void inp_bar_active(int win) wrefresh(inp_bar); } +void inp_bar_get_password(void) +{ + mvwprintw(inp_bar, 0, 1, "Enter password:"); + wrefresh(inp_bar); +} + void inp_bar_print_message(char *msg) { mvwprintw(inp_bar, 0, 9, msg); @@ -46,3 +52,9 @@ void inp_bar_update_time(void) wrefresh(inp_bar); inp_put_back(); } + +void inp_bar_clear(void) +{ + wclear(inp_bar); + wrefresh(inp_bar); +} diff --git a/input_win.c b/input_win.c index 22154065..30df10a9 100644 --- a/input_win.c +++ b/input_win.c @@ -10,19 +10,20 @@ void create_input_window(void) inp_win = newwin(1, cols, rows-1, 0); keypad(inp_win, TRUE); + wmove(inp_win, 0, 1); wrefresh(inp_win); } void inp_get_command_str(char *cmd) { - wmove(inp_win, 0, 0); + wmove(inp_win, 0, 1); wgetstr(inp_win, cmd); } void inp_clear(void) { wclear(inp_win); - wmove(inp_win, 0, 0); + wmove(inp_win, 0, 1); wrefresh(inp_win); } @@ -78,8 +79,10 @@ void inp_get_password(char *passwd) { wclear(inp_win); noecho(); - mvwgetstr(inp_win, 0, 0, passwd); + mvwgetstr(inp_win, 0, 1, passwd); + wmove(inp_win, 0, 1); echo(); + inp_bar_clear(); } void inp_put_back(void) diff --git a/profanity.c b/profanity.c index d627747a..2160eda8 100644 --- a/profanity.c +++ b/profanity.c @@ -103,7 +103,7 @@ static int handle_start_command(char *cmd) char *user; user = strndup(cmd+9, strlen(cmd)-9); - inp_bar_print_message("Enter password:"); + inp_bar_get_password(); char passwd[20]; inp_get_password(passwd); diff --git a/windows.h b/windows.h index 038004d7..0614bbdc 100644 --- a/windows.h +++ b/windows.h @@ -14,6 +14,8 @@ void create_input_bar(void); void create_input_window(void); // input bar actions +void inp_bar_clear(void); +void inp_bar_get_password(void); void inp_bar_print_message(char *msg); void inp_bar_inactive(int win); void inp_bar_active(int win);