I have observed odd behavior with my nCurses app when putting it to background/foreground. After a couple of times my window shows invalid content. I suspect that when sending SIGSTOP
/SIGCONT
signals to my app I need to be handle those and refresh window, but I can't find any note about it. Does nCurses has some way of refreshing window when coming back from background? Or the reason can be different?
Asked
Active
Viewed 78 times
0

blackbrandt
- 2,010
- 1
- 15
- 32

Mateusz Wojtczak
- 1,621
- 1
- 12
- 28
1 Answers
1
ncurses does have a handler for SIGTSTP
, which it sets up in initscr
— if it is in the default state:
SIGTSTP
This handles the stop signal, used in job control. When resuming the process, this implementation discards pending input with flushinput (see curs_util(3x)), and repaints the screen assuming that it has been completely altered. It also updates the saved terminal modes with def_shell_mode (see curs_kernel(3x))

Thomas Dickey
- 51,086
- 7
- 70
- 105
-
Thanks for previous answer, I have followup question. In my app I'm scanning keyboard characters in loop, so when my app goes background and back to foreground I'm experiencing getting some junk character. I would like to call flushinp() when process comes fg but default nurses SIGCONT handler is not doing that. How I can piggyback flushinp() in this case? – Mateusz Wojtczak Dec 21 '20 at 18:07