summaryrefslogtreecommitdiff
path: root/src/wins.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-12-16 00:16:13 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-12-16 02:27:36 +0100
commite492ac6f952043c3b4adbfffb3711be638a93883 (patch)
tree4b414ef1fccdc5c1364e88d2832315ba11c76e8a /src/wins.c
parentaa7844942e1d5e33894c236d326abfbb30462c8f (diff)
downloadcalcurse-e492ac6f952043c3b4adbfffb3711be638a93883.zip
Add hidden key handler window
After BUG#6 had apparently been closed with the screen locks introduced in commit a80f8dcf2c6eb3b54658218bc081ee9694204dd5, some people still had problems with random characters appearing in the notification bar. This was obviously caused by wgetch() refreshing the screen if the status panel was changed. From wgetch(3): If the window is not a pad, and it has been moved or modified since the last call to wrefresh, wrefresh will be called before another character is read. Since the wgetch(3) isn't thread-safe, there were race conditions between the notification bar thread drawing to the notification bar and wgetch() updating the screen. Introduce a (hidden) window that handles all key presses and never gets changed in order to avoid this. Also, call wins_wrefresh() explicitly in status_mesg(), since we can no longer rely on wgetch() updating windows automatically. Fixes reopened BUG#6. Note that this is a hotfix -- FR#26 has been opened to ensure we fix this properly in the next major release. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/wins.c')
-rw-r--r--src/wins.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wins.c b/src/wins.c
index fd8333d..0181ab9 100644
--- a/src/wins.c
+++ b/src/wins.c
@@ -262,8 +262,10 @@ void wins_init(void)
{
wins_init_panels();
win[STA].p = newwin(win[STA].h, win[STA].w, win[STA].y, win[STA].x);
+ win[KEY].p = newwin(1, 1, 1, 1);
keypad(win[STA].p, TRUE);
+ keypad(win[KEY].p, TRUE);
/* Notify that the curses mode is now launched. */
ui_mode = UI_CURSES;
@@ -345,6 +347,7 @@ void wins_reinit(void)
delwin(apad.ptrwin);
delwin(win[TOD].p);
delwin(win[STA].p);
+ delwin(win[KEY].p);
wins_get_config();
wins_init();
if (notify_bar())