summaryrefslogtreecommitdiff
path: root/patches/dwm-libxft-bgra.diff
blob: 8cded6cffad05f5fd8a70cc1c388ea77756e97fe (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
38
39
40
41
diff --git a/drw.c b/drw.c
index 8fd1ca4..66acbbe 100644
--- a/drw.c
+++ b/drw.c
@@ -11,6 +11,8 @@
 #define UTF_INVALID 0xFFFD
 #define UTF_SIZ     4
 
+int has_libxft_bgra = 0;
+
 static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80,    0, 0xC0, 0xE0, 0xF0};
 static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
 static const long utfmin[UTF_SIZ + 1] = {       0,    0,  0x80,  0x800,  0x10000};
@@ -139,11 +141,13 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
 	 * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
 	 * and lots more all over the internet.
 	 */
-	FcBool iscol;
-	if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
-		XftFontClose(drw->dpy, xfont);
-		return NULL;
-	}
+    if (!has_libxft_bgra){
+        FcBool iscol;
+        if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
+            XftFontClose(drw->dpy, xfont);
+            return NULL;
+        }
+    }
 
 	font = ecalloc(1, sizeof(Fnt));
 	font->xfont = xfont;
@@ -174,6 +178,8 @@ drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
 	if (!drw || !fonts)
 		return NULL;
 
+    has_libxft_bgra = !system("pacman -Q libxft | grep bgra > /dev/null 2> /dev/null");
+
 	for (i = 1; i <= fontcount; i++) {
 		if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) {
 			cur->next = ret;