diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-12-16 00:16:13 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-12-16 02:27:36 +0100 |
commit | e492ac6f952043c3b4adbfffb3711be638a93883 (patch) | |
tree | 4b414ef1fccdc5c1364e88d2832315ba11c76e8a /src/custom.c | |
parent | aa7844942e1d5e33894c236d326abfbb30462c8f (diff) | |
download | calcurse-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/custom.c')
-rw-r--r-- | src/custom.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/custom.c b/src/custom.c index 185f65a..df7feef 100644 --- a/src/custom.c +++ b/src/custom.c @@ -226,7 +226,7 @@ void custom_layout_config(void) display_layout_config(&conf_win, mark, cursor); clear(); - while ((ch = keys_getch(win[STA].p, NULL, NULL)) != KEY_GENERIC_QUIT) { + while ((ch = keys_getch(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) { need_reset = 0; switch (ch) { case KEY_GENERIC_HELP: @@ -310,7 +310,7 @@ void custom_sidebar_config(void) bindings_size, NULL); wins_doupdate(); - while ((ch = keys_getch(win[STA].p, NULL, NULL)) != KEY_GENERIC_QUIT) { + while ((ch = keys_getch(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) { switch (ch) { case KEY_MOVE_UP: wins_sbar_winc(); @@ -528,7 +528,7 @@ void custom_color_config(void) theme_changed); clear(); - while ((ch = keys_getch(win[STA].p, NULL, NULL)) != KEY_GENERIC_QUIT) { + while ((ch = keys_getch(win[KEY].p, NULL, NULL)) != KEY_GENERIC_QUIT) { need_reset = 0; theme_changed = 0; @@ -732,7 +732,7 @@ void custom_general_config(void) wins_scrollwin_display(&cwin); buf = mem_malloc(BUFSIZ); - while ((ch = wgetch(win[STA].p)) != 'q') { + while ((ch = wgetch(win[KEY].p)) != 'q') { buf[0] = '\0'; switch (ch) { @@ -921,7 +921,7 @@ void custom_keys_config(void) for (;;) { int ch; - ch = keys_getch(win[STA].p, NULL, NULL); + ch = keys_getch(win[KEY].p, NULL, NULL); switch (ch) { case KEY_MOVE_UP: if (selrow > 0) { @@ -1032,7 +1032,7 @@ void custom_config_main(void) int old_layout; custom_config_bar(); - while ((ch = wgetch(win[STA].p)) != 'q') { + while ((ch = wgetch(win[KEY].p)) != 'q') { switch (ch) { case 'C': case 'c': @@ -1042,7 +1042,7 @@ void custom_config_main(void) colorize = 0; wins_erase_status_bar(); mvwaddstr(win[STA].p, 0, 0, no_color_support); - wgetch(win[STA].p); + wgetch(win[KEY].p); } break; case 'L': |