summaryrefslogtreecommitdiff
path: root/st/patches/st-swapmouse-0.8.4.diff
blob: d948dae6c3b5d62dfbf47e81d71febe16fb0474e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff -up st-0.8.4-ori/x.c st-0.8.4/x.c
--- st-0.8.4-ori/x.c	2020-06-19 14:59:45.000000000 +0530
+++ st-0.8.4/x.c	2020-07-20 03:39:56.260922736 +0530
@@ -254,6 +254,9 @@ static char *opt_title = NULL;
 
 static int oldbutton = 3; /* button event on startup: 3 = release */
 
+static Cursor cursor;
+static XColor xmousefg, xmousebg;
+
 void
 clipcopy(const Arg *dummy)
 {
@@ -1099,10 +1102,8 @@ void
 xinit(int cols, int rows)
 {
 	XGCValues gcvalues;
-	Cursor cursor;
 	Window parent;
 	pid_t thispid = getpid();
-	XColor xmousefg, xmousebg;
 
 	if (!(xw.dpy = XOpenDisplay(NULL)))
 		die("can't open display\n");
@@ -1683,6 +1684,12 @@ xsetmode(int set, unsigned int flags)
 {
 	int mode = win.mode;
 	MODBIT(win.mode, set, flags);
+        if (flags & MODE_MOUSE) {
+                if (win.mode & MODE_MOUSE)
+                        XUndefineCursor(xw.dpy, xw.win);
+                else
+                        XDefineCursor(xw.dpy, xw.win, cursor);
+        }
 	if ((win.mode & MODE_REVERSE) != (mode & MODE_REVERSE))
 		redraw();
 }