changeset 22496:43f28905e2fd

Limit the text input area to half the conversation's height. Also, remove an unused GtkRequisition lookup.
author Will Thompson <will.thompson@collabora.co.uk>
date Mon, 17 Mar 2008 14:08:36 +0000
parents 5c216e2c5405
children 5ddb2a65e7ea
files pidgin/gtkconv.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Mon Mar 17 13:38:34 2008 +0000
+++ b/pidgin/gtkconv.c	Mon Mar 17 14:08:36 2008 +0000
@@ -4366,9 +4366,9 @@
 	int wrapped_lines;
 	int lines;
 	GdkRectangle oneline;
-	GtkRequisition sr;
 	int height, diff;
 	int pad_top, pad_inside, pad_bottom;
+	int max_height = gtkconv->tab_cont->allocation.height / 2;
 
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
 
@@ -4380,9 +4380,8 @@
 
 	lines = gtk_text_buffer_get_line_count(buffer);
 
-	/* Show a maximum of 4 lines */
-	lines = MIN(lines, 4);
-	wrapped_lines = MIN(MAX(wrapped_lines, 2), 4);
+	/* Show at least two lines */
+	wrapped_lines = MAX(wrapped_lines, 2);
 
 	pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry));
 	pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry));
@@ -4392,12 +4391,12 @@
 	if (wrapped_lines > lines)
 		height += (oneline.height + pad_inside) * (wrapped_lines - lines);
 
+	height = MIN(height, max_height);
+
 	diff = height - gtkconv->entry->allocation.height;
 	if (diff == 0 || (diff < 0 && -diff < oneline.height / 2))
 		return FALSE;
 
-	gtk_widget_size_request(gtkconv->lower_hbox, &sr);
-
 	gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
 		diff + gtkconv->lower_hbox->allocation.height);