瀏覽代碼

More stable blinking.

Christoph Lohmann 12 年之前
父節點
當前提交
8618386de9
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      st.c

+ 9 - 2
st.c

@@ -3496,8 +3496,15 @@ run(void) {
 				xev--;
 			if(!FD_ISSET(cmdfd, &rfd) && !FD_ISSET(xfd, &rfd)) {
 				if(blinkset) {
-					drawtimeout.tv_usec = 1000 * \
-						blinktimeout;
+					if(TIMEDIFF(now, lastblink) \
+							> blinktimeout) {
+						drawtimeout.tv_usec = 1;
+					} else {
+						drawtimeout.tv_usec = (1000 * \
+							(blinktimeout - \
+							TIMEDIFF(now,
+								lastblink)));
+					}
 				} else {
 					tv = NULL;
 				}