pidgin: a9db18c9: This should fix the issue where resizing...

sadrul at pidgin.im sadrul at pidgin.im
Fri May 2 13:10:55 EDT 2008


-----------------------------------------------------------------
Revision: a9db18c93f28f014cb3740a20933e2468fb660b7
Ancestor: 1050984d439516a453bb1a2c715d899e40160b25
Author: sadrul at pidgin.im
Date: 2008-05-02T17:00:49
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a9db18c93f28f014cb3740a20933e2468fb660b7

Modified files:
        pidgin/gtkconv.c

ChangeLog: 

This should fix the issue where resizing the entry box resizes the
window. For real this time!

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	8163e3b0df790f2fc0b7414d24758986bf619eb2
+++ pidgin/gtkconv.c	c122337a14eb60106a91d7167247a9e3789edebd
@@ -4458,7 +4458,9 @@ static gboolean resize_imhtml_cb(PidginC
 	GdkRectangle oneline;
 	int height, diff;
 	int pad_top, pad_inside, pad_bottom;
-	int max_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height) / 2;
+	int total_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height);
+	int max_height = total_height / 2;
+	int min_height;
 
 	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));
@@ -4482,12 +4484,11 @@ static gboolean resize_imhtml_cb(PidginC
 	/* Make sure there's enough room for at least two lines. Allocate enough space to
 	 * prevent scrolling when the second line is a continuation of the first line, or
 	 * is the beginning of a new paragraph. */
-	height = MAX(height, 2 * (oneline.height + MAX(pad_inside, pad_top + pad_bottom)));
+	min_height = 2 * (oneline.height + MAX(pad_inside, pad_top + pad_bottom));
+	height = CLAMP(height, min_height, max_height);
 
-	height = MIN(height, max_height);
-
 	diff = height - gtkconv->entry->allocation.height;
-	if (diff == 0 || (diff < 0 && -diff < oneline.height / 2))
+	if (ABS(diff) < oneline.height / 2)
 		return FALSE;
 
 	gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
@@ -4764,6 +4765,7 @@ setup_common_pane(PidginConversation *gt
 
 	/* Setup the gtkimhtml widget */
 	frame = pidgin_create_imhtml(FALSE, &gtkconv->imhtml, NULL, &imhtml_sw);
+	gtk_widget_set_size_request(gtkconv->imhtml, -1, 0);
 	if (chat) {
 		GtkWidget *hpaned;
 


More information about the Commits mailing list