1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-29 13:39:10 +00:00
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@97 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-08-11 05:21:56 +00:00
parent 367ce3db00
commit 315d65a565
2 changed files with 13 additions and 8 deletions

View File

@ -53,7 +53,7 @@
<ccompiler>kdevgccoptions</ccompiler> <ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler> <cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler> <f77compiler>kdevpgf77options</f77compiler>
<cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3 -CB</cflags> <cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3</cflags>
<envvars/> <envvars/>
<topsourcedir></topsourcedir> <topsourcedir></topsourcedir>
<cppflags></cppflags> <cppflags></cppflags>

19
conky.c
View File

@ -372,7 +372,9 @@ static struct special_t {
} specials[128]; } specials[128];
static int special_count; static int special_count;
#ifdef X11
static int special_index; /* used when drawing */ static int special_index; /* used when drawing */
#endif /* X11 */
#define MAX_GRAPH_DEPTH 256 /* why 256? who knows. */ #define MAX_GRAPH_DEPTH 256 /* why 256? who knows. */
@ -450,6 +452,7 @@ 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) {
@ -461,9 +464,9 @@ static char *scan_font(const char *args)
return NULL; return NULL;
} }
#ifdef X11
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);
@ -471,8 +474,8 @@ static void new_font(char *buf, char * args) {
set_font(); set_font();
selected_font = tmp; selected_font = tmp;
} }
#endif /* X11 */
} }
#endif
inline void graph_append(struct special_t *graph, double f) inline void graph_append(struct special_t *graph, double f)
{ {
@ -1603,9 +1606,11 @@ static void generate_text()
OBJ(color) { OBJ(color) {
new_fg(p, obj->data.l); new_fg(p, obj->data.l);
} }
#ifdef X11
OBJ(font) { OBJ(font) {
new_font(p, obj->data.s); new_font(p, obj->data.s);
} }
#endif /* X11 */
OBJ(downspeed) { OBJ(downspeed) {
if (!use_spacer) { if (!use_spacer) {
snprintf(p, n, "%d", snprintf(p, n, "%d",
@ -2612,6 +2617,7 @@ static inline int get_string_width(const char *s)
int fontchange = 0; int fontchange = 0;
#ifdef X11
static void text_size_updater(char *s) static void text_size_updater(char *s)
{ {
int w = 0; int w = 0;
@ -2637,13 +2643,11 @@ 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++;
@ -2651,7 +2655,6 @@ 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;
@ -2660,8 +2663,9 @@ static void text_size_updater(char *s)
if (fontchange) { if (fontchange) {
selected_font = 0; selected_font = 0;
} }
#endif /* X11 */
} }
#endif /* X11 */
#ifdef X11 #ifdef X11
static void update_text_area() static void update_text_area()
@ -2751,7 +2755,8 @@ static void draw_string(const char *s)
if (s[0] == '\0') if (s[0] == '\0')
return; return;
int i, i2, pos, width_of_s; int i, i2, pos, width_of_s;
int max, added; int max=0;
int added;
width_of_s = get_string_width(s); width_of_s = get_string_width(s);
if (out_to_console) { if (out_to_console) {
printf("%s\n", s); printf("%s\n", s);