1 |
commit: ca4f7fd3384bbcee5040f250a7f1229aa006184b |
2 |
Author: Michael Weber <xmw <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 5 11:58:36 2012 +0000 |
4 |
Commit: Michael Weber <xmw <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 5 11:58:36 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/xmw.git;a=commit;h=ca4f7fd3 |
7 |
|
8 |
x11-misc/dmenu: thanks jer for adding xft in the main tree. |
9 |
|
10 |
--- |
11 |
x11-misc/dmenu/ChangeLog | 17 -- |
12 |
x11-misc/dmenu/Manifest | 20 -- |
13 |
x11-misc/dmenu/dmenu-4.3.1.ebuild | 48 ---- |
14 |
x11-misc/dmenu/dmenu-4.4.1-r2.ebuild | 48 ---- |
15 |
x11-misc/dmenu/dmenu-4.5.ebuild | 45 --- |
16 |
x11-misc/dmenu/files/dmenu-4.3.1-xft.patch | 381 -------------------------- |
17 |
x11-misc/dmenu/files/dmenu-4.4.1-xft.patch | 405 ---------------------------- |
18 |
x11-misc/dmenu/metadata.xml | 9 - |
19 |
8 files changed, 0 insertions(+), 973 deletions(-) |
20 |
|
21 |
diff --git a/x11-misc/dmenu/ChangeLog b/x11-misc/dmenu/ChangeLog |
22 |
deleted file mode 100644 |
23 |
index 17ca746..0000000 |
24 |
--- a/x11-misc/dmenu/ChangeLog |
25 |
+++ /dev/null |
26 |
@@ -1,17 +0,0 @@ |
27 |
-# ChangeLog for x11-misc/dmenu |
28 |
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
29 |
-# $Header: $ |
30 |
- |
31 |
-*dmenu-4.5 (10 Jan 2012) |
32 |
-*dmenu-4.4.1-r2 (10 Jan 2012) |
33 |
- |
34 |
- 10 Jan 2012; Michael Weber <xmw@g.o> +dmenu-4.4.1-r2.ebuild, |
35 |
- +files/dmenu-4.4.1-xft.patch, +dmenu-4.5.ebuild: |
36 |
- xft patched 4.4.1, version bump to 4.5 |
37 |
- |
38 |
-*dmenu-4.3.1 (31 May 2011) |
39 |
- |
40 |
- 31 May 2011; Michael Weber <xmw@g.o> +dmenu-4.3.1.ebuild, |
41 |
- +files/dmenu-4.3.1-xft.patch, +metadata.xml: |
42 |
- Initial import w/ xft patch |
43 |
- |
44 |
|
45 |
diff --git a/x11-misc/dmenu/Manifest b/x11-misc/dmenu/Manifest |
46 |
deleted file mode 100644 |
47 |
index 9fbb9ed..0000000 |
48 |
--- a/x11-misc/dmenu/Manifest |
49 |
+++ /dev/null |
50 |
@@ -1,20 +0,0 @@ |
51 |
------BEGIN PGP SIGNED MESSAGE----- |
52 |
-Hash: SHA256 |
53 |
- |
54 |
-AUX dmenu-4.3.1-xft.patch 11711 RMD160 43c39e128d6fbe07e81945ef5567153d709fe2a4 SHA1 0f893f21406e4d292b0c1e9b96efe31957103bd6 SHA256 61ef78f8b6105828e4120cb3a15c994f92bbec8b909c7a34fa9fda24f7dd17e7 |
55 |
-AUX dmenu-4.4.1-xft.patch 12279 RMD160 d2b02e2f40ebdb00542dc2261f163f6ce731a1b5 SHA1 f5c9d9c956355379d225169c44fac81e8dc4c52f SHA256 6866e820481f1dc411f542f79240ea89e187f6e1394d62b69874fcc29f3ebe7f |
56 |
-DIST dmenu-4.3.1.tar.gz 8905 RMD160 61675030c88c31bce88c6d2a2e408b28f622b68c SHA1 c22c468f9383ff485feacb9662571c4d1601aca3 SHA256 7da646228b52a2a5966b27190701e9514c08ee16ac538404b5dfa13b10b3c0ca |
57 |
-DIST dmenu-4.4.1.tar.gz 9318 RMD160 4a15486eaf19fdde93e763ec340001e5e74ac2a4 SHA1 42f8bb4b8bf72840cc343f0b3f31975a22350e5a SHA256 6d641645ab610d98d847b9a64500be7cc0e75bff5342534906936afa6ddb4550 |
58 |
-DIST dmenu-4.5.tar.gz 11543 RMD160 b771a84e0e9a8fbb29317c07fa77f92b64dcdc2f SHA1 70c1a13b950b7b0cb1bc35e30c6e861a78359953 SHA256 082cd698d82125ca0b3989006fb84ac4675c2a5585bf5bb8af0ea09cfb95a850 |
59 |
-EBUILD dmenu-4.3.1.ebuild 1256 RMD160 9e1d2448873906c9ca449dff1443ffd8978235cd SHA1 7f20eea3ea0394cb26dd7fde942a31c32cbe6c65 SHA256 63e98a85ed550a57ca3216a969e209567b7dc53d445186a5338f217203ed723a |
60 |
-EBUILD dmenu-4.4.1-r2.ebuild 1293 RMD160 6829e4ef5232a34a706b4abf0c1c42bfa0e6a9df SHA1 6c3cb743c4c9e7bd170d5f4e68765edcc239e485 SHA256 e53a101a670c9a99eed42f71db34f624f26bfac29e75b941bead00e7b83b9152 |
61 |
-EBUILD dmenu-4.5.ebuild 1150 RMD160 ba9ba9f5820dd59973b5dfcbbec297299ac9ceb7 SHA1 3d91b58bf8a1fd2f9586ee71b07c0a720084a5a4 SHA256 431a3a679873bc7da7bff660a1ec5ca0d6a70cdf5bf6bd06bab18c570d811198 |
62 |
-MISC ChangeLog 507 RMD160 b5142114c0ecfc63ef2e6764e28c0dbe09a1fd81 SHA1 1daea8c57b6b9001707791af630f8758573ec63a SHA256 d8488888731d361ef7135a1c2aa5ae5b1213b07ef8727ec1f16a706c075ea759 |
63 |
-MISC metadata.xml 244 RMD160 ba31bc851ce5d8e007b223b4f799d84d4c6699d0 SHA1 2192e855054fb7016488afba3eda6d938fdf925d SHA256 1022f65be1952b5197408dfbf61543b61557601ce3a9f15acabeb3e9d84a0fbe |
64 |
------BEGIN PGP SIGNATURE----- |
65 |
-Version: GnuPG v2.0.17 (GNU/Linux) |
66 |
- |
67 |
-iF4EAREIAAYFAk8LpTEACgkQknrdDGLu8JDxLwD/dkfEXcNzicvP64KmColPJZZm |
68 |
-TKplRSpeyEjSIUhfBsEA+wcr72OybJtgQwQ60EnhaDBpV2LaquZkBRSC9GA4BaT3 |
69 |
-=ydEL |
70 |
------END PGP SIGNATURE----- |
71 |
|
72 |
diff --git a/x11-misc/dmenu/dmenu-4.3.1.ebuild b/x11-misc/dmenu/dmenu-4.3.1.ebuild |
73 |
deleted file mode 100644 |
74 |
index aa06b5e..0000000 |
75 |
--- a/x11-misc/dmenu/dmenu-4.3.1.ebuild |
76 |
+++ /dev/null |
77 |
@@ -1,48 +0,0 @@ |
78 |
-# Copyright 1999-2011 Gentoo Foundation |
79 |
-# Distributed under the terms of the GNU General Public License v2 |
80 |
-# $Header: /var/cvsroot/gentoo-x86/x11-misc/dmenu/dmenu-4.2.1.ebuild,v 1.5 2011/03/16 21:17:05 xarthisius Exp $ |
81 |
- |
82 |
-EAPI="2" |
83 |
- |
84 |
-inherit eutils toolchain-funcs |
85 |
- |
86 |
-DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System" |
87 |
-HOMEPAGE="http://www.suckless.org/programs/dmenu.html" |
88 |
-SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz" |
89 |
- |
90 |
-LICENSE="MIT" |
91 |
-SLOT="0" |
92 |
-KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd" |
93 |
-IUSE="xft xinerama" |
94 |
- |
95 |
-DEPEND="x11-libs/libX11 |
96 |
- xinerama? ( x11-libs/libXinerama )" |
97 |
-RDEPEND=${DEPEND} |
98 |
- |
99 |
-src_prepare() { |
100 |
- if use xft ; then |
101 |
- epatch "${FILESDIR}/${P}-xft.patch" |
102 |
- fi |
103 |
- |
104 |
- sed -i \ |
105 |
- -e "s/CFLAGS = -ansi -pedantic -Wall -Os/CFLAGS += -ansi -pedantic -Wall/" \ |
106 |
- -e "s/LDFLAGS = -s/LDFLAGS += -g/" \ |
107 |
- -e "s/XINERAMALIBS =/XINERAMALIBS ?=/" \ |
108 |
- -e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \ |
109 |
- config.mk || die "sed failed" |
110 |
-} |
111 |
- |
112 |
-src_compile() { |
113 |
- if use xinerama; then |
114 |
- emake CC=$(tc-getCC) || die "emake failed" |
115 |
- else |
116 |
- emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS="" \ |
117 |
- || die "emake failed" |
118 |
- fi |
119 |
-} |
120 |
- |
121 |
-src_install() { |
122 |
- emake DESTDIR="${D}" PREFIX="/usr" install || die "emake install failed" |
123 |
- |
124 |
- dodoc README |
125 |
-} |
126 |
|
127 |
diff --git a/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild b/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild |
128 |
deleted file mode 100644 |
129 |
index d3e3aa2..0000000 |
130 |
--- a/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild |
131 |
+++ /dev/null |
132 |
@@ -1,48 +0,0 @@ |
133 |
-# Copyright 1999-2012 Gentoo Foundation |
134 |
-# Distributed under the terms of the GNU General Public License v2 |
135 |
-# $Header: /var/cvsroot/gentoo-x86/x11-misc/dmenu/dmenu-4.4.1-r1.ebuild,v 1.2 2011/11/28 00:06:51 jer Exp $ |
136 |
- |
137 |
-EAPI="4" |
138 |
- |
139 |
-inherit eutils toolchain-funcs |
140 |
- |
141 |
-DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System" |
142 |
-HOMEPAGE="http://www.suckless.org/programs/dmenu.html" |
143 |
-SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz" |
144 |
- |
145 |
-LICENSE="MIT" |
146 |
-SLOT="0" |
147 |
-KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd" |
148 |
-IUSE="xft xinerama" |
149 |
- |
150 |
-DEPEND="x11-libs/libX11 |
151 |
- xinerama? ( x11-libs/libXinerama )" |
152 |
-RDEPEND="${DEPEND}" |
153 |
- |
154 |
-src_prepare() { |
155 |
- if use xft ; then |
156 |
- epatch "${FILESDIR}/${P}-xft.patch" |
157 |
- fi |
158 |
- |
159 |
- sed -i \ |
160 |
- -e "s/CFLAGS = -ansi -pedantic -Wall -Os/CFLAGS += -ansi -pedantic -Wall/" \ |
161 |
- -e "s/LDFLAGS = -s/LDFLAGS +=/" \ |
162 |
- -e "s/XINERAMALIBS =/XINERAMALIBS ?=/" \ |
163 |
- -e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \ |
164 |
- config.mk || die |
165 |
- sed -i -e 's|lsx|dmenu_&|g' dmenu_run lsx.1 lsx.c || die |
166 |
-} |
167 |
- |
168 |
-src_compile() { |
169 |
- if use xinerama; then |
170 |
- emake CC=$(tc-getCC) |
171 |
- else |
172 |
- emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS="" |
173 |
- fi |
174 |
-} |
175 |
- |
176 |
-src_install() { |
177 |
- emake DESTDIR="${D}" PREFIX="/usr" install |
178 |
- mv "${D}"/usr/bin/{,dmenu_}lsx || die |
179 |
- mv "${D}"/usr/share/man/man1/{,dmenu_}lsx.1 || die |
180 |
-} |
181 |
|
182 |
diff --git a/x11-misc/dmenu/dmenu-4.5.ebuild b/x11-misc/dmenu/dmenu-4.5.ebuild |
183 |
deleted file mode 100644 |
184 |
index c59345e..0000000 |
185 |
--- a/x11-misc/dmenu/dmenu-4.5.ebuild |
186 |
+++ /dev/null |
187 |
@@ -1,45 +0,0 @@ |
188 |
-# Copyright 1999-2012 Gentoo Foundation |
189 |
-# Distributed under the terms of the GNU General Public License v2 |
190 |
-# $Header: /var/cvsroot/gentoo-x86/x11-misc/dmenu/dmenu-4.4.1-r1.ebuild,v 1.2 2011/11/28 00:06:51 jer Exp $ |
191 |
- |
192 |
-EAPI="4" |
193 |
- |
194 |
-inherit eutils toolchain-funcs |
195 |
- |
196 |
-DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System" |
197 |
-HOMEPAGE="http://www.suckless.org/programs/dmenu.html" |
198 |
-SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz" |
199 |
- |
200 |
-LICENSE="MIT" |
201 |
-SLOT="0" |
202 |
-KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd" |
203 |
-IUSE="xinerama" |
204 |
- |
205 |
-DEPEND="x11-libs/libX11 |
206 |
- xinerama? ( x11-libs/libXinerama )" |
207 |
-RDEPEND="${DEPEND}" |
208 |
- |
209 |
-src_prepare() { |
210 |
- #if use xft ; then |
211 |
- # epatch "${FILESDIR}/${PN}-4.4.1-xft.patch" |
212 |
- #fi |
213 |
- |
214 |
- sed -i \ |
215 |
- -e "s/CFLAGS = -ansi -pedantic -Wall -Os/CFLAGS += -ansi -pedantic -Wall/" \ |
216 |
- -e "s/LDFLAGS = -s/LDFLAGS +=/" \ |
217 |
- -e "s/XINERAMALIBS =/XINERAMALIBS ?=/" \ |
218 |
- -e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \ |
219 |
- config.mk || die |
220 |
-} |
221 |
- |
222 |
-src_compile() { |
223 |
- if use xinerama; then |
224 |
- emake CC=$(tc-getCC) |
225 |
- else |
226 |
- emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS="" |
227 |
- fi |
228 |
-} |
229 |
- |
230 |
-src_install() { |
231 |
- emake DESTDIR="${D}" PREFIX="/usr" install |
232 |
-} |
233 |
|
234 |
diff --git a/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch b/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch |
235 |
deleted file mode 100644 |
236 |
index 0a2d7fb..0000000 |
237 |
--- a/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch |
238 |
+++ /dev/null |
239 |
@@ -1,381 +0,0 @@ |
240 |
-diff -rup dmenu-4.3.1/config.mk dmenu-xft/config.mk |
241 |
---- dmenu-4.3.1/config.mk 2011-05-18 21:32:16.000000000 +0530 |
242 |
-+++ dmenu-xft/config.mk 2011-05-20 03:14:15.000000000 +0530 |
243 |
-@@ -2,19 +2,24 @@ |
244 |
- VERSION = 4.3.1 |
245 |
- |
246 |
- # paths |
247 |
--PREFIX = /usr/local |
248 |
--MANPREFIX = ${PREFIX}/share/man |
249 |
-+PREFIX = /usr |
250 |
-+MANPREFIX = ${PREFIX}/share |
251 |
- |
252 |
- X11INC = /usr/X11R6/include |
253 |
- X11LIB = /usr/X11R6/lib |
254 |
- |
255 |
-+# Xft, comment if you don't want it |
256 |
-+XFTINC = /usr/include/freetype2 |
257 |
-+XFTLIBS = -lXft -lXrender -lfreetype -lz -lfontconfig |
258 |
-+ |
259 |
-+ |
260 |
- # Xinerama, comment if you don't want it |
261 |
- XINERAMALIBS = -lXinerama |
262 |
- XINERAMAFLAGS = -DXINERAMA |
263 |
- |
264 |
- # includes and libs |
265 |
--INCS = -I${X11INC} |
266 |
--LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} |
267 |
-+INCS = -I${X11INC} -I${XFTINC} |
268 |
-+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${XFTLIBS} |
269 |
- |
270 |
- # flags |
271 |
- CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} |
272 |
-diff -rup dmenu-4.3.1/dmenu.c dmenu-xft/dmenu.c |
273 |
---- dmenu-4.3.1/dmenu.c 2011-05-18 21:32:16.000000000 +0530 |
274 |
-+++ dmenu-xft/dmenu.c 2011-05-20 03:12:16.000000000 +0530 |
275 |
-@@ -16,6 +16,8 @@ |
276 |
- #define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh)) |
277 |
- #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
278 |
- #define MAX(a,b) ((a) > (b) ? (a) : (b)) |
279 |
-+#define DEFFONT "fixed" /* xft example: "Monospace-11" */ |
280 |
-+ |
281 |
- |
282 |
- typedef struct Item Item; |
283 |
- struct Item { |
284 |
-@@ -49,8 +51,8 @@ static const char *normbgcolor = "#ccccc |
285 |
- static const char *normfgcolor = "#000000"; |
286 |
- static const char *selbgcolor = "#0066ff"; |
287 |
- static const char *selfgcolor = "#ffffff"; |
288 |
--static unsigned long normcol[ColLast]; |
289 |
--static unsigned long selcol[ColLast]; |
290 |
-+static ColorSet *normcol; |
291 |
-+static ColorSet *selcol; |
292 |
- static Atom utf8; |
293 |
- static Bool topbar = True; |
294 |
- static DC *dc; |
295 |
-@@ -99,7 +101,9 @@ main(int argc, char *argv[]) { |
296 |
- usage(); |
297 |
- |
298 |
- dc = initdc(); |
299 |
-- initfont(dc, font); |
300 |
-+ initfont(dc, font ? font : DEFFONT); |
301 |
-+ normcol = initcolor(dc, normfgcolor, normbgcolor); |
302 |
-+ selcol = initcolor(dc, selfgcolor, selbgcolor); |
303 |
- |
304 |
- if(fast) { |
305 |
- grabkeyboard(); |
306 |
-@@ -151,7 +155,8 @@ drawmenu(void) { |
307 |
- dc->x = 0; |
308 |
- dc->y = 0; |
309 |
- dc->h = bh; |
310 |
-- drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol)); |
311 |
-+ drawrect(dc, 0, 0, mw, mh, True, normcol->BG); |
312 |
-+ |
313 |
- |
314 |
- if(prompt) { |
315 |
- dc->w = promptw; |
316 |
-@@ -161,7 +166,7 @@ drawmenu(void) { |
317 |
- dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw; |
318 |
- drawtext(dc, text, normcol); |
319 |
- if((curpos = textnw(dc, text, cursor) + dc->h/2 - 2) < dc->w) |
320 |
-- drawrect(dc, curpos, 2, 1, dc->h - 4, True, FG(dc, normcol)); |
321 |
-+ drawrect(dc, curpos, 2, 1, dc->h - 4, True, normcol->FG); |
322 |
- |
323 |
- if(lines > 0) { |
324 |
- dc->w = mw - dc->x; |
325 |
-@@ -495,11 +500,12 @@ setup(void) { |
326 |
- XineramaScreenInfo *info; |
327 |
- #endif |
328 |
- |
329 |
-+ /* |
330 |
- normcol[ColBG] = getcolor(dc, normbgcolor); |
331 |
- normcol[ColFG] = getcolor(dc, normfgcolor); |
332 |
- selcol[ColBG] = getcolor(dc, selbgcolor); |
333 |
- selcol[ColFG] = getcolor(dc, selfgcolor); |
334 |
-- |
335 |
-+*/ |
336 |
- utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False); |
337 |
- |
338 |
- /* menu geometry */ |
339 |
-Only in dmenu-4.3.1: dmenu_path |
340 |
-Only in dmenu-4.3.1: dmenu_run |
341 |
-diff -rup dmenu-4.3.1/draw.c dmenu-xft/draw.c |
342 |
---- dmenu-4.3.1/draw.c 2011-05-18 21:32:16.000000000 +0530 |
343 |
-+++ dmenu-xft/draw.c 2011-05-20 03:16:36.000000000 +0530 |
344 |
-@@ -5,13 +5,11 @@ |
345 |
- #include <stdlib.h> |
346 |
- #include <string.h> |
347 |
- #include <X11/Xlib.h> |
348 |
-+#include <X11/Xft/Xft.h> |
349 |
- #include "draw.h" |
350 |
- |
351 |
- #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
352 |
- #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
353 |
--#define DEFAULTFN "fixed" |
354 |
-- |
355 |
--static Bool loadfont(DC *dc, const char *fontstr); |
356 |
- |
357 |
- void |
358 |
- drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color) { |
359 |
-@@ -23,7 +21,7 @@ drawrect(DC *dc, int x, int y, unsigned |
360 |
- } |
361 |
- |
362 |
- void |
363 |
--drawtext(DC *dc, const char *text, unsigned long col[ColLast]) { |
364 |
-+drawtext(DC *dc, const char *text, ColorSet *col) { |
365 |
- char buf[BUFSIZ]; |
366 |
- size_t mn, n = strlen(text); |
367 |
- |
368 |
-@@ -35,19 +33,25 @@ drawtext(DC *dc, const char *text, unsig |
369 |
- if(mn < n) |
370 |
- for(n = MAX(mn-3, 0); n < mn; buf[n++] = '.'); |
371 |
- |
372 |
-- drawrect(dc, 0, 0, dc->w, dc->h, True, BG(dc, col)); |
373 |
-+drawrect(dc, 0, 0, dc->w, dc->h, True, col->BG); |
374 |
-+ |
375 |
- drawtextn(dc, buf, mn, col); |
376 |
- } |
377 |
- |
378 |
- void |
379 |
--drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]) { |
380 |
-+drawtextn(DC *dc, const char *text, size_t n, ColorSet *col) { |
381 |
- int x = dc->x + dc->font.height/2; |
382 |
- int y = dc->y + dc->font.ascent+1; |
383 |
- |
384 |
-- XSetForeground(dc->dpy, dc->gc, FG(dc, col)); |
385 |
-- if(dc->font.set) |
386 |
-- XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n); |
387 |
-- else { |
388 |
-+ XSetForeground(dc->dpy, dc->gc, col->FG); |
389 |
-+ if(dc->font.xft_font) { |
390 |
-+ if (!dc->xftdraw) |
391 |
-+ eprintf("error, xft drawable does not exist"); |
392 |
-+ XftDrawStringUtf8(dc->xftdraw, &col->FG_xft, |
393 |
-+ dc->font.xft_font, x, y, (unsigned char*)text, n); |
394 |
-+ } else if(dc->font.set) { |
395 |
-+ XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n); |
396 |
-+ } else { |
397 |
- XSetFont(dc->dpy, dc->gc, dc->font.xfont->fid); |
398 |
- XDrawString(dc->dpy, dc->canvas, dc->gc, x, y, text, n); |
399 |
- } |
400 |
-@@ -68,19 +72,53 @@ eprintf(const char *fmt, ...) { |
401 |
- exit(EXIT_FAILURE); |
402 |
- } |
403 |
- |
404 |
-+ void |
405 |
-+freecol(DC *dc, ColorSet *col) { |
406 |
-+ if(col) { |
407 |
-+ if(&col->FG_xft) |
408 |
-+ XftColorFree(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)), |
409 |
-+ DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), &col->FG_xft); |
410 |
-+ free(col); |
411 |
-+ } |
412 |
-+} |
413 |
-+ |
414 |
-+ |
415 |
- void |
416 |
- freedc(DC *dc) { |
417 |
-+ if(dc->font.xft_font) { |
418 |
-+ XftFontClose(dc->dpy, dc->font.xft_font); |
419 |
-+ XftDrawDestroy(dc->xftdraw); |
420 |
-+ } |
421 |
- if(dc->font.set) |
422 |
- XFreeFontSet(dc->dpy, dc->font.set); |
423 |
- if(dc->font.xfont) |
424 |
- XFreeFont(dc->dpy, dc->font.xfont); |
425 |
- if(dc->canvas) |
426 |
- XFreePixmap(dc->dpy, dc->canvas); |
427 |
-- XFreeGC(dc->dpy, dc->gc); |
428 |
-- XCloseDisplay(dc->dpy); |
429 |
-- free(dc); |
430 |
-+ if(dc->gc) |
431 |
-+ XFreeGC(dc->dpy, dc->gc); |
432 |
-+ if(dc->dpy) |
433 |
-+ XCloseDisplay(dc->dpy); |
434 |
-+ if(dc) |
435 |
-+ free(dc); |
436 |
-+ |
437 |
- } |
438 |
- |
439 |
-+ColorSet * |
440 |
-+initcolor(DC *dc, const char * foreground, const char * background) { |
441 |
-+ ColorSet * col = (ColorSet *)malloc(sizeof(ColorSet)); |
442 |
-+ if(!col) |
443 |
-+ eprintf("error, cannot allocate memory for color set"); |
444 |
-+ col->BG = getcolor(dc, background); |
445 |
-+ col->FG = getcolor(dc, foreground); |
446 |
-+ if(dc->font.xft_font) |
447 |
-+ if(!XftColorAllocName(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)), |
448 |
-+ DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), foreground, &col->FG_xft)) |
449 |
-+ eprintf("error, cannot allocate xft font color '%s'\n", foreground); |
450 |
-+ return col; |
451 |
-+} |
452 |
-+ |
453 |
-+ |
454 |
- unsigned long |
455 |
- getcolor(DC *dc, const char *colstr) { |
456 |
- Colormap cmap = DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)); |
457 |
-@@ -95,12 +133,16 @@ DC * |
458 |
- initdc(void) { |
459 |
- DC *dc; |
460 |
- |
461 |
-- if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) |
462 |
-+ if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) |
463 |
- fprintf(stderr, "no locale support\n"); |
464 |
- if(!(dc = calloc(1, sizeof *dc))) |
465 |
- eprintf("cannot malloc %u bytes:", sizeof *dc); |
466 |
- if(!(dc->dpy = XOpenDisplay(NULL))) |
467 |
- eprintf("cannot open display\n"); |
468 |
-+ dc->font.xft_font = NULL; |
469 |
-+ dc->xftdraw = NULL; |
470 |
-+ |
471 |
-+ |
472 |
- |
473 |
- dc->gc = XCreateGC(dc->dpy, DefaultRootWindow(dc->dpy), 0, NULL); |
474 |
- XSetLineAttributes(dc->dpy, dc->gc, 1, LineSolid, CapButt, JoinMiter); |
475 |
-@@ -109,23 +151,13 @@ initdc(void) { |
476 |
- |
477 |
- void |
478 |
- initfont(DC *dc, const char *fontstr) { |
479 |
-- if(!loadfont(dc, fontstr ? fontstr : DEFAULTFN)) { |
480 |
-- if(fontstr != NULL) |
481 |
-- fprintf(stderr, "cannot load font '%s'\n", fontstr); |
482 |
-- if(fontstr == NULL || !loadfont(dc, DEFAULTFN)) |
483 |
-- eprintf("cannot load font '%s'\n", DEFAULTFN); |
484 |
-- } |
485 |
-- dc->font.height = dc->font.ascent + dc->font.descent; |
486 |
--} |
487 |
-- |
488 |
--Bool |
489 |
--loadfont(DC *dc, const char *fontstr) { |
490 |
-- char *def, **missing; |
491 |
-+ char *def, **missing=NULL; |
492 |
- int i, n; |
493 |
- |
494 |
-- if(!*fontstr) |
495 |
-- return False; |
496 |
-- if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) { |
497 |
-+ if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) { |
498 |
-+ dc->font.ascent = dc->font.xfont->ascent; |
499 |
-+ dc->font.descent = dc->font.xfont->descent; |
500 |
-+ } else if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) { |
501 |
- char **names; |
502 |
- XFontStruct **xfonts; |
503 |
- |
504 |
-@@ -134,14 +166,16 @@ loadfont(DC *dc, const char *fontstr) { |
505 |
- dc->font.ascent = MAX(dc->font.ascent, xfonts[i]->ascent); |
506 |
- dc->font.descent = MAX(dc->font.descent, xfonts[i]->descent); |
507 |
- } |
508 |
-- } |
509 |
-- else if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) { |
510 |
-- dc->font.ascent = dc->font.xfont->ascent; |
511 |
-- dc->font.descent = dc->font.xfont->descent; |
512 |
-- } |
513 |
-+ } else if((dc->font.xft_font = XftFontOpenName(dc->dpy, |
514 |
-+ DefaultScreen(dc->dpy), fontstr))) { |
515 |
-+ dc->font.ascent = dc->font.xft_font->ascent; |
516 |
-+ dc->font.descent = dc->font.xft_font->descent; |
517 |
-+ } else { |
518 |
-+ eprintf("cannot load font '%s'\n", fontstr); |
519 |
-+ } |
520 |
- if(missing) |
521 |
- XFreeStringList(missing); |
522 |
-- return (dc->font.set || dc->font.xfont); |
523 |
-+ dc->font.height = dc->font.ascent + dc->font.descent; |
524 |
- } |
525 |
- |
526 |
- void |
527 |
-@@ -151,6 +185,7 @@ mapdc(DC *dc, Window win, unsigned int w |
528 |
- |
529 |
- void |
530 |
- resizedc(DC *dc, unsigned int w, unsigned int h) { |
531 |
-+ int screen = DefaultScreen(dc->dpy); |
532 |
- if(dc->canvas) |
533 |
- XFreePixmap(dc->dpy, dc->canvas); |
534 |
- |
535 |
-@@ -158,18 +193,30 @@ resizedc(DC *dc, unsigned int w, unsigne |
536 |
- DefaultDepth(dc->dpy, DefaultScreen(dc->dpy))); |
537 |
- dc->w = w; |
538 |
- dc->h = h; |
539 |
-+ if(dc->font.xft_font && !(dc->xftdraw)) { |
540 |
-+ dc->xftdraw = XftDrawCreate(dc->dpy, dc->canvas, DefaultVisual(dc->dpy,screen), DefaultColormap(dc->dpy,screen)); |
541 |
-+ if(!(dc->xftdraw)) |
542 |
-+ eprintf("error, cannot create xft drawable\n"); |
543 |
-+ } |
544 |
-+ |
545 |
- } |
546 |
- |
547 |
- int |
548 |
- textnw(DC *dc, const char *text, size_t len) { |
549 |
-- if(dc->font.set) { |
550 |
-+ if(dc->font.xft_font) { |
551 |
-+ XGlyphInfo gi; |
552 |
-+ XftTextExtentsUtf8(dc->dpy, dc->font.xft_font, (const FcChar8*)text, len, &gi); |
553 |
-+ return gi.width; |
554 |
-+ } else if(dc->font.set) { |
555 |
- XRectangle r; |
556 |
- |
557 |
- XmbTextExtents(dc->font.set, text, len, NULL, &r); |
558 |
- return r.width; |
559 |
-- } |
560 |
-- return XTextWidth(dc->font.xfont, text, len); |
561 |
--} |
562 |
-+ } else { |
563 |
-+ return XTextWidth(dc->font.xfont, text, len); |
564 |
-+ } |
565 |
-+ |
566 |
-+ } |
567 |
- |
568 |
- int |
569 |
- textw(DC *dc, const char *text) { |
570 |
-diff -rup dmenu-4.3.1/draw.h dmenu-xft/draw.h |
571 |
---- dmenu-4.3.1/draw.h 2011-05-18 21:32:16.000000000 +0530 |
572 |
-+++ dmenu-xft/draw.h 2011-05-20 03:01:58.000000000 +0530 |
573 |
-@@ -1,28 +1,34 @@ |
574 |
- /* See LICENSE file for copyright and license details. */ |
575 |
- |
576 |
--#define FG(dc, col) ((col)[(dc)->invert ? ColBG : ColFG]) |
577 |
--#define BG(dc, col) ((col)[(dc)->invert ? ColFG : ColBG]) |
578 |
-- |
579 |
--enum { ColBG, ColFG, ColBorder, ColLast }; |
580 |
-+#include <X11/Xft/Xft.h> |
581 |
- |
582 |
- typedef struct { |
583 |
- int x, y, w, h; |
584 |
-- Bool invert; |
585 |
- Display *dpy; |
586 |
- GC gc; |
587 |
- Pixmap canvas; |
588 |
-+ XftDraw *xftdraw; |
589 |
- struct { |
590 |
- int ascent; |
591 |
- int descent; |
592 |
- int height; |
593 |
- XFontSet set; |
594 |
- XFontStruct *xfont; |
595 |
-+ XftFont *xft_font; |
596 |
- } font; |
597 |
- } DC; /* draw context */ |
598 |
- |
599 |
-+typedef struct { |
600 |
-+ unsigned long FG; |
601 |
-+ XftColor FG_xft; |
602 |
-+ unsigned long BG; |
603 |
-+} ColorSet; |
604 |
-+ |
605 |
-+ |
606 |
- void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color); |
607 |
--void drawtext(DC *dc, const char *text, unsigned long col[ColLast]); |
608 |
--void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]); |
609 |
-+void drawtext(DC *dc, const char *text, ColorSet *col); |
610 |
-+void drawtextn(DC *dc, const char *text, size_t n, ColorSet *col); |
611 |
-+void freecol(DC *dc, ColorSet *col); |
612 |
- void eprintf(const char *fmt, ...); |
613 |
- void freedc(DC *dc); |
614 |
- unsigned long getcolor(DC *dc, const char *colstr); |
615 |
-@@ -32,3 +38,5 @@ void mapdc(DC *dc, Window win, unsigned |
616 |
- void resizedc(DC *dc, unsigned int w, unsigned int h); |
617 |
- int textnw(DC *dc, const char *text, size_t len); |
618 |
- int textw(DC *dc, const char *text); |
619 |
-+ColorSet *initcolor(DC *dc, const char *foreground, const char *background); |
620 |
-+ |
621 |
|
622 |
diff --git a/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch b/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch |
623 |
deleted file mode 100644 |
624 |
index dc6f5c3..0000000 |
625 |
--- a/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch |
626 |
+++ /dev/null |
627 |
@@ -1,405 +0,0 @@ |
628 |
---- a/dmenu.c 2011-09-19 11:48:13.000000000 +0200 |
629 |
-+++ b/dmenu.c 2011-12-31 00:48:16.000000000 +0200 |
630 |
-@@ -16,6 +16,7 @@ |
631 |
- #define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh)) |
632 |
- #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
633 |
- #define MAX(a,b) ((a) > (b) ? (a) : (b)) |
634 |
-+#define DEFFONT "fixed" /* xft example: "Monospace-11" */ |
635 |
- |
636 |
- typedef struct Item Item; |
637 |
- struct Item { |
638 |
-@@ -25,6 +26,7 @@ struct Item { |
639 |
- |
640 |
- static void appenditem(Item *item, Item **list, Item **last); |
641 |
- static void calcoffsets(void); |
642 |
-+static void cleanup(void); |
643 |
- static char *cistrstr(const char *s, const char *sub); |
644 |
- static void drawmenu(void); |
645 |
- static void grabkeyboard(void); |
646 |
-@@ -49,10 +51,12 @@ static const char *normbgcolor = "#ccccc |
647 |
- static const char *normfgcolor = "#000000"; |
648 |
- static const char *selbgcolor = "#0066ff"; |
649 |
- static const char *selfgcolor = "#ffffff"; |
650 |
--static unsigned long normcol[ColLast]; |
651 |
--static unsigned long selcol[ColLast]; |
652 |
-+static ColorSet *normcol; |
653 |
-+static ColorSet *selcol; |
654 |
- static Atom utf8; |
655 |
- static Bool topbar = True; |
656 |
-+static Bool running = True; |
657 |
-+static int ret = 0; |
658 |
- static DC *dc; |
659 |
- static Item *items = NULL; |
660 |
- static Item *matches, *matchend; |
661 |
-@@ -102,7 +106,9 @@ main(int argc, char *argv[]) { |
662 |
- usage(); |
663 |
- |
664 |
- dc = initdc(); |
665 |
-- initfont(dc, font); |
666 |
-+ initfont(dc, font ? font : DEFFONT); |
667 |
-+ normcol = initcolor(dc, normfgcolor, normbgcolor); |
668 |
-+ selcol = initcolor(dc, selfgcolor, selbgcolor); |
669 |
- |
670 |
- if(fast) { |
671 |
- grabkeyboard(); |
672 |
-@@ -115,7 +121,8 @@ main(int argc, char *argv[]) { |
673 |
- setup(); |
674 |
- run(); |
675 |
- |
676 |
-- return EXIT_FAILURE; /* unreachable */ |
677 |
-+ cleanup(); |
678 |
-+ return ret; |
679 |
- } |
680 |
- |
681 |
- void |
682 |
-@@ -158,6 +165,16 @@ cistrstr(const char *s, const char *sub) |
683 |
- } |
684 |
- |
685 |
- void |
686 |
-+cleanup(void) { |
687 |
-+ Item *itm; |
688 |
-+ freecol(dc, normcol); |
689 |
-+ freecol(dc, selcol); |
690 |
-+ XDestroyWindow(dc->dpy, win); |
691 |
-+ XUngrabKeyboard(dc->dpy, CurrentTime); |
692 |
-+ freedc(dc); |
693 |
-+} |
694 |
-+ |
695 |
-+void |
696 |
- drawmenu(void) { |
697 |
- int curpos; |
698 |
- Item *item; |
699 |
-@@ -165,7 +182,7 @@ drawmenu(void) { |
700 |
- dc->x = 0; |
701 |
- dc->y = 0; |
702 |
- dc->h = bh; |
703 |
-- drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol)); |
704 |
-+ drawrect(dc, 0, 0, mw, mh, True, normcol->BG); |
705 |
- |
706 |
- if(prompt) { |
707 |
- dc->w = promptw; |
708 |
-@@ -175,7 +192,7 @@ drawmenu(void) { |
709 |
- dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw; |
710 |
- drawtext(dc, text, normcol); |
711 |
- if((curpos = textnw(dc, text, cursor) + dc->h/2 - 2) < dc->w) |
712 |
-- drawrect(dc, curpos, 2, 1, dc->h - 4, True, FG(dc, normcol)); |
713 |
-+ drawrect(dc, curpos, 2, 1, dc->h - 4, True, normcol->FG); |
714 |
- |
715 |
- if(lines > 0) { |
716 |
- dc->w = mw - dc->x; |
717 |
-@@ -301,7 +318,8 @@ keypress(XKeyEvent *ev) { |
718 |
- sel = matchend; |
719 |
- break; |
720 |
- case XK_Escape: |
721 |
-- exit(EXIT_FAILURE); |
722 |
-+ ret = EXIT_FAILURE; |
723 |
-+ running = False; |
724 |
- case XK_Home: |
725 |
- if(sel == matches) { |
726 |
- cursor = 0; |
727 |
-@@ -337,7 +355,8 @@ keypress(XKeyEvent *ev) { |
728 |
- case XK_Return: |
729 |
- case XK_KP_Enter: |
730 |
- puts((sel && !(ev->state & ShiftMask)) ? sel->text : text); |
731 |
-- exit(EXIT_SUCCESS); |
732 |
-+ ret = EXIT_SUCCESS; |
733 |
-+ running = False; |
734 |
- case XK_Right: |
735 |
- if(text[cursor] != '\0') { |
736 |
- cursor = nextrune(+1); |
737 |
-@@ -449,7 +468,7 @@ void |
738 |
- run(void) { |
739 |
- XEvent ev; |
740 |
- |
741 |
-- while(!XNextEvent(dc->dpy, &ev)) |
742 |
-+ while(running && !XNextEvent(dc->dpy, &ev)) |
743 |
- switch(ev.type) { |
744 |
- case Expose: |
745 |
- if(ev.xexpose.count == 0) |
746 |
-@@ -479,11 +498,6 @@ setup(void) { |
747 |
- XineramaScreenInfo *info; |
748 |
- #endif |
749 |
- |
750 |
-- normcol[ColBG] = getcolor(dc, normbgcolor); |
751 |
-- normcol[ColFG] = getcolor(dc, normfgcolor); |
752 |
-- selcol[ColBG] = getcolor(dc, selbgcolor); |
753 |
-- selcol[ColFG] = getcolor(dc, selfgcolor); |
754 |
-- |
755 |
- utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False); |
756 |
- |
757 |
- /* menu geometry */ |
758 |
---- a/draw.c 2011-09-19 11:48:13.000000000 +0200 |
759 |
-+++ b/draw.c 2011-12-31 01:44:39.000000000 +0200 |
760 |
-@@ -9,9 +9,6 @@ |
761 |
- |
762 |
- #define MAX(a, b) ((a) > (b) ? (a) : (b)) |
763 |
- #define MIN(a, b) ((a) < (b) ? (a) : (b)) |
764 |
--#define DEFAULTFN "fixed" |
765 |
-- |
766 |
--static Bool loadfont(DC *dc, const char *fontstr); |
767 |
- |
768 |
- void |
769 |
- drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color) { |
770 |
-@@ -23,7 +20,7 @@ drawrect(DC *dc, int x, int y, unsigned |
771 |
- } |
772 |
- |
773 |
- void |
774 |
--drawtext(DC *dc, const char *text, unsigned long col[ColLast]) { |
775 |
-+drawtext(DC *dc, const char *text, ColorSet *col) { |
776 |
- char buf[BUFSIZ]; |
777 |
- size_t mn, n = strlen(text); |
778 |
- |
779 |
-@@ -35,19 +32,24 @@ drawtext(DC *dc, const char *text, unsig |
780 |
- if(mn < n) |
781 |
- for(n = MAX(mn-3, 0); n < mn; buf[n++] = '.'); |
782 |
- |
783 |
-- drawrect(dc, 0, 0, dc->w, dc->h, True, BG(dc, col)); |
784 |
-+ drawrect(dc, 0, 0, dc->w, dc->h, True, col->BG); |
785 |
- drawtextn(dc, buf, mn, col); |
786 |
- } |
787 |
- |
788 |
- void |
789 |
--drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]) { |
790 |
-+drawtextn(DC *dc, const char *text, size_t n, ColorSet *col) { |
791 |
- int x = dc->x + dc->font.height/2; |
792 |
- int y = dc->y + dc->font.ascent+1; |
793 |
- |
794 |
-- XSetForeground(dc->dpy, dc->gc, FG(dc, col)); |
795 |
-- if(dc->font.set) |
796 |
-+ XSetForeground(dc->dpy, dc->gc, col->FG); |
797 |
-+ if(dc->font.xft_font) { |
798 |
-+ if (!dc->xftdraw) |
799 |
-+ eprintf("error, xft drawable does not exist"); |
800 |
-+ XftDrawStringUtf8(dc->xftdraw, &col->FG_xft, |
801 |
-+ dc->font.xft_font, x, y, (unsigned char*)text, n); |
802 |
-+ } else if(dc->font.set) { |
803 |
- XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n); |
804 |
-- else { |
805 |
-+ } else { |
806 |
- XSetFont(dc->dpy, dc->gc, dc->font.xfont->fid); |
807 |
- XDrawString(dc->dpy, dc->canvas, dc->gc, x, y, text, n); |
808 |
- } |
809 |
-@@ -69,16 +71,33 @@ eprintf(const char *fmt, ...) { |
810 |
- } |
811 |
- |
812 |
- void |
813 |
-+freecol(DC *dc, ColorSet *col) { |
814 |
-+ if(col) { |
815 |
-+ if(&col->FG_xft) |
816 |
-+ XftColorFree(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)), |
817 |
-+ DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), &col->FG_xft); |
818 |
-+ free(col); |
819 |
-+ } |
820 |
-+} |
821 |
-+ |
822 |
-+void |
823 |
- freedc(DC *dc) { |
824 |
-+ if(dc->font.xft_font) { |
825 |
-+ XftFontClose(dc->dpy, dc->font.xft_font); |
826 |
-+ XftDrawDestroy(dc->xftdraw); |
827 |
-+ } |
828 |
- if(dc->font.set) |
829 |
- XFreeFontSet(dc->dpy, dc->font.set); |
830 |
-- if(dc->font.xfont) |
831 |
-+ if(dc->font.xfont) |
832 |
- XFreeFont(dc->dpy, dc->font.xfont); |
833 |
-- if(dc->canvas) |
834 |
-+ if(dc->canvas) |
835 |
- XFreePixmap(dc->dpy, dc->canvas); |
836 |
-- XFreeGC(dc->dpy, dc->gc); |
837 |
-- XCloseDisplay(dc->dpy); |
838 |
-- free(dc); |
839 |
-+ if(dc->gc) |
840 |
-+ XFreeGC(dc->dpy, dc->gc); |
841 |
-+ if(dc->dpy) |
842 |
-+ XCloseDisplay(dc->dpy); |
843 |
-+ if(dc) |
844 |
-+ free(dc); |
845 |
- } |
846 |
- |
847 |
- unsigned long |
848 |
-@@ -91,6 +110,20 @@ getcolor(DC *dc, const char *colstr) { |
849 |
- return color.pixel; |
850 |
- } |
851 |
- |
852 |
-+ColorSet * |
853 |
-+initcolor(DC *dc, const char * foreground, const char * background) { |
854 |
-+ ColorSet * col = (ColorSet *)malloc(sizeof(ColorSet)); |
855 |
-+ if(!col) |
856 |
-+ eprintf("error, cannot allocate memory for color set"); |
857 |
-+ col->BG = getcolor(dc, background); |
858 |
-+ col->FG = getcolor(dc, foreground); |
859 |
-+ if(dc->font.xft_font) |
860 |
-+ if(!XftColorAllocName(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)), |
861 |
-+ DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), foreground, &col->FG_xft)) |
862 |
-+ eprintf("error, cannot allocate xft font color '%s'\n", foreground); |
863 |
-+ return col; |
864 |
-+} |
865 |
-+ |
866 |
- DC * |
867 |
- initdc(void) { |
868 |
- DC *dc; |
869 |
-@@ -109,39 +142,33 @@ initdc(void) { |
870 |
- |
871 |
- void |
872 |
- initfont(DC *dc, const char *fontstr) { |
873 |
-- if(!loadfont(dc, fontstr ? fontstr : DEFAULTFN)) { |
874 |
-- if(fontstr != NULL) |
875 |
-- fprintf(stderr, "cannot load font '%s'\n", fontstr); |
876 |
-- if(fontstr == NULL || !loadfont(dc, DEFAULTFN)) |
877 |
-- eprintf("cannot load font '%s'\n", DEFAULTFN); |
878 |
-- } |
879 |
-- dc->font.height = dc->font.ascent + dc->font.descent; |
880 |
--} |
881 |
-- |
882 |
--Bool |
883 |
--loadfont(DC *dc, const char *fontstr) { |
884 |
- char *def, **missing, **names; |
885 |
- int i, n; |
886 |
- XFontStruct **xfonts; |
887 |
- |
888 |
-- if(!*fontstr) |
889 |
-- return False; |
890 |
-- if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) { |
891 |
-+ missing = NULL; |
892 |
-+ if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) { |
893 |
-+ dc->font.ascent = dc->font.xfont->ascent; |
894 |
-+ dc->font.descent = dc->font.xfont->descent; |
895 |
-+ dc->font.width = dc->font.xfont->max_bounds.width; |
896 |
-+ } else if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) { |
897 |
- n = XFontsOfFontSet(dc->font.set, &xfonts, &names); |
898 |
- for(i = 0; i < n; i++) { |
899 |
- dc->font.ascent = MAX(dc->font.ascent, xfonts[i]->ascent); |
900 |
- dc->font.descent = MAX(dc->font.descent, xfonts[i]->descent); |
901 |
- dc->font.width = MAX(dc->font.width, xfonts[i]->max_bounds.width); |
902 |
- } |
903 |
-- } |
904 |
-- else if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) { |
905 |
-- dc->font.ascent = dc->font.xfont->ascent; |
906 |
-- dc->font.descent = dc->font.xfont->descent; |
907 |
-- dc->font.width = dc->font.xfont->max_bounds.width; |
908 |
-+ } else if((dc->font.xft_font = XftFontOpenName(dc->dpy, DefaultScreen(dc->dpy), fontstr))) { |
909 |
-+ dc->font.ascent = dc->font.xft_font->ascent; |
910 |
-+ dc->font.descent = dc->font.xft_font->descent; |
911 |
-+ dc->font.width = dc->font.xft_font->max_advance_width; |
912 |
-+ } else { |
913 |
-+ eprintf("cannot load font '%s'\n", fontstr); |
914 |
- } |
915 |
- if(missing) |
916 |
- XFreeStringList(missing); |
917 |
-- return dc->font.set || dc->font.xfont; |
918 |
-+ dc->font.height = dc->font.ascent + dc->font.descent; |
919 |
-+ return; |
920 |
- } |
921 |
- |
922 |
- void |
923 |
-@@ -151,20 +178,29 @@ mapdc(DC *dc, Window win, unsigned int w |
924 |
- |
925 |
- void |
926 |
- resizedc(DC *dc, unsigned int w, unsigned int h) { |
927 |
-+ int screen = DefaultScreen(dc->dpy); |
928 |
- if(dc->canvas) |
929 |
- XFreePixmap(dc->dpy, dc->canvas); |
930 |
- |
931 |
- dc->w = w; |
932 |
- dc->h = h; |
933 |
- dc->canvas = XCreatePixmap(dc->dpy, DefaultRootWindow(dc->dpy), w, h, |
934 |
-- DefaultDepth(dc->dpy, DefaultScreen(dc->dpy))); |
935 |
-+ DefaultDepth(dc->dpy, screen)); |
936 |
-+ if(dc->font.xft_font && !(dc->xftdraw)) { |
937 |
-+ dc->xftdraw = XftDrawCreate(dc->dpy, dc->canvas, DefaultVisual(dc->dpy,screen), DefaultColormap(dc->dpy,screen)); |
938 |
-+ if(!(dc->xftdraw)) |
939 |
-+ eprintf("error, cannot create xft drawable\n"); |
940 |
-+ } |
941 |
- } |
942 |
- |
943 |
- int |
944 |
- textnw(DC *dc, const char *text, size_t len) { |
945 |
-- if(dc->font.set) { |
946 |
-+ if(dc->font.xft_font) { |
947 |
-+ XGlyphInfo gi; |
948 |
-+ XftTextExtentsUtf8(dc->dpy, dc->font.xft_font, (const FcChar8*)text, len, &gi); |
949 |
-+ return gi.width; |
950 |
-+ } else if(dc->font.set) { |
951 |
- XRectangle r; |
952 |
-- |
953 |
- XmbTextExtents(dc->font.set, text, len, NULL, &r); |
954 |
- return r.width; |
955 |
- } |
956 |
---- a/draw.h 2011-09-19 11:48:13.000000000 +0200 |
957 |
-+++ b/draw.h 2011-12-31 00:28:01.000000000 +0200 |
958 |
-@@ -1,9 +1,6 @@ |
959 |
- /* See LICENSE file for copyright and license details. */ |
960 |
- |
961 |
--#define FG(dc, col) ((col)[(dc)->invert ? ColBG : ColFG]) |
962 |
--#define BG(dc, col) ((col)[(dc)->invert ? ColFG : ColBG]) |
963 |
-- |
964 |
--enum { ColBG, ColFG, ColBorder, ColLast }; |
965 |
-+#include <X11/Xft/Xft.h> |
966 |
- |
967 |
- typedef struct { |
968 |
- int x, y, w, h; |
969 |
-@@ -11,6 +8,7 @@ typedef struct { |
970 |
- Display *dpy; |
971 |
- GC gc; |
972 |
- Pixmap canvas; |
973 |
-+ XftDraw *xftdraw; |
974 |
- struct { |
975 |
- int ascent; |
976 |
- int descent; |
977 |
-@@ -18,15 +16,24 @@ typedef struct { |
978 |
- int width; |
979 |
- XFontSet set; |
980 |
- XFontStruct *xfont; |
981 |
-+ XftFont *xft_font; |
982 |
- } font; |
983 |
- } DC; /* draw context */ |
984 |
- |
985 |
-+typedef struct { |
986 |
-+ unsigned long FG; |
987 |
-+ XftColor FG_xft; |
988 |
-+ unsigned long BG; |
989 |
-+} ColorSet; |
990 |
-+ |
991 |
- void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color); |
992 |
--void drawtext(DC *dc, const char *text, unsigned long col[ColLast]); |
993 |
--void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]); |
994 |
-+void drawtext(DC *dc, const char *text, ColorSet *col); |
995 |
-+void drawtextn(DC *dc, const char *text, size_t n, ColorSet *col); |
996 |
-+void freecol(DC *dc, ColorSet *col); |
997 |
- void eprintf(const char *fmt, ...); |
998 |
- void freedc(DC *dc); |
999 |
- unsigned long getcolor(DC *dc, const char *colstr); |
1000 |
-+ColorSet *initcolor(DC *dc, const char *foreground, const char *background); |
1001 |
- DC *initdc(void); |
1002 |
- void initfont(DC *dc, const char *fontstr); |
1003 |
- void mapdc(DC *dc, Window win, unsigned int w, unsigned int h); |
1004 |
---- a/dmenu.1 2011-09-19 11:48:13.000000000 +0200 |
1005 |
-+++ b/dmenu.1 2011-12-30 23:23:44.000000000 +0200 |
1006 |
-@@ -55,7 +55,7 @@ |
1007 |
- defines the prompt to be displayed to the left of the input field. |
1008 |
- .TP |
1009 |
- .BI \-fn " font" |
1010 |
--defines the font or font set used. |
1011 |
-+defines the font or font set used. eg. "fixed" or "Monospace-12:normal" (an xft font) |
1012 |
- .TP |
1013 |
- .BI \-nb " color" |
1014 |
- defines the normal background color. |
1015 |
---- a/config.mk 2011-12-30 23:23:44.000000000 +0200 |
1016 |
-+++ b/config.mk 2011-12-30 23:23:44.000000000 +0200 |
1017 |
-@@ -12,9 +12,13 @@ |
1018 |
- XINERAMALIBS = -lXinerama |
1019 |
- XINERAMAFLAGS = -DXINERAMA |
1020 |
- |
1021 |
-+# Xft, comment if you don't want it |
1022 |
-+XFTINC = -I/usr/include/freetype2 |
1023 |
-+XFTLIBS = -lXft -lXrender -lfreetype -lz -lfontconfig |
1024 |
-+ |
1025 |
- # includes and libs |
1026 |
--INCS = -I${X11INC} |
1027 |
--LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} |
1028 |
-+INCS = -I${X11INC} ${XFTINC} |
1029 |
-+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${XFTLIBS} |
1030 |
- |
1031 |
- # flags |
1032 |
- CPPFLAGS+= -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} |
1033 |
|
1034 |
diff --git a/x11-misc/dmenu/metadata.xml b/x11-misc/dmenu/metadata.xml |
1035 |
deleted file mode 100644 |
1036 |
index 32c2cb5..0000000 |
1037 |
--- a/x11-misc/dmenu/metadata.xml |
1038 |
+++ /dev/null |
1039 |
@@ -1,9 +0,0 @@ |
1040 |
-<?xml version="1.0" encoding="UTF-8"?> |
1041 |
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
1042 |
-<pkgmetadata> |
1043 |
-<herd>no-herd</herd> |
1044 |
-<maintainer> |
1045 |
-<email>xmw@g.o</email> |
1046 |
-<name>Michael Weber</name> |
1047 |
-</maintainer> |
1048 |
-</pkgmetadata> |