1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 11:05:18 +00:00

added infopipe_bar preliminary

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@468 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2006-01-06 00:02:59 +00:00
parent 387494b56d
commit 287b66d293
2 changed files with 10 additions and 5 deletions

View File

@ -915,6 +915,7 @@ enum text_object_type {
OBJ_infopipe_channels, OBJ_infopipe_channels,
OBJ_infopipe_title, OBJ_infopipe_title,
OBJ_infopipe_file, OBJ_infopipe_file,
OBJ_infopipe_bar,
#endif #endif
#ifdef TCP_PORT_MONITOR #ifdef TCP_PORT_MONITOR
OBJ_tcp_portmon, OBJ_tcp_portmon,
@ -1839,6 +1840,7 @@ int a = stippled_borders, b = 1;
OBJ(infopipe_channels, INFO_INFOPIPE) END OBJ(infopipe_channels, INFO_INFOPIPE) END
OBJ(infopipe_title, INFO_INFOPIPE) END OBJ(infopipe_title, INFO_INFOPIPE) END
OBJ(infopipe_file, INFO_INFOPIPE) END OBJ(infopipe_file, INFO_INFOPIPE) END
OBJ(infopipe_bar, INFO_INFOPIPE) END
#endif #endif
#ifdef TCP_PORT_MONITOR #ifdef TCP_PORT_MONITOR
OBJ(tcp_portmon, INFO_TCP_PORT_MONITOR) OBJ(tcp_portmon, INFO_TCP_PORT_MONITOR)
@ -3158,6 +3160,12 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
OBJ(infopipe_file) { OBJ(infopipe_file) {
snprintf(p, p_max_size, "%s", cur->infopipe.items[INFOPIPE_FILE]); snprintf(p, p_max_size, "%s", cur->infopipe.items[INFOPIPE_FILE]);
} }
OBJ(infopipe_bar) {
double progress;
progress= atof(cur->infopipe.items[INFOPIPE_USEC_POSITION]) /
atof(cur->infopipe.items[INFOPIPE_USEC_TIME]);
new_bar(p,obj->a,obj->b,(int)(progress*255.0f));
}
#endif #endif
OBJ(top) { OBJ(top) {
if (obj->data.top.type == TOP_NAME if (obj->data.top.type == TOP_NAME

View File

@ -69,7 +69,7 @@ void *infopipe_thread_func(void *pvoid)
pvoid=(void*)pvoid; /* useless cast to avoid unused var warning */ pvoid=(void*)pvoid; /* useless cast to avoid unused var warning */
/* I/O multiplexing timer */ /* I/O multiplexing timer */
tm.tv_sec=10; /* high enough to reduce persistent select() failures */ tm.tv_sec=30; /* high enough to reduce persistent select() failures */
tm.tv_usec=0; tm.tv_usec=0;
/* Grab the runnable signal. Should be non-zero here or we do nothing. */ /* Grab the runnable signal. Should be non-zero here or we do nothing. */
@ -96,7 +96,7 @@ void *infopipe_thread_func(void *pvoid)
ideally suited for a worker thread such as this. We don't want ideally suited for a worker thread such as this. We don't want
to slow down ui updates in the main thread as there is already to slow down ui updates in the main thread as there is already
excess latency there. */ excess latency there. */
if ((i=select(fd+1,&readset,NULL,NULL,&tm)) == 1) { /* something to read */ if (select(fd+1,&readset,NULL,NULL,&tm) == 1) { /* something to read */
if (read(fd,buf,sizeof(buf)) > 0) { /* buf has data */ if (read(fd,buf,sizeof(buf)) > 0) { /* buf has data */
@ -113,9 +113,6 @@ void *infopipe_thread_func(void *pvoid)
*/ */
} }
} }
else {
printf("select() says nothing to read: %d, fd %d\n",i,fd);
}
if (close(fd) < 0) { if (close(fd) < 0) {
break; break;