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

spock's hddtemp & goto patches

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@679 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2006-08-10 16:56:13 +00:00
parent fe7ec00729
commit ca79c81374
8 changed files with 615 additions and 422 deletions

View File

@ -126,6 +126,9 @@ Lucas Brutschy <lbrutschy at users dot sourceforge dot net>
MLDonkey patch
if constructs patch
Michal Januszewski <spock at gentoo dot org>
hddtemp support
Moncelier Camille <pixdamix at users dot sourceforge dot net>
METAR patch

206
README
View File

@ -17,8 +17,8 @@ DESCRIPTION
as well as the ability to execute programs and scripts, then display
the output from stdout.
We are always looking for help, and anyone interested in becoming a
developer is welcome. Please use the facilities at SourceForge to make
We are always looking for help, and anyone interested in becoming a de-
veloper is welcome. Please use the facilities at SourceForge to make
bug reports, feature requests, and submit patches.
Thanks for your interest in Conky.
@ -41,12 +41,12 @@ COMPILING
sh autogen.sh # Only required if building from Svn
./configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
--localstatedir=/var/lib --enable-xft --enable-seti --enable-dou-
ble-buffer --enable-own-window --enable-proc-uptime --enable-mpd
--enable-mldonkey --enable-x11 --enable-portmon --enable-xmms
--enable-bmp --enable-audacious --enable-infopipe --enable-bmpx
./configure --prefix=/usr --mandir=/usr/share/man --in-
fodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --local-
statedir=/var/lib --enable-xft --enable-seti --enable-double-buffer
--enable-own-window --enable-proc-uptime --enable-mpd --enable-mldonkey
--enable-x11 --enable-portmon --enable-xmms --enable-bmp --enable-auda-
cious --enable-infopipe --enable-bmpx
make
@ -135,9 +135,9 @@ OPTIONS
CONFIGURATION SETTINGS
Default configuration file is $HOME/.conkyrc (can be changed from
conky.c among other things). See conkyrc.sample. If installing from
Debian package, this should be in /usr/share/doc/conky/examples ("gun-
zip conkyrc.sample.gz" to get conkyrc.sample).
conky.c among other things). See conkyrc.sample. If installing from De-
bian package, this should be in /usr/share/doc/conky/examples ("gunzip
conkyrc.sample.gz" to get conkyrc.sample).
You might want to copy it to $HOME/.conkyrc and then start modifying
it. Other configs can be found at http://conky.sf.net
@ -216,8 +216,8 @@ CONFIGURATION SETTINGS
imap Default global IMAP server. Arguments are: "host user pass [-i
interval] [-f folder] [-p port] [-e command]". Default port is
143, default folder is 'INBOX', default interval is 5 minutes.
If the password is supplied as '*', you will be prompted to
enter the password when Conky starts.
If the password is supplied as '*', you will be prompted to en-
ter the password when Conky starts.
no_buffers
@ -378,10 +378,10 @@ CONFIGURATION SETTINGS
VARIABLES
Colors are parsed using XParsecolor(), there might be a list of them:
/usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html
[http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for-
mat (hex). Note that when displaying bytes, power is 1024 and not 1000
so 1M really means 1024*1024 bytes and not 1000*1000.
/usr/X11R6/lib/X11/rgb.txt. Also, <http://sedition.com/perl/rgb.html>.
Color can be also in #rrggbb format (hex). Note that when displaying
bytes, power is 1024 and not 1000 so 1M really means 1024*1024 bytes
and not 1000*1000.
addr interface
IP address for an interface
@ -522,9 +522,9 @@ VARIABLES
execbar command
Same as exec, except if the first value return is a value
between 0-100, it will use that number for a bar. The size for
the bar is currently fixed, but that may change in the future.
Same as exec, except if the first value return is a value be-
tween 0-100, it will use that number for a bar. The size for the
bar is currently fixed, but that may change in the future.
execgraph command
@ -594,6 +594,15 @@ VARIABLES
File system used space
goto x The next element will be printed at position 'x'.
hddtemp dev, (host,(port))
Displays temperature of a selected hard disk drive as reported
by the hddtemp daemon running on host:port. Default host is
127.0.0.1, default port is 7634.
head logfile lines (interval)
Displays first N lines of supplied text text file. If interval
is not supplied, Conky assumes 2x Conky's interval. Max of 30
@ -658,8 +667,8 @@ VARIABLES
i8k_left_fan_status
If running the i8k kernel driver for Inspiron laptops, displays
the left fan status as listed in /proc/i8k (translated to human-
readable). Beware, some laptops i8k reports these fans in
reverse order.
readable). Beware, some laptops i8k reports these fans in re-
verse order.
i8k_right_fan_rpm
@ -671,8 +680,8 @@ VARIABLES
i8k_right_fan_status
If running the i8k kernel driver for Inspiron laptops, displays
the right fan status as listed in /proc/i8k (translated to
human-readable). Beware, some laptops i8k reports these fans in
the right fan status as listed in /proc/i8k (translated to hu-
man-readable). Beware, some laptops i8k reports these fans in
reverse order.
@ -722,23 +731,21 @@ VARIABLES
imap_messages (args)
Displays the number of messages in your global IMAP inbox by
default. You can define individual IMAP inboxes seperately by
Displays the number of messages in your global IMAP inbox by de-
fault. You can define individual IMAP inboxes seperately by
passing arguments to this object. Arguments are: "host user pass
[-i interval] [-p port] [-e command]". Default port is 110,
default interval is 5 minutes. If the password is supplied as
'*', you will be prompted to enter the password when Conky
starts.
[-i interval] [-p port] [-e command]". Default port is 110, de-
fault interval is 5 minutes. If the password is supplied as '*',
you will be prompted to enter the password when Conky starts.
imap_unseen (args)
Displays the number of unseen messages in your global IMAP inbox
by default. You can define individual IMAP inboxes seperately by
passing arguments to this object. Arguments are: "host user pass
[-i interval] [-p port] [-e command]". Default port is 110,
default interval is 5 minutes. If the password is supplied as
'*', you will be prompted to enter the password when Conky
starts.
[-i interval] [-p port] [-e command]". Default port is 110, de-
fault interval is 5 minutes. If the password is supplied as '*',
you will be prompted to enter the password when Conky starts.
kernel Kernel version
@ -860,11 +867,9 @@ VARIABLES
status: Display if battery is fully charged, charging, discharg-
ing or absent (running on AC)
percent: Display charge of battery in percent, if charging or
discharging. Nothing will be displayed, if battery is fully
charged or absent.
time: Display the time remaining until the battery will be fully
charged or discharged at current rate. Nothing is displayed, if
battery is absent or if it's present but fully charged and not
@ -875,18 +880,17 @@ VARIABLES
Displays the number of unseen messages in your global POP3 inbox
by default. You can define individual POP3 inboxes seperately by
passing arguments to this object. Arguments are: "host user pass
[-i interval] [-p port] [-e command]". Default port is 110,
default interval is 5 minutes. If the password is supplied as
'*', you will be prompted to enter the password when Conky
starts.
[-i interval] [-p port] [-e command]". Default port is 110, de-
fault interval is 5 minutes. If the password is supplied as '*',
you will be prompted to enter the password when Conky starts.
pop3_used (args)
Displays the amount of space (in MiB, 2^20) used in your global
POP3 inbox by default. You can define individual POP3 inboxes
seperately by passing arguments to this object. Arguments are:
"host user pass [-i interval] [-p port] [-e command]". Default
port is 110, default interval is 5 minutes. If the password is
Displays the amount of space (in MiB, 2^20) used in your global
POP3 inbox by default. You can define individual POP3 inboxes
seperately by passing arguments to this object. Arguments are:
"host user pass [-i interval] [-p port] [-e command]". Default
port is 110, default interval is 5 minutes. If the password is
supplied as '*', you will be prompted to enter the password when
Conky starts.
@ -936,69 +940,59 @@ VARIABLES
in the range 1 to 65535. Valid items are:
count - total number of connections in the range
rip - remote ip address
rhost - remote host name
rport - remote port number
rservice - remote service name from /etc/services
lip - local ip address
lhost - local host name
lport - local port number
lservice - local service name from /etc/services
The connection index provides you with access to each connection
in the port monitor. The monitor will return information for
index values from 0 to n-1 connections. Values higher than n-1
are simply ignored. For the "count" item, the connection index
must be omitted. It is required for all other items.
in the port monitor. The monitor will return information for in-
dex values from 0 to n-1 connections. Values higher than n-1 are
simply ignored. For the "count" item, the connection index must
be omitted. It is required for all other items.
Examples:
${tcp_portmon 6881 6999 count} - displays the number of connec-
${tcp_portmon 6881 6999 count} - displays the number of connec-
tions in the bittorrent port range
${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
first sshd connection
${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
tenth sshd connection
${tcp_portmon 1 1024 rhost 0} - displays the remote host name of
the first connection on a privileged port
${tcp_portmon 1 1024 rport 4} - displays the remote host port of
the fifth connection on a privileged port
${tcp_portmon 1 65535 lservice 14} - displays the local service
${tcp_portmon 1 65535 lservice 14} - displays the local service
name of the fifteenth connection in the range of all ports
Note that port monitor variables which share the same port range
actually refer to the same monitor, so many references to a sin-
gle port range for different items and different indexes all use
the same monitor internally. In other words, the program avoids
the same monitor internally. In other words, the program avoids
creating redundant monitors.
texeci interval command
Runs a command at an interval inside a thread and displays the
output. Same as $execi, except the command is run inside a
thread. Use this if you have a slow script to keep Conky updat-
ing. You should make the interval slightly longer then the time
it takes your script to execute. For example, if you have a
script that take 5 seconds to execute, you should make the
interval at least 6 seconds. See also $execi.
Runs a command at an interval inside a thread and displays the
output. Same as $execi, except the command is run inside a
thread. Use this if you have a slow script to keep Conky updat-
ing. You should make the interval slightly longer then the time
it takes your script to execute. For example, if you have a
script that take 5 seconds to execute, you should make the in-
terval at least 6 seconds. See also $execi.
offset (pixels)
Move text over by N pixels. See also $voffset.
tab (width, (start))
Puts a tab of the specified width, starting from column 'start'.
tail logfile lines (interval)
Displays last N lines of supplied text text file. If interval is
not supplied, Conky assumes 2x Conky's interval. Max of 30 lines
@ -1010,17 +1004,28 @@ VARIABLES
mat
utime (format)
Display time in UTC (universal coordinate time).
tztime (timezone) (format)
Local time for specified timezone, see man strftime to get more
information about format. The timezone argument is specified in
similar fashion as TZ environment variable. For hints, look in
/usr/share/zoneinfo. e.g. US/Pacific, Europe/Zurich, etc.
totaldown net
Total download, overflows at 4 GB on Linux with 32-bit arch and
there doesn't seem to be a way to know how many times it has
already done that before conky has started.
Total download, overflows at 4 GB on Linux with 32-bit arch and
there doesn't seem to be a way to know how many times it has al-
ready done that before conky has started.
top type, num
This takes arguments in the form:top (name) (number) Basically,
processes are ranked from highest to lowest in terms of cpu
usage, which is what (num) represents. The types are: "name",
"pid", "cpu", and "mem". There can be a max of 10 processes
This takes arguments in the form:top (name) (number) Basically,
processes are ranked from highest to lowest in terms of cpu us-
age, which is what (num) represents. The types are: "name",
"pid", "cpu", and "mem". There can be a max of 10 processes
listed.
@ -1044,9 +1049,9 @@ VARIABLES
Upload speed in kilobytes with one decimal
upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
2) (scale)
Upload speed graph, colours defined in hex, minus the #. If
Upload speed graph, colours defined in hex, minus the #. If
scale is non-zero, it becomes the scale for the graph.
@ -1070,12 +1075,12 @@ VARIABLES
voffset (pixels)
Change vertical offset by N pixels. Negative values will cause
Change vertical offset by N pixels. Negative values will cause
text to overlap. See also $offset.
voltage_mv (n)
Returns CPU #n's voltage in mV. CPUs are counted from 1. If
Returns CPU #n's voltage in mV. CPUs are counted from 1. If
omitted, the parameter defaults to 1.
@ -1093,12 +1098,12 @@ VARIABLES
xmms_channels
xmms / bmp / audacious / infopipe: number of audio channels of
xmms / bmp / audacious / infopipe: number of audio channels of
current tune
xmms_filename
xmms / bmp / audacious / infopipe: full path and filename of
xmms / bmp / audacious / infopipe: full path and filename of
current tune
@ -1108,17 +1113,17 @@ VARIABLES
xmms_length
xmms / bmp / audacious / infopipe: total length of current tune
xmms / bmp / audacious / infopipe: total length of current tune
as MM:SS
xmms_length_seconds
xmms / bmp / audacious / infopipe: total length of current tune
xmms / bmp / audacious / infopipe: total length of current tune
in seconds
xmms_playlist_position
xmms / bmp / audacious / infopipe: playlist position of current
xmms / bmp / audacious / infopipe: playlist position of current
tune
@ -1127,12 +1132,12 @@ VARIABLES
xmms_position
xmms / bmp / audacious / infopipe: MM:SS position of current
xmms / bmp / audacious / infopipe: MM:SS position of current
tune
xmms_position_seconds
xmms / bmp / audacious / infopipe: position of current tune in
xmms / bmp / audacious / infopipe: position of current tune in
seconds
@ -1159,18 +1164,17 @@ FILES
BUGS
Drawing to root or some other desktop window directly doesn't work with
all window managers. Especially doesn't work well with Gnome and it has
been reported that it doesn't work with KDE either. Nautilus can be
disabled from drawing to desktop with program gconf-editor. Uncheck
show_desktop in /apps/nautilus/preferences/. There is -w switch in
Conky to set some specific window id. You might find xwininfo -tree
useful to find the window to draw to. You can also use -o argument
been reported that it doesn't work with KDE either. Nautilus can be
disabled from drawing to desktop with program gconf-editor. Uncheck
show_desktop in /apps/nautilus/preferences/. There is -w switch in
Conky to set some specific window id. You might find xwininfo -tree
useful to find the window to draw to. You can also use -o argument
which makes Conky to create its own window.
SEE ALSO
http://conky.sourceforge.net [http://conky.sourceforge.net]
<http://conky.sourceforge.net>
http://www.sourceforge.net/projects/conky [http://www.source-
forge.net/projects/conky]
<http://www.sourceforge.net/projects/conky>
#conky on irc.freenode.net

View File

@ -291,6 +291,20 @@ if test x$want_seti = xyes; then
AC_DEFINE(SETI, 1, [Define if you want SETI at Home stats])
fi
dnl
dnl Hddtemp
dnl
want_hddtemp=yes
AC_ARG_ENABLE(hddtemp,
[ --enable-hddtemp enable if you want hddtemp support [[default=yes]]],
[want_hddtemp="$enableval"])
AM_CONDITIONAL(BUILD_HDDTEMP, test x$want_hddtemp = xyes)
if test x$want_hddtemp = xyes; then
AC_DEFINE(HDDTEMP, 1, [Define if you want hddtemp support])
fi
dnl
dnl MPD
dnl
@ -311,7 +325,7 @@ dnl
want_xmms2=no
AC_ARG_ENABLE(xmms2,
[ --enable-xmms2 enable if you want XMMS2 support [[default=no]]],
[ --enable-xmms2 enable if you want XMMS2 support [[default=no]]],
[want_xmms2="$enableval"])
AM_CONDITIONAL(BUILD_XMMS2, test x$want_xmms2 = xyes)
@ -327,7 +341,7 @@ dnl
want_imlib2=no
AC_ARG_ENABLE(imlib2,
[ --enable-imlib2 enable if you want Imlib2 support [[default=no]]],
[ --enable-imlib2 enable if you want Imlib2 support [[default=no]]],
[want_imlib2="$enableval"])
AM_CONDITIONAL(BUILD_IMLIB2, test x$want_imlib2 = xyes)

File diff suppressed because it is too large Load Diff

View File

@ -452,6 +452,27 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>goto</option></command>
<option>x</option>
</term>
<listitem>
The next element will be printed at position 'x'.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>hddtemp</option></command>
<option>dev, (host,(port))</option>
</term>
<listitem>
Displays temperature of a selected hard disk drive as reported by the hddtemp daemon running on host:port.
Default host is 127.0.0.1, default port is 7634.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>head</option></command>
@ -1174,6 +1195,16 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>tab</option></command>
<option>(width, (start))</option>
</term>
<listitem>
Puts a tab of the specified width, starting from column 'start'.
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>tail</option></command>

View File

@ -62,9 +62,13 @@ if BUILD_X11
x11 = x11.c
endif
conky_SOURCES = common.c fs.c $(linux) mail.c mixer.c $(seti) $(mpd) $(xmms2) $(solaris) $(freebsd) $(netbsd) $(port_monitors) conky.c conky.h $(x11) $(mldonkey) remoted.c remoted.h remotec.c remotec.h $(xmms) $(bmpx)
if BUILD_HDDTEMP
hddtemp = hddtemp.c
endif
conky_SOURCES = common.c fs.c $(linux) mail.c mixer.c $(seti) $(mpd) $(xmms2) $(solaris) $(freebsd) $(netbsd) $(port_monitors) conky.c conky.h $(x11) $(mldonkey) remoted.c remoted.h remotec.c remotec.h $(xmms) $(bmpx) $(hddtemp)
AM_LDFLAGS = $(X11_LIBS) $(XFT_LIBS) $(CAIRO_LIBS) $(PTHREAD_LIBS) -lm
EXTRA_DIST = seti.c linux.c solaris.c freebsd.c netbsd.c mpd.c libmpdclient.c \
libmpdclient.h xmms2.c top.h mldonkey.c ftp.c ftp.h x11.c
libmpdclient.h xmms2.c top.h mldonkey.c ftp.c ftp.h x11.c hddtemp.c

View File

@ -450,6 +450,8 @@ enum {
OFFSET,
VOFFSET,
FONT,
GOTO,
TAB,
};
static struct special_t {
@ -752,6 +754,17 @@ static inline void new_alignc(char *buf, long c)
new_special(buf, ALIGNC)->arg = c;
}
static inline void new_goto(char *buf, long c)
{
new_special(buf, GOTO)->arg = c;
}
static inline void new_tab(char *buf, int a, int b) {
struct special_t *s = new_special(buf, TAB);
s->width = a;
s->arg = b;
}
/* quite boring functions */
static inline void for_each_line(char *b, void (*f) (char *))
@ -856,6 +869,8 @@ enum text_object_type {
OBJ_fs_size,
OBJ_fs_used,
OBJ_fs_used_perc,
OBJ_goto,
OBJ_tab,
OBJ_hr,
OBJ_offset,
OBJ_voffset,
@ -1032,6 +1047,9 @@ enum text_object_type {
OBJ_iconv_start,
OBJ_iconv_stop,
#endif
#ifdef HDDTEMP
OBJ_hddtemp,
#endif
};
struct text_object {
@ -1112,6 +1130,11 @@ struct text_object {
int connection_index; /* 0 to n-1 connections. */
} tcp_port_monitor;
#endif
struct {
char *addr;
int port;
char *dev;
} hddtemp; /* 2 */
} data;
};
@ -1961,6 +1984,12 @@ static void free_text_objects(unsigned int count, struct text_object *objs)
info.first_process = NULL;
}
break;
#ifdef HDDTEMP
case OBJ_hddtemp:
free(objs[i].data.hddtemp.dev);
free(objs[i].data.hddtemp.addr);
break;
#endif
}
}
free(objs);
@ -2313,6 +2342,28 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
END OBJ(hr, 0) obj->data.i = arg ? atoi(arg) : 1;
END OBJ(offset, 0) obj->data.i = arg ? atoi(arg) : 1;
END OBJ(voffset, 0) obj->data.i = arg ? atoi(arg) : 1;
END OBJ(goto, 0)
if (!arg) {
ERR("goto needs arguments");
obj->type = OBJ_text;
obj->data.s = strdup("${goto}");
return NULL;
}
obj->data.i = atoi(arg);
END OBJ(tab, 0)
int a = 10, b = 0;
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;
END OBJ(i2c, INFO_I2C) char buf1[64], buf2[64];
int n;
@ -2876,6 +2927,17 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
memset(&(info.bmpx), 0, sizeof(struct bmpx_s));
END
#endif
#ifdef HDDTEMP
OBJ(hddtemp, 0)
if (!arg || scan_hddtemp(arg, &obj->data.hddtemp.dev,
&obj->data.hddtemp.addr, &obj->data.hddtemp.port)) {
ERR("hddtemp needs arguments");
obj->type = OBJ_text;
obj->data.s = strdup("${hddtemp}");
return NULL;
}
END
#endif
#ifdef TCP_PORT_MONITOR
OBJ(tcp_portmon, INFO_TCP_PORT_MONITOR)
int argc, port_begin, port_end, item, connection_index;
@ -3871,9 +3933,29 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
v[obj->data.loadavg[0] -
1]);
}
OBJ(goto) {
new_goto(p, obj->data.i);
}
OBJ(tab) {
new_tab(p, obj->data.pair.a, obj->data.pair.b);
}
OBJ(hr) {
new_hr(p, obj->data.i);
}
OBJ(hddtemp) {
char *temp;
char unit;
temp = get_hddtemp_info(obj->data.hddtemp.dev,
obj->data.hddtemp.addr, obj->data.hddtemp.port, &unit);
if (!temp) {
snprintf(p, p_max_size, "N/A");
} else if (unit == '*') {
snprintf(p, p_max_size, "%s", temp);
} else {
snprintf(p, p_max_size, "%s?%c", temp, unit);
}
}
OBJ(offset) {
new_offset(p, obj->data.i);
}
@ -4834,57 +4916,9 @@ static inline int get_string_width_special(char *s)
}
#ifdef X11
static void text_size_updater(char *s);
int last_font_height;
static void text_size_updater(char *s)
{
int w = 0;
char *p;
/* get string widths and skip specials */
p = s;
while (*p) {
if (*p == SPECIAL_CHAR) {
*p = '\0';
w += get_string_width(s);
*p = SPECIAL_CHAR;
if (specials[special_index].type == BAR
|| specials[special_index].type == GRAPH) {
w += specials[special_index].width;
if (specials[special_index].height > last_font_height) {
last_font_height = specials[special_index].height;
last_font_height += font_ascent();
}
} else if (specials[special_index].type == OFFSET) {
w += specials[special_index].arg + get_string_width("a"); /* filthy, but works */
} else if (specials[special_index].type == VOFFSET) {
last_font_height += specials[special_index].arg;
} else if (specials[special_index].type == FONT) {
selected_font = specials[special_index].font_added;
if (font_height() > last_font_height) {
last_font_height = font_height();
}
}
special_index++;
s = p + 1;
}
p++;
}
w += get_string_width(s);
if (w > text_width) {
text_width = w;
}
if (text_width > maximum_width && maximum_width) {
text_width = maximum_width;
}
text_height += last_font_height;
last_font_height = font_height();
}
#endif /* X11 */
#ifdef X11
static void update_text_area()
{
int x, y;
@ -4974,6 +5008,64 @@ static int cur_x, cur_y; /* current x and y for drawing */
static int draw_mode; /* FG, BG or OUTLINE */
static long current_color;
#ifdef X11
static void text_size_updater(char *s)
{
int w = 0;
char *p;
/* get string widths and skip specials */
p = s;
while (*p) {
if (*p == SPECIAL_CHAR) {
*p = '\0';
w += get_string_width(s);
*p = SPECIAL_CHAR;
if (specials[special_index].type == BAR
|| specials[special_index].type == GRAPH) {
w += specials[special_index].width;
if (specials[special_index].height > last_font_height) {
last_font_height = specials[special_index].height;
last_font_height += font_ascent();
}
} else if (specials[special_index].type == OFFSET) {
w += specials[special_index].arg + get_string_width("a"); /* filthy, but works */
} else if (specials[special_index].type == VOFFSET) {
last_font_height += specials[special_index].arg;
} else if (specials[special_index].type == GOTO) {
if (specials[special_index].arg >= 0)
w += (int)specials[special_index].arg - cur_x;
} else if (specials[special_index].type == TAB) {
int start = specials[special_index].arg;
int step = specials[special_index].width;
if (!step || step < 0)
step = 10;
w += step - (cur_x - text_start_x - start) % step;
} else if (specials[special_index].type == FONT) {
selected_font = specials[special_index].font_added;
if (font_height() > last_font_height) {
last_font_height = font_height();
}
}
special_index++;
s = p + 1;
}
p++;
}
w += get_string_width(s);
if (w > text_width) {
text_width = w;
}
if (text_width > maximum_width && maximum_width) {
text_width = maximum_width;
}
text_height += last_font_height;
last_font_height = font_height();
}
#endif /* X11 */
static inline void set_foreground_color(long c)
{
current_color = c;
@ -5410,14 +5502,26 @@ static void draw_line(char *s)
arg);
break;
case OFFSET:
{
w += specials[special_index].arg;
}
case OFFSET:
w += specials[special_index].arg;
break;
case VOFFSET:
case VOFFSET:
cur_y += specials[special_index].arg;
break;
case GOTO:
if (specials[special_index].arg >= 0)
cur_x = (int)specials[special_index].arg;
break;
case TAB:
{
cur_y += specials[special_index].arg;
int start = specials[special_index].arg;
int step = specials[special_index].width;
if (!step || step < 0)
step = 10;
w = step - (cur_x - text_start_x - start) % step;
}
break;

View File

@ -599,6 +599,12 @@ extern mldonkey_config mlconfig;
int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info);
#endif
/* in hddtemp.c */
#ifdef HDDTEMP
int scan_hddtemp(const char *arg, char **dev, char **addr, int *port);
char *get_hddtemp_info(char *dev, char *addr, int port, char *unit);
#endif /* HDDTEMP */
/* in linux.c */
/* nothing to see here */
@ -607,3 +613,5 @@ int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info);
extern int do_it(void);
#endif