X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=df660ff23919ba6c1f86b18f56d301cdb2936413;hb=dc74c4f729a4350267f269c767aa6e377d8d4fbc;hp=e20a1e0691fb74019b5aeb75a969e82a9df063cd;hpb=45b808b88ee63f21a188800ba3473a24a3c4b987;p=st.git diff --git a/st.c b/st.c index e20a1e0..df660ff 100644 --- a/st.c +++ b/st.c @@ -36,10 +36,6 @@ char *argv0; #define Glyph Glyph_ #define Font Font_ -#define Draw XftDraw * -#define Colour XftColor -#define Colourmap Colormap -#define Rectangle XRectangle #if defined(__linux) #include @@ -180,6 +176,10 @@ typedef unsigned int uint; typedef unsigned long ulong; typedef unsigned short ushort; +typedef XftDraw *Draw; +typedef XftColor Colour; +typedef Colormap Colourmap; + typedef struct { char c[UTF_SIZ]; /* character code */ ushort mode; /* attribute flags */ @@ -1257,7 +1257,7 @@ ttyread(void) { /* process every complete utf8 char */ buflen += ret; ptr = buf; - while(charsize = utf8decode(ptr, &unicodep, buflen)) { + while((charsize = utf8decode(ptr, &unicodep, buflen))) { utf8encode(unicodep, s, UTF_SIZ); tputc(s, charsize); ptr += charsize; @@ -1855,7 +1855,10 @@ tsetmode(bool priv, bool set, int *args, int narg) { MODBIT(term.mode, set, MODE_8BIT); break; case 1049: /* swap screen & set/restore cursor as xterm */ + if (!allowaltscreen) + break; tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); + /* FALLTHRU */ case 47: /* swap screen */ case 1047: if (!allowaltscreen) @@ -2263,9 +2266,10 @@ tdumpsel(void) { char *ptr; - ptr = getsel(); - tprinter(ptr, strlen(ptr)); - free(ptr); + if((ptr = getsel())) { + tprinter(ptr, strlen(ptr)); + free(ptr); + } } void @@ -3088,7 +3092,7 @@ xinit(void) { xresettitle(); XMapWindow(xw.dpy, xw.win); xhints(); - XSync(xw.dpy, 0); + XSync(xw.dpy, False); } void @@ -3106,7 +3110,7 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) { FcCharSet *fccharset; Colour *fg, *bg, *temp, revfg, revbg, truefg, truebg; XRenderColor colfg, colbg; - Rectangle r; + XRectangle r; int oneatatime; frcflags = FRC_NORMAL; @@ -3439,7 +3443,6 @@ void redraw(int timeout) { struct timespec tv = {0, timeout * 1000}; - tfulldirt(); draw(); if(timeout > 0) { @@ -3737,8 +3740,8 @@ run(void) { else cresize(xw.fw, xw.fh); - gettimeofday(&lastblink, NULL); gettimeofday(&last, NULL); + lastblink = last; for(xev = actionfps;;) { long deltatime; @@ -3773,7 +3776,7 @@ run(void) { if(blinktimeout && TIMEDIFF(now, lastblink) > blinktimeout) { tsetdirtattr(ATTR_BLINK); term.mode ^= MODE_BLINK; - gettimeofday(&lastblink, NULL); + lastblink = now; dodraw = 1; } deltatime = TIMEDIFF(now, last);