Date: Sunday August 13, 2000 @ 21:42 Author: cvs Update of /home/cvs/CVS/client In directory boltzmann.eecs.berkeley.edu:/tmp/cvs-serv25435 Modified Files: config.h config.h.in configure configure.in gx11.c x11.c xutil.c CHANGES Added Files: png.c Log Message: The following change removes imlib as are png loading/rendering library - instead, we use our own local function located in png.c. libpng is still needed, but it removes the dependancy on imlib. Also, my home spun function renders all the png images crossfire uses correctly, while imlib had several it did not do properly. MSW 8/13/2000 Files affected: config.h, config.h.in: Change HAVE_IMLIB_H to HAVE_LIBPNG configure, configure.in: Change check from imlib to libpng. gx11.c,x11.c,xutil.c: Changed to use our functions and not imlib. png.c: new file that has our png support in it. **************************************** Index: client/config.h diff -u client/config.h:1.3 client/config.h:1.4 --- client/config.h:1.3 Sat Jun 3 00:20:23 2000 +++ client/config.h Sun Aug 13 21:42:35 2000 @@ -52,5 +52,6 @@ /* Define/not defined depending on the endianness of this system */ /* #undef WORDS_BIGENDIAN */ -/* Define/not defined depending on the endianness of this system */ -#define HAVE_IMLIB_H 1 +/* Define if you have the <xpm.h> header file. */ +#define HAVE_LIBPNG 1 + Index: client/config.h.in diff -u client/config.h.in:1.3 client/config.h.in:1.4 --- client/config.h.in:1.3 Sat Jun 3 00:20:23 2000 +++ client/config.h.in Sun Aug 13 21:42:35 2000 @@ -51,5 +51,6 @@ /* Define/not defined depending on the endianness of this system */ #undef WORDS_BIGENDIAN -/* Define/not defined depending on the endianness of this system */ -#undef HAVE_IMLIB_H +/* Define if you have the <xpm.h> header file. */ +#undef HAVE_LIBPNG + Index: client/configure diff -u client/configure:1.6 client/configure:1.7 --- client/configure:1.6 Tue Jun 20 21:45:47 2000 +++ client/configure Sun Aug 13 21:42:35 2000 @@ -3186,45 +3186,9 @@ fi -echo $ac_n "checking for main in -lgdk_imlib""... $ac_c" 1>&6 -echo "configure:3191: checking for main in -lgdk_imlib" >&5 -ac_lib_var=`echo gdk_imlib'_'main | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lgdk_imlib $LIBS" -cat > conftest.$ac_ext <<EOF -#line 3199 "configure" -#include "confdefs.h" - -int main() { -main() -; return 0; } -EOF -if { (eval echo configure:3206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GTK_LIBS="$GTK_LIBS -lgdk_imlib" -else - echo "$ac_t""no" 1>&6 -fi - echo $ac_n "checking for main in -lXext""... $ac_c" 1>&6 -echo "configure:3228: checking for main in -lXext" >&5 +echo "configure:3192: checking for main in -lXext" >&5 ac_lib_var=`echo Xext'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3232,14 +3196,14 @@ ac_save_LIBS="$LIBS" LIBS="-lXext $LIBS" cat > conftest.$ac_ext <<EOF -#line 3236 "configure" +#line 3200 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:3243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3259,24 +3223,30 @@ echo "$ac_t""no" 1>&6 fi + + +CPPFLAGS="$gcfc_save_CPPFLAGS" +LIBS="$gcfc_save_LIBS" + + -echo $ac_n "checking for main in -lImlib""... $ac_c" 1>&6 -echo "configure:3265: checking for main in -lImlib" >&5 -ac_lib_var=`echo Imlib'_'main | sed 'y%./+-%__p_%'` +echo $ac_n "checking for main in -lpng""... $ac_c" 1>&6 +echo "configure:3235: checking for main in -lpng" >&5 +ac_lib_var=`echo png'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lImlib $LIBS" +LIBS="-lpng $LIBS" cat > conftest.$ac_ext <<EOF -#line 3273 "configure" +#line 3243 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:3280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3291,19 +3261,21 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - X_LIBS="$X_LIBS -lImlib" + ac_tr_lib=HAVE_LIB`echo png | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-lpng $LIBS" + else echo "$ac_t""no" 1>&6 fi -CPPFLAGS="$gcfc_save_CPPFLAGS" -LIBS="$gcfc_save_LIBS" - - - echo $ac_n "checking for main in -ldmalloc""... $ac_c" 1>&6 -echo "configure:3307: checking for main in -ldmalloc" >&5 +echo "configure:3279: checking for main in -ldmalloc" >&5 ac_lib_var=`echo dmalloc'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3311,14 +3283,14 @@ ac_save_LIBS="$LIBS" LIBS="-ldmalloc $LIBS" cat > conftest.$ac_ext <<EOF -#line 3315 "configure" +#line 3287 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:3322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3347,7 +3319,7 @@ echo $ac_n "checking for sqrt in -lm""... $ac_c" 1>&6 -echo "configure:3351: checking for sqrt in -lm" >&5 +echo "configure:3323: checking for sqrt in -lm" >&5 ac_lib_var=`echo m'_'sqrt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3355,7 +3327,7 @@ ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 3359 "configure" +#line 3331 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3366,7 +3338,7 @@ sqrt() ; return 0; } EOF -if { (eval echo configure:3370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3396,12 +3368,12 @@ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3400: checking for ANSI C header files" >&5 +echo "configure:3372: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3405 "configure" +#line 3377 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -3409,7 +3381,7 @@ #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3413: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3385: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3426,7 +3398,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 3430 "configure" +#line 3402 "configure" #include "confdefs.h" #include <string.h> EOF @@ -3444,7 +3416,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 3448 "configure" +#line 3420 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -3465,7 +3437,7 @@ : else cat > conftest.$ac_ext <<EOF -#line 3469 "configure" +#line 3441 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3476,7 +3448,7 @@ exit (0); } EOF -if { (eval echo configure:3480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3499,21 +3471,21 @@ fi -for ac_hdr in fcntl.h sys/ioctl.h sys/time.h unistd.h string.h sys/select.h Imlib.h +for ac_hdr in fcntl.h sys/ioctl.h sys/time.h unistd.h string.h sys/select.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3507: checking for $ac_hdr" >&5 +echo "configure:3479: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3512 "configure" +#line 3484 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3489: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3541,12 +3513,12 @@ echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3545: checking for working const" >&5 +echo "configure:3517: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3550 "configure" +#line 3522 "configure" #include "confdefs.h" int main() { @@ -3595,7 +3567,7 @@ ; return 0; } EOF -if { (eval echo configure:3599: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3616,12 +3588,12 @@ fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3620: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3592: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3625 "configure" +#line 3597 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -3630,7 +3602,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3634: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3653,13 +3625,13 @@ if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:3657: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:3629: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 3663 "configure" +#line 3635 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -3677,7 +3649,7 @@ if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 3681 "configure" +#line 3653 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -3699,12 +3671,12 @@ fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:3703: checking for vprintf" >&5 +echo "configure:3675: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3708 "configure" +#line 3680 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vprintf(); below. */ @@ -3727,7 +3699,7 @@ ; return 0; } EOF -if { (eval echo configure:3731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -3751,12 +3723,12 @@ if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:3755: checking for _doprnt" >&5 +echo "configure:3727: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3760 "configure" +#line 3732 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt(); below. */ @@ -3779,7 +3751,7 @@ ; return 0; } EOF -if { (eval echo configure:3783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -3806,12 +3778,12 @@ for ac_func in mkdir socket strcspn sysconf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3810: checking for $ac_func" >&5 +echo "configure:3782: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3815 "configure" +#line 3787 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3834,7 +3806,7 @@ ; return 0; } EOF -if { (eval echo configure:3838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else Index: client/configure.in diff -u client/configure.in:1.6 client/configure.in:1.7 --- client/configure.in:1.6 Tue Jun 20 21:45:47 2000 +++ client/configure.in Sun Aug 13 21:42:35 2000 @@ -246,12 +246,12 @@ fi dnl Put this here so we get the gdk libs -AC_CHECK_LIB(gdk_imlib, main,GTK_LIBS="$GTK_LIBS -lgdk_imlib") +dnl AC_CHECK_LIB(gdk_imlib, main,GTK_LIBS="$GTK_LIBS -lgdk_imlib") dnl Need to check for Xext while we still have X_LIBS set. AC_CHECK_LIB(Xext, main, X_LIBS="$X_LIBS -lXext") -AC_CHECK_LIB(Imlib, main, X_LIBS="$X_LIBS -lImlib") +dnl AC_CHECK_LIB(Imlib, main, X_LIBS="$X_LIBS -lImlib") dnl Restore previous CPPFLAGS and LIBS. CPPFLAGS="$gcfc_save_CPPFLAGS" @@ -259,6 +259,8 @@ AC_SUBST(LIBS) +AC_CHECK_LIB(png, main) + dnl not strictly needed, but since the X11 client uses it, lets use it here AC_CHECK_LIB(dmalloc, main) @@ -268,7 +270,7 @@ dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h string.h sys/select.h Imlib.h) +AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h string.h sys/select.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST Index: client/gx11.c diff -u client/gx11.c:1.6 client/gx11.c:1.7 --- client/gx11.c:1.6 Sun Aug 6 22:27:22 2000 +++ client/gx11.c Sun Aug 13 21:42:35 2000 @@ -1,6 +1,6 @@ /* * static char *rcsid_xio_c = - * "$Id: gx11.c,v 1.6 2000/08/07 05:27:22 cvs Exp $"; + * "$Id: gx11.c,v 1.7 2000/08/14 04:42:35 cvs Exp $"; * * This file handles all the windowing stuff. The idea is * that all of it is in one file, so to port to different systems @@ -105,8 +105,9 @@ #include <gdk/gdkx.h> #include <gdk/gdkkeysyms.h> -#ifdef HAVE_IMLIB_H -#include <gdk_imlib.h> +#ifdef HAVE_LIBPNG +#define PNG_GDK +#include "png.c" #endif static int image_size=24; @@ -306,12 +307,9 @@ }; struct PixmapInfo { - Pixmap pixmap,mask; - Pixmap bitmap; long fg,bg; GdkPixmap *gdkpixmap; GdkBitmap *gdkmask; - GdkPixmap *gdkbitmap; }; struct GtkMap { @@ -1285,9 +1283,11 @@ } } else if (display_mode == Png_Display) { -#ifdef HAVE_IMLIB_H - if (gdk_imlib_load_file_to_pixmap(buf, &pixmaps[pnum].gdkpixmap, &pixmaps[pnum].gdkmask)==0) { - fprintf(stderr,"Got error on Imlib_load_file_to_pixmap\n"); +#ifdef HAVE_LIBPNG + + if (png_to_gdkpixmap(gtkwin_root->window, buf, &pixmaps[pnum].gdkpixmap, + &pixmaps[pnum].gdkmask,gtk_widget_get_colormap(gtkwin_root))) { + fprintf(stderr,"Got error on png_to_gdkpixmap\n"); requestface(pnum, face, buf); } #endif @@ -1970,7 +1970,6 @@ static int get_game_display(GtkWidget *frame) { - /*#include "pixmaps/bg.xpm"*/ GtkWidget *gtvbox, *gthbox; gtvbox = gtk_vbox_new (FALSE, 0); @@ -3405,18 +3404,6 @@ ****************************************************************************/ -/*#define draw_status_icon(l,x,y,face) \ -do { \ - XClearArea(display, l->win, x, y, 24, 6, False); \ - if (face) { \ - XSetClipMask(display, l->gc_status, icons[face].mask), \ - XSetClipOrigin(display, l->gc_status, x, y), \ - XCopyArea(display, icons[face].pixmap, l->win, l->gc_status, \ - 0, 0, 24, 6, x, y); \ - } \ -} while (0) -*/ - /* * draw_all_list clears a window and after that draws all objects * and a scrollbar @@ -6234,7 +6221,7 @@ #ifdef Xpm_Pix puts("-xpm - Use color pixmaps (XPM) for display."); #endif -#ifdef HAVE_IMLIB_H +#ifdef HAVE_LIBPNG puts("-png - Use png images for display."); #endif puts("-showicon - Print status icons in inventory window"); @@ -6305,7 +6292,7 @@ #endif } if (!strcmp(argv[on_arg],"-png")) { -#ifdef HAVE_IMLIB_H +#ifdef HAVE_LIBPNG display_mode = Png_Display; image_size=32; continue; @@ -6384,11 +6371,6 @@ init_keys(); if (cache_images) init_cache_data(); destroy_splash(); -#ifdef HAVE_IMLIB_H - if (display_mode == Png_Display) { - gdk_imlib_init(); - } -#endif return 0; } @@ -6519,7 +6501,7 @@ */ void display_newpng(long face,char *buf,long buflen) { -#ifdef HAVE_IMLIB_H +#ifdef HAVE_LIBPNG char *filename; FILE *tmpfile; @@ -6540,8 +6522,10 @@ fclose(tmpfile); } - if (gdk_imlib_load_file_to_pixmap(filename, &pixmaps[face].gdkpixmap, &pixmaps[face].gdkmask)==0) { - fprintf(stderr,"Got error on Imlib_load_file_to_pixmap\n"); + if (png_to_gdkpixmap(gtkwin_root->window, filename, + &pixmaps[face].gdkpixmap, &pixmaps[face].gdkmask, + gtk_widget_get_colormap(gtkwin_root))) { + fprintf(stderr,"Got error on png_to_gdkpixmap\n"); } if (cache_images) { Index: client/x11.c diff -u client/x11.c:1.9 client/x11.c:1.10 --- client/x11.c:1.9 Sun Aug 6 22:27:22 2000 +++ client/x11.c Sun Aug 13 21:42:35 2000 @@ -1,6 +1,6 @@ /* * static char *rcsid_x11_c = - * "$Id: x11.c,v 1.9 2000/08/07 05:27:22 cvs Exp $"; + * "$Id: x11.c,v 1.10 2000/08/14 04:42:35 cvs Exp $"; */ /* Crossfire client, a client program for the crossfire program. @@ -306,11 +306,10 @@ /* info win */ #define INFOCHARS 50 -#ifdef HAVE_IMLIB_H -#include <Imlib.h> -static ImlibData *id; -#endif +#if defined(HAVE_LIBPNG) && !defined(__CEXTRACT__) +#include <png.c> +#endif #include <xutil.c> /* This is the loop that the client goes through once all the @@ -324,6 +323,7 @@ */ extern int maxfd; + void event_loop() { fd_set tmp_read, tmp_exceptions; @@ -2604,7 +2604,7 @@ #ifdef HAVE_LIBXPM puts("-xpm - Use color pixmaps (XPM) for display."); #endif -#ifdef HAVE_IMLIB_H +#ifdef HAVE_LIBPNG puts("-png - Use png images for display."); #endif puts("-showicon - Print status icons in inventory window"); @@ -2678,7 +2678,7 @@ #endif } if (!strcmp(argv[on_arg],"-png")) { -#ifdef HAVE_IMLIB_H +#ifdef HAVE_LIBPNG display_mode = Png_Display; image_size=32; continue; @@ -2762,11 +2762,6 @@ if (cache_images) init_cache_data(); set_window_pos(); info_ratio=(float) infodata.width/ (float) (infodata.width + INV_WIDTH); -#ifdef HAVE_IMLIB_H - if (display_mode == Png_Display) { - id=Imlib_init(display); - } -#endif return 0; } @@ -2891,11 +2886,12 @@ */ void display_newpng(long face,char *buf,long buflen) { -#ifdef HAVE_IMLIB_H +#ifdef HAVE_LIBPNG char *filename; FILE *tmpfile; Pixmap pixmap, mask; + unsigned long w,h; if (cache_images) { if (facetoname[face]==NULL) { @@ -2913,7 +2909,8 @@ fclose(tmpfile); } - if (Imlib_load_file_to_pixmap(id, filename, &pixmap, &mask)==0) { + if (png_to_xpixmap(display, win_game, filename, &pixmap, &mask, + colormap, &w, &h)) { fprintf(stderr,"Got error on Imlib_load_file_to_pixmap\n"); } Index: client/xutil.c diff -u client/xutil.c:1.7 client/xutil.c:1.8 --- client/xutil.c:1.7 Sat Jun 3 00:20:24 2000 +++ client/xutil.c Sun Aug 13 21:42:35 2000 @@ -1,6 +1,6 @@ /* * static char *rcsid_xio_c = - * "$Id: xutil.c,v 1.7 2000/06/03 07:20:24 cvs Exp $"; + * "$Id: xutil.c,v 1.8 2000/08/14 04:42:35 cvs Exp $"; * * This contains varous 'support' functions. These functions will probably * go mostly unaltered between different toolkits, as long as X11 is still @@ -156,11 +156,13 @@ /* fprintf(stderr,"Successfully loaded %s (%d) from cache\n", buf, pnum);*/ } } else if (display_mode==Png_Display) { -#ifdef HAVE_IMLIB_H +#ifdef HAVE_LIBPNG Pixmap pixmap, mask; + unsigned long w, h; /* Fail on this read, we will request a new copy */ - if (Imlib_load_file_to_pixmap(id, buf, &pixmap, &mask)==0) { + if (png_to_xpixmap(display, win_game, buf, + &pixmap, &mask, colormap, &w, &h)) { requestface(pnum, face, buf); } else { pixmaps[pnum].pixmap = pixmap; Index: client/CHANGES diff -u client/CHANGES:1.19 client/CHANGES:1.20 --- client/CHANGES:1.19 Thu Aug 10 20:57:09 2000 +++ client/CHANGES Sun Aug 13 21:42:35 2000 @@ -1,5 +1,16 @@ -"$Id: CHANGES,v 1.19 2000/08/11 03:57:09 cvs Exp $" +"$Id: CHANGES,v 1.20 2000/08/14 04:42:35 cvs Exp $" Top of CVS tree: + +The following change removes imlib as are png loading/rendering library - +instead, we use our own local function located in png.c. libpng is +still needed, but it removes the dependancy on imlib. Also, my home +spun function renders all the png images crossfire uses correctly, while +imlib had several it did not do properly. MSW 8/13/2000 +Files affected: +config.h, config.h.in: Change HAVE_IMLIB_H to HAVE_LIBPNG +configure, configure.in: Change check from imlib to libpng. +gx11.c,x11.c,xutil.c: Changed to use our functions and not imlib. +png.c: new file that has our png support in it. cfsndserv.c: Make some changes so that sound on ultrasparc systems is played properly. Missing FD_SET call to re-add the soundfd, as well as a missing