From c95903d1aba4850a987c373b3da0138749c80a57 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 15 Feb 2018 20:28:49 +0000
Subject: [PATCH] Cursor blink rate is 2x character blink rate.

---
 src/conio/bitmap_con.c | 20 ++++++++++++++++----
 src/conio/vidmodes.h   |  1 +
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c
index 41385d1c9b..6cdb17a67a 100644
--- a/src/conio/bitmap_con.c
+++ b/src/conio/bitmap_con.c
@@ -362,7 +362,7 @@ static BOOL bitmap_draw_cursor(void)
 	if(!bitmap_initialized)
 		return ret;
 	if(vstat.curs_visible) {
-		if(vstat.blink || (!vstat.curs_blinks)) {
+		if(vstat.curs_blink || (!vstat.curs_blinks)) {
 			if(vstat.curs_start<=vstat.curs_end) {
 				xoffset=(vstat.curs_col-1)*vstat.charwidth;
 				yoffset=(vstat.curs_row-1)*vstat.charheight;
@@ -608,12 +608,24 @@ static void blinker_thread(void *data)
 			SLEEP(10);
 		} while(locked_screen_check()==NULL);
 		count++;
+		if (count==25) {
+			pthread_mutex_lock(&vstatlock);
+			if(vstat.curs_blink)
+				vstat.curs_blink=FALSE;
+			else
+				vstat.curs_blink=TRUE;
+			pthread_mutex_unlock(&vstatlock);
+		}
 		if(count==50) {
 			pthread_mutex_lock(&vstatlock);
 			if(vstat.blink)
 				vstat.blink=FALSE;
 			else
 				vstat.blink=TRUE;
+			if(vstat.curs_blink)
+				vstat.curs_blink=FALSE;
+			else
+				vstat.curs_blink=TRUE;
 			count=0;
 			pthread_mutex_unlock(&vstatlock);
 		}
@@ -624,7 +636,7 @@ static void blinker_thread(void *data)
 				request_redraw();
 		}
 		else {
-			if (count==0)
+			if (count==0 || count==25)
 				if (update_from_vmem(FALSE))
 					request_redraw();
 		}
@@ -697,8 +709,8 @@ static int update_from_vmem(int force)
 	/* Redraw cursor? */
 	if(vstat.curs_visible							// Visible
 			&& vstat.curs_start <= vstat.curs_end	// Should be drawn
-			&& vstat.curs_blinks						// Is blinking
-			&& vstat.blink != vs.blink)				// Blink has changed
+			&& vstat.curs_blinks					// Is blinking
+			&& vstat.curs_blink != vs.curs_blink)	// Blink has changed
 		redraw_cursor=1;
 
 	/* Did the meaning of the blink bit change? */
diff --git a/src/conio/vidmodes.h b/src/conio/vidmodes.h
index 6bb421df89..d5ea078e38 100644
--- a/src/conio/vidmodes.h
+++ b/src/conio/vidmodes.h
@@ -85,6 +85,7 @@ struct video_stats {
 	int charwidth;
 	int bright_background;
 	int blink;
+	int curs_blink;
 	int no_bright;
 	int no_blink;
 	int bright_altcharset;
-- 
GitLab