1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-23 19:39:06 +00:00

- Fix build on FreeBSD by moving volage stuff under #ifdef __linux__

and adjusting get_freq() prototype
- Fix Xdamage detection, make it not mandatory


git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@678 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Roman Bogorodskiy 2006-08-01 21:24:15 +00:00
parent 16e8431a25
commit fe7ec00729
3 changed files with 26 additions and 9 deletions

View File

@ -386,8 +386,6 @@ else
fi
dnl
dnl X
dnl
@ -397,6 +395,11 @@ AC_ARG_ENABLE(double_buffer,
[ --enable-double-buffer enable if you want to support flicker-free operation [[default=yes]]],
[dah="$enableval"])
want_xdamage=yes
AC_ARG_ENABLE(xdamage,
[ --enable-xdamage enable if you want Xdamage support [[default=yes]]],
[want_xdamage="$enableval"])
want_x11=yes
AC_ARG_ENABLE(x11,
[ --enable-x11 enable if you want X11 support [[default=yes]]],
@ -415,12 +418,18 @@ if test "x$want_x11" = "xyes"; then
AC_DEFINE(X11, 1, [Define if you want to use X11])
AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
AM_CONDITIONAL(BUILD_X11, true)
AC_CHECK_LIB(Xdamage, XDamageQueryExtension, [AC_DEFINE([HAVE_XDAMAGE], 1, [Xdamage]) LIBS="$LIBS -lXdamage"], [AC_MSG_ERROR([something went wrong when checking for Xdamage])])
if test $dah != "no"; then
if test "x$dah" != xno; then
AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
AC_CHECK_LIB(Xext, XdbeQueryExtension, [AC_DEFINE([HAVE_XDBE], 1, [Xdbe]) LIBS="$LIBS -lXext"],
[AC_MSG_ERROR([something went wrong when checking for Xdbe (double buffer extension)])])
fi
if test "x$want_xdamage" = "xyes"; then
AC_DEFINE(XDAMAGE, 1, [Define if you want support for the Xdamage extension])
AC_CHECK_LIB(Xdamage, XDamageQueryExtension,
[AC_DEFINE([HAVE_XDAMAGE], 1, [Xdamage]) LIBS="$LIBS -lXdamage"],
[AC_MSG_ERROR([something went wrong when checking for Xdamage])])
fi
else
AM_CONDITIONAL(BUILD_X11, false)
fi

View File

@ -3207,16 +3207,18 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
obj->a = get_freq(p, p_max_size, "%'.2f", 1000, obj->data.cpu_index); /* pk */
}
}
#if defined(__linux__)
OBJ(voltage_mv) {
if (obj->a) {
obj->a = get_voltage(p, p_max_size, "%.0f", 1, obj->data.cpu_index); /* ptarjan */
obj->a = get_voltage(p, p_max_size, "%.0f", 1, obj->data.cpu_index);
}
}
OBJ(voltage_v) {
if (obj->a) {
obj->a = get_voltage(p, p_max_size, "%'.3f", 1000, obj->data.cpu_index); /* ptarjan */
obj->a = get_voltage(p, p_max_size, "%'.3f", 1000, obj->data.cpu_index);
}
}
#endif /* __linux__ */
OBJ(freq_dyn) {
if (use_spacer) {
@ -5594,12 +5596,14 @@ static void main_loop()
#ifdef X11
Region region = XCreateRegion();
int event_base, error_base;
#ifdef HAVE_XDAMAGE
if (!XDamageQueryExtension (display, &event_base, &error_base)) {
ERR("Xdamage extension unavailable");
}
Damage damage = XDamageCreate(display, window.window, XDamageReportNonEmpty);
XserverRegion region2 = XFixesCreateRegionFromWindow(display, window.window, 0);
XserverRegion part = XFixesCreateRegionFromWindow(display, window.window, 0);
#endif /* HAVE_XDAMAGE */
#endif /* X11 */
info.looped = 0;
@ -5813,6 +5817,7 @@ static void main_loop()
#endif
default:
#ifdef HAVE_XDAMAGE
if (ev.type == event_base + XDamageNotify) {
XDamageNotifyEvent *dev = (XDamageNotifyEvent *) &ev;
XFixesSetRegion(display, part, &dev->area, 1);
@ -5820,6 +5825,7 @@ static void main_loop()
XDamageSubtract(display, damage, region2, None);
XFixesSetRegion(display, region2, 0, 0);
}
#endif /* HAVE_XDAMAGE */
break;
}
}
@ -5895,13 +5901,13 @@ static void main_loop()
g_signal_pending=0;
}
#ifdef X11
#if defined(X11) && defined(HAVE_XDAMAGE)
XDamageDestroy(display, damage);
XFixesDestroyRegion(display, region2);
XFixesDestroyRegion(display, part);
XDestroyRegion(region);
region = NULL;
#endif /* X11 */
#endif /* X11 && HAVE_XDAMAGE */
}
static void load_config_file(const char *);

View File

@ -495,7 +495,8 @@ get_freq_dynamic(char *p_client_buffer, size_t client_buffer_size,
#endif
}
void
/*void*/
char
get_freq(char *p_client_buffer, size_t client_buffer_size,
char *p_format, int divisor, unsigned int cpu)
{
@ -519,6 +520,7 @@ get_freq(char *p_client_buffer, size_t client_buffer_size,
snprintf(p_client_buffer, client_buffer_size, p_format, 0.0f);
free(freq_sysctl);
return 1;
}
void