public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/xmw:master commit in: x11-misc/dmenu/files/, x11-misc/dmenu/
@ 2011-05-31  2:42 Michael Weber
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Weber @ 2011-05-31  2:42 UTC (permalink / raw
  To: gentoo-commits

commit:     6d24833ef40e86559961355d215b610a11457742
Author:     Michael Weber <xmw <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 02:42:03 2011 +0000
Commit:     Michael Weber <xmw <AT> gentoo <DOT> org>
CommitDate: Tue May 31 02:42:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/xmw.git;a=commit;h=6d24833e

x11-misc/dmenu: Initial import w/ xft patch

(Portage version: 2.1.9.42/git/Linux x86_64, signed Manifest commit with key 62EEF090)

---
 x11-misc/dmenu/ChangeLog                   |   10 +
 x11-misc/dmenu/Manifest                    |   15 +
 x11-misc/dmenu/dmenu-4.3.1.ebuild          |   48 ++++
 x11-misc/dmenu/files/dmenu-4.3.1-xft.patch |  381 ++++++++++++++++++++++++++++
 x11-misc/dmenu/metadata.xml                |    9 +
 5 files changed, 463 insertions(+), 0 deletions(-)

diff --git a/x11-misc/dmenu/ChangeLog b/x11-misc/dmenu/ChangeLog
new file mode 100644
index 0000000..3594f0a
--- /dev/null
+++ b/x11-misc/dmenu/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for x11-misc/dmenu
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+*dmenu-4.3.1 (31 May 2011)
+
+  31 May 2011; Michael Weber <xmw@gentoo.org> +dmenu-4.3.1.ebuild,
+  +files/dmenu-4.3.1-xft.patch, +metadata.xml:
+  Initial import w/ xft patch
+

diff --git a/x11-misc/dmenu/Manifest b/x11-misc/dmenu/Manifest
new file mode 100644
index 0000000..b2f2437
--- /dev/null
+++ b/x11-misc/dmenu/Manifest
@@ -0,0 +1,15 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+AUX dmenu-4.3.1-xft.patch 11711 RMD160 43c39e128d6fbe07e81945ef5567153d709fe2a4 SHA1 0f893f21406e4d292b0c1e9b96efe31957103bd6 SHA256 61ef78f8b6105828e4120cb3a15c994f92bbec8b909c7a34fa9fda24f7dd17e7
+DIST dmenu-4.3.1.tar.gz 8905 RMD160 61675030c88c31bce88c6d2a2e408b28f622b68c SHA1 c22c468f9383ff485feacb9662571c4d1601aca3 SHA256 7da646228b52a2a5966b27190701e9514c08ee16ac538404b5dfa13b10b3c0ca
+EBUILD dmenu-4.3.1.ebuild 1256 RMD160 9e1d2448873906c9ca449dff1443ffd8978235cd SHA1 7f20eea3ea0394cb26dd7fde942a31c32cbe6c65 SHA256 63e98a85ed550a57ca3216a969e209567b7dc53d445186a5338f217203ed723a
+MISC ChangeLog 288 RMD160 e5d48ca2feecd9cfc201e090fec3821686dad480 SHA1 985d395d023bf3a8ebeaa9446e9a07936e5a2407 SHA256 96d1993dbba93014471ab60b0554446cb3c3023b63b4a21b0209f05c0e4e12b9
+MISC metadata.xml 244 RMD160 ba31bc851ce5d8e007b223b4f799d84d4c6699d0 SHA1 2192e855054fb7016488afba3eda6d938fdf925d SHA256 1022f65be1952b5197408dfbf61543b61557601ce3a9f15acabeb3e9d84a0fbe
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.17 (GNU/Linux)
+
+iF4EAREIAAYFAk3kVXoACgkQknrdDGLu8JASHwD/VvMI0QKhOw5HwkJFGwZiPBb3
+GtKV7gP1zEwZ1vqAYjMA/2shEGPOyLqRNaTLsShI/gdfK9Xkun4LyQeDD3SClXyP
+=rcB5
+-----END PGP SIGNATURE-----

diff --git a/x11-misc/dmenu/dmenu-4.3.1.ebuild b/x11-misc/dmenu/dmenu-4.3.1.ebuild
new file mode 100644
index 0000000..aa06b5e
--- /dev/null
+++ b/x11-misc/dmenu/dmenu-4.3.1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-misc/dmenu/dmenu-4.2.1.ebuild,v 1.5 2011/03/16 21:17:05 xarthisius Exp $
+
+EAPI="2"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System"
+HOMEPAGE="http://www.suckless.org/programs/dmenu.html"
+SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE="xft xinerama"
+
+DEPEND="x11-libs/libX11
+	xinerama? ( x11-libs/libXinerama )"
+RDEPEND=${DEPEND}
+
+src_prepare() {
+	if use xft ; then
+		epatch "${FILESDIR}/${P}-xft.patch"
+	fi
+
+	sed -i \
+		-e "s/CFLAGS   = -ansi -pedantic -Wall -Os/CFLAGS  += -ansi -pedantic -Wall/" \
+		-e "s/LDFLAGS  = -s/LDFLAGS  += -g/" \
+		-e "s/XINERAMALIBS  =/XINERAMALIBS  ?=/" \
+		-e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \
+		config.mk || die "sed failed"
+}
+
+src_compile() {
+	if use xinerama; then
+		emake CC=$(tc-getCC) || die "emake failed"
+	else
+		emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS="" \
+			|| die "emake failed"
+	fi
+}
+
+src_install() {
+	emake DESTDIR="${D}" PREFIX="/usr" install || die "emake install failed"
+
+	dodoc README
+}

diff --git a/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch b/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch
new file mode 100644
index 0000000..0a2d7fb
--- /dev/null
+++ b/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch
@@ -0,0 +1,381 @@
+diff -rup dmenu-4.3.1/config.mk dmenu-xft/config.mk
+--- dmenu-4.3.1/config.mk	2011-05-18 21:32:16.000000000 +0530
++++ dmenu-xft/config.mk	2011-05-20 03:14:15.000000000 +0530
+@@ -2,19 +2,24 @@
+ VERSION = 4.3.1
+ 
+ # paths
+-PREFIX = /usr/local
+-MANPREFIX = ${PREFIX}/share/man
++PREFIX = /usr
++MANPREFIX = ${PREFIX}/share
+ 
+ X11INC = /usr/X11R6/include
+ X11LIB = /usr/X11R6/lib
+ 
++# Xft, comment if you don't want it
++XFTINC = /usr/include/freetype2
++XFTLIBS  = -lXft -lXrender -lfreetype -lz -lfontconfig
++
++
+ # Xinerama, comment if you don't want it
+ XINERAMALIBS  = -lXinerama
+ XINERAMAFLAGS = -DXINERAMA
+ 
+ # includes and libs
+-INCS = -I${X11INC}
+-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS}
++INCS = -I${X11INC} -I${XFTINC}
++LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${XFTLIBS}
+ 
+ # flags
+ CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
+diff -rup dmenu-4.3.1/dmenu.c dmenu-xft/dmenu.c
+--- dmenu-4.3.1/dmenu.c	2011-05-18 21:32:16.000000000 +0530
++++ dmenu-xft/dmenu.c	2011-05-20 03:12:16.000000000 +0530
+@@ -16,6 +16,8 @@
+ #define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh))
+ #define MIN(a,b)                ((a) < (b) ? (a) : (b))
+ #define MAX(a,b)                ((a) > (b) ? (a) : (b))
++#define DEFFONT "fixed" /* xft example: "Monospace-11" */
++
+ 
+ typedef struct Item Item;
+ struct Item {
+@@ -49,8 +51,8 @@ static const char *normbgcolor = "#ccccc
+ static const char *normfgcolor = "#000000";
+ static const char *selbgcolor  = "#0066ff";
+ static const char *selfgcolor  = "#ffffff";
+-static unsigned long normcol[ColLast];
+-static unsigned long selcol[ColLast];
++static ColorSet *normcol;
++static ColorSet *selcol;
+ static Atom utf8;
+ static Bool topbar = True;
+ static DC *dc;
+@@ -99,7 +101,9 @@ main(int argc, char *argv[]) {
+ 			usage();
+ 
+ 	dc = initdc();
+-	initfont(dc, font);
++    initfont(dc, font ? font : DEFFONT);
++    normcol = initcolor(dc, normfgcolor, normbgcolor);
++    selcol = initcolor(dc, selfgcolor, selbgcolor);
+ 
+ 	if(fast) {
+ 		grabkeyboard();
+@@ -151,7 +155,8 @@ drawmenu(void) {
+ 	dc->x = 0;
+ 	dc->y = 0;
+ 	dc->h = bh;
+-	drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol));
++	drawrect(dc, 0, 0, mw, mh, True, normcol->BG);
++
+ 
+ 	if(prompt) {
+ 		dc->w = promptw;
+@@ -161,7 +166,7 @@ drawmenu(void) {
+ 	dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw;
+ 	drawtext(dc, text, normcol);
+ 	if((curpos = textnw(dc, text, cursor) + dc->h/2 - 2) < dc->w)
+-		drawrect(dc, curpos, 2, 1, dc->h - 4, True, FG(dc, normcol));
++			drawrect(dc, curpos, 2, 1, dc->h - 4, True, normcol->FG);
+ 
+ 	if(lines > 0) {
+ 		dc->w = mw - dc->x;
+@@ -495,11 +500,12 @@ setup(void) {
+ 	XineramaScreenInfo *info;
+ #endif
+ 
++    /* 
+ 	normcol[ColBG] = getcolor(dc, normbgcolor);
+ 	normcol[ColFG] = getcolor(dc, normfgcolor);
+ 	selcol[ColBG]  = getcolor(dc, selbgcolor);
+ 	selcol[ColFG]  = getcolor(dc, selfgcolor);
+-
++*/
+ 	utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
+ 
+ 	/* menu geometry */
+Only in dmenu-4.3.1: dmenu_path
+Only in dmenu-4.3.1: dmenu_run
+diff -rup dmenu-4.3.1/draw.c dmenu-xft/draw.c
+--- dmenu-4.3.1/draw.c	2011-05-18 21:32:16.000000000 +0530
++++ dmenu-xft/draw.c	2011-05-20 03:16:36.000000000 +0530
+@@ -5,13 +5,11 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <X11/Xlib.h>
++#include <X11/Xft/Xft.h>
+ #include "draw.h"
+ 
+ #define MAX(a, b)  ((a) > (b) ? (a) : (b))
+ #define MIN(a, b)  ((a) < (b) ? (a) : (b))
+-#define DEFAULTFN  "fixed"
+-
+-static Bool loadfont(DC *dc, const char *fontstr);
+ 
+ void
+ drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color) {
+@@ -23,7 +21,7 @@ drawrect(DC *dc, int x, int y, unsigned
+ }
+ 
+ void
+-drawtext(DC *dc, const char *text, unsigned long col[ColLast]) {
++drawtext(DC *dc, const char *text, ColorSet *col) {
+ 	char buf[BUFSIZ];
+ 	size_t mn, n = strlen(text);
+ 
+@@ -35,19 +33,25 @@ drawtext(DC *dc, const char *text, unsig
+ 	if(mn < n)
+ 		for(n = MAX(mn-3, 0); n < mn; buf[n++] = '.');
+ 
+-	drawrect(dc, 0, 0, dc->w, dc->h, True, BG(dc, col));
++drawrect(dc, 0, 0, dc->w, dc->h, True, col->BG);
++
+ 	drawtextn(dc, buf, mn, col);
+ }
+ 
+ void
+-drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]) {
++drawtextn(DC *dc, const char *text, size_t n, ColorSet *col)  {
+ 	int x = dc->x + dc->font.height/2;
+ 	int y = dc->y + dc->font.ascent+1;
+ 
+-	XSetForeground(dc->dpy, dc->gc, FG(dc, col));
+-	if(dc->font.set)
+-		XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n);
+-	else {
++	XSetForeground(dc->dpy, dc->gc, col->FG);
++	if(dc->font.xft_font) {
++        if (!dc->xftdraw)
++            eprintf("error, xft drawable does not exist");
++        XftDrawStringUtf8(dc->xftdraw, &col->FG_xft, 
++            dc->font.xft_font, x, y, (unsigned char*)text, n);
++    } else if(dc->font.set) {	
++    XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n);
++    } else {
+ 		XSetFont(dc->dpy, dc->gc, dc->font.xfont->fid);
+ 		XDrawString(dc->dpy, dc->canvas, dc->gc, x, y, text, n);
+ 	}
+@@ -68,19 +72,53 @@ eprintf(const char *fmt, ...) {
+ 	exit(EXIT_FAILURE);
+ }
+ 
++ void
++freecol(DC *dc, ColorSet *col) {
++    if(col) {
++        if(&col->FG_xft)
++            XftColorFree(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)),
++                DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), &col->FG_xft);
++        free(col); 
++    }
++}
++
++
+ void
+ freedc(DC *dc) {
++        if(dc->font.xft_font) {
++        XftFontClose(dc->dpy, dc->font.xft_font);
++        XftDrawDestroy(dc->xftdraw);
++        }
+ 	if(dc->font.set)
+ 		XFreeFontSet(dc->dpy, dc->font.set);
+ 	if(dc->font.xfont)
+ 		XFreeFont(dc->dpy, dc->font.xfont);
+ 	if(dc->canvas)
+ 		XFreePixmap(dc->dpy, dc->canvas);
+-	XFreeGC(dc->dpy, dc->gc);
+-	XCloseDisplay(dc->dpy);
+-	free(dc);
++	if(dc->gc)
++        XFreeGC(dc->dpy, dc->gc);
++	if(dc->dpy)
++       XCloseDisplay(dc->dpy);
++	if(dc)
++        free(dc);
++
+ }
+ 
++ColorSet *
++initcolor(DC *dc, const char * foreground, const char * background) {
++    ColorSet * col = (ColorSet *)malloc(sizeof(ColorSet));
++    if(!col)
++        eprintf("error, cannot allocate memory for color set");
++    col->BG = getcolor(dc, background);
++    col->FG = getcolor(dc, foreground);
++    if(dc->font.xft_font)
++        if(!XftColorAllocName(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)),
++        DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), foreground, &col->FG_xft))
++            eprintf("error, cannot allocate xft font color '%s'\n", foreground);
++    return col;
++}
++
++
+ unsigned long
+ getcolor(DC *dc, const char *colstr) {
+ 	Colormap cmap = DefaultColormap(dc->dpy, DefaultScreen(dc->dpy));
+@@ -95,12 +133,16 @@ DC *
+ initdc(void) {
+ 	DC *dc;
+ 
+-	if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
++     	if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
+ 		fprintf(stderr, "no locale support\n");
+ 	if(!(dc = calloc(1, sizeof *dc)))
+ 		eprintf("cannot malloc %u bytes:", sizeof *dc);
+ 	if(!(dc->dpy = XOpenDisplay(NULL)))
+ 		eprintf("cannot open display\n");
++    dc->font.xft_font = NULL;
++     dc->xftdraw = NULL;
++
++
+ 
+ 	dc->gc = XCreateGC(dc->dpy, DefaultRootWindow(dc->dpy), 0, NULL);
+ 	XSetLineAttributes(dc->dpy, dc->gc, 1, LineSolid, CapButt, JoinMiter);
+@@ -109,23 +151,13 @@ initdc(void) {
+ 
+ void
+ initfont(DC *dc, const char *fontstr) {
+-	if(!loadfont(dc, fontstr ? fontstr : DEFAULTFN)) {
+-		if(fontstr != NULL)
+-			fprintf(stderr, "cannot load font '%s'\n", fontstr);
+-		if(fontstr == NULL || !loadfont(dc, DEFAULTFN))
+-			eprintf("cannot load font '%s'\n", DEFAULTFN);
+-	}
+-	dc->font.height = dc->font.ascent + dc->font.descent;
+-}
+-
+-Bool
+-loadfont(DC *dc, const char *fontstr) {
+-	char *def, **missing;
++	char *def, **missing=NULL;
+ 	int i, n;
+ 
+-	if(!*fontstr)
+-		return False;
+-	if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
++	if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
++		dc->font.ascent = dc->font.xfont->ascent;
++		dc->font.descent = dc->font.xfont->descent;
++	} else if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
+ 		char **names;
+ 		XFontStruct **xfonts;
+ 
+@@ -134,14 +166,16 @@ loadfont(DC *dc, const char *fontstr) {
+ 			dc->font.ascent = MAX(dc->font.ascent, xfonts[i]->ascent);
+ 			dc->font.descent = MAX(dc->font.descent, xfonts[i]->descent);
+ 		}
+-	}
+-	else if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
+-		dc->font.ascent = dc->font.xfont->ascent;
+-		dc->font.descent = dc->font.xfont->descent;
+-	}
++    } else if((dc->font.xft_font = XftFontOpenName(dc->dpy,
++            DefaultScreen(dc->dpy), fontstr))) {
++        dc->font.ascent = dc->font.xft_font->ascent;
++        dc->font.descent = dc->font.xft_font->descent;
++	} else {
++	    eprintf("cannot load font '%s'\n", fontstr);
++    }
+ 	if(missing)
+ 		XFreeStringList(missing);
+-	return (dc->font.set || dc->font.xfont);
++	dc->font.height = dc->font.ascent + dc->font.descent;
+ }
+ 
+ void
+@@ -151,6 +185,7 @@ mapdc(DC *dc, Window win, unsigned int w
+ 
+ void
+ resizedc(DC *dc, unsigned int w, unsigned int h) {
++    int screen = DefaultScreen(dc->dpy);
+ 	if(dc->canvas)
+ 		XFreePixmap(dc->dpy, dc->canvas);
+ 
+@@ -158,18 +193,30 @@ resizedc(DC *dc, unsigned int w, unsigne
+ 	                           DefaultDepth(dc->dpy, DefaultScreen(dc->dpy)));
+ 	dc->w = w;
+ 	dc->h = h;
++    if(dc->font.xft_font && !(dc->xftdraw)) {
++       dc->xftdraw = XftDrawCreate(dc->dpy, dc->canvas, DefaultVisual(dc->dpy,screen), DefaultColormap(dc->dpy,screen));
++        if(!(dc->xftdraw))
++            eprintf("error, cannot create xft drawable\n");
++    }
++
+ }
+ 
+ int
+ textnw(DC *dc, const char *text, size_t len) {
+-	if(dc->font.set) {
++	 if(dc->font.xft_font) {
++        XGlyphInfo gi;
++        XftTextExtentsUtf8(dc->dpy, dc->font.xft_font, (const FcChar8*)text, len, &gi);
++        return gi.width;
++    } else   if(dc->font.set) {
+ 		XRectangle r;
+ 
+ 		XmbTextExtents(dc->font.set, text, len, NULL, &r);
+ 		return r.width;
+-	}
+-	return XTextWidth(dc->font.xfont, text, len);
+-}
++    } else {
++	    return XTextWidth(dc->font.xfont, text, len);
++    }
++
++    }
+ 
+ int
+ textw(DC *dc, const char *text) {
+diff -rup dmenu-4.3.1/draw.h dmenu-xft/draw.h
+--- dmenu-4.3.1/draw.h	2011-05-18 21:32:16.000000000 +0530
++++ dmenu-xft/draw.h	2011-05-20 03:01:58.000000000 +0530
+@@ -1,28 +1,34 @@
+ /* See LICENSE file for copyright and license details. */
+ 
+-#define FG(dc, col)  ((col)[(dc)->invert ? ColBG : ColFG])
+-#define BG(dc, col)  ((col)[(dc)->invert ? ColFG : ColBG])
+-
+-enum { ColBG, ColFG, ColBorder, ColLast };
++#include <X11/Xft/Xft.h>
+ 
+ typedef struct {
+ 	int x, y, w, h;
+-	Bool invert;
+ 	Display *dpy;
+ 	GC gc;
+ 	Pixmap canvas;
++    XftDraw *xftdraw;
+ 	struct {
+ 		int ascent;
+ 		int descent;
+ 		int height;
+ 		XFontSet set;
+ 		XFontStruct *xfont;
++        XftFont *xft_font;
+ 	} font;
+ } DC;  /* draw context */
+ 
++typedef struct {
++    unsigned long FG;
++    XftColor FG_xft;
++    unsigned long BG;
++} ColorSet;
++
++
+ void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color);
+-void drawtext(DC *dc, const char *text, unsigned long col[ColLast]);
+-void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]);
++void drawtext(DC *dc, const char *text, ColorSet *col);
++void drawtextn(DC *dc, const char *text, size_t n, ColorSet *col);
++void freecol(DC *dc, ColorSet *col);
+ void eprintf(const char *fmt, ...);
+ void freedc(DC *dc);
+ unsigned long getcolor(DC *dc, const char *colstr);
+@@ -32,3 +38,5 @@ void mapdc(DC *dc, Window win, unsigned
+ void resizedc(DC *dc, unsigned int w, unsigned int h);
+ int textnw(DC *dc, const char *text, size_t len);
+ int textw(DC *dc, const char *text);
++ColorSet *initcolor(DC *dc, const char *foreground, const char *background);
++

diff --git a/x11-misc/dmenu/metadata.xml b/x11-misc/dmenu/metadata.xml
new file mode 100644
index 0000000..32c2cb5
--- /dev/null
+++ b/x11-misc/dmenu/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>no-herd</herd>
+<maintainer>
+<email>xmw@gentoo.org</email>
+<name>Michael Weber</name>
+</maintainer>
+</pkgmetadata>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] dev/xmw:master commit in: x11-misc/dmenu/files/, x11-misc/dmenu/
@ 2012-01-10  2:41 Michael Weber
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Weber @ 2012-01-10  2:41 UTC (permalink / raw
  To: gentoo-commits

commit:     0e4d7e633f524fa24701b0cf89321f2d1ecb2a98
Author:     Michael Weber <xmw <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 10 02:40:50 2012 +0000
Commit:     Michael Weber <xmw <AT> gentoo <DOT> org>
CommitDate: Tue Jan 10 02:40:50 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/xmw.git;a=commit;h=0e4d7e63

x11-misc/xft: patched 4.4.1, version bump to 4.5

(Portage version: 2.1.10.41/git/Linux x86_64, signed Manifest commit with key 62EEF090)

---
 x11-misc/dmenu/ChangeLog                   |    9 +-
 x11-misc/dmenu/Manifest                    |   13 +-
 x11-misc/dmenu/dmenu-4.4.1-r2.ebuild       |   48 ++++
 x11-misc/dmenu/dmenu-4.5.ebuild            |   45 +++
 x11-misc/dmenu/files/dmenu-4.4.1-xft.patch |  405 ++++++++++++++++++++++++++++
 5 files changed, 515 insertions(+), 5 deletions(-)

diff --git a/x11-misc/dmenu/ChangeLog b/x11-misc/dmenu/ChangeLog
index 3594f0a..17ca746 100644
--- a/x11-misc/dmenu/ChangeLog
+++ b/x11-misc/dmenu/ChangeLog
@@ -1,7 +1,14 @@
 # ChangeLog for x11-misc/dmenu
-# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+*dmenu-4.5 (10 Jan 2012)
+*dmenu-4.4.1-r2 (10 Jan 2012)
+
+  10 Jan 2012; Michael Weber <xmw@gentoo.org> +dmenu-4.4.1-r2.ebuild,
+  +files/dmenu-4.4.1-xft.patch, +dmenu-4.5.ebuild:
+  xft patched 4.4.1, version bump to 4.5
+
 *dmenu-4.3.1 (31 May 2011)
 
   31 May 2011; Michael Weber <xmw@gentoo.org> +dmenu-4.3.1.ebuild,

diff --git a/x11-misc/dmenu/Manifest b/x11-misc/dmenu/Manifest
index b2f2437..9fbb9ed 100644
--- a/x11-misc/dmenu/Manifest
+++ b/x11-misc/dmenu/Manifest
@@ -2,14 +2,19 @@
 Hash: SHA256
 
 AUX dmenu-4.3.1-xft.patch 11711 RMD160 43c39e128d6fbe07e81945ef5567153d709fe2a4 SHA1 0f893f21406e4d292b0c1e9b96efe31957103bd6 SHA256 61ef78f8b6105828e4120cb3a15c994f92bbec8b909c7a34fa9fda24f7dd17e7
+AUX dmenu-4.4.1-xft.patch 12279 RMD160 d2b02e2f40ebdb00542dc2261f163f6ce731a1b5 SHA1 f5c9d9c956355379d225169c44fac81e8dc4c52f SHA256 6866e820481f1dc411f542f79240ea89e187f6e1394d62b69874fcc29f3ebe7f
 DIST dmenu-4.3.1.tar.gz 8905 RMD160 61675030c88c31bce88c6d2a2e408b28f622b68c SHA1 c22c468f9383ff485feacb9662571c4d1601aca3 SHA256 7da646228b52a2a5966b27190701e9514c08ee16ac538404b5dfa13b10b3c0ca
+DIST dmenu-4.4.1.tar.gz 9318 RMD160 4a15486eaf19fdde93e763ec340001e5e74ac2a4 SHA1 42f8bb4b8bf72840cc343f0b3f31975a22350e5a SHA256 6d641645ab610d98d847b9a64500be7cc0e75bff5342534906936afa6ddb4550
+DIST dmenu-4.5.tar.gz 11543 RMD160 b771a84e0e9a8fbb29317c07fa77f92b64dcdc2f SHA1 70c1a13b950b7b0cb1bc35e30c6e861a78359953 SHA256 082cd698d82125ca0b3989006fb84ac4675c2a5585bf5bb8af0ea09cfb95a850
 EBUILD dmenu-4.3.1.ebuild 1256 RMD160 9e1d2448873906c9ca449dff1443ffd8978235cd SHA1 7f20eea3ea0394cb26dd7fde942a31c32cbe6c65 SHA256 63e98a85ed550a57ca3216a969e209567b7dc53d445186a5338f217203ed723a
-MISC ChangeLog 288 RMD160 e5d48ca2feecd9cfc201e090fec3821686dad480 SHA1 985d395d023bf3a8ebeaa9446e9a07936e5a2407 SHA256 96d1993dbba93014471ab60b0554446cb3c3023b63b4a21b0209f05c0e4e12b9
+EBUILD dmenu-4.4.1-r2.ebuild 1293 RMD160 6829e4ef5232a34a706b4abf0c1c42bfa0e6a9df SHA1 6c3cb743c4c9e7bd170d5f4e68765edcc239e485 SHA256 e53a101a670c9a99eed42f71db34f624f26bfac29e75b941bead00e7b83b9152
+EBUILD dmenu-4.5.ebuild 1150 RMD160 ba9ba9f5820dd59973b5dfcbbec297299ac9ceb7 SHA1 3d91b58bf8a1fd2f9586ee71b07c0a720084a5a4 SHA256 431a3a679873bc7da7bff660a1ec5ca0d6a70cdf5bf6bd06bab18c570d811198
+MISC ChangeLog 507 RMD160 b5142114c0ecfc63ef2e6764e28c0dbe09a1fd81 SHA1 1daea8c57b6b9001707791af630f8758573ec63a SHA256 d8488888731d361ef7135a1c2aa5ae5b1213b07ef8727ec1f16a706c075ea759
 MISC metadata.xml 244 RMD160 ba31bc851ce5d8e007b223b4f799d84d4c6699d0 SHA1 2192e855054fb7016488afba3eda6d938fdf925d SHA256 1022f65be1952b5197408dfbf61543b61557601ce3a9f15acabeb3e9d84a0fbe
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.17 (GNU/Linux)
 
-iF4EAREIAAYFAk3kVXoACgkQknrdDGLu8JASHwD/VvMI0QKhOw5HwkJFGwZiPBb3
-GtKV7gP1zEwZ1vqAYjMA/2shEGPOyLqRNaTLsShI/gdfK9Xkun4LyQeDD3SClXyP
-=rcB5
+iF4EAREIAAYFAk8LpTEACgkQknrdDGLu8JDxLwD/dkfEXcNzicvP64KmColPJZZm
+TKplRSpeyEjSIUhfBsEA+wcr72OybJtgQwQ60EnhaDBpV2LaquZkBRSC9GA4BaT3
+=ydEL
 -----END PGP SIGNATURE-----

diff --git a/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild b/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild
new file mode 100644
index 0000000..d3e3aa2
--- /dev/null
+++ b/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $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 $
+
+EAPI="4"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System"
+HOMEPAGE="http://www.suckless.org/programs/dmenu.html"
+SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE="xft xinerama"
+
+DEPEND="x11-libs/libX11
+	xinerama? ( x11-libs/libXinerama )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+	if use xft ; then
+		epatch "${FILESDIR}/${P}-xft.patch"
+	fi
+
+	sed -i \
+		-e "s/CFLAGS   = -ansi -pedantic -Wall -Os/CFLAGS  += -ansi -pedantic -Wall/" \
+		-e "s/LDFLAGS  = -s/LDFLAGS  +=/" \
+		-e "s/XINERAMALIBS  =/XINERAMALIBS  ?=/" \
+		-e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \
+		config.mk || die
+	sed -i -e 's|lsx|dmenu_&|g' dmenu_run lsx.1 lsx.c || die
+}
+
+src_compile() {
+	if use xinerama; then
+		emake CC=$(tc-getCC)
+	else
+		emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS=""
+	fi
+}
+
+src_install() {
+	emake DESTDIR="${D}" PREFIX="/usr" install
+	mv "${D}"/usr/bin/{,dmenu_}lsx || die
+	mv "${D}"/usr/share/man/man1/{,dmenu_}lsx.1 || die
+}

diff --git a/x11-misc/dmenu/dmenu-4.5.ebuild b/x11-misc/dmenu/dmenu-4.5.ebuild
new file mode 100644
index 0000000..c59345e
--- /dev/null
+++ b/x11-misc/dmenu/dmenu-4.5.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $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 $
+
+EAPI="4"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System"
+HOMEPAGE="http://www.suckless.org/programs/dmenu.html"
+SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE="xinerama"
+
+DEPEND="x11-libs/libX11
+	xinerama? ( x11-libs/libXinerama )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+	#if use xft ; then
+	#	epatch "${FILESDIR}/${PN}-4.4.1-xft.patch"
+	#fi
+
+	sed -i \
+		-e "s/CFLAGS   = -ansi -pedantic -Wall -Os/CFLAGS  += -ansi -pedantic -Wall/" \
+		-e "s/LDFLAGS  = -s/LDFLAGS  +=/" \
+		-e "s/XINERAMALIBS  =/XINERAMALIBS  ?=/" \
+		-e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \
+		config.mk || die
+}
+
+src_compile() {
+	if use xinerama; then
+		emake CC=$(tc-getCC)
+	else
+		emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS=""
+	fi
+}
+
+src_install() {
+	emake DESTDIR="${D}" PREFIX="/usr" install
+}

diff --git a/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch b/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch
new file mode 100644
index 0000000..dc6f5c3
--- /dev/null
+++ b/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch
@@ -0,0 +1,405 @@
+--- a/dmenu.c	2011-09-19 11:48:13.000000000 +0200
++++ b/dmenu.c	2011-12-31 00:48:16.000000000 +0200
+@@ -16,6 +16,7 @@
+ #define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh))
+ #define MIN(a,b)                ((a) < (b) ? (a) : (b))
+ #define MAX(a,b)                ((a) > (b) ? (a) : (b))
++#define DEFFONT "fixed" /* xft example: "Monospace-11" */
+ 
+ typedef struct Item Item;
+ struct Item {
+@@ -25,6 +26,7 @@ struct Item {
+ 
+ static void appenditem(Item *item, Item **list, Item **last);
+ static void calcoffsets(void);
++static void cleanup(void);
+ static char *cistrstr(const char *s, const char *sub);
+ static void drawmenu(void);
+ static void grabkeyboard(void);
+@@ -49,10 +51,12 @@ static const char *normbgcolor = "#ccccc
+ static const char *normfgcolor = "#000000";
+ static const char *selbgcolor  = "#0066ff";
+ static const char *selfgcolor  = "#ffffff";
+-static unsigned long normcol[ColLast];
+-static unsigned long selcol[ColLast];
++static ColorSet *normcol;
++static ColorSet *selcol;
+ static Atom utf8;
+ static Bool topbar = True;
++static Bool running = True;
++static int ret = 0;
+ static DC *dc;
+ static Item *items = NULL;
+ static Item *matches, *matchend;
+@@ -102,7 +106,9 @@ main(int argc, char *argv[]) {
+ 			usage();
+ 
+ 	dc = initdc();
+-	initfont(dc, font);
++	initfont(dc, font ? font : DEFFONT);
++	normcol = initcolor(dc, normfgcolor, normbgcolor);
++	selcol = initcolor(dc, selfgcolor, selbgcolor);
+ 
+ 	if(fast) {
+ 		grabkeyboard();
+@@ -115,7 +121,8 @@ main(int argc, char *argv[]) {
+ 	setup();
+ 	run();
+ 
+-	return EXIT_FAILURE; /* unreachable */
++	cleanup();
++	return ret;
+ }
+ 
+ void
+@@ -158,6 +165,16 @@ cistrstr(const char *s, const char *sub)
+ }
+ 
+ void
++cleanup(void) {
++    Item *itm;
++    freecol(dc, normcol);
++    freecol(dc, selcol);
++    XDestroyWindow(dc->dpy, win);
++    XUngrabKeyboard(dc->dpy, CurrentTime);
++    freedc(dc);
++}
++
++void
+ drawmenu(void) {
+ 	int curpos;
+ 	Item *item;
+@@ -165,7 +182,7 @@ drawmenu(void) {
+ 	dc->x = 0;
+ 	dc->y = 0;
+ 	dc->h = bh;
+-	drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol));
++	drawrect(dc, 0, 0, mw, mh, True, normcol->BG);
+ 
+ 	if(prompt) {
+ 		dc->w = promptw;
+@@ -175,7 +192,7 @@ drawmenu(void) {
+ 	dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw;
+ 	drawtext(dc, text, normcol);
+ 	if((curpos = textnw(dc, text, cursor) + dc->h/2 - 2) < dc->w)
+-		drawrect(dc, curpos, 2, 1, dc->h - 4, True, FG(dc, normcol));
++		drawrect(dc, curpos, 2, 1, dc->h - 4, True, normcol->FG);
+ 
+ 	if(lines > 0) {
+ 		dc->w = mw - dc->x;
+@@ -301,7 +318,8 @@ keypress(XKeyEvent *ev) {
+ 		sel = matchend;
+ 		break;
+ 	case XK_Escape:
+-		exit(EXIT_FAILURE);
++        ret = EXIT_FAILURE;
++        running = False;
+ 	case XK_Home:
+ 		if(sel == matches) {
+ 			cursor = 0;
+@@ -337,7 +355,8 @@ keypress(XKeyEvent *ev) {
+ 	case XK_Return:
+ 	case XK_KP_Enter:
+ 		puts((sel && !(ev->state & ShiftMask)) ? sel->text : text);
+-		exit(EXIT_SUCCESS);
++		ret = EXIT_SUCCESS;
++		running = False;
+ 	case XK_Right:
+ 		if(text[cursor] != '\0') {
+ 			cursor = nextrune(+1);
+@@ -449,7 +468,7 @@ void
+ run(void) {
+ 	XEvent ev;
+ 
+-	while(!XNextEvent(dc->dpy, &ev))
++	while(running && !XNextEvent(dc->dpy, &ev))
+ 		switch(ev.type) {
+ 		case Expose:
+ 			if(ev.xexpose.count == 0)
+@@ -479,11 +498,6 @@ setup(void) {
+ 	XineramaScreenInfo *info;
+ #endif
+ 
+-	normcol[ColBG] = getcolor(dc, normbgcolor);
+-	normcol[ColFG] = getcolor(dc, normfgcolor);
+-	selcol[ColBG]  = getcolor(dc, selbgcolor);
+-	selcol[ColFG]  = getcolor(dc, selfgcolor);
+-
+ 	utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
+ 
+ 	/* menu geometry */
+--- a/draw.c	2011-09-19 11:48:13.000000000 +0200
++++ b/draw.c	2011-12-31 01:44:39.000000000 +0200
+@@ -9,9 +9,6 @@
+ 
+ #define MAX(a, b)  ((a) > (b) ? (a) : (b))
+ #define MIN(a, b)  ((a) < (b) ? (a) : (b))
+-#define DEFAULTFN  "fixed"
+-
+-static Bool loadfont(DC *dc, const char *fontstr);
+ 
+ void
+ drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color) {
+@@ -23,7 +20,7 @@ drawrect(DC *dc, int x, int y, unsigned 
+ }
+ 
+ void
+-drawtext(DC *dc, const char *text, unsigned long col[ColLast]) {
++drawtext(DC *dc, const char *text, ColorSet *col) {
+ 	char buf[BUFSIZ];
+ 	size_t mn, n = strlen(text);
+ 
+@@ -35,19 +32,24 @@ drawtext(DC *dc, const char *text, unsig
+ 	if(mn < n)
+ 		for(n = MAX(mn-3, 0); n < mn; buf[n++] = '.');
+ 
+-	drawrect(dc, 0, 0, dc->w, dc->h, True, BG(dc, col));
++	drawrect(dc, 0, 0, dc->w, dc->h, True, col->BG);
+ 	drawtextn(dc, buf, mn, col);
+ }
+ 
+ void
+-drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]) {
++drawtextn(DC *dc, const char *text, size_t n, ColorSet *col) {
+ 	int x = dc->x + dc->font.height/2;
+ 	int y = dc->y + dc->font.ascent+1;
+ 
+-	XSetForeground(dc->dpy, dc->gc, FG(dc, col));
+-	if(dc->font.set)
++	XSetForeground(dc->dpy, dc->gc, col->FG);
++	if(dc->font.xft_font) {
++		if (!dc->xftdraw)
++			eprintf("error, xft drawable does not exist");
++		XftDrawStringUtf8(dc->xftdraw, &col->FG_xft,
++			dc->font.xft_font, x, y, (unsigned char*)text, n);
++	} else if(dc->font.set) {
+ 		XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n);
+-	else {
++	} else {
+ 		XSetFont(dc->dpy, dc->gc, dc->font.xfont->fid);
+ 		XDrawString(dc->dpy, dc->canvas, dc->gc, x, y, text, n);
+ 	}
+@@ -69,16 +71,33 @@ eprintf(const char *fmt, ...) {
+ }
+ 
+ void
++freecol(DC *dc, ColorSet *col) {
++    if(col) {
++        if(&col->FG_xft)
++            XftColorFree(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)),
++                DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), &col->FG_xft);
++        free(col); 
++    }
++}
++
++void
+ freedc(DC *dc) {
++    if(dc->font.xft_font) {
++        XftFontClose(dc->dpy, dc->font.xft_font);
++        XftDrawDestroy(dc->xftdraw);
++    }
+ 	if(dc->font.set)
+ 		XFreeFontSet(dc->dpy, dc->font.set);
+-	if(dc->font.xfont)
++    if(dc->font.xfont)
+ 		XFreeFont(dc->dpy, dc->font.xfont);
+-	if(dc->canvas)
++    if(dc->canvas)
+ 		XFreePixmap(dc->dpy, dc->canvas);
+-	XFreeGC(dc->dpy, dc->gc);
+-	XCloseDisplay(dc->dpy);
+-	free(dc);
++	if(dc->gc)
++        XFreeGC(dc->dpy, dc->gc);
++	if(dc->dpy)
++        XCloseDisplay(dc->dpy);
++	if(dc)
++        free(dc);
+ }
+ 
+ unsigned long
+@@ -91,6 +110,20 @@ getcolor(DC *dc, const char *colstr) {
+ 	return color.pixel;
+ }
+ 
++ColorSet *
++initcolor(DC *dc, const char * foreground, const char * background) {
++	ColorSet * col = (ColorSet *)malloc(sizeof(ColorSet));
++	if(!col)
++		eprintf("error, cannot allocate memory for color set");
++	col->BG = getcolor(dc, background);
++	col->FG = getcolor(dc, foreground);
++	if(dc->font.xft_font)
++		if(!XftColorAllocName(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)),
++			DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), foreground, &col->FG_xft))
++			eprintf("error, cannot allocate xft font color '%s'\n", foreground);
++	return col;
++}
++
+ DC *
+ initdc(void) {
+ 	DC *dc;
+@@ -109,39 +142,33 @@ initdc(void) {
+ 
+ void
+ initfont(DC *dc, const char *fontstr) {
+-	if(!loadfont(dc, fontstr ? fontstr : DEFAULTFN)) {
+-		if(fontstr != NULL)
+-			fprintf(stderr, "cannot load font '%s'\n", fontstr);
+-		if(fontstr == NULL || !loadfont(dc, DEFAULTFN))
+-			eprintf("cannot load font '%s'\n", DEFAULTFN);
+-	}
+-	dc->font.height = dc->font.ascent + dc->font.descent;
+-}
+-
+-Bool
+-loadfont(DC *dc, const char *fontstr) {
+ 	char *def, **missing, **names;
+ 	int i, n;
+ 	XFontStruct **xfonts;
+ 
+-	if(!*fontstr)
+-		return False;
+-	if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
++	missing = NULL;
++	if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
++		dc->font.ascent = dc->font.xfont->ascent;
++		dc->font.descent = dc->font.xfont->descent;
++		dc->font.width   = dc->font.xfont->max_bounds.width;
++	} else if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
+ 		n = XFontsOfFontSet(dc->font.set, &xfonts, &names);
+ 		for(i = 0; i < n; i++) {
+ 			dc->font.ascent  = MAX(dc->font.ascent,  xfonts[i]->ascent);
+ 			dc->font.descent = MAX(dc->font.descent, xfonts[i]->descent);
+ 			dc->font.width   = MAX(dc->font.width,   xfonts[i]->max_bounds.width);
+ 		}
+-	}
+-	else if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
+-		dc->font.ascent  = dc->font.xfont->ascent;
+-		dc->font.descent = dc->font.xfont->descent;
+-		dc->font.width   = dc->font.xfont->max_bounds.width;
++	} else if((dc->font.xft_font = XftFontOpenName(dc->dpy, DefaultScreen(dc->dpy), fontstr))) {
++		dc->font.ascent = dc->font.xft_font->ascent;
++		dc->font.descent = dc->font.xft_font->descent;
++		dc->font.width = dc->font.xft_font->max_advance_width;
++	} else {
++		eprintf("cannot load font '%s'\n", fontstr);
+ 	}
+ 	if(missing)
+ 		XFreeStringList(missing);
+-	return dc->font.set || dc->font.xfont;
++	dc->font.height = dc->font.ascent + dc->font.descent;
++	return;
+ }
+ 
+ void
+@@ -151,20 +178,29 @@ mapdc(DC *dc, Window win, unsigned int w
+ 
+ void
+ resizedc(DC *dc, unsigned int w, unsigned int h) {
++	int screen = DefaultScreen(dc->dpy);
+ 	if(dc->canvas)
+ 		XFreePixmap(dc->dpy, dc->canvas);
+ 
+ 	dc->w = w;
+ 	dc->h = h;
+ 	dc->canvas = XCreatePixmap(dc->dpy, DefaultRootWindow(dc->dpy), w, h,
+-	                           DefaultDepth(dc->dpy, DefaultScreen(dc->dpy)));
++	                           DefaultDepth(dc->dpy, screen));
++	if(dc->font.xft_font && !(dc->xftdraw)) {
++		dc->xftdraw = XftDrawCreate(dc->dpy, dc->canvas, DefaultVisual(dc->dpy,screen), DefaultColormap(dc->dpy,screen));
++		if(!(dc->xftdraw))
++			eprintf("error, cannot create xft drawable\n");
++	}
+ }
+ 
+ int
+ textnw(DC *dc, const char *text, size_t len) {
+-	if(dc->font.set) {
++	if(dc->font.xft_font) {
++		XGlyphInfo gi;
++		XftTextExtentsUtf8(dc->dpy, dc->font.xft_font, (const FcChar8*)text, len, &gi);
++		return gi.width;
++	} else if(dc->font.set) {
+ 		XRectangle r;
+-
+ 		XmbTextExtents(dc->font.set, text, len, NULL, &r);
+ 		return r.width;
+ 	}
+--- a/draw.h	2011-09-19 11:48:13.000000000 +0200
++++ b/draw.h	2011-12-31 00:28:01.000000000 +0200
+@@ -1,9 +1,6 @@
+ /* See LICENSE file for copyright and license details. */
+ 
+-#define FG(dc, col)  ((col)[(dc)->invert ? ColBG : ColFG])
+-#define BG(dc, col)  ((col)[(dc)->invert ? ColFG : ColBG])
+-
+-enum { ColBG, ColFG, ColBorder, ColLast };
++#include <X11/Xft/Xft.h>
+ 
+ typedef struct {
+ 	int x, y, w, h;
+@@ -11,6 +8,7 @@ typedef struct {
+ 	Display *dpy;
+ 	GC gc;
+ 	Pixmap canvas;
++	XftDraw *xftdraw;
+ 	struct {
+ 		int ascent;
+ 		int descent;
+@@ -18,15 +16,24 @@ typedef struct {
+ 		int width;
+ 		XFontSet set;
+ 		XFontStruct *xfont;
++		XftFont *xft_font;
+ 	} font;
+ } DC;  /* draw context */
+ 
++typedef struct {
++	unsigned long FG;
++	XftColor FG_xft;
++	unsigned long BG;
++} ColorSet;
++
+ void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color);
+-void drawtext(DC *dc, const char *text, unsigned long col[ColLast]);
+-void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]);
++void drawtext(DC *dc, const char *text, ColorSet *col);
++void drawtextn(DC *dc, const char *text, size_t n, ColorSet *col);
++void freecol(DC *dc, ColorSet *col);
+ void eprintf(const char *fmt, ...);
+ void freedc(DC *dc);
+ unsigned long getcolor(DC *dc, const char *colstr);
++ColorSet *initcolor(DC *dc, const char *foreground, const char *background);
+ DC *initdc(void);
+ void initfont(DC *dc, const char *fontstr);
+ void mapdc(DC *dc, Window win, unsigned int w, unsigned int h);
+--- a/dmenu.1	2011-09-19 11:48:13.000000000 +0200
++++ b/dmenu.1	2011-12-30 23:23:44.000000000 +0200
+@@ -55,7 +55,7 @@
+ defines the prompt to be displayed to the left of the input field.
+ .TP
+ .BI \-fn " font"
+-defines the font or font set used.
++defines the font or font set used. eg. "fixed" or "Monospace-12:normal" (an xft font)
+ .TP
+ .BI \-nb " color"
+ defines the normal background color.
+--- a/config.mk	2011-12-30 23:23:44.000000000 +0200
++++ b/config.mk	2011-12-30 23:23:44.000000000 +0200
+@@ -12,9 +12,13 @@
+ XINERAMALIBS  = -lXinerama
+ XINERAMAFLAGS = -DXINERAMA
+ 
++# Xft, comment if you don't want it
++XFTINC = -I/usr/include/freetype2
++XFTLIBS  = -lXft -lXrender -lfreetype -lz -lfontconfig
++
+ # includes and libs
+-INCS = -I${X11INC}
+-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS}
++INCS = -I${X11INC} ${XFTINC}
++LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${XFTLIBS}
+ 
+ # flags
+ CPPFLAGS+= -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] dev/xmw:master commit in: x11-misc/dmenu/files/, x11-misc/dmenu/
@ 2012-03-05 11:59 Michael Weber
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Weber @ 2012-03-05 11:59 UTC (permalink / raw
  To: gentoo-commits

commit:     ca4f7fd3384bbcee5040f250a7f1229aa006184b
Author:     Michael Weber <xmw <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  5 11:58:36 2012 +0000
Commit:     Michael Weber <xmw <AT> gentoo <DOT> org>
CommitDate: Mon Mar  5 11:58:36 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/xmw.git;a=commit;h=ca4f7fd3

x11-misc/dmenu: thanks jer for adding xft in the main tree.

---
 x11-misc/dmenu/ChangeLog                   |   17 --
 x11-misc/dmenu/Manifest                    |   20 --
 x11-misc/dmenu/dmenu-4.3.1.ebuild          |   48 ----
 x11-misc/dmenu/dmenu-4.4.1-r2.ebuild       |   48 ----
 x11-misc/dmenu/dmenu-4.5.ebuild            |   45 ---
 x11-misc/dmenu/files/dmenu-4.3.1-xft.patch |  381 --------------------------
 x11-misc/dmenu/files/dmenu-4.4.1-xft.patch |  405 ----------------------------
 x11-misc/dmenu/metadata.xml                |    9 -
 8 files changed, 0 insertions(+), 973 deletions(-)

diff --git a/x11-misc/dmenu/ChangeLog b/x11-misc/dmenu/ChangeLog
deleted file mode 100644
index 17ca746..0000000
--- a/x11-misc/dmenu/ChangeLog
+++ /dev/null
@@ -1,17 +0,0 @@
-# ChangeLog for x11-misc/dmenu
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: $
-
-*dmenu-4.5 (10 Jan 2012)
-*dmenu-4.4.1-r2 (10 Jan 2012)
-
-  10 Jan 2012; Michael Weber <xmw@gentoo.org> +dmenu-4.4.1-r2.ebuild,
-  +files/dmenu-4.4.1-xft.patch, +dmenu-4.5.ebuild:
-  xft patched 4.4.1, version bump to 4.5
-
-*dmenu-4.3.1 (31 May 2011)
-
-  31 May 2011; Michael Weber <xmw@gentoo.org> +dmenu-4.3.1.ebuild,
-  +files/dmenu-4.3.1-xft.patch, +metadata.xml:
-  Initial import w/ xft patch
-

diff --git a/x11-misc/dmenu/Manifest b/x11-misc/dmenu/Manifest
deleted file mode 100644
index 9fbb9ed..0000000
--- a/x11-misc/dmenu/Manifest
+++ /dev/null
@@ -1,20 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
-
-AUX dmenu-4.3.1-xft.patch 11711 RMD160 43c39e128d6fbe07e81945ef5567153d709fe2a4 SHA1 0f893f21406e4d292b0c1e9b96efe31957103bd6 SHA256 61ef78f8b6105828e4120cb3a15c994f92bbec8b909c7a34fa9fda24f7dd17e7
-AUX dmenu-4.4.1-xft.patch 12279 RMD160 d2b02e2f40ebdb00542dc2261f163f6ce731a1b5 SHA1 f5c9d9c956355379d225169c44fac81e8dc4c52f SHA256 6866e820481f1dc411f542f79240ea89e187f6e1394d62b69874fcc29f3ebe7f
-DIST dmenu-4.3.1.tar.gz 8905 RMD160 61675030c88c31bce88c6d2a2e408b28f622b68c SHA1 c22c468f9383ff485feacb9662571c4d1601aca3 SHA256 7da646228b52a2a5966b27190701e9514c08ee16ac538404b5dfa13b10b3c0ca
-DIST dmenu-4.4.1.tar.gz 9318 RMD160 4a15486eaf19fdde93e763ec340001e5e74ac2a4 SHA1 42f8bb4b8bf72840cc343f0b3f31975a22350e5a SHA256 6d641645ab610d98d847b9a64500be7cc0e75bff5342534906936afa6ddb4550
-DIST dmenu-4.5.tar.gz 11543 RMD160 b771a84e0e9a8fbb29317c07fa77f92b64dcdc2f SHA1 70c1a13b950b7b0cb1bc35e30c6e861a78359953 SHA256 082cd698d82125ca0b3989006fb84ac4675c2a5585bf5bb8af0ea09cfb95a850
-EBUILD dmenu-4.3.1.ebuild 1256 RMD160 9e1d2448873906c9ca449dff1443ffd8978235cd SHA1 7f20eea3ea0394cb26dd7fde942a31c32cbe6c65 SHA256 63e98a85ed550a57ca3216a969e209567b7dc53d445186a5338f217203ed723a
-EBUILD dmenu-4.4.1-r2.ebuild 1293 RMD160 6829e4ef5232a34a706b4abf0c1c42bfa0e6a9df SHA1 6c3cb743c4c9e7bd170d5f4e68765edcc239e485 SHA256 e53a101a670c9a99eed42f71db34f624f26bfac29e75b941bead00e7b83b9152
-EBUILD dmenu-4.5.ebuild 1150 RMD160 ba9ba9f5820dd59973b5dfcbbec297299ac9ceb7 SHA1 3d91b58bf8a1fd2f9586ee71b07c0a720084a5a4 SHA256 431a3a679873bc7da7bff660a1ec5ca0d6a70cdf5bf6bd06bab18c570d811198
-MISC ChangeLog 507 RMD160 b5142114c0ecfc63ef2e6764e28c0dbe09a1fd81 SHA1 1daea8c57b6b9001707791af630f8758573ec63a SHA256 d8488888731d361ef7135a1c2aa5ae5b1213b07ef8727ec1f16a706c075ea759
-MISC metadata.xml 244 RMD160 ba31bc851ce5d8e007b223b4f799d84d4c6699d0 SHA1 2192e855054fb7016488afba3eda6d938fdf925d SHA256 1022f65be1952b5197408dfbf61543b61557601ce3a9f15acabeb3e9d84a0fbe
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.17 (GNU/Linux)
-
-iF4EAREIAAYFAk8LpTEACgkQknrdDGLu8JDxLwD/dkfEXcNzicvP64KmColPJZZm
-TKplRSpeyEjSIUhfBsEA+wcr72OybJtgQwQ60EnhaDBpV2LaquZkBRSC9GA4BaT3
-=ydEL
------END PGP SIGNATURE-----

diff --git a/x11-misc/dmenu/dmenu-4.3.1.ebuild b/x11-misc/dmenu/dmenu-4.3.1.ebuild
deleted file mode 100644
index aa06b5e..0000000
--- a/x11-misc/dmenu/dmenu-4.3.1.ebuild
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/x11-misc/dmenu/dmenu-4.2.1.ebuild,v 1.5 2011/03/16 21:17:05 xarthisius Exp $
-
-EAPI="2"
-
-inherit eutils toolchain-funcs
-
-DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System"
-HOMEPAGE="http://www.suckless.org/programs/dmenu.html"
-SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd"
-IUSE="xft xinerama"
-
-DEPEND="x11-libs/libX11
-	xinerama? ( x11-libs/libXinerama )"
-RDEPEND=${DEPEND}
-
-src_prepare() {
-	if use xft ; then
-		epatch "${FILESDIR}/${P}-xft.patch"
-	fi
-
-	sed -i \
-		-e "s/CFLAGS   = -ansi -pedantic -Wall -Os/CFLAGS  += -ansi -pedantic -Wall/" \
-		-e "s/LDFLAGS  = -s/LDFLAGS  += -g/" \
-		-e "s/XINERAMALIBS  =/XINERAMALIBS  ?=/" \
-		-e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \
-		config.mk || die "sed failed"
-}
-
-src_compile() {
-	if use xinerama; then
-		emake CC=$(tc-getCC) || die "emake failed"
-	else
-		emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS="" \
-			|| die "emake failed"
-	fi
-}
-
-src_install() {
-	emake DESTDIR="${D}" PREFIX="/usr" install || die "emake install failed"
-
-	dodoc README
-}

diff --git a/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild b/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild
deleted file mode 100644
index d3e3aa2..0000000
--- a/x11-misc/dmenu/dmenu-4.4.1-r2.ebuild
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $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 $
-
-EAPI="4"
-
-inherit eutils toolchain-funcs
-
-DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System"
-HOMEPAGE="http://www.suckless.org/programs/dmenu.html"
-SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd"
-IUSE="xft xinerama"
-
-DEPEND="x11-libs/libX11
-	xinerama? ( x11-libs/libXinerama )"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	if use xft ; then
-		epatch "${FILESDIR}/${P}-xft.patch"
-	fi
-
-	sed -i \
-		-e "s/CFLAGS   = -ansi -pedantic -Wall -Os/CFLAGS  += -ansi -pedantic -Wall/" \
-		-e "s/LDFLAGS  = -s/LDFLAGS  +=/" \
-		-e "s/XINERAMALIBS  =/XINERAMALIBS  ?=/" \
-		-e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \
-		config.mk || die
-	sed -i -e 's|lsx|dmenu_&|g' dmenu_run lsx.1 lsx.c || die
-}
-
-src_compile() {
-	if use xinerama; then
-		emake CC=$(tc-getCC)
-	else
-		emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS=""
-	fi
-}
-
-src_install() {
-	emake DESTDIR="${D}" PREFIX="/usr" install
-	mv "${D}"/usr/bin/{,dmenu_}lsx || die
-	mv "${D}"/usr/share/man/man1/{,dmenu_}lsx.1 || die
-}

diff --git a/x11-misc/dmenu/dmenu-4.5.ebuild b/x11-misc/dmenu/dmenu-4.5.ebuild
deleted file mode 100644
index c59345e..0000000
--- a/x11-misc/dmenu/dmenu-4.5.ebuild
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $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 $
-
-EAPI="4"
-
-inherit eutils toolchain-funcs
-
-DESCRIPTION="a generic, highly customizable, and efficient menu for the X Window System"
-HOMEPAGE="http://www.suckless.org/programs/dmenu.html"
-SRC_URI="http://dl.suckless.org/tools/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd"
-IUSE="xinerama"
-
-DEPEND="x11-libs/libX11
-	xinerama? ( x11-libs/libXinerama )"
-RDEPEND="${DEPEND}"
-
-src_prepare() {
-	#if use xft ; then
-	#	epatch "${FILESDIR}/${PN}-4.4.1-xft.patch"
-	#fi
-
-	sed -i \
-		-e "s/CFLAGS   = -ansi -pedantic -Wall -Os/CFLAGS  += -ansi -pedantic -Wall/" \
-		-e "s/LDFLAGS  = -s/LDFLAGS  +=/" \
-		-e "s/XINERAMALIBS  =/XINERAMALIBS  ?=/" \
-		-e "s/XINERAMAFLAGS =/XINERAMAFLAGS ?=/" \
-		config.mk || die
-}
-
-src_compile() {
-	if use xinerama; then
-		emake CC=$(tc-getCC)
-	else
-		emake CC=$(tc-getCC) XINERAMAFLAGS="" XINERAMALIBS=""
-	fi
-}
-
-src_install() {
-	emake DESTDIR="${D}" PREFIX="/usr" install
-}

diff --git a/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch b/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch
deleted file mode 100644
index 0a2d7fb..0000000
--- a/x11-misc/dmenu/files/dmenu-4.3.1-xft.patch
+++ /dev/null
@@ -1,381 +0,0 @@
-diff -rup dmenu-4.3.1/config.mk dmenu-xft/config.mk
---- dmenu-4.3.1/config.mk	2011-05-18 21:32:16.000000000 +0530
-+++ dmenu-xft/config.mk	2011-05-20 03:14:15.000000000 +0530
-@@ -2,19 +2,24 @@
- VERSION = 4.3.1
- 
- # paths
--PREFIX = /usr/local
--MANPREFIX = ${PREFIX}/share/man
-+PREFIX = /usr
-+MANPREFIX = ${PREFIX}/share
- 
- X11INC = /usr/X11R6/include
- X11LIB = /usr/X11R6/lib
- 
-+# Xft, comment if you don't want it
-+XFTINC = /usr/include/freetype2
-+XFTLIBS  = -lXft -lXrender -lfreetype -lz -lfontconfig
-+
-+
- # Xinerama, comment if you don't want it
- XINERAMALIBS  = -lXinerama
- XINERAMAFLAGS = -DXINERAMA
- 
- # includes and libs
--INCS = -I${X11INC}
--LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS}
-+INCS = -I${X11INC} -I${XFTINC}
-+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${XFTLIBS}
- 
- # flags
- CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
-diff -rup dmenu-4.3.1/dmenu.c dmenu-xft/dmenu.c
---- dmenu-4.3.1/dmenu.c	2011-05-18 21:32:16.000000000 +0530
-+++ dmenu-xft/dmenu.c	2011-05-20 03:12:16.000000000 +0530
-@@ -16,6 +16,8 @@
- #define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh))
- #define MIN(a,b)                ((a) < (b) ? (a) : (b))
- #define MAX(a,b)                ((a) > (b) ? (a) : (b))
-+#define DEFFONT "fixed" /* xft example: "Monospace-11" */
-+
- 
- typedef struct Item Item;
- struct Item {
-@@ -49,8 +51,8 @@ static const char *normbgcolor = "#ccccc
- static const char *normfgcolor = "#000000";
- static const char *selbgcolor  = "#0066ff";
- static const char *selfgcolor  = "#ffffff";
--static unsigned long normcol[ColLast];
--static unsigned long selcol[ColLast];
-+static ColorSet *normcol;
-+static ColorSet *selcol;
- static Atom utf8;
- static Bool topbar = True;
- static DC *dc;
-@@ -99,7 +101,9 @@ main(int argc, char *argv[]) {
- 			usage();
- 
- 	dc = initdc();
--	initfont(dc, font);
-+    initfont(dc, font ? font : DEFFONT);
-+    normcol = initcolor(dc, normfgcolor, normbgcolor);
-+    selcol = initcolor(dc, selfgcolor, selbgcolor);
- 
- 	if(fast) {
- 		grabkeyboard();
-@@ -151,7 +155,8 @@ drawmenu(void) {
- 	dc->x = 0;
- 	dc->y = 0;
- 	dc->h = bh;
--	drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol));
-+	drawrect(dc, 0, 0, mw, mh, True, normcol->BG);
-+
- 
- 	if(prompt) {
- 		dc->w = promptw;
-@@ -161,7 +166,7 @@ drawmenu(void) {
- 	dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw;
- 	drawtext(dc, text, normcol);
- 	if((curpos = textnw(dc, text, cursor) + dc->h/2 - 2) < dc->w)
--		drawrect(dc, curpos, 2, 1, dc->h - 4, True, FG(dc, normcol));
-+			drawrect(dc, curpos, 2, 1, dc->h - 4, True, normcol->FG);
- 
- 	if(lines > 0) {
- 		dc->w = mw - dc->x;
-@@ -495,11 +500,12 @@ setup(void) {
- 	XineramaScreenInfo *info;
- #endif
- 
-+    /* 
- 	normcol[ColBG] = getcolor(dc, normbgcolor);
- 	normcol[ColFG] = getcolor(dc, normfgcolor);
- 	selcol[ColBG]  = getcolor(dc, selbgcolor);
- 	selcol[ColFG]  = getcolor(dc, selfgcolor);
--
-+*/
- 	utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
- 
- 	/* menu geometry */
-Only in dmenu-4.3.1: dmenu_path
-Only in dmenu-4.3.1: dmenu_run
-diff -rup dmenu-4.3.1/draw.c dmenu-xft/draw.c
---- dmenu-4.3.1/draw.c	2011-05-18 21:32:16.000000000 +0530
-+++ dmenu-xft/draw.c	2011-05-20 03:16:36.000000000 +0530
-@@ -5,13 +5,11 @@
- #include <stdlib.h>
- #include <string.h>
- #include <X11/Xlib.h>
-+#include <X11/Xft/Xft.h>
- #include "draw.h"
- 
- #define MAX(a, b)  ((a) > (b) ? (a) : (b))
- #define MIN(a, b)  ((a) < (b) ? (a) : (b))
--#define DEFAULTFN  "fixed"
--
--static Bool loadfont(DC *dc, const char *fontstr);
- 
- void
- drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color) {
-@@ -23,7 +21,7 @@ drawrect(DC *dc, int x, int y, unsigned
- }
- 
- void
--drawtext(DC *dc, const char *text, unsigned long col[ColLast]) {
-+drawtext(DC *dc, const char *text, ColorSet *col) {
- 	char buf[BUFSIZ];
- 	size_t mn, n = strlen(text);
- 
-@@ -35,19 +33,25 @@ drawtext(DC *dc, const char *text, unsig
- 	if(mn < n)
- 		for(n = MAX(mn-3, 0); n < mn; buf[n++] = '.');
- 
--	drawrect(dc, 0, 0, dc->w, dc->h, True, BG(dc, col));
-+drawrect(dc, 0, 0, dc->w, dc->h, True, col->BG);
-+
- 	drawtextn(dc, buf, mn, col);
- }
- 
- void
--drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]) {
-+drawtextn(DC *dc, const char *text, size_t n, ColorSet *col)  {
- 	int x = dc->x + dc->font.height/2;
- 	int y = dc->y + dc->font.ascent+1;
- 
--	XSetForeground(dc->dpy, dc->gc, FG(dc, col));
--	if(dc->font.set)
--		XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n);
--	else {
-+	XSetForeground(dc->dpy, dc->gc, col->FG);
-+	if(dc->font.xft_font) {
-+        if (!dc->xftdraw)
-+            eprintf("error, xft drawable does not exist");
-+        XftDrawStringUtf8(dc->xftdraw, &col->FG_xft, 
-+            dc->font.xft_font, x, y, (unsigned char*)text, n);
-+    } else if(dc->font.set) {	
-+    XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n);
-+    } else {
- 		XSetFont(dc->dpy, dc->gc, dc->font.xfont->fid);
- 		XDrawString(dc->dpy, dc->canvas, dc->gc, x, y, text, n);
- 	}
-@@ -68,19 +72,53 @@ eprintf(const char *fmt, ...) {
- 	exit(EXIT_FAILURE);
- }
- 
-+ void
-+freecol(DC *dc, ColorSet *col) {
-+    if(col) {
-+        if(&col->FG_xft)
-+            XftColorFree(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)),
-+                DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), &col->FG_xft);
-+        free(col); 
-+    }
-+}
-+
-+
- void
- freedc(DC *dc) {
-+        if(dc->font.xft_font) {
-+        XftFontClose(dc->dpy, dc->font.xft_font);
-+        XftDrawDestroy(dc->xftdraw);
-+        }
- 	if(dc->font.set)
- 		XFreeFontSet(dc->dpy, dc->font.set);
- 	if(dc->font.xfont)
- 		XFreeFont(dc->dpy, dc->font.xfont);
- 	if(dc->canvas)
- 		XFreePixmap(dc->dpy, dc->canvas);
--	XFreeGC(dc->dpy, dc->gc);
--	XCloseDisplay(dc->dpy);
--	free(dc);
-+	if(dc->gc)
-+        XFreeGC(dc->dpy, dc->gc);
-+	if(dc->dpy)
-+       XCloseDisplay(dc->dpy);
-+	if(dc)
-+        free(dc);
-+
- }
- 
-+ColorSet *
-+initcolor(DC *dc, const char * foreground, const char * background) {
-+    ColorSet * col = (ColorSet *)malloc(sizeof(ColorSet));
-+    if(!col)
-+        eprintf("error, cannot allocate memory for color set");
-+    col->BG = getcolor(dc, background);
-+    col->FG = getcolor(dc, foreground);
-+    if(dc->font.xft_font)
-+        if(!XftColorAllocName(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)),
-+        DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), foreground, &col->FG_xft))
-+            eprintf("error, cannot allocate xft font color '%s'\n", foreground);
-+    return col;
-+}
-+
-+
- unsigned long
- getcolor(DC *dc, const char *colstr) {
- 	Colormap cmap = DefaultColormap(dc->dpy, DefaultScreen(dc->dpy));
-@@ -95,12 +133,16 @@ DC *
- initdc(void) {
- 	DC *dc;
- 
--	if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
-+     	if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
- 		fprintf(stderr, "no locale support\n");
- 	if(!(dc = calloc(1, sizeof *dc)))
- 		eprintf("cannot malloc %u bytes:", sizeof *dc);
- 	if(!(dc->dpy = XOpenDisplay(NULL)))
- 		eprintf("cannot open display\n");
-+    dc->font.xft_font = NULL;
-+     dc->xftdraw = NULL;
-+
-+
- 
- 	dc->gc = XCreateGC(dc->dpy, DefaultRootWindow(dc->dpy), 0, NULL);
- 	XSetLineAttributes(dc->dpy, dc->gc, 1, LineSolid, CapButt, JoinMiter);
-@@ -109,23 +151,13 @@ initdc(void) {
- 
- void
- initfont(DC *dc, const char *fontstr) {
--	if(!loadfont(dc, fontstr ? fontstr : DEFAULTFN)) {
--		if(fontstr != NULL)
--			fprintf(stderr, "cannot load font '%s'\n", fontstr);
--		if(fontstr == NULL || !loadfont(dc, DEFAULTFN))
--			eprintf("cannot load font '%s'\n", DEFAULTFN);
--	}
--	dc->font.height = dc->font.ascent + dc->font.descent;
--}
--
--Bool
--loadfont(DC *dc, const char *fontstr) {
--	char *def, **missing;
-+	char *def, **missing=NULL;
- 	int i, n;
- 
--	if(!*fontstr)
--		return False;
--	if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
-+	if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
-+		dc->font.ascent = dc->font.xfont->ascent;
-+		dc->font.descent = dc->font.xfont->descent;
-+	} else if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
- 		char **names;
- 		XFontStruct **xfonts;
- 
-@@ -134,14 +166,16 @@ loadfont(DC *dc, const char *fontstr) {
- 			dc->font.ascent = MAX(dc->font.ascent, xfonts[i]->ascent);
- 			dc->font.descent = MAX(dc->font.descent, xfonts[i]->descent);
- 		}
--	}
--	else if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
--		dc->font.ascent = dc->font.xfont->ascent;
--		dc->font.descent = dc->font.xfont->descent;
--	}
-+    } else if((dc->font.xft_font = XftFontOpenName(dc->dpy,
-+            DefaultScreen(dc->dpy), fontstr))) {
-+        dc->font.ascent = dc->font.xft_font->ascent;
-+        dc->font.descent = dc->font.xft_font->descent;
-+	} else {
-+	    eprintf("cannot load font '%s'\n", fontstr);
-+    }
- 	if(missing)
- 		XFreeStringList(missing);
--	return (dc->font.set || dc->font.xfont);
-+	dc->font.height = dc->font.ascent + dc->font.descent;
- }
- 
- void
-@@ -151,6 +185,7 @@ mapdc(DC *dc, Window win, unsigned int w
- 
- void
- resizedc(DC *dc, unsigned int w, unsigned int h) {
-+    int screen = DefaultScreen(dc->dpy);
- 	if(dc->canvas)
- 		XFreePixmap(dc->dpy, dc->canvas);
- 
-@@ -158,18 +193,30 @@ resizedc(DC *dc, unsigned int w, unsigne
- 	                           DefaultDepth(dc->dpy, DefaultScreen(dc->dpy)));
- 	dc->w = w;
- 	dc->h = h;
-+    if(dc->font.xft_font && !(dc->xftdraw)) {
-+       dc->xftdraw = XftDrawCreate(dc->dpy, dc->canvas, DefaultVisual(dc->dpy,screen), DefaultColormap(dc->dpy,screen));
-+        if(!(dc->xftdraw))
-+            eprintf("error, cannot create xft drawable\n");
-+    }
-+
- }
- 
- int
- textnw(DC *dc, const char *text, size_t len) {
--	if(dc->font.set) {
-+	 if(dc->font.xft_font) {
-+        XGlyphInfo gi;
-+        XftTextExtentsUtf8(dc->dpy, dc->font.xft_font, (const FcChar8*)text, len, &gi);
-+        return gi.width;
-+    } else   if(dc->font.set) {
- 		XRectangle r;
- 
- 		XmbTextExtents(dc->font.set, text, len, NULL, &r);
- 		return r.width;
--	}
--	return XTextWidth(dc->font.xfont, text, len);
--}
-+    } else {
-+	    return XTextWidth(dc->font.xfont, text, len);
-+    }
-+
-+    }
- 
- int
- textw(DC *dc, const char *text) {
-diff -rup dmenu-4.3.1/draw.h dmenu-xft/draw.h
---- dmenu-4.3.1/draw.h	2011-05-18 21:32:16.000000000 +0530
-+++ dmenu-xft/draw.h	2011-05-20 03:01:58.000000000 +0530
-@@ -1,28 +1,34 @@
- /* See LICENSE file for copyright and license details. */
- 
--#define FG(dc, col)  ((col)[(dc)->invert ? ColBG : ColFG])
--#define BG(dc, col)  ((col)[(dc)->invert ? ColFG : ColBG])
--
--enum { ColBG, ColFG, ColBorder, ColLast };
-+#include <X11/Xft/Xft.h>
- 
- typedef struct {
- 	int x, y, w, h;
--	Bool invert;
- 	Display *dpy;
- 	GC gc;
- 	Pixmap canvas;
-+    XftDraw *xftdraw;
- 	struct {
- 		int ascent;
- 		int descent;
- 		int height;
- 		XFontSet set;
- 		XFontStruct *xfont;
-+        XftFont *xft_font;
- 	} font;
- } DC;  /* draw context */
- 
-+typedef struct {
-+    unsigned long FG;
-+    XftColor FG_xft;
-+    unsigned long BG;
-+} ColorSet;
-+
-+
- void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color);
--void drawtext(DC *dc, const char *text, unsigned long col[ColLast]);
--void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]);
-+void drawtext(DC *dc, const char *text, ColorSet *col);
-+void drawtextn(DC *dc, const char *text, size_t n, ColorSet *col);
-+void freecol(DC *dc, ColorSet *col);
- void eprintf(const char *fmt, ...);
- void freedc(DC *dc);
- unsigned long getcolor(DC *dc, const char *colstr);
-@@ -32,3 +38,5 @@ void mapdc(DC *dc, Window win, unsigned
- void resizedc(DC *dc, unsigned int w, unsigned int h);
- int textnw(DC *dc, const char *text, size_t len);
- int textw(DC *dc, const char *text);
-+ColorSet *initcolor(DC *dc, const char *foreground, const char *background);
-+

diff --git a/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch b/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch
deleted file mode 100644
index dc6f5c3..0000000
--- a/x11-misc/dmenu/files/dmenu-4.4.1-xft.patch
+++ /dev/null
@@ -1,405 +0,0 @@
---- a/dmenu.c	2011-09-19 11:48:13.000000000 +0200
-+++ b/dmenu.c	2011-12-31 00:48:16.000000000 +0200
-@@ -16,6 +16,7 @@
- #define INRECT(x,y,rx,ry,rw,rh) ((x) >= (rx) && (x) < (rx)+(rw) && (y) >= (ry) && (y) < (ry)+(rh))
- #define MIN(a,b)                ((a) < (b) ? (a) : (b))
- #define MAX(a,b)                ((a) > (b) ? (a) : (b))
-+#define DEFFONT "fixed" /* xft example: "Monospace-11" */
- 
- typedef struct Item Item;
- struct Item {
-@@ -25,6 +26,7 @@ struct Item {
- 
- static void appenditem(Item *item, Item **list, Item **last);
- static void calcoffsets(void);
-+static void cleanup(void);
- static char *cistrstr(const char *s, const char *sub);
- static void drawmenu(void);
- static void grabkeyboard(void);
-@@ -49,10 +51,12 @@ static const char *normbgcolor = "#ccccc
- static const char *normfgcolor = "#000000";
- static const char *selbgcolor  = "#0066ff";
- static const char *selfgcolor  = "#ffffff";
--static unsigned long normcol[ColLast];
--static unsigned long selcol[ColLast];
-+static ColorSet *normcol;
-+static ColorSet *selcol;
- static Atom utf8;
- static Bool topbar = True;
-+static Bool running = True;
-+static int ret = 0;
- static DC *dc;
- static Item *items = NULL;
- static Item *matches, *matchend;
-@@ -102,7 +106,9 @@ main(int argc, char *argv[]) {
- 			usage();
- 
- 	dc = initdc();
--	initfont(dc, font);
-+	initfont(dc, font ? font : DEFFONT);
-+	normcol = initcolor(dc, normfgcolor, normbgcolor);
-+	selcol = initcolor(dc, selfgcolor, selbgcolor);
- 
- 	if(fast) {
- 		grabkeyboard();
-@@ -115,7 +121,8 @@ main(int argc, char *argv[]) {
- 	setup();
- 	run();
- 
--	return EXIT_FAILURE; /* unreachable */
-+	cleanup();
-+	return ret;
- }
- 
- void
-@@ -158,6 +165,16 @@ cistrstr(const char *s, const char *sub)
- }
- 
- void
-+cleanup(void) {
-+    Item *itm;
-+    freecol(dc, normcol);
-+    freecol(dc, selcol);
-+    XDestroyWindow(dc->dpy, win);
-+    XUngrabKeyboard(dc->dpy, CurrentTime);
-+    freedc(dc);
-+}
-+
-+void
- drawmenu(void) {
- 	int curpos;
- 	Item *item;
-@@ -165,7 +182,7 @@ drawmenu(void) {
- 	dc->x = 0;
- 	dc->y = 0;
- 	dc->h = bh;
--	drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol));
-+	drawrect(dc, 0, 0, mw, mh, True, normcol->BG);
- 
- 	if(prompt) {
- 		dc->w = promptw;
-@@ -175,7 +192,7 @@ drawmenu(void) {
- 	dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw;
- 	drawtext(dc, text, normcol);
- 	if((curpos = textnw(dc, text, cursor) + dc->h/2 - 2) < dc->w)
--		drawrect(dc, curpos, 2, 1, dc->h - 4, True, FG(dc, normcol));
-+		drawrect(dc, curpos, 2, 1, dc->h - 4, True, normcol->FG);
- 
- 	if(lines > 0) {
- 		dc->w = mw - dc->x;
-@@ -301,7 +318,8 @@ keypress(XKeyEvent *ev) {
- 		sel = matchend;
- 		break;
- 	case XK_Escape:
--		exit(EXIT_FAILURE);
-+        ret = EXIT_FAILURE;
-+        running = False;
- 	case XK_Home:
- 		if(sel == matches) {
- 			cursor = 0;
-@@ -337,7 +355,8 @@ keypress(XKeyEvent *ev) {
- 	case XK_Return:
- 	case XK_KP_Enter:
- 		puts((sel && !(ev->state & ShiftMask)) ? sel->text : text);
--		exit(EXIT_SUCCESS);
-+		ret = EXIT_SUCCESS;
-+		running = False;
- 	case XK_Right:
- 		if(text[cursor] != '\0') {
- 			cursor = nextrune(+1);
-@@ -449,7 +468,7 @@ void
- run(void) {
- 	XEvent ev;
- 
--	while(!XNextEvent(dc->dpy, &ev))
-+	while(running && !XNextEvent(dc->dpy, &ev))
- 		switch(ev.type) {
- 		case Expose:
- 			if(ev.xexpose.count == 0)
-@@ -479,11 +498,6 @@ setup(void) {
- 	XineramaScreenInfo *info;
- #endif
- 
--	normcol[ColBG] = getcolor(dc, normbgcolor);
--	normcol[ColFG] = getcolor(dc, normfgcolor);
--	selcol[ColBG]  = getcolor(dc, selbgcolor);
--	selcol[ColFG]  = getcolor(dc, selfgcolor);
--
- 	utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
- 
- 	/* menu geometry */
---- a/draw.c	2011-09-19 11:48:13.000000000 +0200
-+++ b/draw.c	2011-12-31 01:44:39.000000000 +0200
-@@ -9,9 +9,6 @@
- 
- #define MAX(a, b)  ((a) > (b) ? (a) : (b))
- #define MIN(a, b)  ((a) < (b) ? (a) : (b))
--#define DEFAULTFN  "fixed"
--
--static Bool loadfont(DC *dc, const char *fontstr);
- 
- void
- drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color) {
-@@ -23,7 +20,7 @@ drawrect(DC *dc, int x, int y, unsigned 
- }
- 
- void
--drawtext(DC *dc, const char *text, unsigned long col[ColLast]) {
-+drawtext(DC *dc, const char *text, ColorSet *col) {
- 	char buf[BUFSIZ];
- 	size_t mn, n = strlen(text);
- 
-@@ -35,19 +32,24 @@ drawtext(DC *dc, const char *text, unsig
- 	if(mn < n)
- 		for(n = MAX(mn-3, 0); n < mn; buf[n++] = '.');
- 
--	drawrect(dc, 0, 0, dc->w, dc->h, True, BG(dc, col));
-+	drawrect(dc, 0, 0, dc->w, dc->h, True, col->BG);
- 	drawtextn(dc, buf, mn, col);
- }
- 
- void
--drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]) {
-+drawtextn(DC *dc, const char *text, size_t n, ColorSet *col) {
- 	int x = dc->x + dc->font.height/2;
- 	int y = dc->y + dc->font.ascent+1;
- 
--	XSetForeground(dc->dpy, dc->gc, FG(dc, col));
--	if(dc->font.set)
-+	XSetForeground(dc->dpy, dc->gc, col->FG);
-+	if(dc->font.xft_font) {
-+		if (!dc->xftdraw)
-+			eprintf("error, xft drawable does not exist");
-+		XftDrawStringUtf8(dc->xftdraw, &col->FG_xft,
-+			dc->font.xft_font, x, y, (unsigned char*)text, n);
-+	} else if(dc->font.set) {
- 		XmbDrawString(dc->dpy, dc->canvas, dc->font.set, dc->gc, x, y, text, n);
--	else {
-+	} else {
- 		XSetFont(dc->dpy, dc->gc, dc->font.xfont->fid);
- 		XDrawString(dc->dpy, dc->canvas, dc->gc, x, y, text, n);
- 	}
-@@ -69,16 +71,33 @@ eprintf(const char *fmt, ...) {
- }
- 
- void
-+freecol(DC *dc, ColorSet *col) {
-+    if(col) {
-+        if(&col->FG_xft)
-+            XftColorFree(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)),
-+                DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), &col->FG_xft);
-+        free(col); 
-+    }
-+}
-+
-+void
- freedc(DC *dc) {
-+    if(dc->font.xft_font) {
-+        XftFontClose(dc->dpy, dc->font.xft_font);
-+        XftDrawDestroy(dc->xftdraw);
-+    }
- 	if(dc->font.set)
- 		XFreeFontSet(dc->dpy, dc->font.set);
--	if(dc->font.xfont)
-+    if(dc->font.xfont)
- 		XFreeFont(dc->dpy, dc->font.xfont);
--	if(dc->canvas)
-+    if(dc->canvas)
- 		XFreePixmap(dc->dpy, dc->canvas);
--	XFreeGC(dc->dpy, dc->gc);
--	XCloseDisplay(dc->dpy);
--	free(dc);
-+	if(dc->gc)
-+        XFreeGC(dc->dpy, dc->gc);
-+	if(dc->dpy)
-+        XCloseDisplay(dc->dpy);
-+	if(dc)
-+        free(dc);
- }
- 
- unsigned long
-@@ -91,6 +110,20 @@ getcolor(DC *dc, const char *colstr) {
- 	return color.pixel;
- }
- 
-+ColorSet *
-+initcolor(DC *dc, const char * foreground, const char * background) {
-+	ColorSet * col = (ColorSet *)malloc(sizeof(ColorSet));
-+	if(!col)
-+		eprintf("error, cannot allocate memory for color set");
-+	col->BG = getcolor(dc, background);
-+	col->FG = getcolor(dc, foreground);
-+	if(dc->font.xft_font)
-+		if(!XftColorAllocName(dc->dpy, DefaultVisual(dc->dpy, DefaultScreen(dc->dpy)),
-+			DefaultColormap(dc->dpy, DefaultScreen(dc->dpy)), foreground, &col->FG_xft))
-+			eprintf("error, cannot allocate xft font color '%s'\n", foreground);
-+	return col;
-+}
-+
- DC *
- initdc(void) {
- 	DC *dc;
-@@ -109,39 +142,33 @@ initdc(void) {
- 
- void
- initfont(DC *dc, const char *fontstr) {
--	if(!loadfont(dc, fontstr ? fontstr : DEFAULTFN)) {
--		if(fontstr != NULL)
--			fprintf(stderr, "cannot load font '%s'\n", fontstr);
--		if(fontstr == NULL || !loadfont(dc, DEFAULTFN))
--			eprintf("cannot load font '%s'\n", DEFAULTFN);
--	}
--	dc->font.height = dc->font.ascent + dc->font.descent;
--}
--
--Bool
--loadfont(DC *dc, const char *fontstr) {
- 	char *def, **missing, **names;
- 	int i, n;
- 	XFontStruct **xfonts;
- 
--	if(!*fontstr)
--		return False;
--	if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
-+	missing = NULL;
-+	if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
-+		dc->font.ascent = dc->font.xfont->ascent;
-+		dc->font.descent = dc->font.xfont->descent;
-+		dc->font.width   = dc->font.xfont->max_bounds.width;
-+	} else if((dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def))) {
- 		n = XFontsOfFontSet(dc->font.set, &xfonts, &names);
- 		for(i = 0; i < n; i++) {
- 			dc->font.ascent  = MAX(dc->font.ascent,  xfonts[i]->ascent);
- 			dc->font.descent = MAX(dc->font.descent, xfonts[i]->descent);
- 			dc->font.width   = MAX(dc->font.width,   xfonts[i]->max_bounds.width);
- 		}
--	}
--	else if((dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))) {
--		dc->font.ascent  = dc->font.xfont->ascent;
--		dc->font.descent = dc->font.xfont->descent;
--		dc->font.width   = dc->font.xfont->max_bounds.width;
-+	} else if((dc->font.xft_font = XftFontOpenName(dc->dpy, DefaultScreen(dc->dpy), fontstr))) {
-+		dc->font.ascent = dc->font.xft_font->ascent;
-+		dc->font.descent = dc->font.xft_font->descent;
-+		dc->font.width = dc->font.xft_font->max_advance_width;
-+	} else {
-+		eprintf("cannot load font '%s'\n", fontstr);
- 	}
- 	if(missing)
- 		XFreeStringList(missing);
--	return dc->font.set || dc->font.xfont;
-+	dc->font.height = dc->font.ascent + dc->font.descent;
-+	return;
- }
- 
- void
-@@ -151,20 +178,29 @@ mapdc(DC *dc, Window win, unsigned int w
- 
- void
- resizedc(DC *dc, unsigned int w, unsigned int h) {
-+	int screen = DefaultScreen(dc->dpy);
- 	if(dc->canvas)
- 		XFreePixmap(dc->dpy, dc->canvas);
- 
- 	dc->w = w;
- 	dc->h = h;
- 	dc->canvas = XCreatePixmap(dc->dpy, DefaultRootWindow(dc->dpy), w, h,
--	                           DefaultDepth(dc->dpy, DefaultScreen(dc->dpy)));
-+	                           DefaultDepth(dc->dpy, screen));
-+	if(dc->font.xft_font && !(dc->xftdraw)) {
-+		dc->xftdraw = XftDrawCreate(dc->dpy, dc->canvas, DefaultVisual(dc->dpy,screen), DefaultColormap(dc->dpy,screen));
-+		if(!(dc->xftdraw))
-+			eprintf("error, cannot create xft drawable\n");
-+	}
- }
- 
- int
- textnw(DC *dc, const char *text, size_t len) {
--	if(dc->font.set) {
-+	if(dc->font.xft_font) {
-+		XGlyphInfo gi;
-+		XftTextExtentsUtf8(dc->dpy, dc->font.xft_font, (const FcChar8*)text, len, &gi);
-+		return gi.width;
-+	} else if(dc->font.set) {
- 		XRectangle r;
--
- 		XmbTextExtents(dc->font.set, text, len, NULL, &r);
- 		return r.width;
- 	}
---- a/draw.h	2011-09-19 11:48:13.000000000 +0200
-+++ b/draw.h	2011-12-31 00:28:01.000000000 +0200
-@@ -1,9 +1,6 @@
- /* See LICENSE file for copyright and license details. */
- 
--#define FG(dc, col)  ((col)[(dc)->invert ? ColBG : ColFG])
--#define BG(dc, col)  ((col)[(dc)->invert ? ColFG : ColBG])
--
--enum { ColBG, ColFG, ColBorder, ColLast };
-+#include <X11/Xft/Xft.h>
- 
- typedef struct {
- 	int x, y, w, h;
-@@ -11,6 +8,7 @@ typedef struct {
- 	Display *dpy;
- 	GC gc;
- 	Pixmap canvas;
-+	XftDraw *xftdraw;
- 	struct {
- 		int ascent;
- 		int descent;
-@@ -18,15 +16,24 @@ typedef struct {
- 		int width;
- 		XFontSet set;
- 		XFontStruct *xfont;
-+		XftFont *xft_font;
- 	} font;
- } DC;  /* draw context */
- 
-+typedef struct {
-+	unsigned long FG;
-+	XftColor FG_xft;
-+	unsigned long BG;
-+} ColorSet;
-+
- void drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color);
--void drawtext(DC *dc, const char *text, unsigned long col[ColLast]);
--void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]);
-+void drawtext(DC *dc, const char *text, ColorSet *col);
-+void drawtextn(DC *dc, const char *text, size_t n, ColorSet *col);
-+void freecol(DC *dc, ColorSet *col);
- void eprintf(const char *fmt, ...);
- void freedc(DC *dc);
- unsigned long getcolor(DC *dc, const char *colstr);
-+ColorSet *initcolor(DC *dc, const char *foreground, const char *background);
- DC *initdc(void);
- void initfont(DC *dc, const char *fontstr);
- void mapdc(DC *dc, Window win, unsigned int w, unsigned int h);
---- a/dmenu.1	2011-09-19 11:48:13.000000000 +0200
-+++ b/dmenu.1	2011-12-30 23:23:44.000000000 +0200
-@@ -55,7 +55,7 @@
- defines the prompt to be displayed to the left of the input field.
- .TP
- .BI \-fn " font"
--defines the font or font set used.
-+defines the font or font set used. eg. "fixed" or "Monospace-12:normal" (an xft font)
- .TP
- .BI \-nb " color"
- defines the normal background color.
---- a/config.mk	2011-12-30 23:23:44.000000000 +0200
-+++ b/config.mk	2011-12-30 23:23:44.000000000 +0200
-@@ -12,9 +12,13 @@
- XINERAMALIBS  = -lXinerama
- XINERAMAFLAGS = -DXINERAMA
- 
-+# Xft, comment if you don't want it
-+XFTINC = -I/usr/include/freetype2
-+XFTLIBS  = -lXft -lXrender -lfreetype -lz -lfontconfig
-+
- # includes and libs
--INCS = -I${X11INC}
--LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS}
-+INCS = -I${X11INC} ${XFTINC}
-+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${XFTLIBS}
- 
- # flags
- CPPFLAGS+= -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}

diff --git a/x11-misc/dmenu/metadata.xml b/x11-misc/dmenu/metadata.xml
deleted file mode 100644
index 32c2cb5..0000000
--- a/x11-misc/dmenu/metadata.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
-<pkgmetadata>
-<herd>no-herd</herd>
-<maintainer>
-<email>xmw@gentoo.org</email>
-<name>Michael Weber</name>
-</maintainer>
-</pkgmetadata>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-05 11:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-05 11:59 [gentoo-commits] dev/xmw:master commit in: x11-misc/dmenu/files/, x11-misc/dmenu/ Michael Weber
  -- strict thread matches above, loose matches on Subject: below --
2012-01-10  2:41 Michael Weber
2011-05-31  2:42 Michael Weber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox