]> git.armaanb.net Git - st.git/blobdiff - st.c
Uses a &[] pointer loop instead of + pointer loop
[st.git] / st.c
diff --git a/st.c b/st.c
index bf5b675487b2be4c0b11807df804417ab2e7947f..5e92db20ac6d9131e206f25d32a73eef27cf2049 100644 (file)
--- a/st.c
+++ b/st.c
@@ -158,8 +158,7 @@ enum escape_state {
 
 enum window_state {
        WIN_VISIBLE = 1,
-       WIN_REDRAW  = 2,
-       WIN_FOCUSED = 4
+       WIN_FOCUSED = 2
 };
 
 enum selection_type {
@@ -1459,7 +1458,7 @@ treset(void) {
        term.top = 0;
        term.bot = term.row - 1;
        term.mode = MODE_WRAP;
-       memset(term.trantbl, sizeof(term.trantbl), CS_USA);
+       memset(term.trantbl, CS_USA, sizeof(term.trantbl));
        term.charset = 0;
 
        for(i = 0; i < 2; i++) {
@@ -2504,7 +2503,6 @@ tstrsequence(uchar c) {
        strreset();
        strescseq.type = c;
        term.esc |= ESC_STR;
-       return;
 }
 
 void
@@ -2586,7 +2584,6 @@ tcontrolcode(uchar ascii) {
        }
        /* only CAN, SUB, \a and C1 chars interrupt a sequence */
        term.esc &= ~(ESC_STR_END|ESC_STR);
-       return;
 }
 
 /*
@@ -2909,7 +2906,7 @@ xloadcols(void) {
        Color *cp;
 
        if(loaded) {
-               for (cp = dc.col; cp < dc.col + LEN(dc.col); ++cp)
+               for (cp = dc.col; cp < &dc.col[LEN(dc.col)]; ++cp)
                        XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);
        }
 
@@ -3741,12 +3738,6 @@ drawregion(int x1, int y1, int x2, int y2) {
 
 void
 expose(XEvent *ev) {
-       XExposeEvent *e = &ev->xexpose;
-
-       if(xw.state & WIN_REDRAW) {
-               if(!e->count)
-                       xw.state &= ~WIN_REDRAW;
-       }
        redraw();
 }
 
@@ -3754,12 +3745,7 @@ void
 visibility(XEvent *ev) {
        XVisibilityEvent *e = &ev->xvisibility;
 
-       if(e->state == VisibilityFullyObscured) {
-               xw.state &= ~WIN_VISIBLE;
-       } else if(!(xw.state & WIN_VISIBLE)) {
-               /* need a full redraw for next Expose, not just a buf copy */
-               xw.state |= WIN_VISIBLE | WIN_REDRAW;
-       }
+       MODBIT(xw.state, e->state != VisibilityFullyObscured, WIN_VISIBLE);
 }
 
 void
@@ -3992,7 +3978,7 @@ run(void) {
 
                clock_gettime(CLOCK_MONOTONIC, &now);
                drawtimeout.tv_sec = 0;
-               drawtimeout.tv_nsec = (1000/xfps) * 1E6;
+               drawtimeout.tv_nsec =  (1000 * 1E6)/ xfps;
                tv = &drawtimeout;
 
                dodraw = 0;
@@ -4003,8 +3989,7 @@ run(void) {
                        dodraw = 1;
                }
                deltatime = TIMEDIFF(now, last);
-               if(deltatime > (xev? (1000/xfps) : (1000/actionfps))
-                               || deltatime < 0) {
+               if(deltatime > 1000 / (xev ? xfps : actionfps)) {
                        dodraw = 1;
                        last = now;
                }
@@ -4105,7 +4090,7 @@ run:
        if(argc > 0) {
                /* eat all remaining arguments */
                opt_cmd = argv;
-               if(!opt_title)
+               if(!opt_title && !opt_line)
                        opt_title = basename(xstrdup(argv[0]));
        }
        setlocale(LC_CTYPE, "");