Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flicker when stats are updated every second #115

Closed
PartialVolume opened this issue Nov 6, 2019 · 0 comments · Fixed by #200
Closed

Flicker when stats are updated every second #115

PartialVolume opened this issue Nov 6, 2019 · 0 comments · Fixed by #200
Labels

Comments

@PartialVolume
Copy link
Collaborator

Flicker when stats are updated every second when nwipe is run not in a desktop terminal but in a full screen terminal such as when you select ALT-F2 or ALT-F3 and nwipe in that terminal etc.

Is a full screen update being done rather than a specific window update ?

Quote from the ncurses manual.

Causing Output to the Terminal
refresh() and wrefresh(win)
These functions must be called to actually get any output on the terminal, as other routines merely manipulate data structures. wrefresh() copies the named window to the physical terminal screen, taking into account what is already there in order to do optimizations. refresh() does a refresh of stdscr. Unless leaveok() has been enabled, the physical cursor of the terminal is left at the location of the window's cursor.
doupdate() and wnoutrefresh(win)
These two functions allow multiple updates with more efficiency than wrefresh. To use them, it is important to understand how curses works. In addition to all the window structures, curses keeps two data structures representing the terminal screen: a physical screen, describing what is actually on the screen, and a virtual screen, describing what the programmer wants to have on the screen. wrefresh works by first copying the named window to the virtual screen (wnoutrefresh()), and then calling the routine to update the screen (doupdate()). If the programmer wishes to output several windows at once, a series of calls to wrefresh will result in alternating calls to wnoutrefresh() and doupdate(), causing several bursts of output to the screen. By calling wnoutrefresh() for each window, it is then possible to call doupdate() once, resulting in only one burst of output, with fewer total characters transmitted (this also avoids a visually annoying flicker at each update).

PartialVolume added a commit to PartialVolume/nwipe that referenced this issue Mar 9, 2020
These apply in full screen mode ONLY: i.e ALT-F2, Shredos etc.
1. When selecting a drive using up/down arrow keys
2. During a wipe the screen flashes at one second intervals.

These apply in a terminal window such as konsole, tmux etc.
1. When resizing the terminal there was a flicker.

All these problems have been fixed.

Most of the causes of the flicker was an excessive use of wrefresh() which calls
the wnoutrefresh() and doupdate() functions. This can cause flickering when a
number of calls to wrefresh happen at the same time. It is more appropriate to
replace the wrefresh() with wnoutrefresh(), then at an appropriate time call
doupate() just once. The result is that before doupdate() would have been
called multiple times and now it's called once when required.

fixes martijnvanbrummelen#115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant