Mercurial > pidgin.yaz
diff src/gtkimhtml.c @ 10777:ffa44a5159e0
[gaim-migrate @ 12392]
To test Tim's new code, I needed a way to set background colors, so I changed
gtkimhtmltoolbar such that now it will set the body background color unless
text is selected in which case it will set the font background color on that
text only. That seems sensible.
Then I tested Tim's new code and it went into an infinite loop. Twice ;).
Maybe I'll have time to check that out later.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sun, 03 Apr 2005 03:51:59 +0000 |
parents | b640d066eb51 |
children | 93fd90cbf45c |
line wrap: on
line diff
--- a/src/gtkimhtml.c Sat Apr 02 23:59:49 2005 +0000 +++ b/src/gtkimhtml.c Sun Apr 03 03:51:59 2005 +0000 @@ -531,7 +531,9 @@ int buf_x, buf_y; GSList *tags, *l; GdkRectangle visible_rect; - + GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(event->window)); + GdkColor gcolor; + gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, @@ -543,6 +545,29 @@ gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, event->area.x, event->area.y, &buf_x, &buf_y); + if (GTK_IMHTML(widget)->editable || GTK_IMHTML(widget)->wbfo) { + + if (GTK_IMHTML(widget)->edit.background) { + gdk_color_parse(GTK_IMHTML(widget)->edit.background, &gcolor); + gdk_gc_set_rgb_fg_color(gc, &gcolor); + } else { + gdk_gc_set_rgb_fg_color(gc, &(widget->style->base[GTK_WIDGET_STATE(widget)])); + } + + gdk_draw_rectangle(event->window, + gc, + TRUE, + visible_rect.x, visible_rect.y, visible_rect.width, visible_rect.height); + gdk_gc_unref(gc); + + if (GTK_WIDGET_CLASS (parent_class)->expose_event) + return (* GTK_WIDGET_CLASS (parent_class)->expose_event) + (widget, event); + + return FALSE; + + } + gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(widget), &start, buf_x, buf_y); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(widget), &end, buf_x + event->area.width, buf_y + event->area.height); @@ -552,7 +577,6 @@ cur = start; while (gtk_text_iter_in_range(&cur, &start, &end)) { - GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(event->window)); tags = gtk_text_iter_get_tags(&cur); for (l = tags; l; l = l->next) { @@ -560,8 +584,7 @@ GdkRectangle rect; GdkRectangle tag_area; const char *color; - GdkColor gcolor; - + if (strncmp(tag->name, "BACKGROUND ", 11)) continue; @@ -612,7 +635,6 @@ } g_slist_free(tags); - gdk_gc_unref(gc); gtk_text_iter_forward_to_tag_toggle(&cur, NULL); } #if 0 @@ -684,6 +706,8 @@ l = l->next; } #endif + gdk_gc_unref(gc); + if (GTK_WIDGET_CLASS (parent_class)->expose_event) return (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);