diff options
author | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2012-09-16 10:48:38 +0200 |
---|---|---|
committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2012-09-16 10:48:38 +0200 |
commit | c5a9b799d44be9c0fa4264dc34d9dd61321be795 (patch) | |
tree | 327a0f3e907db5dee0c7a678c5c701bc202e59fe /FAQ | |
parent | 85849ce72aa4e9cee307a031b97777e9eba2d453 (diff) |
Render only once in each main loop iteration
draw() runs over all lines of the screen and renders only the dirty lines,
this avoids render lines which are not modified since last draw() call. In
this moment the main loop is something like:
- Wait something to read from file descriptors
- Read from pseudo tty
- Call draw() for rending
- Read X events
This cause the problem that all the X events that have to update the screen
have to call draw() (because draw() is called before of X events handling),
so you can have multiples renderings in only one iteration, that will waste
a lot of resources.
This patch change the main loop to:
- Wait something to read from file descriptors
- Read from pseudo tty
- Read X events
- Call draw() for rending
So X events don't have to worry about rendering, because draw() is called
after them.
The only place where draw is called outside of the main loop is in redraw(),
but it is necessary for getting a good tput flash.
---
st.c | 29 ++++++-----------------------
1 file changed, 6 insertions(+), 23 deletions(-)
Diffstat (limited to 'FAQ')
0 files changed, 0 insertions, 0 deletions