Commit 1609be549aca6c7895ad46a1b2987bb3568842f4
Fix flicker in Input::peek()
`man wget_wch`:
If the window is not a pad and has been moved or modified since the
last call to wrefresh, wrefresh will be called before another
character is read.
Do `wnoutrefresh()` on auxiliary windows in constructor to avoid the
issue (calling every time before `wget_wch()` doesn't remove the flicker
at least for windows of screen size which is how they are created).
Author: xaizek
Author date (UTC): 2022-02-09 17:30
Committer name: xaizek
Committer date (UTC): 2022-02-09 17:30
Parent(s): dfb643c3de00d30143a3d517f89f3f9808b2560a
Signing key: 99DC5E4DB05F6BE2
Tree: d46a3dce979a31385f1d43d8a2b987c05b895df1
File Input.cpp changed (mode: 100644) (index e604f27..bf7cf62) |
... |
... |
Input::Input(Keypad keypad) |
71 |
71 |
|
|
72 |
72 |
guts::keypad(readWin, keypad == Keypad::Enabled); |
guts::keypad(readWin, keypad == Keypad::Enabled); |
73 |
73 |
wtimeout(peekWin, 0); |
wtimeout(peekWin, 0); |
|
74 |
|
|
|
75 |
|
// `man wget_wch`: |
|
76 |
|
// If the window is not a pad and has been moved or modified since the |
|
77 |
|
// last call to wrefresh, wrefresh will be called before another character |
|
78 |
|
// is read. |
|
79 |
|
wnoutrefresh(readWin); |
|
80 |
|
wnoutrefresh(peekWin); |
74 |
81 |
} |
} |
75 |
82 |
|
|
76 |
83 |
InputElement |
InputElement |
77 |
84 |
Input::read() |
Input::read() |
78 |
85 |
{ |
{ |
79 |
|
// Refresh the window, because otherwise curses clears the screen on call to |
|
80 |
|
// `wget_wch()` (why does it do this?). |
|
81 |
|
wnoutrefresh(readWin); |
|
82 |
|
|
|
83 |
86 |
std::wint_t wch; |
std::wint_t wch; |
84 |
87 |
int status = wget_wch(readWin, &wch); |
int status = wget_wch(readWin, &wch); |
85 |
88 |
|
|