* widget.c (label_new): Don't calculate dimensions of multiline

labels, since they cannot be changed and msglen() is already
used when the dialog is created.
This commit is contained in:
Pavel Roskin 2001-09-03 15:17:27 +00:00
parent cf5ddb2e33
commit e840cff0dc
2 changed files with 14 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2001-09-03 Pavel Roskin <proski@gnu.org>
* widget.c (label_new): Don't calculate dimensions of multiline
labels, since they cannot be changed and msglen() is already
used when the dialog is created.
* Makefile.in: Converted to ...
* Makefile.am: ... this.

View File

@ -628,9 +628,17 @@ label_destroy (WLabel *l)
WLabel *
label_new (int y, int x, const char *text, char *tkname)
{
WLabel *l = g_new (WLabel, 1);
WLabel *l;
int width;
init_widget (&l->widget, y, x, 1, text ? strlen (text) : 0,
/* Multiline labels are immutable - no need to compute their sizes */
if (!text || strchr(text, '\n'))
width = 1;
else
width = strlen (text);
l = g_new (WLabel, 1);
init_widget (&l->widget, y, x, 1, width,
(callback_fn) label_callback,
(destroy_fn) label_destroy, NULL, tkname);
l->text = text ? g_strdup (text) : 0;