aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.def.h8
-rw-r--r--st.c20
2 files changed, 24 insertions, 4 deletions
diff --git a/config.def.h b/config.def.h
index 2616dea..930e468 100644
--- a/config.def.h
+++ b/config.def.h
@@ -105,6 +105,14 @@ static unsigned int defaultfg = 7;
105static unsigned int defaultbg = 0; 105static unsigned int defaultbg = 0;
106static unsigned int defaultcs = 256; 106static unsigned int defaultcs = 256;
107 107
108
109/*
110 * Default colour and shape of the mouse cursor
111 */
112static unsigned int mouseshape = XC_xterm;
113static unsigned int mousefg = 7;
114static unsigned int mousebg = 0;
115
108/* 116/*
109 * Colors used, when the specific fg == defaultfg. So in reverse mode this 117 * Colors used, when the specific fg == defaultfg. So in reverse mode this
110 * will reverse too. Another logic would only make the simple feature too 118 * will reverse too. Another logic would only make the simple feature too
diff --git a/st.c b/st.c
index 0db3d58..1df4fde 100644
--- a/st.c
+++ b/st.c
@@ -3411,6 +3411,7 @@ xinit(void)
3411 Cursor cursor; 3411 Cursor cursor;
3412 Window parent; 3412 Window parent;
3413 pid_t thispid = getpid(); 3413 pid_t thispid = getpid();
3414 XColor xmousefg, xmousebg;
3414 3415
3415 if (!(xw.dpy = XOpenDisplay(NULL))) 3416 if (!(xw.dpy = XOpenDisplay(NULL)))
3416 die("Can't open display\n"); 3417 die("Can't open display\n");
@@ -3483,11 +3484,22 @@ xinit(void)
3483 die("XCreateIC failed. Could not obtain input method.\n"); 3484 die("XCreateIC failed. Could not obtain input method.\n");
3484 3485
3485 /* white cursor, black outline */ 3486 /* white cursor, black outline */
3486 cursor = XCreateFontCursor(xw.dpy, XC_xterm); 3487 cursor = XCreateFontCursor(xw.dpy, mouseshape);
3487 XDefineCursor(xw.dpy, xw.win, cursor); 3488 XDefineCursor(xw.dpy, xw.win, cursor);
3488 XRecolorCursor(xw.dpy, cursor, 3489
3489 &(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff}, 3490 if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
3490 &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000}); 3491 xmousefg.red = 0xffff;
3492 xmousefg.green = 0xffff;
3493 xmousefg.blue = 0xffff;
3494 }
3495
3496 if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
3497 xmousebg.red = 0x0000;
3498 xmousebg.green = 0x0000;
3499 xmousebg.blue = 0x0000;
3500 }
3501
3502 XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg);
3491 3503
3492 xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); 3504 xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
3493 xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); 3505 xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);