From a1cd28f8099eac3938461f9e63ff6b74d4d824ef Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 6 Sep 2012 00:00:50 +0200 Subject: [PATCH 01/16] Allow simpler stdout -f handling. --- st.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/st.c b/st.c index fd5e0fd..7852de0 100644 --- a/st.c +++ b/st.c @@ -801,9 +801,15 @@ ttynew(void) { close(s); cmdfd = m; signal(SIGCHLD, sigchld); - if(opt_io && !(fileio = fopen(opt_io, "w"))) { - fprintf(stderr, "Error opening %s:%s\n", - opt_io, strerror(errno)); + if(opt_io) { + if(!strcmp(opt_io, "-")) { + fileio = stdout; + } else { + if(!(fileio = fopen(opt_io, "w"))) { + fprintf(stderr, "Error opening %s:%s\n", + opt_io, strerror(errno)); + } + } } } } -- 2.20.1 From 122ed577027ccbb85b2fe6a0f9449035fe074a9e Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 6 Sep 2012 08:02:56 +0200 Subject: [PATCH 02/16] Making the selection work again. --- st.c | 1 - 1 file changed, 1 deletion(-) diff --git a/st.c b/st.c index 7852de0..a4575f4 100644 --- a/st.c +++ b/st.c @@ -551,7 +551,6 @@ bpress(XEvent *e) { sel.mode = 1; sel.ex = sel.bx = X2COL(e->xbutton.x); sel.ey = sel.by = Y2ROW(e->xbutton.y); - draw(); } } -- 2.20.1 From af29fb2a5015918a8bb32075ab82b4e59d85910a Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Mon, 10 Sep 2012 13:39:41 +0200 Subject: [PATCH 03/16] Fixing the too small window in non-tiling window managers. --- st.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/st.c b/st.c index a4575f4..15d22ac 100644 --- a/st.c +++ b/st.c @@ -1933,6 +1933,17 @@ xinit(void) { die("Can't open display\n"); xw.scr = XDefaultScreen(xw.dpy); + /* font */ + initfonts(FONT, BOLDFONT, ITALICFONT); + + /* XXX: Assuming same size for bold font */ + xw.cw = dc.font.rbearing - dc.font.lbearing; + xw.ch = dc.font.ascent + dc.font.descent; + + /* colors */ + xw.cmap = XDefaultColormap(xw.dpy, xw.scr); + xloadcols(); + /* adjust fixed window geometry */ if(xw.isfixed) { sw = DisplayWidth(xw.dpy, xw.scr); @@ -1952,17 +1963,6 @@ xinit(void) { xw.fy = 0; } - /* font */ - initfonts(FONT, BOLDFONT, ITALICFONT); - - /* XXX: Assuming same size for bold font */ - xw.cw = dc.font.rbearing - dc.font.lbearing; - xw.ch = dc.font.ascent + dc.font.descent; - - /* colors */ - xw.cmap = XDefaultColormap(xw.dpy, xw.scr); - xloadcols(); - attrs.background_pixel = dc.col[DefaultBG]; attrs.border_pixel = dc.col[DefaultBG]; attrs.bit_gravity = NorthWestGravity; -- 2.20.1 From c092bce366ce7469e92f59c889b31fa9037976b2 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Wed, 12 Sep 2012 13:00:39 +0200 Subject: [PATCH 04/16] Add another obscure way to set a window title. --- st.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/st.c b/st.c index 15d22ac..f3b0b08 100644 --- a/st.c +++ b/st.c @@ -1509,6 +1509,9 @@ strhandle(void) { break; } break; + case 'k': /* old title set compatibility */ + XStoreName(xw.dpy, xw.win, strescseq.buf); + break; case 'P': /* DSC -- Device Control String */ case '_': /* APC -- Application Program Command */ case '^': /* PM -- Privacy Message */ @@ -1624,6 +1627,7 @@ tputc(char *c) { case '_': /* APC -- Application Program Command */ case '^': /* PM -- Privacy Message */ case ']': /* OSC -- Operating System Command */ + case 'k': /* old title set compatibility */ strreset(); strescseq.type = ascii; term.esc |= ESC_STR; -- 2.20.1 From 121d9109e8202aaa8df836f2d23922008bdf2c72 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Wed, 12 Sep 2012 13:08:26 +0200 Subject: [PATCH 05/16] Add preliminary blink stubs. Real implementation is still missing. --- st.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/st.c b/st.c index f3b0b08..5e8cf02 100644 --- a/st.c +++ b/st.c @@ -77,6 +77,7 @@ enum glyph_attribute { ATTR_BOLD = 4, ATTR_GFX = 8, ATTR_ITALIC = 16, + ATTR_BLINK = 32, }; enum cursor_movement { @@ -1133,7 +1134,7 @@ tsetattr(int *attr, int l) { switch(attr[i]) { case 0: term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE | ATTR_BOLD \ - | ATTR_ITALIC); + | ATTR_ITALIC | ATTR_BLINK); term.c.attr.fg = DefaultFG; term.c.attr.bg = DefaultBG; break; @@ -1146,6 +1147,9 @@ tsetattr(int *attr, int l) { case 4: term.c.attr.mode |= ATTR_UNDERLINE; break; + case 5: + term.c.attr.mode |= ATTR_BLINK; + break; case 7: term.c.attr.mode |= ATTR_REVERSE; break; @@ -1158,6 +1162,9 @@ tsetattr(int *attr, int l) { case 24: term.c.attr.mode &= ~ATTR_UNDERLINE; break; + case 25: + term.c.attr.mode &= ~ATTR_BLINK; + break; case 27: term.c.attr.mode &= ~ATTR_REVERSE; break; -- 2.20.1 From 8f1144edee8f4c9ac54faae2ad522544e9e217fa Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Wed, 12 Sep 2012 13:20:10 +0200 Subject: [PATCH 06/16] Make nyancat(1) work. Important release feature! --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/st.c b/st.c index 5e8cf02..75c6cea 100644 --- a/st.c +++ b/st.c @@ -1204,7 +1204,7 @@ tsetattr(int *attr, int l) { else if(BETWEEN(attr[i], 90, 97)) term.c.attr.fg = attr[i] - 90 + 8; else if(BETWEEN(attr[i], 100, 107)) - term.c.attr.fg = attr[i] - 100 + 8; + term.c.attr.bg = attr[i] - 100 + 8; else fprintf(stderr, "erresc(default): gfx attr %d unknown\n", attr[i]), csidump(); break; -- 2.20.1 From b9d5fec4f277b688b3bb4741134abf152e801e90 Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Wed, 12 Sep 2012 21:25:35 +0200 Subject: [PATCH 07/16] Add xmalloc and xrealloc wrappers If malloc or realloc fail they return NULL. Theorically this condition should be tested in the code, but it's a strange condition today (basically if this is hapenning thenyou have a big problem), and even Linux never returns NULL in the default configuration (only if the process don't have room in the space address, something a bit impossible in the case of st). But stis enough small for being executed in low resources computers where this can be a real problem. So the easy way is creating a wrappers function for them and call to die in case of error. --- st.c | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) --- st.c | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/st.c b/st.c index 75c6cea..8741145 100644 --- a/st.c +++ b/st.c @@ -326,6 +326,9 @@ static int utf8encode(long *, char *); static int utf8size(char *); static int isfullutf8(char *, int); +static void *xmalloc(size_t); +static void *xrealloc(void *, size_t); + static void (*handler[LASTEvent])(XEvent *) = { [KeyPress] = kpress, [ClientMessage] = cmessage, @@ -359,6 +362,21 @@ static char *opt_title = NULL; static char *opt_embed = NULL; static char *opt_class = NULL; +void * +xmalloc(size_t len) { + void *p = malloc(len); + if(!p) + die("Out of memory"); + return p; +} + +void * +xrealloc(void *p, size_t len) { + if((p = realloc(p, len)) == NULL) + die("Out of memory"); + return p; +} + int utf8decode(char *s, long *u) { uchar c; @@ -565,7 +583,7 @@ selcopy(void) { else { bufsize = (term.col+1) * (sel.e.y-sel.b.y+1) * UTF_SIZ; - ptr = str = malloc(bufsize); + ptr = str = xmalloc(bufsize); /* append every set & selected glyph to the selection */ for(y = 0; y < term.row; y++) { @@ -918,14 +936,14 @@ void tnew(int col, int row) { /* set screen size */ term.row = row, term.col = col; - term.line = malloc(term.row * sizeof(Line)); - term.alt = malloc(term.row * sizeof(Line)); - term.dirty = malloc(term.row * sizeof(*term.dirty)); - term.tabs = malloc(term.col * sizeof(*term.tabs)); + term.line = xmalloc(term.row * sizeof(Line)); + term.alt = xmalloc(term.row * sizeof(Line)); + term.dirty = xmalloc(term.row * sizeof(*term.dirty)); + term.tabs = xmalloc(term.col * sizeof(*term.tabs)); for(row = 0; row < term.row; row++) { - term.line[row] = malloc(term.col * sizeof(Glyph)); - term.alt [row] = malloc(term.col * sizeof(Glyph)); + term.line[row] = xmalloc(term.col * sizeof(Glyph)); + term.alt [row] = xmalloc(term.col * sizeof(Glyph)); term.dirty[row] = 0; } memset(term.tabs, 0, term.col * sizeof(*term.tabs)); @@ -1761,16 +1779,16 @@ tresize(int col, int row) { } /* resize to new height */ - term.line = realloc(term.line, row * sizeof(Line)); - term.alt = realloc(term.alt, row * sizeof(Line)); - term.dirty = realloc(term.dirty, row * sizeof(*term.dirty)); - term.tabs = realloc(term.tabs, col * sizeof(*term.tabs)); + term.line = xrealloc(term.line, row * sizeof(Line)); + term.alt = xrealloc(term.alt, row * sizeof(Line)); + term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); + term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); /* resize each row to new width, zero-pad if needed */ for(i = 0; i < minrow; i++) { term.dirty[i] = 1; - term.line[i] = realloc(term.line[i], col * sizeof(Glyph)); - term.alt[i] = realloc(term.alt[i], col * sizeof(Glyph)); + term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); + term.alt[i] = xrealloc(term.alt[i], col * sizeof(Glyph)); for(x = mincol; x < col; x++) { term.line[i][x].state = 0; term.alt[i][x].state = 0; -- 2.20.1 From 720cb816dcff55f8b75bdc2a8ffa265f460f5d55 Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Wed, 12 Sep 2012 21:51:55 +0200 Subject: [PATCH 08/16] Remove buffering to fileio instead of calling fflush By default text files are line buffered, and this means that -f option will not write the line until a \n is printed. This is not very useful for debugging, so a call to fflush was added. This patch substitute this call (which will be done by each character painted) by the full remove of the buffering in the file. --- st.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) --- st.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/st.c b/st.c index 8741145..19d0a86 100644 --- a/st.c +++ b/st.c @@ -355,7 +355,7 @@ static STREscape strescseq; static int cmdfd; static pid_t pid; static Selection sel; -static FILE *fileio; +static int iofd = -1; static char **opt_cmd = NULL; static char *opt_io = NULL; static char *opt_title = NULL; @@ -821,9 +821,9 @@ ttynew(void) { signal(SIGCHLD, sigchld); if(opt_io) { if(!strcmp(opt_io, "-")) { - fileio = stdout; + iofd = STDOUT_FILENO; } else { - if(!(fileio = fopen(opt_io, "w"))) { + if((iofd = open(opt_io, O_WRONLY | O_CREAT, 0666)) < 0) { fprintf(stderr, "Error opening %s:%s\n", opt_io, strerror(errno)); } @@ -1599,10 +1599,8 @@ void tputc(char *c) { char ascii = *c; - if(fileio) { - putc(ascii, fileio); - fflush(fileio); - } + if(iofd != -1) + write(iofd, c, 1); if(term.esc & ESC_START) { if(term.esc & ESC_CSI) { -- 2.20.1 From d018c9c8efc3e1781d84d7b7d24e9531bb841b34 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 13 Sep 2012 07:04:34 +0200 Subject: [PATCH 09/16] Adding another bold off sequence. --- st.c | 1 + 1 file changed, 1 insertion(+) diff --git a/st.c b/st.c index 19d0a86..0db81f4 100644 --- a/st.c +++ b/st.c @@ -1171,6 +1171,7 @@ tsetattr(int *attr, int l) { case 7: term.c.attr.mode |= ATTR_REVERSE; break; + case 21: case 22: term.c.attr.mode &= ~ATTR_BOLD; break; -- 2.20.1 From 977c5d908903c4c300b02811382a9ab53ec73803 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 13 Sep 2012 07:04:59 +0200 Subject: [PATCH 10/16] Adding a statemant on legacy support. --- LEGACY | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 LEGACY diff --git a/LEGACY b/LEGACY new file mode 100644 index 0000000..6aca893 --- /dev/null +++ b/LEGACY @@ -0,0 +1,17 @@ +A STATEMENT ON LEGACY SUPPORT + +In the terminal world there is much cruft that comes from old and unsup‐ +ported terminals that inherit incompatible modes and escape sequences +which noone is able to know, except when he/she comes from that time and +developed a graphical vt100 emulator at that time. + +One goal of st is to only support what is really needed. When you en‐ +counter a sequence which you really need, implement it. But while you +are add it, do not add the other cruft you might encounter while sneek‐ +ing at other terminal emulators. History has bloated them and there is +no real evidence that most of the sequences are used today. + + +Christoph Lohmann <20h@r-36.net> +2012-09-13T07:00:36.081271045+02:00 + -- 2.20.1 From fe2ba95b3d81127b98a5dc6fa0341a90beabd1a0 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 13 Sep 2012 07:16:38 +0200 Subject: [PATCH 11/16] Reset window title on terminal reset too. --- st.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/st.c b/st.c index 0db81f4..fe2b922 100644 --- a/st.c +++ b/st.c @@ -296,6 +296,7 @@ static void xcopy(void); static void xdrawcursor(void); static void xinit(void); static void xloadcols(void); +static void xresettitle(void); static void xseturgency(int); static void xsetsel(char*); static void xresize(int, int); @@ -1684,6 +1685,7 @@ tputc(char *c) { case 'c': /* RIS -- Reset to inital state */ treset(); term.esc = 0; + xresettitle(); break; case '=': /* DECPAM -- Application keypad */ term.mode |= MODE_APPKEYPAD; @@ -2026,7 +2028,7 @@ xinit(void) { xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); - XStoreName(xw.dpy, xw.win, opt_title ? opt_title : "st"); + xresettitle(); XMapWindow(xw.dpy, xw.win); xhints(); XSync(xw.dpy, 0); @@ -2122,6 +2124,11 @@ xdrawcursor(void) { xcopy(); } +void +xresettitle(void) { + XStoreName(xw.dpy, xw.win, opt_title ? opt_title : "st"); +} + void redraw(void) { struct timespec tv = {0, REDRAW_TIMEOUT * 1000}; -- 2.20.1 From 776a022e39a3c8f7c81b35d6b4307ffaa0ae3df8 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 13 Sep 2012 23:19:57 +0200 Subject: [PATCH 12/16] Importing the patch of Roberto Vargas to inherit signal handlers. --- st.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/st.c b/st.c index fe2b922..c2ee3e2 100644 --- a/st.c +++ b/st.c @@ -774,6 +774,13 @@ execsh(void) { unsetenv("LINES"); unsetenv("TERMCAP"); + signal(SIGCHLD, SIG_DFL); + signal(SIGHUP, SIG_DFL); + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + signal(SIGALRM, SIG_DFL); + DEFAULT(envshell, SHELL); putenv("TERM="TNAME); args = opt_cmd ? opt_cmd : (char*[]){envshell, "-i", NULL}; -- 2.20.1 From b1563526561a913dc2a69ee78eb5aaa09cc98978 Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Thu, 13 Sep 2012 23:21:40 +0200 Subject: [PATCH 13/16] Ignore NUL character as a padding character. Telnet may use this. Patch of Roberto Vargas. --- st.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/st.c b/st.c index c2ee3e2..da895c6 100644 --- a/st.c +++ b/st.c @@ -1723,6 +1723,8 @@ tputc(char *c) { if(sel.bx != -1 && BETWEEN(term.c.y, sel.by, sel.ey)) sel.bx = -1; switch(ascii) { + case '\0': /* padding character, do nothing */ + break; case '\t': tputtab(1); break; -- 2.20.1 From a62789788c87425fd90209bad15b324f8dee84da Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Fri, 14 Sep 2012 19:46:07 +0200 Subject: [PATCH 14/16] Implementing italic-bold. This will require an increase of the avgWdth. --- config.def.h | 7 ++++--- st.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/config.def.h b/config.def.h index 0aef8be..f0e5556 100644 --- a/config.def.h +++ b/config.def.h @@ -1,8 +1,9 @@ -#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-60-*-*" -#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-60-*-*" +#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-70-*-*" +#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-70-*-*" /* If italic is not availbel, fall back to bold. */ -#define ITALICFONT "-*-*-medium-o-*-*-*-120-75-75-*-60-*-*," BOLDFONT +#define ITALICFONT "-*-*-medium-o-*-*-*-120-75-75-*-70-*-*," BOLDFONT +#define ITALICBOLDFONT "-*-*-bold-o-*-*-*-120-75-75-*-70-*-*," BOLDFONT /* Space in pixels around the terminal buffer */ #define BORDER 2 diff --git a/st.c b/st.c index da895c6..2e1ac67 100644 --- a/st.c +++ b/st.c @@ -240,7 +240,7 @@ typedef struct { short lbearing; short rbearing; XFontSet set; - } font, bfont, ifont; + } font, bfont, ifont, ibfont; } DC; static void die(const char*, ...); @@ -1945,13 +1945,15 @@ xgetfontinfo(XFontSet set, int *ascent, int *descent, short *lbearing, short *rb } void -initfonts(char *fontstr, char *bfontstr, char *ifontstr) { +initfonts(char *fontstr, char *bfontstr, char *ifontstr, char *ibfontstr) { if((dc.font.set = xinitfont(fontstr)) == NULL) die("Can't load font %s\n", fontstr); if((dc.bfont.set = xinitfont(bfontstr)) == NULL) die("Can't load bfont %s\n", bfontstr); if((dc.ifont.set = xinitfont(ifontstr)) == NULL) die("Can't load ifont %s\n", ifontstr); + if((dc.ibfont.set = xinitfont(ibfontstr)) == NULL) + die("Can't load ibfont %s\n", ibfontstr); xgetfontinfo(dc.font.set, &dc.font.ascent, &dc.font.descent, &dc.font.lbearing, &dc.font.rbearing); @@ -1959,6 +1961,8 @@ initfonts(char *fontstr, char *bfontstr, char *ifontstr) { &dc.bfont.lbearing, &dc.bfont.rbearing); xgetfontinfo(dc.ifont.set, &dc.ifont.ascent, &dc.ifont.descent, &dc.ifont.lbearing, &dc.ifont.rbearing); + xgetfontinfo(dc.ibfont.set, &dc.ibfont.ascent, &dc.ibfont.descent, + &dc.ibfont.lbearing, &dc.ibfont.rbearing); } void @@ -1973,7 +1977,7 @@ xinit(void) { xw.scr = XDefaultScreen(xw.dpy); /* font */ - initfonts(FONT, BOLDFONT, ITALICFONT); + initfonts(FONT, BOLDFONT, ITALICFONT, ITALICBOLDFONT); /* XXX: Assuming same size for bold font */ xw.cw = dc.font.rbearing - dc.font.lbearing; @@ -2068,6 +2072,8 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { if(base.mode & ATTR_ITALIC) fontset = dc.ifont.set; + if(base.mode & (ATTR_ITALIC|ATTR_ITALIC)) + fontset = dc.ibfont.set; XSetBackground(xw.dpy, dc.gc, dc.col[bg]); XSetForeground(xw.dpy, dc.gc, dc.col[fg]); -- 2.20.1 From ba1e9daeef0d7e6e52a9889d8f7eb61d74480cf0 Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Sun, 16 Sep 2012 10:45:36 +0200 Subject: [PATCH 15/16] Call XdbeQueryExtension before of calling any Xdbe function XdbeQueryExtension() tells to the caller if the Xdbe extension is present in the X server, so it should be called for sanity. But like is said in XdbeQueryExtension(3): No other Xdbe functions may be called before this function. If a client violates this rule, the effects of all subsequent Xdbe calls that it makes are undefined. it is mandatory call this function. --- st.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- st.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/st.c b/st.c index 2e1ac67..b013bca 100644 --- a/st.c +++ b/st.c @@ -1970,7 +1970,7 @@ xinit(void) { XSetWindowAttributes attrs; Cursor cursor; Window parent; - int sw, sh; + int sw, sh, major, minor; if(!(xw.dpy = XOpenDisplay(NULL))) die("Can't open display\n"); @@ -2021,9 +2021,10 @@ xinit(void) { CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask | CWColormap, &attrs); + if(!XdbeQueryExtension(xw.dpy, &major, &minor)) + die("Xdbe extension is not present\n"); xw.buf = XdbeAllocateBackBufferName(xw.dpy, xw.win, XdbeCopied); - /* input methods */ xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL); xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing -- 2.20.1 From 15cc8754c2e272ebac6e86845859816e881da000 Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Sun, 16 Sep 2012 10:46:08 +0200 Subject: [PATCH 16/16] Call XSync in redraw It is necessary call to XSync if you want a good tput flash, because in other way you can not be sure that white screen will be shown. --- st.c | 1 + 1 file changed, 1 insertion(+) --- st.c | 1 + 1 file changed, 1 insertion(+) diff --git a/st.c b/st.c index b013bca..f4ad23d 100644 --- a/st.c +++ b/st.c @@ -2150,6 +2150,7 @@ redraw(void) { struct timespec tv = {0, REDRAW_TIMEOUT * 1000}; tfulldirt(); draw(); + XSync(xw.dpy, False); /* necessary for a good tput flash */ nanosleep(&tv, NULL); } -- 2.20.1