pidgin: 21269273: Limit the text input area to half the co...

resiak at soc.pidgin.im resiak at soc.pidgin.im
Mon Mar 17 10:10:37 EDT 2008


-----------------------------------------------------------------
Revision: 212692733e6f978d447d57562ebb154f679930b7
Ancestor: aca28988d0e09ad0e24d6b2e36a83eea403d1cde
Author: resiak at soc.pidgin.im
Date: 2008-03-17T14:08:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/212692733e6f978d447d57562ebb154f679930b7

Modified files:
        pidgin/gtkconv.c

ChangeLog: 

Limit the text input area to half the conversation's height.
Also, remove an unused GtkRequisition lookup.

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	b7fbd693ae0b64103e95aa23660585284b95f893
+++ pidgin/gtkconv.c	cc7999937fb84fa678ed6b0dc51b0ec0ef762185
@@ -4366,9 +4366,9 @@ static gboolean resize_imhtml_cb(PidginC
 	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 @@ static gboolean resize_imhtml_cb(PidginC
 
 	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 @@ static gboolean resize_imhtml_cb(PidginC
 	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);
 


More information about the Commits mailing list