mirror of https://github.com/0intro/wmii
Experimental demand-loading of Xft. Removed hard dependency.
This commit is contained in:
parent
f4e31a199c
commit
14c09cbc53
5
PKGBUILD
5
PKGBUILD
|
@ -6,11 +6,12 @@ pkgdesc="The latest hg pull of wmii, a lightweight, dynamic window manager for X
|
||||||
url="http://wmii.suckless.org"
|
url="http://wmii.suckless.org"
|
||||||
license=("MIT")
|
license=("MIT")
|
||||||
arch=("i686" "x86_64")
|
arch=("i686" "x86_64")
|
||||||
depends=("libx11" "libxinerama" "libxrandr" "libxft")
|
depends=("libx11" "libxinerama" "libxrandr")
|
||||||
makedepends=("mercurial")
|
makedepends=("mercurial")
|
||||||
optdepends=("plan9port: for use of the alternative plan9port wmiirc" \
|
optdepends=("plan9port: for use of the alternative plan9port wmiirc" \
|
||||||
"python: for use of the alternative Python wmiirc" \
|
"python: for use of the alternative Python wmiirc" \
|
||||||
"ruby-rumai: for use of the alternative Ruby wmiirc")
|
"ruby-rumai: for use of the alternative Ruby wmiirc" \
|
||||||
|
"libxft: for anti-aliased font support")
|
||||||
provides=("wmii")
|
provides=("wmii")
|
||||||
conflicts=("wmii")
|
conflicts=("wmii")
|
||||||
source=()
|
source=()
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "dat.h"
|
#include "dat.h"
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
#ifdef VARARGCK
|
#ifdef VARARGCK
|
||||||
# pragma varargck argpos debug 2
|
# pragma varargck argpos debug 2
|
||||||
# pragma varargck argpos dprint 1
|
# pragma varargck argpos dprint 1
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
*/
|
*/
|
||||||
#include "dat.h"
|
#include "dat.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include "fns.h"
|
#include "fns.h"
|
||||||
|
|
||||||
#ifdef notdef
|
#ifdef notdef
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <stuff/clientutil.h>
|
#include <stuff/clientutil.h>
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#define IXP_NO_P9_
|
#define IXP_NO_P9_
|
||||||
#define IXP_P9_STRUCTS
|
#define IXP_P9_STRUCTS
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
19
config.mk
19
config.mk
|
@ -20,21 +20,24 @@ include $(ROOT)/mk/gcc.mk
|
||||||
CFLAGS += $(DEBUGCFLAGS) -O0
|
CFLAGS += $(DEBUGCFLAGS) -O0
|
||||||
LDFLAGS += -g
|
LDFLAGS += -g
|
||||||
|
|
||||||
SOLDFLAGS += $(LDFLAGS)
|
|
||||||
SHARED = -shared -Wl,-soname=$(SONAME)
|
|
||||||
STATIC = -static
|
|
||||||
|
|
||||||
# Compiler, Linker. Linker should usually *not* be ld.
|
# Compiler, Linker. Linker should usually *not* be ld.
|
||||||
CC = cc -c
|
CC = cc -c
|
||||||
LD = cc
|
LD = cc
|
||||||
# Archiver
|
# Archiver
|
||||||
AR = ar crs
|
AR = ar crs
|
||||||
|
|
||||||
X11PACKAGES = xft
|
X11PACKAGES = x11 xinerama xrender
|
||||||
INCX11 = $$(pkg-config --cflags $(X11PACKAGES))
|
INCX11 = $$(pkg-config --cflags $(X11PACKAGES))
|
||||||
LIBICONV = # Leave blank if your libc includes iconv (glibc does)
|
|
||||||
LIBIXP = $(LIBDIR)/libixp.a
|
LIBIXP = $(LIBDIR)/libixp.a
|
||||||
|
|
||||||
|
# Enable RTLD. Only necessary for Xft support.
|
||||||
|
CFLAGS += -DHAVE_RTLD
|
||||||
|
LDFLAGS += -ldl # Comment this out on BSD systems.
|
||||||
|
|
||||||
|
SOLDFLAGS += $(LDFLAGS)
|
||||||
|
SHARED = -shared -Wl,-soname=$(SONAME)
|
||||||
|
STATIC = -static
|
||||||
|
|
||||||
# Your make shell. By default, the first found of /bin/dash, /bin/ksh,
|
# Your make shell. By default, the first found of /bin/dash, /bin/ksh,
|
||||||
# /bin/sh. Except with bsdmake, which assumes /bin/sh is sane. bash and zsh
|
# /bin/sh. Except with bsdmake, which assumes /bin/sh is sane. bash and zsh
|
||||||
# are painfully slow, and should be avoided.
|
# are painfully slow, and should be avoided.
|
||||||
|
@ -50,9 +53,7 @@ LIBIXP = $(LIBDIR)/libixp.a
|
||||||
#CC=pcc -c
|
#CC=pcc -c
|
||||||
#LD=pcc
|
#LD=pcc
|
||||||
|
|
||||||
# *BSD
|
# Darwin
|
||||||
#LIBICONV = -L/usr/local/lib -liconv
|
|
||||||
# +Darwin
|
|
||||||
#STATIC = # Darwin doesn't like static linking
|
#STATIC = # Darwin doesn't like static linking
|
||||||
#SHARED = -dynamiclib
|
#SHARED = -dynamiclib
|
||||||
#SOEXT = dylib
|
#SOEXT = dylib
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define _XOPEN_SOURCE 600
|
#define _XOPEN_SOURCE 600
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifndef nil
|
#ifndef nil
|
||||||
#define nil ((void*)0)
|
#define nil ((void*)0)
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <stuff/geom.h>
|
#include <stuff/geom.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xft/Xft.h>
|
|
||||||
#include <X11/extensions/Xrender.h>
|
#include <X11/extensions/Xrender.h>
|
||||||
#ifdef _X11_VISIBLE
|
#ifdef _X11_VISIBLE
|
||||||
# include <X11/Xatom.h>
|
# include <X11/Xatom.h>
|
||||||
|
@ -44,6 +43,10 @@ typedef struct Screen Screen;
|
||||||
typedef struct WinHints WinHints;
|
typedef struct WinHints WinHints;
|
||||||
typedef struct Window Image;
|
typedef struct Window Image;
|
||||||
typedef struct Window Window;
|
typedef struct Window Window;
|
||||||
|
typedef struct Xft Xft;
|
||||||
|
typedef struct XftColor XftColor;
|
||||||
|
typedef void XftDraw;
|
||||||
|
typedef struct XftFont XftFont;
|
||||||
|
|
||||||
struct Color {
|
struct Color {
|
||||||
ulong pixel;
|
ulong pixel;
|
||||||
|
@ -138,6 +141,30 @@ struct Window {
|
||||||
int depth;
|
int depth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Xft {
|
||||||
|
XftDraw* (*drawcreate)(Display*, Drawable, Visual*, Colormap);
|
||||||
|
void (*drawdestroy)(XftDraw*);
|
||||||
|
XftFont* (*fontopen)(Display*, int, const char*);
|
||||||
|
XftFont* (*fontopenname)(Display*, int, const char*);
|
||||||
|
XftFont* (*fontclose)(Display*, XftFont*);
|
||||||
|
void (*textextents)(Display*, XftFont*, char*, int len, XGlyphInfo*);
|
||||||
|
void (*drawstring)(Display*, XftColor*, XftFont*, int x, int y, char*, int len);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XftColor {
|
||||||
|
ulong pixel;
|
||||||
|
XRenderColor color;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XftFont {
|
||||||
|
int ascent;
|
||||||
|
int descent;
|
||||||
|
int height;
|
||||||
|
int max_advance_width;
|
||||||
|
void* charset;
|
||||||
|
void* pattern;
|
||||||
|
};
|
||||||
|
|
||||||
struct Screen {
|
struct Screen {
|
||||||
int screen;
|
int screen;
|
||||||
Window root;
|
Window root;
|
||||||
|
@ -165,6 +192,7 @@ Screen scr;
|
||||||
extern const Point ZP;
|
extern const Point ZP;
|
||||||
extern const Rectangle ZR;
|
extern const Rectangle ZR;
|
||||||
extern Window* pointerwin;
|
extern Window* pointerwin;
|
||||||
|
extern Xft* xft;
|
||||||
|
|
||||||
XRectangle XRect(Rectangle r);
|
XRectangle XRect(Rectangle r);
|
||||||
|
|
||||||
|
@ -205,6 +233,7 @@ ulong getprop_ulong(Window*, char*, char*, ulong, ulong**, ulong);
|
||||||
ulong getproperty(Window*, char *prop, char *type, Atom *actual, ulong offset, uchar **ret, ulong length);
|
ulong getproperty(Window*, char *prop, char *type, Atom *actual, ulong offset, uchar **ret, ulong length);
|
||||||
int grabkeyboard(Window*);
|
int grabkeyboard(Window*);
|
||||||
int grabpointer(Window*, Window *confine, Cursor, int mask);
|
int grabpointer(Window*, Window *confine, Cursor, int mask);
|
||||||
|
bool havexft(void);
|
||||||
void initdisplay(void);
|
void initdisplay(void);
|
||||||
KeyCode keycode(char*);
|
KeyCode keycode(char*);
|
||||||
uint labelh(Font*);
|
uint labelh(Font*);
|
||||||
|
|
|
@ -86,6 +86,7 @@ OBJ=\
|
||||||
x11/sync \
|
x11/sync \
|
||||||
x11/x11 \
|
x11/x11 \
|
||||||
x11/xatom \
|
x11/xatom \
|
||||||
|
x11/xft \
|
||||||
x11/colors/loadcolor \
|
x11/colors/loadcolor \
|
||||||
x11/colors/namedcolor \
|
x11/colors/namedcolor \
|
||||||
x11/colors/xftcolor \
|
x11/colors/xftcolor \
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Written by Kris Maglione */
|
/* Written by Kris Maglione */
|
||||||
/* Public domain */
|
/* Public domain */
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stuff/util.h>
|
#include <stuff/util.h>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
/* Public domain */
|
/* Public domain */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fmt.h>
|
#include <fmt.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <plan9.h>
|
#include <plan9.h>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Written by Kris Maglione <maglione.k at Gmail> */
|
/* Written by Kris Maglione <maglione.k at Gmail> */
|
||||||
/* Public domain */
|
/* Public domain */
|
||||||
#include <stdlib.h>
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Written by Kris Maglione <maglione.k at Gmail> */
|
/* Written by Kris Maglione <maglione.k at Gmail> */
|
||||||
/* Public domain */
|
/* Public domain */
|
||||||
#include <stdlib.h>
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Written by Kris Maglione <maglione.k at Gmail> */
|
/* Written by Kris Maglione <maglione.k at Gmail> */
|
||||||
/* Public domain */
|
/* Public domain */
|
||||||
#include <stdlib.h>
|
|
||||||
#include <fmt.h>
|
#include <fmt.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Written by Kris Maglione <maglione.k at Gmail> */
|
/* Written by Kris Maglione <maglione.k at Gmail> */
|
||||||
/* Public domain */
|
/* Public domain */
|
||||||
#include <stdlib.h>
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void*
|
void*
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stuff/util.h>
|
#include <stuff/util.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stuff/util.h>
|
#include <stuff/util.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
|
||||||
#include <fmt.h>
|
#include <fmt.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* Written by Kris Maglione <maglione.k at Gmail> */
|
/* Written by Kris Maglione <maglione.k at Gmail> */
|
||||||
/* Public domain */
|
/* Public domain */
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fmt.h>
|
#include <fmt.h>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
|
||||||
#include <fmt.h>
|
#include <fmt.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
#include "../x11.h"
|
#include "../x11.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
#include "../x11.h"
|
#include "../x11.h"
|
||||||
|
|
||||||
uint
|
uint
|
||||||
|
@ -69,9 +70,9 @@ drawstring(Image *dst, Font *font,
|
||||||
buf, len);
|
buf, len);
|
||||||
break;
|
break;
|
||||||
case FXft:
|
case FXft:
|
||||||
XftDrawStringUtf8(xftdrawable(dst), xftcolor(col),
|
xft->drawstring(xftdrawable(dst), xftcolor(col),
|
||||||
font->font.xft,
|
font->font.xft,
|
||||||
x, y, (uchar*)buf, len);
|
x, y, buf, len);
|
||||||
break;
|
break;
|
||||||
case FX11:
|
case FX11:
|
||||||
XSetFont(display, dst->gc, font->font.x11->fid);
|
XSetFont(display, dst->gc, font->font.x11->fid);
|
||||||
|
|
|
@ -11,7 +11,7 @@ freeimage(Image *img) {
|
||||||
assert(img->type == WImage);
|
assert(img->type == WImage);
|
||||||
|
|
||||||
if(img->xft)
|
if(img->xft)
|
||||||
XftDrawDestroy(img->xft);
|
xft->drawdestroy(img->xft);
|
||||||
XFreePixmap(display, img->xid);
|
XFreePixmap(display, img->xid);
|
||||||
XFreeGC(display, img->gc);
|
XFreeGC(display, img->gc);
|
||||||
free(img);
|
free(img);
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
XftDraw*
|
XftDraw*
|
||||||
xftdrawable(Image *img) {
|
xftdrawable(Image *img) {
|
||||||
if(img->xft == nil)
|
if(img->xft == nil)
|
||||||
img->xft = XftDrawCreate(display, img->xid, img->visual, img->colormap);
|
img->xft = xft->drawcreate(display, img->xid, img->visual, img->colormap);
|
||||||
return img->xft;
|
return img->xft;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
#include "../x11.h"
|
#include "../x11.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
#include "../x11.h"
|
#include "../x11.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
#include "../x11.h"
|
#include "../x11.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
#include "../x11.h"
|
#include "../x11.h"
|
||||||
|
|
||||||
char**
|
char**
|
||||||
|
|
|
@ -10,7 +10,7 @@ freefont(Font *f) {
|
||||||
XFreeFontSet(display, f->font.set);
|
XFreeFontSet(display, f->font.set);
|
||||||
break;
|
break;
|
||||||
case FXft:
|
case FXft:
|
||||||
XftFontClose(display, f->font.xft);
|
xft->fontclose(display, f->font.xft);
|
||||||
break;
|
break;
|
||||||
case FX11:
|
case FX11:
|
||||||
XFreeFont(display, f->font.x11);
|
XFreeFont(display, f->font.x11);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
#include "../x11.h"
|
#include "../x11.h"
|
||||||
|
|
||||||
Font*
|
Font*
|
||||||
|
@ -17,9 +18,12 @@ loadfont(char *name) {
|
||||||
if(!strncmp(f->name, "xft:", 4)) {
|
if(!strncmp(f->name, "xft:", 4)) {
|
||||||
f->type = FXft;
|
f->type = FXft;
|
||||||
|
|
||||||
f->font.xft = XftFontOpenXlfd(display, scr.screen, f->name + 4);
|
if(!havexft())
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
f->font.xft = xft->fontopen(display, scr.screen, f->name + 4);
|
||||||
if(!f->font.xft)
|
if(!f->font.xft)
|
||||||
f->font.xft = XftFontOpenName(display, scr.screen, f->name + 4);
|
f->font.xft = xft->fontopenname(display, scr.screen, f->name + 4);
|
||||||
if(!f->font.xft)
|
if(!f->font.xft)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ textextents_l(Font *font, char *text, uint len, int *offset) {
|
||||||
*offset = Xutf8TextExtents(font->font.set, text, len, &r, nil);
|
*offset = Xutf8TextExtents(font->font.set, text, len, &r, nil);
|
||||||
return Rect(r.x, -r.y - r.height, r.x + r.width, -r.y);
|
return Rect(r.x, -r.y - r.height, r.x + r.width, -r.y);
|
||||||
case FXft:
|
case FXft:
|
||||||
XftTextExtentsUtf8(display, font->font.xft, (uchar*)text, len, &i);
|
xft->textextents(display, font->font.xft, text, len, &i);
|
||||||
*offset = i.xOff;
|
*offset = i.xOff;
|
||||||
return Rect(-i.x, i.y - i.height, -i.x + i.width, i.y);
|
return Rect(-i.x, i.y - i.height, -i.x + i.width, i.y);
|
||||||
case FX11:
|
case FX11:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
/* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail>
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
|
#include <string.h>
|
||||||
#include "../x11.h"
|
#include "../x11.h"
|
||||||
|
|
||||||
uint
|
uint
|
||||||
|
|
|
@ -8,7 +8,7 @@ destroywindow(Window *w) {
|
||||||
assert(w->type == WWindow);
|
assert(w->type == WWindow);
|
||||||
sethandler(w, nil);
|
sethandler(w, nil);
|
||||||
if(w->xft)
|
if(w->xft)
|
||||||
XftDrawDestroy(w->xft);
|
xft->drawdestroy(w->xft);
|
||||||
if(w->gc)
|
if(w->gc)
|
||||||
XFreeGC(display, w->gc);
|
XFreeGC(display, w->gc);
|
||||||
XDestroyWindow(display, w->xid);
|
XDestroyWindow(display, w->xid);
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* Copyright ©2010 Kris Maglione <maglione.k at Gmail>
|
||||||
|
* See LICENSE file for license details.
|
||||||
|
*/
|
||||||
|
#include <stuff/x.h>
|
||||||
|
#include <stuff/util.h>
|
||||||
|
|
||||||
|
Xft *xft;
|
||||||
|
|
||||||
|
#ifdef HAVE_RTLD
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
bool
|
||||||
|
havexft(void) {
|
||||||
|
void *libxft;
|
||||||
|
|
||||||
|
if(xft == nil) {
|
||||||
|
libxft = dlopen("libXft.so", RTLD_LAZY);
|
||||||
|
if(libxft == nil)
|
||||||
|
return false;
|
||||||
|
xft = emalloc(sizeof *xft);
|
||||||
|
*(void**)(uintptr_t)&xft->drawcreate = dlsym(libxft, "XftDrawCreate");
|
||||||
|
*(void**)(uintptr_t)&xft->drawdestroy = dlsym(libxft, "XftDrawDestroy");
|
||||||
|
*(void**)(uintptr_t)&xft->fontopen = dlsym(libxft, "XftFontOpenXlfd");
|
||||||
|
*(void**)(uintptr_t)&xft->fontopenname = dlsym(libxft, "XftFontOpenName");
|
||||||
|
*(void**)(uintptr_t)&xft->fontclose = dlsym(libxft, "XftFontClose");
|
||||||
|
*(void**)(uintptr_t)&xft->textextents = dlsym(libxft, "XftTextExtentsUtf8");
|
||||||
|
*(void**)(uintptr_t)&xft->drawstring = dlsym(libxft, "XftDrawStringUtf8");
|
||||||
|
}
|
||||||
|
return xft && xft->drawcreate && xft->drawdestroy && xft->fontopen
|
||||||
|
&& xft->fontopenname && xft->fontclose && xft->textextents && xft->drawstring;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
bool
|
||||||
|
havexft(void) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
|
@ -17,7 +17,7 @@ status=$?
|
||||||
[ $? -eq 0 ] || echo $CC -o $outfile $CFLAGS $@ >&2
|
[ $? -eq 0 ] || echo $CC -o $outfile $CFLAGS $@ >&2
|
||||||
|
|
||||||
base=$(echo $BASE | sed 's/,/\\,/g')
|
base=$(echo $BASE | sed 's/,/\\,/g')
|
||||||
re='\([^[:space:]/]*\..:[0-9]\)'
|
re='\([^[:space:]/][^[:space:]]*\..:[0-9]\)'
|
||||||
|
|
||||||
undup() { # GCC is crap.
|
undup() { # GCC is crap.
|
||||||
awk '
|
awk '
|
||||||
|
|
Loading…
Reference in New Issue