Xinqi Bao's Git

Use LEN(dc.col) instead of LEN(colorname).
[st.git] / st.c
diff --git a/st.c b/st.c
index 71b1521..7f08748 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 {
@@ -2912,7 +2911,7 @@ xloadcols(void) {
        }
 
        /* load colors [0-15] and [256-LEN(colorname)] (config.h) */
-       for(i = 0; i < LEN(colorname); i++) {
+       for(i = 0; i < LEN(dc.col); i++) {
                if(!colorname[i])
                        continue;
                if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, colorname[i], &dc.col[i])) {
@@ -2943,7 +2942,7 @@ xsetcolorname(int x, const char *name) {
        XRenderColor color = { .alpha = 0xffff };
        Color ncolor;
 
-       if(!BETWEEN(x, 0, LEN(colorname)))
+       if(!BETWEEN(x, 0, LEN(dc.col)))
                return 1;
 
        if(!name) {
@@ -3739,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();
 }
 
@@ -3752,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