<kdevautoproject>
<general>
<activetarget>conky</activetarget>
- <useconfiguration>debug</useconfiguration>
+ <useconfiguration>debug-no-x</useconfiguration>
</general>
<run>
<mainprogram>conky</mainprogram>
</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>
+ <configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --disable-x11 --without-x</configargs>
<builddir>debug-no-x</builddir>
- <topsourcedir/>
- <cppflags/>
- <ldflags/>
+ <topsourcedir></topsourcedir>
+ <cppflags></cppflags>
+ <ldflags></ldflags>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
- <ccompilerbinary/>
- <cxxcompilerbinary/>
- <f77compilerbinary/>
+ <ccompilerbinary></ccompilerbinary>
+ <cxxcompilerbinary></cxxcompilerbinary>
+ <f77compilerbinary></f77compilerbinary>
<cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -ggdb</cflags>
- <cxxflags/>
- <f77flags/>
+ <cxxflags></cxxflags>
+ <f77flags></f77flags>
</debug-no-x>
</configurations>
<make>
#include <unistd.h>
#include <string.h>
#include <errno.h>
+#include <pthread.h>
#include <string.h>
#include <limits.h>
#if HAVE_DIRENT_H
OBJ_endif,
OBJ_exec,
OBJ_execi,
+ OBJ_texeci,
OBJ_execbar,
OBJ_execgraph,
OBJ_execibar,
static unsigned int text_object_count;
static struct text_object *text_objects;
+pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
+
+void *threaded_exec( struct text_object *obj ) {
+ char *p2 = obj->data.execi.buffer;
+ FILE *fp = popen(obj->data.execi.cmd,"r");
+ pthread_mutex_lock( &mutex1 );
+ int n2 = fread(p2, 1, TEXT_BUFFER_SIZE, fp);
+ (void) pclose(fp);
+ p2[n2] = '\0';
+ if (n2 && p2[n2 - 1] == '\n')
+ p2[n2 - 1] = '\0';
+
+ while (*p2) {
+ if (*p2 == '\001')
+ *p2 = ' ';
+ p2++;
+ }
+ pthread_mutex_unlock( &mutex1 );
+ return NULL;
+}
+
/* new_text_object() allocates a new zeroed text_object */
static struct text_object *new_text_object()
{
free(text_objects[i].data.execi.cmd);
free(text_objects[i].data.execi.buffer);
break;
+ case OBJ_texeci:
+ free(text_objects[i].data.execi.cmd);
+ free(text_objects[i].data.execi.buffer);
+ break;
}
}
obj->data.execi.buffer =
(char *) calloc(1, TEXT_BUFFER_SIZE);
}
+ END OBJ(texeci, 0) unsigned int n;
+
+ if (!arg
+ || sscanf(arg, "%f %n", &obj->data.execi.interval, &n) <= 0) {
+ char buf[256];
+ ERR("${texeci <interval> command}");
+ obj->type = OBJ_text;
+ snprintf(buf, 256, "${%s}", s);
+ obj->data.s = strdup(buf);
+ } else {
+ obj->data.execi.cmd = strdup(arg + n);
+ obj->data.execi.buffer =
+ (char *) calloc(1, TEXT_BUFFER_SIZE);
+ }
END OBJ(pre_exec, 0) obj->type = OBJ_text;
if (arg) {
FILE *fp = popen(arg, "r");
current_update_time;
}
}
+ OBJ(texeci) {
+ static int running = 0;
+ if (current_update_time - obj->data.execi.last_update < obj->data.execi.interval) {
+ snprintf(p, n, "%s", obj->data.execi.buffer);
+ } else {
+ static pthread_t execthread;
+ if (!running) {
+ running = 1;
+ pthread_create( &execthread, NULL, (void*)threaded_exec, (void*) obj);
+ pthread_mutex_lock( &mutex1 );
+ obj->data.execi.last_update = current_update_time;
+ pthread_mutex_unlock( &mutex1 );
+ } else {
+ pthread_join( execthread, NULL);
+ running = 0;
+ }
+ snprintf(p, n, "%s", obj->data.execi.buffer);
+ }
+ }
#endif
OBJ(fs_bar) {
if (obj->data.fs != NULL) {
{
#ifdef XFT
if (use_xft) {
- if (window.xftdraw != NULL)
+ if (window.xftdraw != NULL) {
XftDrawDestroy(window.xftdraw);
+ }
window.xftdraw = XftDrawCreate(display, window.drawable,
DefaultVisual(display,
screen),
}
}
}
+#ifdef X11
if (text_width == maximum_width) {
/* this means the text is probably pushing the limit, so we'll chop it */
while (cur_x + get_string_width(tmpstring2) - text_start_x > maximum_width && strlen(tmpstring2) > 0) {
tmpstring2[strlen(tmpstring2)-1] = '\0';
}
}
+#endif /* X11 */
s = tmpstring2;
#ifdef X11
#ifdef XFT
selected_font = specials[special_index].font_added;
cur_y += font_ascent();
#ifdef XFT
- if (!use_xft)
+ if (!use_xft || use_xdbe)
#endif
{
set_font();
static void clear_text(int exposures)
{
#ifdef XDBE
- if (use_xdbe)
+ if (use_xdbe) {
return; /* The swap action is XdbeBackground, which clears */
+ }
#endif
/* there is some extra space for borders and outlines */
XClearArea(display, window.drawable,
}
#ifdef OWN_WINDOW
if (own_window) {
- set_transparent_background(window.window);
+ set_transparent_background(window.window);
}
#endif
}
break;
#ifdef OWN_WINDOW
- /*case ReparentNotify:
- set background to ParentRelative for all parents
+ case ReparentNotify:
+ /* set background to ParentRelative for all parents */
if (own_window) {
set_transparent_background(window.
window);
}
- break;*/
+ break;
case ConfigureNotify:
if (own_window) {
r.width = text_width + border_margin * 2;
r.height = text_height + border_margin * 2;
XUnionRectWithRegion(&r, region, region);
- }
+ }
#endif
XSetRegion(display, window.gc, region);
#ifdef XFT
- if (use_xft)
+ if (use_xft) {
XftDrawSetClip(window.xftdraw, region);
+ }
#endif
#endif /* X11 */
draw_stuff();
XDestroyRegion(region);
region = XCreateRegion();
}
-
-
#endif /* X11 */
}
-#ifdef X11
- XDestroyRegion(region);
-#endif /* X11 */
}
static void load_config_file(const char *);
{
#ifdef X11
#ifdef XDBE
- if (use_xdbe)
+ if (use_xdbe) {
XdbeDeallocateBackBufferName(display, window.back_buffer);
+ }
#endif
#ifdef OWN_WINDOW
if (own_window)