Added possibility to configure not to use fnlib (configure --without-fnlib).

SVN revision: 7154
This commit is contained in:
Kim Woelders 2003-07-12 14:34:14 +00:00
parent 39e322bc7c
commit 30e6961bb0
11 changed files with 136 additions and 30 deletions

View File

@ -77,6 +77,8 @@ AC_ARG_ENABLE(hints-gnome,
[ --enable-hints-gnome compile with GNOME(<2.0) hints support [default=yes]],, enable_hints_gnome=yes)
AC_ARG_ENABLE(hints-kde,
[ --enable-hints-kde compile with KDE(<2.0) hints support [default=no]],, enable_hints_kde=no)
AC_ARG_WITH(fnlib,
[ --with-fnlib compile with Fnlib support [default=yes]],, with_fnlib=yes)
if test "x$enable_hints_ewmh" = "xyes"; then AC_DEFINE(ENABLE_EWMH, 1, [Extended Window Manager Hints]) fi
if test "x$enable_hints_gnome" = "xyes"; then AC_DEFINE(ENABLE_GNOME, 1, [GNOME(<2.0) Hints]) fi
@ -131,6 +133,7 @@ LDFLAGS="$LDFLAGS `echo $IMLIB_LIBS | sed 's/\(.*\)-lImlib.*/\1/'`"
LDFLAGS="$LDFLAGS `echo $IMLIB_LIBS | sed 's/.*-lImlib.*\(-L[[^ ]]*\).*$/\1/'`"
XTST_LIBS=""
if test "x$with_fnlib" = "xyes"; then
# AC_CHECK_HEADER(Fnlib.h, ,AC_MSG_ERROR([Fatal Error: no Fnlib header detected.]))
AC_CHECK_LIB(Fnlib, Fnlib_init, FNLIB_LIBS=-lFnlib , [
echo "ERROR: Enlightenment needs a system with libFnlib.so (Fnlib)"
@ -140,6 +143,8 @@ echo "ftp://www.rasterman.com/pub/enlightenment/"
echo "ftp://ftp.labs.redhat.com/pub/fnlib/"
AC_MSG_ERROR([Fatal Error: no Fnlib detected.])], $IMLIB_LIBS)
AC_SUBST(FNLIB_LIBS)
AC_DEFINE(USE_FNLIB, 1, [Fnlib support])
fi
if test "x$enable_upgrade" = "xyes"; then
AC_CHECK_LIB(ghttp, ghttp_uri_validate, [AC_DEFINE(AUTOUPGRADE, 1, [Automatic upgrading])

View File

@ -37,7 +37,9 @@
#endif
#include <Imlib.h>
#if USE_FNLIB
#include <Fnlib.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -88,7 +90,9 @@ typedef struct _mwmhints {
Display *disp;
ImlibData *id;
FnlibData *fd;
#if USE_FNLIB
FnlibData *pFnlibData;
#endif
Window win_main, win_title, win_exit, win_next, win_prev, win_text, win_cover;
int w, h, t;
ImlibImage *im_text;
@ -216,7 +220,9 @@ int main(int argc, char **argv)
params.pixmapcachesize = (w * h * 3 * 2 * 8);
id = Imlib_init_with_params(disp, &params);
Imlib_set_render_type(id, RT_DITHER_TRUECOL);
fd = Fnlib_init(id);
#if USE_FNLIB
pFnlibData = Fnlib_init(id);
#endif
im_title = Imlib_create_image_from_xpm_data(id, title_xpm);
ibd.left = 50;
@ -280,7 +286,9 @@ int main(int argc, char **argv)
t = 16;
GetObjects(f);
fclose(f);
Fnlib_add_dir(fd, docdir);
#if USE_FNLIB
Fnlib_add_dir(pFnlibData, docdir);
#endif
wx = (DisplayWidth(disp, DefaultScreen(disp)) - w) / 2;
wy = (DisplayHeight(disp, DefaultScreen(disp)) - (h + t)) / 2;
#ifdef HAS_XINERAMA

View File

@ -34,7 +34,9 @@
#include <X11/extensions/shape.h>
#include <X11/extensions/XShm.h>
#include <Imlib.h>
#if USE_FNLIB
#include <Fnlib.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@ -104,8 +106,10 @@ Efont;
typedef struct _textstate
{
char *fontname;
#if USE_FNLIB
FnlibStyle style;
FnlibFont *font;
#endif
ImlibColor fg_col;
ImlibColor bg_col;
int effect;
@ -249,5 +253,7 @@ Link *RenderPage(Window win, int page_num, int w, int h);
extern Display *disp;
extern ImlibData *id;
extern FnlibData *fd;
#if USE_FNLIB
extern FnlibData *pFnlibData;
#endif
extern char *docdir;

View File

@ -519,11 +519,13 @@ RenderPage(Window win, int page_num, int w, int h)
int wastext = 0;
ts.fontname = NULL;
#if USE_FNLIB
ts.style.orientation = FONT_TO_RIGHT;
ts.style.mode = MODE_WRAP_WORD;
ts.style.justification = 0;
ts.style.spacing = 0;
ts.font = NULL;
#endif
ts.fg_col.r = 0;
ts.fg_col.g = 0;
ts.fg_col.b = 0;
@ -604,13 +606,15 @@ RenderPage(Window win, int page_num, int w, int h)
case FONT:
fn = pg->obj[i].object;
ts.fontname = NULL;
#if USE_FNLIB
ts.style.orientation = FONT_TO_RIGHT;
ts.style.mode = MODE_WRAP_WORD;
ts.style.justification = 0;
ts.style.spacing = 0;
if (ts.font)
Fnlib_free_font(fd, ts.font);
Fnlib_free_font(pFnlibData, ts.font);
ts.font = NULL;
#endif
ts.fg_col.r = 0;
ts.fg_col.g = 0;
ts.fg_col.b = 0;
@ -980,8 +984,10 @@ RenderPage(Window win, int page_num, int w, int h)
}
}
#if USE_FNLIB
if (ts.font)
Fnlib_free_font(fd, ts.font);
Fnlib_free_font(pFnlibData, ts.font);
#endif
if (ts.efont)
Efont_free(ts.efont);
if (ts.xfont)

View File

@ -57,13 +57,23 @@ TextGetLines(char *text, int *count)
void
TextStateLoadFont(TextState * ts)
{
#if USE_FNLIB
if ((ts->font) || (ts->efont) || (ts->xfont) || (ts->xfontset))
#else
if ((ts->efont) || (ts->xfont) || (ts->xfontset))
#endif
return;
if (!ts->fontname)
return;
#if USE_FNLIB
if ((!ts->font) && (!ts->efont))
ts->font = Fnlib_load_font(fd, ts->fontname);
ts->font = Fnlib_load_font(pFnlibData, ts->fontname);
#endif
#if USE_FNLIB
if ((!ts->font) && (!ts->efont))
#else
if (!ts->efont)
#endif
{
char s[4096], w[4046], *dup, *ss;
@ -90,7 +100,11 @@ TextStateLoadFont(TextState * ts)
if (dup)
free(dup);
}
#if USE_FNLIB
if ((!ts->font) && (!ts->efont))
#else
if (!ts->efont)
#endif
{
if ((!ts->xfont) && (strchr(ts->fontname, ',') == NULL))
{
@ -145,13 +159,14 @@ TextSize(TextState * ts, char *text,
if (!ts)
return;
TextStateLoadFont(ts);
#if USE_FNLIB
if (ts->font)
{
for (i = 0; i < num_lines; i++)
{
int high, wid, dummy;
Fnlib_measure(fd, ts->font, 0, 0, 999999, 999999,
Fnlib_measure(pFnlibData, ts->font, 0, 0, 999999, 999999,
0, 0, fsize, &ts->style, (unsigned char *)lines[i],
0, 0, &dummy, &dummy, &wid, &high, &dummy,
&dummy, &dummy, &dummy);
@ -160,7 +175,9 @@ TextSize(TextState * ts, char *text,
*width = wid;
}
}
else if (ts->efont)
else
#endif
if (ts->efont)
{
for (i = 0; i < num_lines; i++)
{
@ -237,13 +254,14 @@ TextDraw(TextState * ts, Window win, char *text,
yy = y;
if (!gc)
gc = XCreateGC(disp, win, 0, &gcv);
#if USE_FNLIB
if (ts->font)
{
for (i = 0; i < num_lines; i++)
{
int high, wid, dummy;
Fnlib_measure(fd, ts->font, 0, 0, 999999, 999999,
Fnlib_measure(pFnlibData, ts->font, 0, 0, 999999, 999999,
0, 0, fsize, &ts->style, (unsigned char *)lines[i],
0, 0, &dummy, &dummy, &wid, &high, &dummy,
&dummy, &dummy, &dummy);
@ -251,12 +269,14 @@ TextDraw(TextState * ts, Window win, char *text,
(ts->style.orientation == FONT_TO_DOWN))
fsize = w;
xx = x + (((w - wid) * justification) >> 10);
Fnlib_draw(fd, ts->font, win, 0, xx, yy, w, h,
Fnlib_draw(pFnlibData, ts->font, win, 0, xx, yy, w, h,
0, 0, fsize, &ts->style, (unsigned char *)lines[i]);
yy += high;
}
}
else if (ts->efont)
else
#endif
if (ts->efont)
{
for (i = 0; i < num_lines; i++)
{

26
src/E.h
View File

@ -35,7 +35,9 @@
/*#include <X11/extensions/XTest.h> */
#include <X11/extensions/XShm.h>
#include <Imlib.h>
#if USE_FNLIB
#include <Fnlib.h>
#endif
#define DEBUG_EWMH 0
@ -675,11 +677,30 @@ typedef struct _efont
}
Efont;
#if !USE_FNLIB
#define MODE_VERBATIM 0
#define MODE_WRAP_CHAR 1
#define MODE_WRAP_WORD 2
#define FONT_TO_RIGHT 0
#define FONT_TO_DOWN 1
#define FONT_TO_UP 2
#define FONT_TO_LEFT 3
#endif
typedef struct _textstate
{
char *fontname;
#if USE_FNLIB
FnlibStyle style;
FnlibFont *font;
#else
struct
{
char mode;
char orientation;
} style;
#endif
ImlibColor fg_col;
ImlibColor bg_col;
int effect;
@ -3011,7 +3032,10 @@ extern int single_screen_mode;
extern Display *disp;
extern ImlibData *id;
extern ImlibData *ird;
extern FnlibData *fd;
#if USE_FNLIB
extern FnlibData *pFnlibData;
#endif
extern List *lists;
extern int event_base_shape;
extern Window comms_win;

View File

@ -3665,13 +3665,17 @@ LoadEConfig(char *themelocation)
mustdel = 0;
Esnprintf(s, sizeof(s), "%s/", UserEDir());
Fnlib_add_dir(fd, s);
#if USE_FNLIB
Fnlib_add_dir(pFnlibData, s);
#endif
#ifndef __EMX__
Esnprintf(s, sizeof(s), "%s/config/", ENLIGHTENMENT_ROOT);
#else
Esnprintf(s, sizeof(s), "%s/config/", __XOS2RedirRoot(ENLIGHTENMENT_ROOT));
#endif
Fnlib_add_dir(fd, s);
#if USE_FNLIB
Fnlib_add_dir(pFnlibData, s);
#endif
/* save the current theme */
if ((themelocation) && (themelocation[0] != 0))
{
@ -3723,7 +3727,9 @@ LoadEConfig(char *themelocation)
}
strcpy(themepath, theme);
Esnprintf(s, sizeof(s), "%s/", theme);
Fnlib_add_dir(fd, s);
#if USE_FNLIB
Fnlib_add_dir(pFnlibData, s);
#endif
{
Progressbar *p = NULL;
int i;

View File

@ -36,7 +36,10 @@ int single_screen_mode;
Display *disp;
ImlibData *id;
ImlibData *ird;
FnlibData *fd;
#if USE_FNLIB
FnlibData *pFnlibData;
#endif
List *lists;
int event_base_shape;
Window comms_win;

View File

@ -331,8 +331,9 @@ SetupX()
RESET_ALERT;
EExit((void *)1);
}
fd = Fnlib_init(id);
if (!fd)
#if USE_FNLIB
pFnlibData = Fnlib_init(id);
if (!pFnlibData)
{
ASSIGN_ALERT(_("X server setup error"), "", "",
_("Quit Enlightenment"));
@ -343,6 +344,7 @@ SetupX()
RESET_ALERT;
EExit((void *)1);
}
#endif
root.win = id->x.root;
root.vis = Imlib_get_visual(id);
root.depth = id->x.depth;

View File

@ -53,8 +53,10 @@ FreeTextState(TextState * ts)
if (ts->fontname)
Efree(ts->fontname);
#if USE_FNLIB
if (ts->font)
Fnlib_free_font(fd, ts->font);
Fnlib_free_font(pFnlibData, ts->font);
#endif
if (ts->xfont)
XFreeFont(disp, ts->xfont);
if (ts->efont)
@ -141,9 +143,11 @@ CreateTextState()
ts->fontname = NULL;
ts->style.mode = MODE_WRAP_CHAR;
ts->style.orientation = FONT_TO_RIGHT;
#if USE_FNLIB
ts->style.justification = 0;
ts->style.spacing = 0;
ts->font = NULL;
#endif
ts->efont = NULL;
ts->xfont = NULL;
ts->xfontset = 0;

View File

@ -139,13 +139,23 @@ void
TextStateLoadFont(TextState * ts)
{
EDBUG(5, "TextStateLoadFont");
#if USE_FNLIB
if ((ts->font) || (ts->efont) || (ts->xfont) || (ts->xfontset))
#else
if ((ts->efont) || (ts->xfont) || (ts->xfontset))
#endif
EDBUG_RETURN_;
if (!ts->fontname)
EDBUG_RETURN_;
#if USE_FNLIB
if ((!ts->font) && (!ts->efont))
ts->font = Fnlib_load_font(fd, ts->fontname);
ts->font = Fnlib_load_font(pFnlibData, ts->fontname);
#endif
#if USE_FNLIB
if ((!ts->font) && (!ts->efont))
#else
if (!ts->efont)
#endif
{
char s[4096], w[4046], *dup, *ss;
@ -168,7 +178,11 @@ TextStateLoadFont(TextState * ts)
if (dup)
Efree(dup);
}
#if USE_FNLIB
if ((!ts->font) && (!ts->efont))
#else
if (!ts->efont)
#endif
{
if ((!ts->xfont) && (strchr(ts->fontname, ',') == NULL))
{
@ -218,21 +232,25 @@ TextSize(TextClass * tclass, int active, int sticky, int state, char *text,
if (!ts)
EDBUG_RETURN_;
TextStateLoadFont(ts);
#if USE_FNLIB
if (ts->font)
{
for (i = 0; i < num_lines; i++)
{
int high, wid, dummy;
Fnlib_measure(fd, ts->font, 0, 0, 999999, 999999, 0, 0, fsize,
&ts->style, (unsigned char *)lines[i], 0, 0, &dummy,
&dummy, &wid, &high, &dummy, &dummy, &dummy, &dummy);
Fnlib_measure(pFnlibData, ts->font, 0, 0, 999999, 999999, 0, 0,
fsize, &ts->style, (unsigned char *)lines[i], 0, 0,
&dummy, &dummy, &wid, &high, &dummy, &dummy, &dummy,
&dummy);
*height += high;
if (wid > *width)
*width = wid;
}
}
else if (ts->efont)
else
#endif
if (ts->efont)
{
for (i = 0; i < num_lines; i++)
{
@ -323,25 +341,29 @@ TextDraw(TextClass * tclass, Window win, int active, int sticky, int state,
else
textwidth_limit = h;
#if USE_FNLIB
if (ts->font)
{
for (i = 0; i < num_lines; i++)
{
int high, wid, dummy;
Fnlib_measure(fd, ts->font, 0, 0, 999999, 999999, 0, 0, fsize,
&ts->style, (unsigned char *)lines[i], 0, 0, &dummy,
&dummy, &wid, &high, &dummy, &dummy, &dummy, &dummy);
Fnlib_measure(pFnlibData, ts->font, 0, 0, 999999, 999999, 0, 0,
fsize, &ts->style, (unsigned char *)lines[i], 0, 0,
&dummy, &dummy, &wid, &high, &dummy, &dummy, &dummy,
&dummy);
if ((ts->style.orientation == FONT_TO_UP)
|| (ts->style.orientation == FONT_TO_DOWN))
fsize = w;
xx = x + (((w - wid) * justification) >> 10);
Fnlib_draw(fd, ts->font, win, 0, xx, yy, w, h, 0, 0, fsize,
Fnlib_draw(pFnlibData, ts->font, win, 0, xx, yy, w, h, 0, 0, fsize,
&ts->style, (unsigned char *)lines[i]);
yy += high;
}
}
else if (ts->efont)
else
#endif
if (ts->efont)
{
for (i = 0; i < num_lines; i++)
{