1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-08 23:18:31 +00:00

run without x11

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@79 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-08-08 01:18:52 +00:00
parent 5edfd58e18
commit fb78b0f0ca
11 changed files with 422 additions and 333 deletions

View File

@ -1,5 +1,6 @@
2005-08-07 2005-08-07
* mpd password patch from Joshua Gerrish * mpd password patch from Joshua Gerrish
* conky can run without X now, use --disable-x11 when configuring
2005-08-06 2005-08-06
* Conky 1.2 released * Conky 1.2 released

View File

@ -15,13 +15,13 @@
<kdevautoproject> <kdevautoproject>
<general> <general>
<activetarget>conky</activetarget> <activetarget>conky</activetarget>
<useconfiguration>debug</useconfiguration> <useconfiguration>debug-no-x</useconfiguration>
</general> </general>
<run> <run>
<mainprogram>conky</mainprogram> <mainprogram>conky</mainprogram>
<directoryradio>build</directoryradio> <directoryradio>build</directoryradio>
<customdirectory>/</customdirectory> <customdirectory>/</customdirectory>
<programargs></programargs> <programargs/>
<terminal>false</terminal> <terminal>false</terminal>
<autocompile>true</autocompile> <autocompile>true</autocompile>
<envvars/> <envvars/>
@ -48,7 +48,7 @@
<f77flags/> <f77flags/>
</optimized> </optimized>
<debug> <debug>
<configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey</configargs> <configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --enable-x11</configargs>
<builddir>debug</builddir> <builddir>debug</builddir>
<ccompiler>kdevgccoptions</ccompiler> <ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler> <cxxcompiler>kdevgppoptions</cxxcompiler>
@ -64,6 +64,23 @@
<cxxflags></cxxflags> <cxxflags></cxxflags>
<f77flags></f77flags> <f77flags></f77flags>
</debug> </debug>
<debug-no-x>
<envvars/>
<configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --disable-x11</configargs>
<builddir>debug-no-x</builddir>
<topsourcedir></topsourcedir>
<cppflags></cppflags>
<ldflags></ldflags>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<ccompilerbinary></ccompilerbinary>
<cxxcompilerbinary></cxxcompilerbinary>
<f77compilerbinary></f77compilerbinary>
<cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3</cflags>
<cxxflags></cxxflags>
<f77flags></f77flags>
</debug-no-x>
</configurations> </configurations>
<make> <make>
<envvars> <envvars>

View File

@ -37,8 +37,12 @@ if BUILD_MLDONKEY
mldonkey = mldonkey.c mldonkey = mldonkey.c
endif endif
if BUILD_X11
x11 = x11.c
endif
conky_SOURCES = common.c fs.c top.c $(linux) mail.c mixer.c $(seti) $(mpd) \ conky_SOURCES = common.c fs.c top.c $(linux) mail.c mixer.c $(seti) $(mpd) \
$(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h x11.c $(metar) \ $(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h $(x11) $(metar) \
$(mldonkey) $(mldonkey)
conky_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS) conky_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS)
@ -59,4 +63,4 @@ EXTRA_DIST = conkyrc.sample conky.1 conky.x \
app-admin/conky/conky-1.2.ebuild app-admin/conky/conky-1.2.ebuild
EXTRA_conky_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \ EXTRA_conky_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h x11.c

View File

@ -64,14 +64,15 @@ am__conky_SOURCES_DIST = common.c fs.c top.c linux.c mail.c mixer.c \
@BUILD_FREEBSD_TRUE@am__objects_5 = freebsd.$(OBJEXT) @BUILD_FREEBSD_TRUE@am__objects_5 = freebsd.$(OBJEXT)
@BUILD_NETBSD_TRUE@am__objects_6 = netbsd.$(OBJEXT) @BUILD_NETBSD_TRUE@am__objects_6 = netbsd.$(OBJEXT)
@BUILD_CAIRO_TRUE@am__objects_7 = cairo.$(OBJEXT) @BUILD_CAIRO_TRUE@am__objects_7 = cairo.$(OBJEXT)
@BUILD_METAR_TRUE@am__objects_8 = ftp.$(OBJEXT) metarinfo.$(OBJEXT) @BUILD_X11_TRUE@am__objects_8 = x11.$(OBJEXT)
@BUILD_MLDONKEY_TRUE@am__objects_9 = mldonkey.$(OBJEXT) @BUILD_METAR_TRUE@am__objects_9 = ftp.$(OBJEXT) metarinfo.$(OBJEXT)
@BUILD_MLDONKEY_TRUE@am__objects_10 = mldonkey.$(OBJEXT)
am_conky_OBJECTS = common.$(OBJEXT) fs.$(OBJEXT) top.$(OBJEXT) \ am_conky_OBJECTS = common.$(OBJEXT) fs.$(OBJEXT) top.$(OBJEXT) \
$(am__objects_1) mail.$(OBJEXT) mixer.$(OBJEXT) \ $(am__objects_1) mail.$(OBJEXT) mixer.$(OBJEXT) \
$(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \
$(am__objects_5) $(am__objects_6) $(am__objects_7) \ $(am__objects_5) $(am__objects_6) $(am__objects_7) \
conky.$(OBJEXT) x11.$(OBJEXT) $(am__objects_8) \ conky.$(OBJEXT) $(am__objects_8) $(am__objects_9) \
$(am__objects_9) $(am__objects_10)
conky_OBJECTS = $(am_conky_OBJECTS) conky_OBJECTS = $(am_conky_OBJECTS)
am__DEPENDENCIES_1 = am__DEPENDENCIES_1 =
conky_DEPENDENCIES = $(am__DEPENDENCIES_1) conky_DEPENDENCIES = $(am__DEPENDENCIES_1)
@ -126,6 +127,8 @@ BUILD_SETI_FALSE = @BUILD_SETI_FALSE@
BUILD_SETI_TRUE = @BUILD_SETI_TRUE@ BUILD_SETI_TRUE = @BUILD_SETI_TRUE@
BUILD_SOLARIS_FALSE = @BUILD_SOLARIS_FALSE@ BUILD_SOLARIS_FALSE = @BUILD_SOLARIS_FALSE@
BUILD_SOLARIS_TRUE = @BUILD_SOLARIS_TRUE@ BUILD_SOLARIS_TRUE = @BUILD_SOLARIS_TRUE@
BUILD_X11_FALSE = @BUILD_X11_FALSE@
BUILD_X11_TRUE = @BUILD_X11_TRUE@
CAIROCONFIG = @CAIROCONFIG@ CAIROCONFIG = @CAIROCONFIG@
CC = @CC@ CC = @CC@
CCDEPMODE = @CCDEPMODE@ CCDEPMODE = @CCDEPMODE@
@ -206,8 +209,9 @@ target_alias = @target_alias@
@BUILD_METAR_TRUE@metar = ftp.c metarinfo.c @BUILD_METAR_TRUE@metar = ftp.c metarinfo.c
@BUILD_METAR_TRUE@METAR_LIBS = -lmetar @BUILD_METAR_TRUE@METAR_LIBS = -lmetar
@BUILD_MLDONKEY_TRUE@mldonkey = mldonkey.c @BUILD_MLDONKEY_TRUE@mldonkey = mldonkey.c
@BUILD_X11_TRUE@x11 = x11.c
conky_SOURCES = common.c fs.c top.c $(linux) mail.c mixer.c $(seti) $(mpd) \ conky_SOURCES = common.c fs.c top.c $(linux) mail.c mixer.c $(seti) $(mpd) \
$(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h x11.c $(metar) \ $(solaris) $(freebsd) $(netbsd) $(cairo) conky.c conky.h $(x11) $(metar) \
$(mldonkey) $(mldonkey)
conky_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS) conky_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS)
@ -219,7 +223,7 @@ EXTRA_DIST = conkyrc.sample conky.1 conky.x \
app-admin/conky/conky-1.2.ebuild app-admin/conky/conky-1.2.ebuild
EXTRA_conky_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \ EXTRA_conky_SOURCES = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h cairo.c libmpdclient.h top.h mldonkey.c ftp.c metarinfo.c ftp.h metarinfo.h x11.c
all: config.h all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am $(MAKE) $(AM_MAKEFLAGS) all-am

1
TODO
View File

@ -9,6 +9,7 @@ Heres a very simplified roadmap for Conky. By no means does this mean any of th
* conditional colours (ie if temp > 40C, make it red) * conditional colours (ie if temp > 40C, make it red)
* think of new features to add * think of new features to add
* max_width * max_width
* move things out of conky.c, since it's far too big
1.4 1.4
* ideas needed * ideas needed
1.5 (maybe in december?) 1.5 (maybe in december?)

View File

@ -135,5 +135,8 @@
/* Version number of package */ /* Version number of package */
#undef VERSION #undef VERSION
/* Define if you want to use X11 */
#undef X11
/* Define if you are using Xft */ /* Define if you are using Xft */
#undef XFT #undef XFT

355
configure vendored
View File

@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar BUILD_LINUX_TRUE BUILD_LINUX_FALSE BUILD_SOLARIS_TRUE BUILD_SOLARIS_FALSE BUILD_FREEBSD_TRUE BUILD_FREEBSD_FALSE BUILD_NETBSD_TRUE BUILD_NETBSD_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP BUILD_SETI_TRUE BUILD_SETI_FALSE BUILD_MPD_TRUE BUILD_MPD_FALSE BUILD_CAIRO_TRUE BUILD_CAIRO_FALSE CAIROCONFIG BUILD_METAR_TRUE BUILD_METAR_FALSE BUILD_MLDONKEY_TRUE BUILD_MLDONKEY_FALSE XFTCONFIG HELP2MAN HAVE_HELP2MAN_TRUE HAVE_HELP2MAN_FALSE X11_LIBS XFT_LIBS LIBOBJS LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar BUILD_LINUX_TRUE BUILD_LINUX_FALSE BUILD_SOLARIS_TRUE BUILD_SOLARIS_FALSE BUILD_FREEBSD_TRUE BUILD_FREEBSD_FALSE BUILD_NETBSD_TRUE BUILD_NETBSD_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP BUILD_SETI_TRUE BUILD_SETI_FALSE BUILD_MPD_TRUE BUILD_MPD_FALSE BUILD_CAIRO_TRUE BUILD_CAIRO_FALSE CAIROCONFIG BUILD_METAR_TRUE BUILD_METAR_FALSE BUILD_MLDONKEY_TRUE BUILD_MLDONKEY_FALSE BUILD_X11_TRUE BUILD_X11_FALSE XFTCONFIG HELP2MAN HAVE_HELP2MAN_TRUE HAVE_HELP2MAN_FALSE X11_LIBS XFT_LIBS LIBOBJS LTLIBOBJS'
ac_subst_files='' ac_subst_files=''
# Initialize some variables set by options. # Initialize some variables set by options.
@ -835,10 +835,6 @@ Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names --program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names
X features:
--x-includes=DIR X include files are in DIR
--x-libraries=DIR X library files are in DIR
_ACEOF _ACEOF
fi fi
@ -860,11 +856,7 @@ Optional Features:
--enable-cairo enable if you want Cairo support default=no --enable-cairo enable if you want Cairo support default=no
--enable-metar enable if you want metar stats (weather information) default=no --enable-metar enable if you want metar stats (weather information) default=no
--enable-mldonkey enable if you want MLDonkey support default=no --enable-mldonkey enable if you want MLDonkey support default=no
--enable-x11 enable if you want X11 support default=yes
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-x use the X Window System
Some influential environment variables: Some influential environment variables:
CC C compiler command CC C compiler command
@ -4967,110 +4959,93 @@ fi
echo "$as_me:$LINENO: checking for X" >&5 want_x11=yes
echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --enable-x11 or --disable-x11 was given.
if test "${enable_x11+set}" = set; then
enableval="$enable_x11"
# Check whether --with-x or --without-x was given. want_x11="$enableval"
if test "${with_x+set}" = set; then
withval="$with_x"
fi; fi;
# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
if test "x$with_x" = xno; then
# The user explicitly disabled X.
have_x=disabled
if test x$want_x11 == xyes; then
BUILD_X11_TRUE=
BUILD_X11_FALSE='#'
else else
if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then BUILD_X11_TRUE='#'
# Both variables are already set. BUILD_X11_FALSE=
have_x=yes
else
if test "${ac_cv_have_x+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# One or both of the vars are not set, and there is no cached value.
ac_x_includes=no ac_x_libraries=no
rm -fr conftest.dir
if mkdir conftest.dir; then
cd conftest.dir
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
cat >Imakefile <<'_ACEOF'
acfindx:
@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
_ACEOF
if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
for ac_extension in a so sl; do
if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
test -f $ac_im_libdir/libX11.$ac_extension; then
ac_im_usrlibdir=$ac_im_libdir; break
fi
done
# Screen out bogus values from the imake configuration. They are
# bogus both because they are the default anyway, and because
# using them would break gcc on systems where it needs fixed includes.
case $ac_im_incroot in
/usr/include) ;;
*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
esac
case $ac_im_usrlibdir in
/usr/lib | /lib) ;;
*) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
esac
fi
cd ..
rm -fr conftest.dir
fi fi
# Standard set of common directories for X headers. if test x$want_x11 == xyes; then
# Check X11 before X11Rn because it is often a symlink to the current release.
ac_x_header_dirs='
/usr/X11/include
/usr/X11R6/include
/usr/X11R5/include
/usr/X11R4/include
/usr/include/X11 for ac_header in X11/Xlib.h
/usr/include/X11R6 do
/usr/include/X11R5 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
/usr/include/X11R4 if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
/usr/local/X11/include echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
/usr/local/X11R6/include if eval "test \"\${$as_ac_Header+set}\" = set"; then
/usr/local/X11R5/include echo $ECHO_N "(cached) $ECHO_C" >&6
/usr/local/X11R4/include fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
/usr/local/include/X11 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
/usr/local/include/X11R6 else
/usr/local/include/X11R5 # Is the header compilable?
/usr/local/include/X11R4 echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
/usr/X386/include cat >conftest.$ac_ext <<_ACEOF
/usr/x386/include
/usr/XFree86/include/X11
/usr/include
/usr/local/include
/usr/unsupported/include
/usr/athena/include
/usr/local/x11r5/include
/usr/lpp/Xamples/include
/usr/openwin/include
/usr/openwin/share/include'
if test "$ac_x_includes" = no; then
# Guess where to find include files, by looking for Intrinsic.h.
# First, try using that file with no special directory specified.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */ /* confdefs.h. */
_ACEOF _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
#include <X11/Intrinsic.h> $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF _ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@ -5090,126 +5065,87 @@ else
ac_cpp_err=yes ac_cpp_err=yes
fi fi
if test -z "$ac_cpp_err"; then if test -z "$ac_cpp_err"; then
# We can compile using X headers with no special include directory. ac_header_preproc=yes
ac_x_includes=
else else
echo "$as_me: failed program was:" >&5 echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5 sed 's/^/| /' conftest.$ac_ext >&5
for ac_dir in $ac_x_header_dirs; do ac_header_preproc=no
if test -r "$ac_dir/X11/Intrinsic.h"; then
ac_x_includes=$ac_dir
break
fi
done
fi fi
rm -f conftest.err conftest.$ac_ext rm -f conftest.err conftest.$ac_ext
fi # $ac_x_includes = no echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
if test "$ac_x_libraries" = no; then # So? What about this header?
# Check for the libraries. case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
# See if we find them without any special options. yes:no: )
# Don't add to $LIBS permanently. { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
ac_save_LIBS=$LIBS echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
LIBS="-lXt $LIBS" { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
cat >conftest.$ac_ext <<_ACEOF echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
/* confdefs.h. */ ac_header_preproc=yes
_ACEOF ;;
cat confdefs.h >>conftest.$ac_ext no:yes:* )
cat >>conftest.$ac_ext <<_ACEOF { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
/* end confdefs.h. */ echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
#include <X11/Intrinsic.h> { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
int echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
main () { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
{ echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
XtMalloc (0) { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
; echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
return 0; { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
} echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
_ACEOF { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
rm -f conftest.$ac_objext conftest$ac_exeext echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (
(eval $ac_link) 2>conftest.er1 cat <<\_ASBOX
ac_status=$? ## ------------------------------------------ ##
grep -v '^ *+' conftest.er1 >conftest.err ## Report this to the AC_PACKAGE_NAME lists. ##
rm -f conftest.er1 ## ------------------------------------------ ##
cat conftest.err >&5 _ASBOX
echo "$as_me:$LINENO: \$? = $ac_status" >&5 ) |
(exit $ac_status); } && sed "s/^/$as_me: WARNING: /" >&2
{ ac_try='test -z "$ac_c_werror_flag" ;;
|| test ! -s conftest.err' esac
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 echo "$as_me:$LINENO: checking for $ac_header" >&5
(eval $ac_try) 2>&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
ac_status=$? if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: \$? = $ac_status" >&5 echo $ECHO_N "(cached) $ECHO_C" >&6
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
LIBS=$ac_save_LIBS
# We can link X programs with no special library path.
ac_x_libraries=
else else
echo "$as_me: failed program was:" >&5 eval "$as_ac_Header=\$ac_header_preproc"
sed 's/^/| /' conftest.$ac_ext >&5 fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
else
X11_MISSING=yes
fi
LIBS=$ac_save_LIBS
for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
# Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
if test -r $ac_dir/libXt.$ac_extension; then
ac_x_libraries=$ac_dir
break 2
fi
done
done done
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi # $ac_x_libraries = no
if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
# Didn't find X anywhere. Cache the known absence of X.
ac_cv_have_x="have_x=no"
else
# Record where we found X for the cache.
ac_cv_have_x="have_x=yes \
ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi
fi
if test "x$X11_MISSING" = xyes; then
{ { echo "$as_me:$LINENO: error: something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this" >&5
echo "$as_me: error: something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this" >&2;}
{ (exit 1); exit 1; }; }
fi fi
eval "$ac_cv_have_x"
fi # $with_x != no
if test "$have_x" != yes; then cat >>confdefs.h <<\_ACEOF
echo "$as_me:$LINENO: result: $have_x" >&5 #define X11 1
echo "${ECHO_T}$have_x" >&6 _ACEOF
no_x=yes
else
# If each of the values was on the command line, it overrides each guess.
test "x$x_includes" = xNONE && x_includes=$ac_x_includes
test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
# Update the cache value to reflect the command line values.
ac_cv_have_x="have_x=yes \
ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
fi
if test $have_x != "yes"; then
echo "Sorry, X is very much needed"
exit 1
fi
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define HAVE_X11 1 #define HAVE_X11 1
_ACEOF _ACEOF
fi
if test "$x_libraries" != ""; then if test "$x_libraries" != ""; then
@ -6445,6 +6381,13 @@ echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;} Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; } { (exit 1); exit 1; }; }
fi fi
if test -z "${BUILD_X11_TRUE}" && test -z "${BUILD_X11_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"BUILD_X11\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"BUILD_X11\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
if test -z "${HAVE_HELP2MAN_TRUE}" && test -z "${HAVE_HELP2MAN_FALSE}"; then if test -z "${HAVE_HELP2MAN_TRUE}" && test -z "${HAVE_HELP2MAN_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"HAVE_HELP2MAN\" was never defined. { { echo "$as_me:$LINENO: error: conditional \"HAVE_HELP2MAN\" was never defined.
Usually this means the macro was only invoked conditionally." >&5 Usually this means the macro was only invoked conditionally." >&5
@ -7043,6 +6986,8 @@ s,@BUILD_METAR_TRUE@,$BUILD_METAR_TRUE,;t t
s,@BUILD_METAR_FALSE@,$BUILD_METAR_FALSE,;t t s,@BUILD_METAR_FALSE@,$BUILD_METAR_FALSE,;t t
s,@BUILD_MLDONKEY_TRUE@,$BUILD_MLDONKEY_TRUE,;t t s,@BUILD_MLDONKEY_TRUE@,$BUILD_MLDONKEY_TRUE,;t t
s,@BUILD_MLDONKEY_FALSE@,$BUILD_MLDONKEY_FALSE,;t t s,@BUILD_MLDONKEY_FALSE@,$BUILD_MLDONKEY_FALSE,;t t
s,@BUILD_X11_TRUE@,$BUILD_X11_TRUE,;t t
s,@BUILD_X11_FALSE@,$BUILD_X11_FALSE,;t t
s,@XFTCONFIG@,$XFTCONFIG,;t t s,@XFTCONFIG@,$XFTCONFIG,;t t
s,@HELP2MAN@,$HELP2MAN,;t t s,@HELP2MAN@,$HELP2MAN,;t t
s,@HAVE_HELP2MAN_TRUE@,$HAVE_HELP2MAN_TRUE,;t t s,@HAVE_HELP2MAN_TRUE@,$HAVE_HELP2MAN_TRUE,;t t

View File

@ -187,12 +187,26 @@ dnl
dnl X dnl X
dnl dnl
AC_PATH_X want_x11=yes
if test $have_x != "yes"; then AC_ARG_ENABLE(x11,
echo "Sorry, X is very much needed" [ --enable-x11 enable if you want X11 support [default=yes]],
exit 1 [want_x11="$enableval"])
AM_CONDITIONAL(BUILD_X11, test x$want_x11 == xyes)
if test x$want_x11 == xyes; then
AC_CHECK_HEADERS([X11/Xlib.h], [], [X11_MISSING=yes])
if test "x$X11_MISSING" = xyes; then
AC_MSG_ERROR([something went wrong when checking for X11, you're probably missing headers or it's not installed, either re-run configure with --disable-x11, or fix this])
fi
AC_DEFINE(X11, 1, [Define if you want to use X11])
AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
fi fi
AC_DEFINE(HAVE_X11, 1, [Define if you have X11]) dnl AC_PATH_X if test $have_x != "yes"; then
dnl echo "Sorry, X is very much needed"
dnl exit 1
dnl fi
dnl AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
dnl AC_CHECK_LIB([X11], [XOpenDisplay], [X11_LIBS="-lX11"], [], [[-L$x_libraries]]) dnl AC_CHECK_LIB([X11], [XOpenDisplay], [X11_LIBS="-lX11"], [], [[-L$x_libraries]])
dnl AC_CHECK_LIB([Xext], [XdbeQueryExtension], [ dnl AC_CHECK_LIB([Xext], [XdbeQueryExtension], [

294
conky.c
View File

@ -23,7 +23,9 @@
#include <dirent.h> #include <dirent.h>
#endif #endif
#include <sys/time.h> #include <sys/time.h>
#ifdef X11
#include <X11/Xutil.h> #include <X11/Xutil.h>
#endif /* X11 */
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -31,6 +33,8 @@
#define MAIL_FILE "$MAIL" #define MAIL_FILE "$MAIL"
#define MAX_IF_BLOCK_DEPTH 5 #define MAX_IF_BLOCK_DEPTH 5
#ifdef X11
/* alignments */ /* alignments */
enum alignment { enum alignment {
TOP_LEFT = 1, TOP_LEFT = 1,
@ -187,19 +191,14 @@ static void load_fonts()
} }
} }
#endif /* X11 */
/* default config file */ /* default config file */
static char *current_config; static char *current_config;
/* set to 1 if you want all text to be in uppercase */ /* set to 1 if you want all text to be in uppercase */
static unsigned int stuff_in_upper_case; static unsigned int stuff_in_upper_case;
/* Position on the screen */
static int text_alignment;
static int gap_x, gap_y;
/* Always on bottom */
static int on_bottom;
/* Update interval */ /* Update interval */
static double update_interval; static double update_interval;
@ -209,6 +208,17 @@ static unsigned long total_run_times;
/* fork? */ /* fork? */
static int fork_to_background; static int fork_to_background;
static int cpu_avg_samples, net_avg_samples;
#ifdef X11
/* Always on bottom */
static int on_bottom;
/* Position on the screen */
static int text_alignment;
static int gap_x, gap_y;
/* border */ /* border */
static int draw_borders; static int draw_borders;
static int stippled_borders; static int stippled_borders;
@ -219,8 +229,6 @@ static int border_margin, border_width;
static long default_fg_color, default_bg_color, default_out_color; static long default_fg_color, default_bg_color, default_out_color;
static int cpu_avg_samples, net_avg_samples;
/* create own window or draw stuff to root? */ /* create own window or draw stuff to root? */
static int own_window = 0; static int own_window = 0;
@ -231,16 +239,17 @@ static int fixed_size = 0, fixed_pos = 0;
static int minimum_width, minimum_height; static int minimum_width, minimum_height;
/* UTF-8 */
int utf8_mode = 0;
#endif /* X11 */
/* no buffers in used memory? */ /* no buffers in used memory? */
int no_buffers; int no_buffers;
/* pad percentages to decimals? */ /* pad percentages to decimals? */
static int pad_percents = 0; static int pad_percents = 0;
/* UTF-8 */
int utf8_mode = 0;
/* Text that is shown */ /* Text that is shown */
static char original_text[] = static char original_text[] =
"$nodename - $sysname $kernel on $machine\n" "$nodename - $sysname $kernel on $machine\n"
@ -305,7 +314,7 @@ int check_mount(char *s)
} }
#ifdef X11
static inline int calc_text_width(const char *s, unsigned int l) static inline int calc_text_width(const char *s, unsigned int l)
{ {
#ifdef XFT #ifdef XFT
@ -323,6 +332,7 @@ static inline int calc_text_width(const char *s, unsigned int l)
return XTextWidth(fonts[selected_font].font, s, l); return XTextWidth(fonts[selected_font].font, s, l);
} }
} }
#endif /* X11 */
/* formatted text to render on screen, generated in generate_text(), /* formatted text to render on screen, generated in generate_text(),
* drawn in draw_stuff() */ * drawn in draw_stuff() */
@ -440,7 +450,6 @@ static const char *scan_bar(const char *args, int *w, int *h)
return args; return args;
} }
static char *scan_font(const char *args) static char *scan_font(const char *args)
{ {
if (args && sizeof(args) < 127) { if (args && sizeof(args) < 127) {
@ -454,6 +463,7 @@ static char *scan_font(const char *args)
static void new_font(char *buf, char * args) { static void new_font(char *buf, char * args) {
struct special_t *s = new_special(buf, FONT); struct special_t *s = new_special(buf, FONT);
#ifdef X11
if (!s->font_added || strcmp(args, fonts[s->font_added].name)) { if (!s->font_added || strcmp(args, fonts[s->font_added].name)) {
int tmp = selected_font; int tmp = selected_font;
selected_font = s->font_added = addfont(args); selected_font = s->font_added = addfont(args);
@ -461,6 +471,7 @@ static void new_font(char *buf, char * args) {
set_font(); set_font();
selected_font = tmp; selected_font = tmp;
} }
#endif /* X11 */
} }
inline void graph_append(struct special_t *graph, double f) inline void graph_append(struct special_t *graph, double f)
@ -905,11 +916,13 @@ static void construct_text_object(const char *s, const char *arg)
#define OBJ(a, n) if (strcmp(s, #a) == 0) { obj->type = OBJ_##a; need_mask |= (1 << n); { #define OBJ(a, n) if (strcmp(s, #a) == 0) { obj->type = OBJ_##a; need_mask |= (1 << n); {
#define END ; } } else #define END ; } } else
if (s[0] == '#') { #ifdef X11
if (s[0] == '#') {
obj->type = OBJ_color; obj->type = OBJ_color;
obj->data.l = get_x11_color(s); obj->data.l = get_x11_color(s);
} else } else
OBJ(acpitemp, 0) obj->data.i = open_acpi_temperature(arg); #endif /* X11 */
OBJ(acpitemp, 0) obj->data.i = open_acpi_temperature(arg);
END OBJ(acpiacadapter, 0) END OBJ(acpiacadapter, 0)
END OBJ(freq, 0) END OBJ(acpifan, 0) END OBJ(battery, END OBJ(freq, 0) END OBJ(acpifan, 0) END OBJ(battery,
0) char bat[64]; 0) char bat[64];
@ -925,8 +938,10 @@ static void construct_text_object(const char *s, const char *arg)
(void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b); (void) scan_bar(arg, &obj->data.pair.a, &obj->data.pair.b);
END OBJ(cpugraph, INFO_CPU) END OBJ(cpugraph, INFO_CPU)
(void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d); (void) scan_graph(arg, &obj->a, &obj->b, &obj->c, &obj->d);
END OBJ(color, 0) obj->data.l = END OBJ(color, 0)
arg ? get_x11_color(arg) : default_fg_color; #ifdef X11
obj->data.l = arg ? get_x11_color(arg) : default_fg_color;
#endif /* X11 */
END END
OBJ(font, 0) OBJ(font, 0)
obj->data.s = scan_font(arg); obj->data.s = scan_font(arg);
@ -1283,10 +1298,16 @@ static void construct_text_object(const char *s, const char *arg)
END OBJ(processes, INFO_PROCS) END OBJ(processes, INFO_PROCS)
END OBJ(running_processes, INFO_RUN_PROCS) END OBJ(running_processes, INFO_RUN_PROCS)
END OBJ(shadecolor, 0) END OBJ(shadecolor, 0)
#ifdef X11
obj->data.l = arg ? get_x11_color(arg) : default_bg_color; obj->data.l = arg ? get_x11_color(arg) : default_bg_color;
#endif /* X11 */
END OBJ(outlinecolor, 0) END OBJ(outlinecolor, 0)
#ifdef X11
obj->data.l = arg ? get_x11_color(arg) : default_out_color; obj->data.l = arg ? get_x11_color(arg) : default_out_color;
END OBJ(stippled_hr, 0) int a = stippled_borders, b = 1; #endif /* X11 */
END OBJ(stippled_hr, 0)
#ifdef X11
int a = stippled_borders, b = 1;
if (arg) { if (arg) {
if (sscanf(arg, "%d %d", &a, &b) != 2) if (sscanf(arg, "%d %d", &a, &b) != 2)
sscanf(arg, "%d", &b); sscanf(arg, "%d", &b);
@ -1295,6 +1316,7 @@ static void construct_text_object(const char *s, const char *arg)
a = 1; a = 1;
obj->data.pair.a = a; obj->data.pair.a = a;
obj->data.pair.b = b; obj->data.pair.b = b;
#endif /* X11 */
END OBJ(swap, INFO_MEM) END OBJ(swap, INFO_MEM)
END OBJ(swapmax, INFO_MEM) END OBJ(swapmax, INFO_MEM)
END OBJ(swapperc, INFO_MEM) END OBJ(swapperc, INFO_MEM)
@ -2409,7 +2431,7 @@ static void generate_text()
} }
OBJ(metar_tempf) { OBJ(metar_tempf) {
if (data.temp != INT_MAX && metar_worked) if (data.temp != INT_MAX && metar_worked)
snprintf(p, n, "%3.1f", snprintf(p, n, "%3f",
(data.temp + (data.temp +
40) * 9.0 / 5 - 40); 40) * 9.0 / 5 - 40);
else else
@ -2447,7 +2469,6 @@ static void generate_text()
else else
snprintf(p, n, "-"); snprintf(p, n, "-");
} }
OBJ(metar_windspeed) { OBJ(metar_windspeed) {
if (data.winData.windSpeed != INT_MAX if (data.winData.windSpeed != INT_MAX
&& metar_worked) && metar_worked)
@ -2551,7 +2572,7 @@ static void generate_text()
//free(p); //free(p);
} }
#ifdef X11
static void set_font() static void set_font()
{ {
#ifdef XFT #ifdef XFT
@ -2579,9 +2600,15 @@ static void set_font()
static int text_start_x, text_start_y; /* text start position in window */ static int text_start_x, text_start_y; /* text start position in window */
static int text_width, text_height; static int text_width, text_height;
#endif /* X11 */
static inline int get_string_width(const char *s) static inline int get_string_width(const char *s)
{ {
#ifdef X11
return *s ? calc_text_width(s, strlen(s)) : 0; return *s ? calc_text_width(s, strlen(s)) : 0;
#else
return strlen(s);
#endif /* X11 */
} }
int fontchange = 0; int fontchange = 0;
@ -2611,12 +2638,13 @@ static void text_size_updater(char *s)
else if (specials[special_index].type == OFFSET) { else if (specials[special_index].type == OFFSET) {
w += specials[special_index].arg + get_string_width("a"); /* filthy, but works */ w += specials[special_index].arg + get_string_width("a"); /* filthy, but works */
} }
#ifdef X11
else if (specials[special_index].type == FONT) { else if (specials[special_index].type == FONT) {
fontchange = specials[special_index].font_added; fontchange = specials[special_index].font_added;
selected_font = specials[special_index].font_added; selected_font = specials[special_index].font_added;
h = font_height(); h = font_height();
} }
#endif /* X11 */
special_index++; special_index++;
@ -2624,6 +2652,7 @@ static void text_size_updater(char *s)
} }
p++; p++;
} }
#ifdef X11
w += get_string_width(s); w += get_string_width(s);
if (w > text_width) if (w > text_width)
text_width = w; text_width = w;
@ -2632,8 +2661,10 @@ static void text_size_updater(char *s)
if (fontchange) { if (fontchange) {
selected_font = 0; selected_font = 0;
} }
#endif /* X11 */
} }
#ifdef X11
static void update_text_area() static void update_text_area()
{ {
int x, y; int x, y;
@ -2714,6 +2745,7 @@ static inline void set_foreground_color(long c)
current_color = c; current_color = c;
XSetForeground(display, window.gc, c); XSetForeground(display, window.gc, c);
} }
#endif /* X11 */
static void draw_string(const char *s) static void draw_string(const char *s)
{ {
@ -2730,7 +2762,9 @@ static void draw_string(const char *s)
added = 0; added = 0;
char space[2]; char space[2];
snprintf(space, 2, " "); snprintf(space, 2, " ");
#ifdef X11
max = ((text_width - width_of_s) / get_string_width(space)); max = ((text_width - width_of_s) / get_string_width(space));
#endif /* X11 */
/* /*
* This code looks for tabs in the text and coverts them to spaces. * This code looks for tabs in the text and coverts them to spaces.
* The trick is getting the correct number of spaces, * The trick is getting the correct number of spaces,
@ -2756,6 +2790,7 @@ static void draw_string(const char *s)
} }
} }
s = tmpstring2; s = tmpstring2;
#ifdef X11
#ifdef XFT #ifdef XFT
if (use_xft) { if (use_xft) {
XColor c; XColor c;
@ -2783,8 +2818,9 @@ static void draw_string(const char *s)
XDrawString(display, window.drawable, window.gc, XDrawString(display, window.drawable, window.gc,
cur_x, cur_y, s, strlen(s)); cur_x, cur_y, s, strlen(s));
} }
memcpy(tmpstring1, s, TEXT_BUFFER_SIZE);
cur_x += width_of_s; cur_x += width_of_s;
#endif /* X11 */
memcpy(tmpstring1, s, TEXT_BUFFER_SIZE);
} }
inline unsigned long do_gradient(unsigned long first_colour, unsigned long last_colour) { /* this function returns the next colour between two colours for a gradient */ inline unsigned long do_gradient(unsigned long first_colour, unsigned long last_colour) { /* this function returns the next colour between two colours for a gradient */
@ -2862,11 +2898,10 @@ inline unsigned long gradient_max(unsigned long first_colour, unsigned long last
return max; return max;
} }
static void draw_line(char *s) static void draw_line(char *s)
{ {
#ifdef X11
char *p; char *p;
cur_x = text_start_x; cur_x = text_start_x;
cur_y += font_ascent(); cur_y += font_ascent();
int cur_y_add = 0; int cur_y_add = 0;
@ -3133,6 +3168,10 @@ static void draw_line(char *s)
p++; p++;
} }
#else
draw_string(s);
#endif
#ifdef X11
if (cur_y_add > 0) { if (cur_y_add > 0) {
cur_y += cur_y_add; cur_y += cur_y_add;
cur_y -= font_descent(); cur_y -= font_descent();
@ -3144,10 +3183,12 @@ static void draw_line(char *s)
if (fontchange) { if (fontchange) {
selected_font = 0; selected_font = 0;
} }
#endif /* X11 */
} }
static void draw_text() static void draw_text()
{ {
#ifdef X11
cur_y = text_start_y; cur_y = text_start_y;
/* draw borders */ /* draw borders */
@ -3177,11 +3218,13 @@ static void draw_text()
/* draw text */ /* draw text */
special_index = 0; special_index = 0;
#endif /* X11 */
for_each_line(text_buffer, draw_line); for_each_line(text_buffer, draw_line);
} }
static void draw_stuff() static void draw_stuff()
{ {
#ifdef X11
if (draw_shades && !draw_outline) { if (draw_shades && !draw_outline) {
text_start_x++; text_start_x++;
text_start_y++; text_start_y++;
@ -3210,8 +3253,9 @@ static void draw_stuff()
set_foreground_color(default_fg_color); set_foreground_color(default_fg_color);
draw_mode = FG; draw_mode = FG;
#endif /* X11 */
draw_text(); draw_text();
#ifdef X11
#ifdef XDBE #ifdef XDBE
if (use_xdbe) { if (use_xdbe) {
XdbeSwapInfo swap; XdbeSwapInfo swap;
@ -3234,9 +3278,9 @@ if (metar_path != NULL) {
metar_path = NULL; metar_path = NULL;
} }
#endif*/ #endif*/
#endif /* X11 */
} }
#ifdef X11
static void clear_text(int exposures) static void clear_text(int exposures)
{ {
#ifdef XDBE #ifdef XDBE
@ -3251,6 +3295,7 @@ static void clear_text(int exposures)
text_height + border_margin * 2 + 2, text_height + border_margin * 2 + 2,
exposures ? True : 0); exposures ? True : 0);
} }
#endif /* X11 */
static int need_to_update; static int need_to_update;
@ -3258,16 +3303,22 @@ static int need_to_update;
static void update_text() static void update_text()
{ {
generate_text(); generate_text();
#ifdef X11
clear_text(1); clear_text(1);
#endif /* X11 */
need_to_update = 1; need_to_update = 1;
} }
static void main_loop() static void main_loop()
{ {
#ifdef X11
Region region = XCreateRegion(); Region region = XCreateRegion();
#endif /* X11 */
info.looped = 0; info.looped = 0;
while (total_run_times == 0 || info.looped < total_run_times - 1) { while (total_run_times == 0 || info.looped < total_run_times - 1) {
info.looped++; info.looped++;
#ifdef X11
XFlush(display); XFlush(display);
/* wait for X event or timeout */ /* wait for X event or timeout */
@ -3285,12 +3336,16 @@ static void main_loop()
tv.tv_sec = (long) t; tv.tv_sec = (long) t;
tv.tv_usec = (long) (t * 1000000) % 1000000; tv.tv_usec = (long) (t * 1000000) % 1000000;
FD_ZERO(&fdsr); FD_ZERO(&fdsr);
FD_SET(ConnectionNumber(display), &fdsr); FD_SET(ConnectionNumber(display), &fdsr);
s = select(ConnectionNumber(display) + 1, &fdsr, 0, s = select(ConnectionNumber(display) + 1, &fdsr, 0,
0, &tv); 0, &tv);
#else
usleep(update_interval*1000000); /* FIXME just sleep for the interval time if no X11 */
#endif /* X11 */
#ifdef X11
if (s == -1) { if (s == -1) {
if (errno != EINTR) if (errno != EINTR)
ERR("can't select(): %s", ERR("can't select(): %s",
@ -3298,7 +3353,9 @@ static void main_loop()
} else { } else {
/* timeout */ /* timeout */
if (s == 0) if (s == 0)
#endif /* X11 */
update_text(); update_text();
#ifdef X11
} }
} }
@ -3465,10 +3522,14 @@ static void main_loop()
if (use_xft) if (use_xft)
XftDrawSetClip(window.xftdraw, region); XftDrawSetClip(window.xftdraw, region);
#endif #endif
#endif /* X11 */
draw_stuff(); draw_stuff();
#ifdef X11
XDestroyRegion(region); XDestroyRegion(region);
region = XCreateRegion(); region = XCreateRegion();
} }
#endif /* X11 */
} }
} }
@ -3482,8 +3543,10 @@ static void reload_handler(int a)
if (current_config) { if (current_config) {
clear_fs_stats(); clear_fs_stats();
load_config_file(current_config); load_config_file(current_config);
#ifdef X11
load_fonts(); load_fonts();
set_font(); set_font();
#endif /* X11 */
extract_variable_text(text); extract_variable_text(text);
free(text); free(text);
text = NULL; text = NULL;
@ -3493,6 +3556,7 @@ static void reload_handler(int a)
static void clean_up() static void clean_up()
{ {
#ifdef X11
#ifdef XDBE #ifdef XDBE
if (use_xdbe) if (use_xdbe)
XdbeDeallocateBackBufferName(display, window.back_buffer); XdbeDeallocateBackBufferName(display, window.back_buffer);
@ -3508,6 +3572,8 @@ static void clean_up()
} }
XFreeGC(display, window.gc); XFreeGC(display, window.gc);
#endif /* X11 */
/* it is really pointless to free() memory at the end of program but ak|ra /* it is really pointless to free() memory at the end of program but ak|ra
* wants me to do this */ * wants me to do this */
@ -3543,7 +3609,7 @@ static int string_to_bool(const char *s)
return 1; return 1;
return 0; return 0;
} }
#ifdef X11
static enum alignment string_to_alignment(const char *s) static enum alignment string_to_alignment(const char *s)
{ {
if (strcasecmp(s, "top_left") == 0) if (strcasecmp(s, "top_left") == 0)
@ -3565,14 +3631,12 @@ static enum alignment string_to_alignment(const char *s)
return TOP_LEFT; return TOP_LEFT;
} }
#endif /* X11 */
static void set_default_configurations(void) static void set_default_configurations(void)
{ {
text_alignment = BOTTOM_LEFT;
on_bottom = 1;
fork_to_background = 0; fork_to_background = 0;
border_margin = 3;
border_width = 1;
total_run_times = 0; total_run_times = 0;
info.cpu_avg_samples = 2; info.cpu_avg_samples = 2;
info.net_avg_samples = 2; info.net_avg_samples = 2;
@ -3584,22 +3648,33 @@ static void set_default_configurations(void)
info.mpd.port = 6600; info.mpd.port = 6600;
info.mpd.status = "Checking status..."; info.mpd.status = "Checking status...";
#endif #endif
out_to_console = 0;
use_spacer = 0; use_spacer = 0;
#ifdef X11
out_to_console = 0;
#else
out_to_console = 1;
#endif
#ifdef X11
default_fg_color = WhitePixel(display, screen); default_fg_color = WhitePixel(display, screen);
default_bg_color = BlackPixel(display, screen); default_bg_color = BlackPixel(display, screen);
default_out_color = BlackPixel(display, screen); default_out_color = BlackPixel(display, screen);
draw_borders = 0; draw_borders = 0;
draw_shades = 1; draw_shades = 1;
draw_outline = 0; draw_outline = 0;
/*#ifdef XFT
use_xft = 1;
set_first_font("courier-12");
#endif
#else*/
set_first_font("6x10"); set_first_font("6x10");
gap_x = 5; gap_x = 5;
gap_y = 5; gap_y = 5;
minimum_width = 5;
minimum_height = 5;
#ifdef OWN_WINDOW
own_window = 0;
#endif
stippled_borders = 0;
border_margin = 3;
border_width = 1;
text_alignment = BOTTOM_LEFT;
on_bottom = 1;
#endif /* X11 */
free(current_mail_spool); free(current_mail_spool);
{ {
@ -3609,13 +3684,7 @@ static void set_default_configurations(void)
current_mail_spool = strdup(buf); current_mail_spool = strdup(buf);
} }
minimum_width = 5;
minimum_height = 5;
no_buffers = 1; no_buffers = 1;
#ifdef OWN_WINDOW
own_window = 0;
#endif
stippled_borders = 0;
update_interval = 10.0; update_interval = 10.0;
stuff_in_upper_case = 0; stuff_in_upper_case = 0;
#ifdef MLDONKEY #ifdef MLDONKEY
@ -3695,15 +3764,16 @@ static void load_config_file(const char *f)
else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0) else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
#ifdef X11
CONF2("alignment") { CONF2("alignment") {
if (value) { if (value) {
int a = string_to_alignment(value); int a = string_to_alignment(value);
if (a <= 0) if (a <= 0)
CONF_ERR; CONF_ERR;
else else
text_alignment = a; text_alignment = a;
} else } else
CONF_ERR; CONF_ERR;
} }
CONF("on_bottom") { CONF("on_bottom") {
if(value) if(value)
@ -3714,6 +3784,13 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
CONF("background") { CONF("background") {
fork_to_background = string_to_bool(value); fork_to_background = string_to_bool(value);
} }
#else
CONF2("background") {
fork_to_background = string_to_bool(value);
}
#endif /* X11 */
#ifdef X11
CONF("border_margin") { CONF("border_margin") {
if (value) if (value)
border_margin = strtol(value, 0, 0); border_margin = strtol(value, 0, 0);
@ -3744,6 +3821,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
else else
CONF_ERR; CONF_ERR;
} }
#endif /* X11 */
#ifdef MPD #ifdef MPD
CONF("mpd_host") { CONF("mpd_host") {
if (value) if (value)
@ -3792,14 +3870,16 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
CONF("override_utf8_locale") {
utf8_mode = string_to_bool(value);
}
#ifdef XDBE #ifdef XDBE
CONF("double_buffer") { CONF("double_buffer") {
use_xdbe = string_to_bool(value); use_xdbe = string_to_bool(value);
} }
#endif #endif
#ifdef X11
CONF("override_utf8_locale") {
utf8_mode = string_to_bool(value);
}
CONF("draw_borders") { CONF("draw_borders") {
draw_borders = string_to_bool(value); draw_borders = string_to_bool(value);
} }
@ -3809,12 +3889,14 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
CONF("draw_outline") { CONF("draw_outline") {
draw_outline = string_to_bool(value); draw_outline = string_to_bool(value);
} }
#endif /* X11 */
CONF("out_to_console") { CONF("out_to_console") {
out_to_console = string_to_bool(value); out_to_console = string_to_bool(value);
} }
CONF("use_spacer") { CONF("use_spacer") {
use_spacer = string_to_bool(value); use_spacer = string_to_bool(value);
} }
#ifdef X11
#ifdef XFT #ifdef XFT
CONF("use_xft") { CONF("use_xft") {
use_xft = string_to_bool(value); use_xft = string_to_bool(value);
@ -3865,6 +3947,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
else else
CONF_ERR; CONF_ERR;
} }
#endif /* X11 */
CONF("mail_spool") { CONF("mail_spool") {
if (value) { if (value) {
char buf[256]; char buf[256];
@ -3879,6 +3962,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
} else } else
CONF_ERR; CONF_ERR;
} }
#ifdef X11
CONF("minimum_size") { CONF("minimum_size") {
if (value) { if (value) {
if (sscanf if (sscanf
@ -3891,6 +3975,7 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
} else } else
CONF_ERR; CONF_ERR;
} }
#endif /* X11 */
CONF("no_buffers") { CONF("no_buffers") {
no_buffers = string_to_bool(value); no_buffers = string_to_bool(value);
} }
@ -3932,20 +4017,22 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
CONF_ERR; CONF_ERR;
} }
#endif #endif
CONF("pad_percents") {
pad_percents = atoi(value);
}
#ifdef X11
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
CONF("own_window") { CONF("own_window") {
own_window = string_to_bool(value); own_window = string_to_bool(value);
} }
#endif #endif
CONF("pad_percents") {
pad_percents = atoi(value);
}
CONF("stippled_borders") { CONF("stippled_borders") {
if (value) if (value)
stippled_borders = strtol(value, 0, 0); stippled_borders = strtol(value, 0, 0);
else else
stippled_borders = 4; stippled_borders = 4;
} }
#endif /* X11 */
CONF("temp1") { CONF("temp1") {
ERR("temp1 configuration is obsolete, use ${i2c <i2c device here> temp 1}"); ERR("temp1 configuration is obsolete, use ${i2c <i2c device here> temp 1}");
} }
@ -4034,22 +4121,23 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, a) == 0)
} }
/* : means that character before that takes an argument */ /* : means that character before that takes an argument */
static static const char *getopt_string = "vVdt:f:u:i:hc:w:x:y:a:"
const #ifdef X11
char "x:y:w:a:f:"
*getopt_string = "vVdt:f:u:i:hc:w:x:y:a:"
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
"o" "o"
#endif #endif
#ifdef XDBE #ifdef XDBE
"b" "b"
#endif #endif
#endif /* X11 */
; ;
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* handle command line parameters that don't change configs */ /* handle command line parameters that don't change configs */
#ifdef X11
char *s; char *s;
char temp[10]; char temp[10];
unsigned int x; unsigned int x;
@ -4068,6 +4156,7 @@ int main(int argc, char **argv)
ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL."); ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL.");
return 1; return 1;
} }
#endif /* X11 */
while (1) { while (1) {
int c = getopt(argc, int c = getopt(argc,
argv, argv,
@ -4092,42 +4181,47 @@ int main(int argc, char **argv)
case 'h': case 'h':
printf printf
("Usage: %s [OPTION]...\n" ("Usage: %s [OPTION]...\n"
"Conky is a system monitor that renders text on desktop or to own transparent\n" "Conky is a system monitor that renders text on desktop or to own transparent\n"
"window. Command line options will override configurations defined in config\n" "window. Command line options will override configurations defined in config\n"
"file.\n" "file.\n"
" -V version\n" " -V version\n"
" -a ALIGNMENT text alignment on screen, {top,bottom}_{left,right}\n" " -c FILE config file to load instead of "
" -c FILE config file to load instead of " CONFIG_FILE
CONFIG_FILE "\n"
"\n" " -d daemonize, fork to background\n"
" -d daemonize, fork to background\n" " -h help\n"
" -f FONT font to use\n" #ifdef X11
" -h help\n" " -a ALIGNMENT text alignment on screen, {top,bottom}_{left,right}\n"
" -f FONT font to use\n"
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
" -o create own window to draw\n" " -o create own window to draw\n"
#endif #endif
#ifdef XDBE #ifdef XDBE
" -b double buffer (prevents flickering)\n" " -b double buffer (prevents flickering)\n"
#endif #endif
" -t TEXT text to render, remember single quotes, like -t '$uptime'\n" " -w WIN_ID window id to draw\n"
" -u SECS update interval\n" " -x X x position\n"
" -i NUM number of times to update Conky\n" " -y Y y position\n"
" -w WIN_ID window id to draw\n" #endif /* X11 */
" -x X x position\n" " -t TEXT text to render, remember single quotes, like -t '$uptime'\n"
" -y Y y position\n", argv[0]); " -u SECS update interval\n"
" -i NUM number of times to update Conky\n", argv[0]);
return 0; return 0;
#ifdef X11
case 'w': case 'w':
window.window = strtol(optarg, 0, 0); window.window = strtol(optarg, 0, 0);
break; break;
#endif /* X11 */
case '?': case '?':
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
#ifdef X11
/* initalize X BEFORE we load config. (we need to so that 'screen' is set) */ /* initalize X BEFORE we load config. (we need to so that 'screen' is set) */
init_X11(); init_X11();
#endif /* X11 */
tmpstring1 = (char *) tmpstring1 = (char *)
malloc(TEXT_BUFFER_SIZE); malloc(TEXT_BUFFER_SIZE);
@ -4175,17 +4269,17 @@ int main(int argc, char **argv)
break; break;
switch (c) { switch (c) {
case 'a':
text_alignment = string_to_alignment(optarg);
break;
case 'd': case 'd':
fork_to_background = 1; fork_to_background = 1;
break; break;
case 'f': #ifdef X11
case 'f':
set_first_font(optarg); set_first_font(optarg);
break; break;
case 'a':
text_alignment = string_to_alignment(optarg);
break;
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
case 'o': case 'o':
@ -4197,7 +4291,7 @@ int main(int argc, char **argv)
use_xdbe = 1; use_xdbe = 1;
break; break;
#endif #endif
#endif /* X11 */
case 't': case 't':
if (text != original_text) if (text != original_text)
free(text); free(text);
@ -4212,7 +4306,7 @@ int main(int argc, char **argv)
case 'i': case 'i':
total_run_times = strtod(optarg, 0); total_run_times = strtod(optarg, 0);
break; break;
#ifdef X11
case 'x': case 'x':
gap_x = atoi(optarg); gap_x = atoi(optarg);
break; break;
@ -4220,14 +4314,17 @@ int main(int argc, char **argv)
case 'y': case 'y':
gap_y = atoi(optarg); gap_y = atoi(optarg);
break; break;
#endif /* X11 */
case '?': case '?':
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
#ifdef X11
/* load font */ /* load font */
load_fonts(); load_fonts();
#endif /* X11 */
/* generate text and get initial size */ /* generate text and get initial size */
extract_variable_text(text); extract_variable_text(text);
@ -4239,6 +4336,7 @@ int main(int argc, char **argv)
update_uname(); update_uname();
generate_text(); generate_text();
#ifdef X11
update_text_area(); /* to get initial size of the window */ update_text_area(); /* to get initial size of the window */
init_window init_window
@ -4247,12 +4345,14 @@ int main(int argc, char **argv)
+ border_margin * 2 + 1, text_height + border_margin * 2 + 1, on_bottom); + border_margin * 2 + 1, text_height + border_margin * 2 + 1, on_bottom);
update_text_area(); /* to position text/window on screen */ update_text_area(); /* to position text/window on screen */
#endif /* X11 */
#ifdef CAIRO /*#ifdef CAIRO
// why the fuck not? // why the fuck not?
//do_it(); //do_it();
#endif #endif*/
#ifdef X11
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
if (own_window) if (own_window)
XMoveWindow(display, window.window, window.x, window.y); XMoveWindow(display, window.window, window.x, window.y);
@ -4261,8 +4361,8 @@ int main(int argc, char **argv)
create_gc(); create_gc();
set_font(); set_font();
draw_stuff(); draw_stuff();
#endif /* X11 */
/* fork */ /* fork */
if (fork_to_background) { if (fork_to_background) {

24
conky.h
View File

@ -9,6 +9,7 @@
#ifndef _conky_h_ #ifndef _conky_h_
#define _conky_h_ #define _conky_h_
//#include <mcheck.h> //#include <mcheck.h>
#include "config.h" #include "config.h"
#include <sys/utsname.h> #include <sys/utsname.h>
@ -18,6 +19,7 @@
#include <langinfo.h> #include <langinfo.h>
#include <wchar.h> #include <wchar.h>
#ifdef X11
#if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO) #if defined(HAVE_CAIRO_H) && defined(HAVE_CAIRO_XLIB_H) && defined(WANT_CAIRO)
#define CAIRO #define CAIRO
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -25,6 +27,7 @@
#include <cairo.h> #include <cairo.h>
#include <cairo-xlib.h> #include <cairo-xlib.h>
#endif #endif
#endif /* X11 */
#define TOP_CPU 1 #define TOP_CPU 1
#define TOP_NAME 2 #define TOP_NAME 2
@ -160,7 +163,17 @@ struct information {
unsigned long looped; unsigned long looped;
}; };
int out_to_console;
int top_cpu;
int top_mem;
int use_spacer;
char *tmpstring1;
char *tmpstring2;
#ifdef X11
/* in x11.c */ /* in x11.c */
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -201,15 +214,6 @@ struct conky_window {
extern int use_xdbe; extern int use_xdbe;
#endif #endif
int out_to_console;
int top_cpu;
int top_mem;
int use_spacer;
char *tmpstring1;
char *tmpstring2;
#ifdef XFT #ifdef XFT
extern int use_xft; extern int use_xft;
@ -230,6 +234,8 @@ void create_gc();
void set_transparent_background(Window win); void set_transparent_background(Window win);
long get_x11_color(const char *); long get_x11_color(const char *);
#endif /* X11 */
/* in common.c */ /* in common.c */
/* struct that has all info */ /* struct that has all info */

View File

@ -167,17 +167,11 @@ void update_metar()
if (!status) { if (!status) {
status = 2; status = 2;
iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL); iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL);
<<<<<<< metarinfo.c
} else if (status == 2) { /* thread is still running. what else can we do? */
return;
} else { /* status must be 1 */
=======
} else if (status == 2) { /* thread is still running. let's kill it and start again */ } else if (status == 2) { /* thread is still running. let's kill it and start again */
pthread_cancel(thread1); pthread_cancel(thread1);
status = 2; status = 2;
iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL); iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL);
} else { /* status must be 1 */ } else { /* status must be 1 */
>>>>>>> 1.9
pthread_join(thread1, NULL); pthread_join(thread1, NULL);
status = 2; status = 2;
iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL); iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL);