Commit Diff


commit - 416dd257274fd334be082b1138338adffa3e2d5e
commit + 323d38da20c8a1d295ab1dbc0fc7ce947ef824e1
blob - ec747cc4f3dd8caafca8d772a023c992e9bf20b8
blob + fdf697bfe14f9b943b7ffd62d09222120ec5e73e
--- st.c
+++ st.c
@@ -170,7 +170,6 @@ static char *base64dec(const char *);
 static ssize_t xwrite(int, const char *, size_t);
 
 /* Globals */
-TermWindow win;
 Term term;
 Selection sel;
 int cmdfd;
@@ -1683,11 +1682,8 @@ csihandle(void)
 	case ' ':
 		switch (csiescseq.mode[1]) {
 		case 'q': /* DECSCUSR -- Set Cursor Style */
-			DEFAULT(csiescseq.arg[0], 1);
-			if (!BETWEEN(csiescseq.arg[0], 0, 6)) {
+			if (xsetcursor(csiescseq.arg[0]))
 				goto unknown;
-			}
-			win.cursor = csiescseq.arg[0];
 			break;
 		default:
 			goto unknown;
blob - 71c79f4c83c86021aa55b3f04d8489f5c41ee399
blob + 8637d358123ea1d5cdcc850bcc571bb698eb6b15
--- st.h
+++ st.h
@@ -201,7 +201,6 @@ void *xrealloc(void *, size_t);
 char *xstrdup(char *);
 
 /* Globals */
-extern TermWindow win;
 extern Term term;
 extern Selection sel;
 extern int cmdfd;
blob - beb458d2347830b896be034819b384891798c680
blob + c6a5337680adec0e2a4544fc42e582a56d232a5b
--- win.h
+++ win.h
@@ -14,5 +14,6 @@ void xhints(void);
 void xloadcols(void);
 int xsetcolorname(int, const char *);
 void xsettitle(char *);
+int xsetcursor(int);
 void xsetpointermotion(int);
 void xsetsel(char *, Time);
blob - 24f699169c2196728905071fbd2c9d8dace5c5fd
blob + 04e2e053b9f4a505c5fe2fa255d4ed6a9806cfce
--- x.c
+++ x.c
@@ -187,6 +187,7 @@ static void (*handler[LASTEvent])(XEvent *) = {
 static DC dc;
 static XWindow xw;
 static XSelection xsel;
+static TermWindow win;
 
 enum window_state {
 	WIN_VISIBLE = 1,
@@ -1615,6 +1616,16 @@ xsetpointermotion(int set)
 	XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
 }
 
+int
+xsetcursor(int cursor)
+{
+	DEFAULT(cursor, 1);
+	if (!BETWEEN(cursor, 0, 6))
+		return 1;
+	win.cursor = cursor;
+	return 0;
+}
+
 void
 xseturgency(int add)
 {