aboutsummaryrefslogtreecommitdiff
path: root/src/ui_elements.c
diff options
context:
space:
mode:
authortoni <toni@devlap.local>2015-11-16 22:30:32 +0100
committertoni <toni@devlap.local>2015-11-16 22:30:32 +0100
commit5dcfb21b85391ddaace3ec7e2161859661894597 (patch)
tree492f651f3dc588523730f0edf807d69de05d91b7 /src/ui_elements.c
parent99dfc48c542ec59c9541faa33c8895bfa471089b (diff)
fixed wgetch key loop and wtimeout bug
Diffstat (limited to 'src/ui_elements.c')
-rw-r--r--src/ui_elements.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/ui_elements.c b/src/ui_elements.c
index e57c0de..427415a 100644
--- a/src/ui_elements.c
+++ b/src/ui_elements.c
@@ -73,23 +73,36 @@ passwd_input_cb(WINDOW *wnd, void *data, int key)
char ipc_buf[IPC_MQSIZ+1];
memset(ipc_buf, '\0', IPC_MQSIZ+1);
+ wtimeout(stdscr, -1);
switch (key) {
case UIKEY_ENTER:
- deactivate_input(pw_input);
mq_passwd_send(a->input);
+ ui_thrd_suspend();
clear_input(wnd, a);
+ deactivate_input(pw_input);
ui_ipc_msgrecv(MQ_IF, ipc_buf);
set_txtwindow_color(infownd, COLOR_PAIR(5), COLOR_PAIR(5));
set_txtwindow_title(infownd, "BUSY");
set_txtwindow_text(infownd, ipc_buf);
set_txtwindow_active(infownd, true);
+ ui_thrd_resume();
sleep(2);
ui_ipc_msgrecv(MQ_IF, ipc_buf);
+ ui_thrd_suspend();
set_txtwindow_color(infownd, COLOR_PAIR(4), COLOR_PAIR(4) | A_BOLD);
+ set_txtwindow_title(infownd, "ERROR");
set_txtwindow_text(infownd, ipc_buf);
+ ui_thrd_resume();
+// while (getch() != '\n') { }
+wgetch(stdscr);
+ ui_thrd_suspend();
+ set_txtwindow_active(infownd, false);
+ activate_input(pw_input);
+ ui_thrd_resume();
break;
case UIKEY_BACKSPACE:
del_input(wnd, a);
+ ui_thrd_force_update();
break;
case UIKEY_ESC:
return DOUI_ERR;
@@ -102,7 +115,9 @@ passwd_input_cb(WINDOW *wnd, void *data, int key)
break;
default:
add_input(wnd, a, key);
+ ui_thrd_force_update();
}
+ wtimeout(stdscr, 1000);
return DOUI_OK;
}
@@ -129,7 +144,7 @@ init_ui_elements(WINDOW *wnd_main, unsigned int max_x, unsigned int max_y)
register_statusbar(lower);
register_anic_default(heartbeat);
register_txtwindow(infownd);
- activate_input(wnd_main, pw_input);
+ activate_input(pw_input);
set_statusbar_text(higher, title);
}