summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorAlex Kozadaev <akozadaev at yahoo com>2015-07-28 10:30:14 +0100
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2015-07-28 12:21:11 +0200
commitee5cad439b427fa974903a6f0bb2689d11119d89 (patch)
tree7f13e99912dffa896ec428b18d5c422ccc1ed599 /st.c
parentdc33d1d66e89ee974cc6d7cfa2efb693ce67aa86 (diff)
Adding mouse colour/shape settings
Diffstat (limited to 'st.c')
-rw-r--r--st.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/st.c b/st.c
index 0db3d58..1df4fde 100644
--- a/st.c
+++ b/st.c
@@ -3411,6 +3411,7 @@ xinit(void)
Cursor cursor;
Window parent;
pid_t thispid = getpid();
+ XColor xmousefg, xmousebg;
if (!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n");
@@ -3483,11 +3484,22 @@ xinit(void)
die("XCreateIC failed. Could not obtain input method.\n");
/* white cursor, black outline */
- cursor = XCreateFontCursor(xw.dpy, XC_xterm);
+ cursor = XCreateFontCursor(xw.dpy, mouseshape);
XDefineCursor(xw.dpy, xw.win, cursor);
- XRecolorCursor(xw.dpy, cursor,
- &(XColor){.red = 0xffff, .green = 0xffff, .blue = 0xffff},
- &(XColor){.red = 0x0000, .green = 0x0000, .blue = 0x0000});
+
+ if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
+ xmousefg.red = 0xffff;
+ xmousefg.green = 0xffff;
+ xmousefg.blue = 0xffff;
+ }
+
+ if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
+ xmousebg.red = 0x0000;
+ xmousebg.green = 0x0000;
+ xmousebg.blue = 0x0000;
+ }
+
+ XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg);
xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False);
xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);