[wiki] [sites] st: themed_cursor patch for HiDPI displays || Jim Fowler

From: <git_AT_suckless.org>
Date: Thu, 10 Jan 2019 02:38:30 +0100

commit bd500476ffd5d61a41b207a7f11788923a7b6376
Author: Jim Fowler <fowler_AT_math.osu.edu>
Date: Wed Jan 9 20:38:17 2019 -0500

    st: themed_cursor patch for HiDPI displays

diff --git a/st.suckless.org/patches/themed_cursor/index.md b/st.suckless.org/patches/themed_cursor/index.md
new file mode 100644
index 00000000..a2958582
--- /dev/null
+++ b/st.suckless.org/patches/themed_cursor/index.md
_AT_@ -0,0 +1,20 @@
+themed_cursor
+=============
+
+Description
+-----------
+Instead of a default X cursor, use the xterm cursor from your cursor
+theme.
+
+Specifically, this replaces `XCreateFontCursor` with
+`XcursorLibraryLoadCursor` which depends on libXcursor. This is
+especially helpful on a HiDPI display.
+
+Download
+--------
+
+* [st-themed\_cursor-0.8.1.diff](st-themed_cursor-0.8.1.diff)
+
+Author
+-------
+Jim Fowler <kisonecat_AT_gmail.com>
diff --git a/st.suckless.org/patches/themed_cursor/st-themed_cursor-0.8.1.diff b/st.suckless.org/patches/themed_cursor/st-themed_cursor-0.8.1.diff
new file mode 100644
index 00000000..ee89ecc2
--- /dev/null
+++ b/st.suckless.org/patches/themed_cursor/st-themed_cursor-0.8.1.diff
_AT_@ -0,0 +1,68 @@
+diff --git a/config.def.h b/config.def.h
+index 82b1b09..ffd6cde 100644
++++ b/config.def.h
+_AT_@ -138,11 +138,10 @@ static unsigned int cols = 80;
+ static unsigned int rows = 24;
+
+ /*
+- * Default colour and shape of the mouse cursor
++ * Default shape of the mouse cursor
+ */
+-static unsigned int mouseshape = XC_xterm;
+-static unsigned int mousefg = 7;
+-static unsigned int mousebg = 0;
++
++static char* mouseshape = "xterm";
+
+ /*
+ * Color used to display font attributes when fontconfig selected a font which
+diff --git a/config.mk b/config.mk
+index 039c42c..a0cb4fd 100644
+--- a/config.mk
++++ b/config.mk
+_AT_@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib
+ INCS = -I$(X11INC) \
+ `pkg-config --cflags fontconfig` \
+ `pkg-config --cflags freetype2`
+-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
++LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXcursor \
+ `pkg-config --libs fontconfig` \
+ `pkg-config --libs freetype2`
+
+diff --git a/x.c b/x.c
+index c343ba2..5a7461e 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -14,6 +14,7 @@
+ #include <X11/keysym.h>
+ #include <X11/Xft/Xft.h>
+ #include <X11/XKBlib.h>
++#include <X11/Xcursor/Xcursor.h>
+
+ static char *argv0;
+ #include "arg.h"
+_AT_@ -1076,23 +1079,9 @@ xinit(int cols, int rows)
+ die("XCreateIC failed. Could not obtain input method.
");
+
+ /* white cursor, black outline */
+- cursor = XCreateFontCursor(xw.dpy, mouseshape);
++ cursor = XcursorLibraryLoadCursor(xw.dpy, mouseshape);
+ XDefineCursor(xw.dpy, xw.win, cursor);
+
+- 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);
+ xw.netwmname = XInternAtom(xw.dpy, "_NET_WM_NAME", False);
Received on Thu Jan 10 2019 - 02:38:30 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 10 2019 - 02:48:26 CET