Browse Source

Force redisplay of all lines in DECSCNM

When it is called DECSCNM all lines become dirty, because it is necessary
redraw all lines for getting the new colors. It is easy see the problem
running 'echo ^[[?5h'.

In order to get a correct flash when running tput flash is necessary wait
after DECSCNM, until the changes are displayed, because in other case the
switch between reverse on/reverse off will be too much fast and nothing will
happen.
---
 st.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
master
Roberto E. Vargas Caballero 12 years ago
parent
commit
930b2c4a7f
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      st.c

+ 11
- 1
st.c View File

@ -54,6 +54,7 @@
#define SELECT_TIMEOUT (20*1000) /* 20 ms */ #define SELECT_TIMEOUT (20*1000) /* 20 ms */
#define DRAW_TIMEOUT (20*1000) /* 20 ms */ #define DRAW_TIMEOUT (20*1000) /* 20 ms */
#define REDRAW_TIMEOUT (80*1000) /* 80 ms */
#define SERRNO strerror(errno) #define SERRNO strerror(errno)
#define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b))
@ -238,6 +239,7 @@ typedef struct {
static void die(const char*, ...); static void die(const char*, ...);
static void draw(void); static void draw(void);
static void redraw(void);
static void drawregion(int, int, int, int); static void drawregion(int, int, int, int);
static void execsh(void); static void execsh(void);
static void sigchld(int); static void sigchld(int);
@ -1206,7 +1208,7 @@ tsetmode(bool priv, bool set, int *args, int narg) {
mode = term.mode; mode = term.mode;
MODBIT(term.mode,set, MODE_REVERSE); MODBIT(term.mode,set, MODE_REVERSE);
if (mode != term.mode) if (mode != term.mode)
draw();
redraw();
break; break;
case 7: case 7:
MODBIT(term.mode, set, MODE_WRAP); MODBIT(term.mode, set, MODE_WRAP);
@ -2029,6 +2031,14 @@ xdrawcursor(void) {
xcopy(term.c.x, term.c.y, 1, 1); xcopy(term.c.x, term.c.y, 1, 1);
} }
void
redraw(void) {
struct timespec tv = {0, REDRAW_TIMEOUT * 1000};
tfulldirt();
draw();
nanosleep(&tv, NULL);
}
void void
draw() { draw() {
drawregion(0, 0, term.col, term.row); drawregion(0, 0, term.col, term.row);


Loading…
Cancel
Save