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

specials: convert stippled_hr object to new style

This commit is contained in:
Phil Sutter 2009-10-29 03:22:58 +01:00
parent 3458db80aa
commit 041059f1c2
4 changed files with 36 additions and 17 deletions

View File

@ -1606,7 +1606,7 @@ void generate_text_internal(char *p, int p_max_size,
new_bg(p, obj->data.l);
}
OBJ(stippled_hr) {
new_stippled_hr(p, obj->data.pair.a, obj->data.pair.b);
new_stippled_hr(obj, p);
}
#endif /* X11 */
OBJ(swap) {

View File

@ -669,18 +669,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
#endif /* X11 */
END OBJ(stippled_hr, 0)
#ifdef X11
int a = get_stippled_borders(), b = 1;
if (arg) {
if (sscanf(arg, "%d %d", &a, &b) != 2) {
sscanf(arg, "%d", &b);
}
}
if (a <= 0) {
a = 1;
}
obj->data.pair.a = a;
obj->data.pair.b = b;
scan_stippled_hr(obj, arg);
#endif /* X11 */
END OBJ(swap, &update_meminfo)
END OBJ(swapfree, &update_meminfo)

View File

@ -70,6 +70,10 @@ struct graph {
char tempgrad;
};
struct stippled_hr {
int height, arg;
};
struct tab {
int width, arg;
};
@ -387,17 +391,42 @@ void new_hr(char *buf, int a)
new_special(buf, HORIZONTAL_LINE)->height = a;
}
void new_stippled_hr(char *buf, int a, int b)
void scan_stippled_hr(struct text_object *obj, const char *arg)
{
struct stippled_hr *sh;
sh = malloc(sizeof(struct stippled_hr));
memset(sh, 0, sizeof(struct stippled_hr));
sh->arg = get_stippled_borders();
sh->height = 1;
if (arg) {
if (sscanf(arg, "%d %d", &sh->arg, &sh->height) != 2) {
sscanf(arg, "%d", &sh->height);
}
}
if (sh->arg <= 0) {
sh->arg = 1;
}
obj->special_data = sh;
}
void new_stippled_hr(struct text_object *obj, char *buf)
{
struct special_t *s = 0;
struct stippled_hr *sh = obj->special_data;
if ((output_methods & TO_X) == 0)
return;
if (!sh)
return;
s = new_special(buf, STIPPLED_HR);
s->height = b;
s->arg = a;
s->height = sh->height;
s->arg = sh->arg;
}
#endif /* X11 */

View File

@ -105,6 +105,7 @@ const char *scan_gauge(struct text_object *, const char *);
char *scan_font(const char *);
char *scan_graph(struct text_object *, const char *);
void scan_tab(struct text_object *, const char *);
void scan_stippled_hr(struct text_object *, const char*);
/* printing specials */
void new_gauge(struct text_object *, char *, int);
@ -112,7 +113,7 @@ void new_bar(struct text_object *, char *, int);
void new_font(char *, char *);
void new_graph(struct text_object *, char *, double);
void new_hr(char *, int);
void new_stippled_hr(char *, int, int);
void new_stippled_hr(struct text_object *, char *);
#endif
void new_bar_in_shell(struct text_object *, char *, int, double);
void new_fg(char *, long);