[teklib-general] teklib: X11 Display: Added ENABLE_XFT compile-time switch
Timm S. Mueller
tmueller at neoscientists.org
Sat Dec 27 22:31:31 CET 2008
details: http://hg.teklib.org/teklib/rev/5e3ea0d11e14
changeset: 210:5e3ea0d11e14
user: Timm S. Mueller <tmueller at neoscientists.org>
date: Sun Dec 21 19:39:32 2008 +0100
description:
X11 Display: Added ENABLE_XFT compile-time switch
diffs (truncated from 465 to 100 lines):
diff -r 4d21a44a6342 -r 5e3ea0d11e14 src/display_x11/build/tmkmakefile
--- a/src/display_x11/build/tmkmakefile Thu Dec 18 15:54:52 2008 +0100
+++ b/src/display_x11/build/tmkmakefile Sun Dec 21 19:39:32 2008 +0100
@@ -13,7 +13,7 @@
[/embed]
EXTRAMODLIBS = -L/usr/X11R6/lib -lX11 -lXext
- EXTRADEFS = -D_XOPEN_SOURCE -I/usr/X11R6/include/ -I/usr/include/freetype2/ -I/usr/X11R6/include/freetype2/
+ EXTRADEFS = -D_XOPEN_SOURCE -DENABLE_XFT -I/usr/X11R6/include/ -I/usr/include/freetype2/ -I/usr/X11R6/include/freetype2/
[embed body="modlink"]
display_x11
diff -r 4d21a44a6342 -r 5e3ea0d11e14 src/display_x11/display_x11_api.c
--- a/src/display_x11/display_x11_api.c Thu Dec 18 15:54:52 2008 +0100
+++ b/src/display_x11/display_x11_api.c Sun Dec 21 19:39:32 2008 +0100
@@ -177,12 +177,14 @@
v->window, True, GrabModeAsync, GrabModeAsync, CurrentTime);
}
+ #if defined(ENABLE_XFT)
if (mod->x11_use_xft)
{
v->draw = (*mod->x11_xftiface.XftDrawCreate)(mod->x11_Display,
v->window, mod->x11_Visual, v->colormap);
if (!v->draw) break;
}
+ #endif
v->bgpen = TVPEN_UNDEFINED;
v->fgpen = TVPEN_UNDEFINED;
@@ -215,8 +217,10 @@
x11_freeimage(mod, v);
TExecFree(TGetExecBase(mod), v->tempbuf);
+ #if defined(ENABLE_XFT)
if (mod->x11_use_xft && v->draw)
(*mod->x11_xftiface.XftDrawDestroy)(v->draw);
+ #endif
if (v->window)
XUnmapWindow(mod->x11_Display, v->window);
@@ -286,6 +290,7 @@
if (XAllocColor(mod->x11_Display, v->colormap, &pen->color))
{
TBOOL success = TTRUE;
+ #if defined(ENABLE_XFT)
if (mod->x11_use_xft)
{
XRenderColor xrcolor = { red: ((rgb >> 16) & 0xff) << 8,
@@ -297,6 +302,7 @@
(mod->x11_Display, mod->x11_Visual, v->colormap, &xrcolor,
&pen->xftcolor);
}
+ #endif
if (success)
{
TAddTail(&v->penlist, &pen->node);
@@ -316,9 +322,11 @@
{
TRemove(&pen->node);
XFreeColors(mod->x11_Display, v->colormap, &pen->color.pixel, 1, 0);
+ #if defined(ENABLE_XFT)
if (mod->x11_use_xft)
(*mod->x11_xftiface.XftColorFree)(mod->x11_Display, mod->x11_Visual,
v->colormap, &pen->xftcolor);
+ #endif
TExecFree(mod->x11_ExecBase, pen);
}
@@ -594,8 +602,10 @@
/* set clip region */
XSetRegion(mod->x11_Display, v->gc, region);
+ #if defined(ENABLE_XFT)
if (mod->x11_use_xft)
(*mod->x11_xftiface.XftDrawSetClip)(v->draw, region);
+ #endif
XDestroyRegion(region);
}
@@ -608,8 +618,10 @@
VISUAL *v = req->tvr_Op.ClipRect.Instance;
/*XSetClipMask(mod->x11_Display, v->gc, None);*/
XSetRegion(mod->x11_Display, v->gc, mod->x11_HugeRegion);
+ #if defined(ENABLE_XFT)
if (mod->x11_use_xft)
(*mod->x11_xftiface.XftDrawSetClip)(v->draw, mod->x11_HugeRegion);
+ #endif
}
/*****************************************************************************/
@@ -822,6 +834,7 @@
if ((TVPEN) bgpen == TVPEN_UNDEFINED)
{
+ #if defined(ENABLE_XFT)
if (mod->x11_use_xft)
{
XftFont *f = ((struct FontNode *) v->curfont)->xftfont;
@@ -829,6 +842,7 @@
More information about the teklib-general
mailing list