comparison src/gtkhtml.c @ 829:9a123b171f46

[gaim-migrate @ 839] yay. i have a secret. but basically this should fix most outstanding libfaim issues in gaim. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 02 Sep 2000 02:41:57 +0000
parents 678bdc430df7
children 2804dc8e9ba0
comparison
equal deleted inserted replaced
828:4c71c0e7f04e 829:9a123b171f46
2894 maxwidth = (hwidth - html->current_x - 8); 2894 maxwidth = (hwidth - html->current_x - 8);
2895 /* 2895 /*
2896 * HTK_SCROLLED_WINDOW(GTK_WIDGET(layout)->parent)->vscrollbar->allocation.width) - 8; 2896 * HTK_SCROLLED_WINDOW(GTK_WIDGET(layout)->parent)->vscrollbar->allocation.width) - 8;
2897 */ 2897 */
2898 2898
2899 /* FIXME: gtk_text_measure can overflow if the text is too long. hopefully that will
2900 * never happen though. but it is very possible. NOTE: this is not a buffer overflow,
2901 * it just means it won't display text properly. */
2899 while (gdk_text_measure(cfont, text, num) > maxwidth) 2902 while (gdk_text_measure(cfont, text, num) > maxwidth)
2900 { 2903 {
2901 if (num > 1) 2904 if (num > 1)
2902 num--; 2905 num--;
2903 else 2906 else
3105 void gtk_html_append_text(GtkHtml * html, char *text, gint options) 3108 void gtk_html_append_text(GtkHtml * html, char *text, gint options)
3106 { 3109 {
3107 GdkColormap *map; 3110 GdkColormap *map;
3108 GdkFont *cfont; 3111 GdkFont *cfont;
3109 GdkRectangle area; 3112 GdkRectangle area;
3110 char ws[BUF_LONG], 3113 char *ws,
3111 tag[BUF_LONG], 3114 tag[BUF_LONG],
3112 *c, 3115 *c,
3113 *url = NULL; 3116 *url = NULL;
3114 gint intag = 0, 3117 gint intag = 0,
3115 wpos = 0, 3118 wpos = 0,
3149 if (!current) current = &def_state; 3152 if (!current) current = &def_state;
3150 map = gdk_window_get_colormap(html->html_area); 3153 map = gdk_window_get_colormap(html->html_area);
3151 cfont = getfont(current->font, bold, italic, fixed, current->size); 3154 cfont = getfont(current->font, bold, italic, fixed, current->size);
3152 c = text; 3155 c = text;
3153 3156
3157 ws = g_malloc(strlen(text) + 2);
3154 3158
3155 while (*c) 3159 while (*c)
3156 { 3160 {
3157 if (*c == '<') 3161 if (*c == '<')
3158 { 3162 {
3592 /* gtk_html_add_text(html, cfont, current->color, current->bgcol, ">", 1, 3596 /* gtk_html_add_text(html, cfont, current->color, current->bgcol, ">", 1,
3593 0, 0, NULL); 3597 0, 0, NULL);
3594 */ } 3598 */ }
3595 3599
3596 3600
3601 g_free(ws);
3597 3602
3598 gdk_window_get_size(html->html_area, NULL, &height); 3603 gdk_window_get_size(html->html_area, NULL, &height);
3599 area.height = height; 3604 area.height = height;
3600 gtk_adjustment_set_value(html->vadj, html->vadj->upper - area.height); 3605 gtk_adjustment_set_value(html->vadj, html->vadj->upper - area.height);
3601 3606