# HG changeset patch # User Luke Schierer # Date 1050035035 0 # Node ID 4cfc49e31c2e440cb36a051d6ecc4f3f749697fb # Parent a20a644e0da49ff39c42a2a3dae49b6a22487008 [gaim-migrate @ 5468] David Brigada (jsi) writes: " This patch changes GTK_WRAP_WORD to GTK_WRAP_WORD_CHAR throughout the sources. That fixes a bug where long single-word input into GtkTextViews and similar would cause the textview to expand, causing the window to expand. This fix depends on a patch to GTK+ that is in current CVS but not yet released. To address the backwards-compatibility issue, GTK_WRAP_WORD_CHAR is #defined to GTK_WRAP_WORD when not defined by GTK+'s header files. The only problem I can forsee is binary compatibility; if Gaim is compiled under a GTK+ CVS (or a future release) environment, and then run under a GTK+ 2.2.1 or earlier environment, behavior is undefined; the text area will probably not wrap at all. However, source compatibility is maintained." basically, gaim will start wrapping text in any version of gtk2 that supports it, and should work exactly the same in any version that still has the bug. many thanks to David for his hard work. committer: Tailor Script diff -r a20a644e0da4 -r 4cfc49e31c2e src/dialogs.c --- a/src/dialogs.c Fri Apr 11 00:52:02 2003 +0000 +++ b/src/dialogs.c Fri Apr 11 04:23:55 2003 +0000 @@ -1970,7 +1970,7 @@ gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); b->text = gtk_text_view_new(); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(b->text), GTK_WRAP_WORD_CHAR); gtk_widget_set_size_request(b->text, 300, 200); buf = g_malloc(strlen(account->user_info) + 1); strncpy_nohtml(buf, account->user_info, strlen(account->user_info) + 1); @@ -3086,7 +3086,7 @@ gtk_box_pack_start(GTK_BOX(fbox), frame, TRUE, TRUE, 0); ca->text = gtk_text_view_new(); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD_CHAR); gtk_container_add(GTK_CONTAINER(frame), ca->text); @@ -4516,7 +4516,7 @@ gtk_container_add(GTK_CONTAINER (*texts_ibox), frame); mtd->textbox = gtk_text_view_new(); gtk_text_view_set_editable(GTK_TEXT_VIEW(mtd->textbox), TRUE); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(mtd->textbox), GTK_WRAP_WORD); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(mtd->textbox), GTK_WRAP_WORD_CHAR); gtk_text_buffer_set_text( gtk_text_view_get_buffer(GTK_TEXT_VIEW(mtd->textbox)), mtd->text?mtd->text:"", -1); diff -r a20a644e0da4 -r 4cfc49e31c2e src/gtkconv.c --- a/src/gtkconv.c Fri Apr 11 00:52:02 2003 +0000 +++ b/src/gtkconv.c Fri Apr 11 04:23:55 2003 +0000 @@ -3085,7 +3085,7 @@ g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); gtk_widget_set_size_request(gtkconv->entry, -1, MAX(buddy_chat_size.entry_height, 25)); @@ -3181,7 +3181,7 @@ g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", conv); gtkconv->entry = gtk_text_view_new_with_buffer(gtkconv->entry_buffer); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(gtkconv->entry), GTK_WRAP_WORD_CHAR); gtk_widget_set_size_request(gtkconv->entry, -1, MAX(conv_size.entry_height, 25)); diff -r a20a644e0da4 -r 4cfc49e31c2e src/gtkimhtml.c --- a/src/gtkimhtml.c Fri Apr 11 00:52:02 2003 +0000 +++ b/src/gtkimhtml.c Fri Apr 11 04:23:55 2003 +0000 @@ -51,6 +51,11 @@ #include +/* GTK+ < 2.2.2 hack, see ui.h for details. */ +#ifndef GTK_WRAP_WORD_CHAR +#define GTK_WRAP_WORD_CHAR GTK_WRAP_WORD +#endif + #define TOOLTIP_TIMEOUT 500 static gboolean gtk_motion_event_notify(GtkWidget *imhtml, GdkEventMotion *event, gpointer user_data); @@ -207,7 +212,7 @@ gtk_text_buffer_get_end_iter (imhtml->text_buffer, &iter); imhtml->end = gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, FALSE); gtk_text_view_set_buffer(GTK_TEXT_VIEW(imhtml), imhtml->text_buffer); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD_CHAR); gtk_text_view_set_editable(GTK_TEXT_VIEW(imhtml), FALSE); gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(imhtml), 5); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(imhtml), FALSE); diff -r a20a644e0da4 -r 4cfc49e31c2e src/prefs.c --- a/src/prefs.c Fri Apr 11 00:52:02 2003 +0000 +++ b/src/prefs.c Fri Apr 11 04:23:55 2003 +0000 @@ -1898,7 +1898,7 @@ dw->entry = gtk_text_view_new(); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(dw->entry), FALSE); gtk_text_view_set_editable(GTK_TEXT_VIEW(dw->entry), FALSE); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(dw->entry), GTK_WRAP_WORD); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(dw->entry), GTK_WRAP_WORD_CHAR); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(dw->entry)); gtk_text_buffer_get_end_iter(buffer, &end); diff -r a20a644e0da4 -r 4cfc49e31c2e src/ui.h --- a/src/ui.h Fri Apr 11 00:52:02 2003 +0000 +++ b/src/ui.h Fri Apr 11 04:23:55 2003 +0000 @@ -43,6 +43,14 @@ gtk_window_set_type_hint(GTK_WINDOW(x), GDK_WINDOW_TYPE_HINT_DIALOG) #define GAIM_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED) +/* This is backwards-compatibility code for old versions of GTK+ (2.2.1 and + * earlier). It defines the new wrap behavior (unknown in earlier versions) + * as the old (slightly buggy) wrap behavior. + */ +#ifndef GTK_WRAP_WORD_CHAR +#define GTK_WRAP_WORD_CHAR GTK_WRAP_WORD +#endif + #define DEFAULT_FONT_FACE "Helvetica" #define BROWSER_NETSCAPE 0