From: Jose Dapena Paz Date: Mon, 9 Nov 2009 17:09:56 +0000 (+0100) Subject: Some fixes in panning of msg view: X-Git-Tag: 3.1.15~5 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=5f4727739f2ae0882bfdc53429e4a5e64bb4488d Some fixes in panning of msg view: * Now we properly show messages where the rendered html is bigger than 32768 pixels (fixes NB#114484). * Show properly a message that caused an old bug. As you paned the document, scroll size growed forever. Now it works properly (fixes NB#138980). --- diff --git a/src/widgets/modest-gtkhtml-msg-view.c b/src/widgets/modest-gtkhtml-msg-view.c index 6bd1abd..6d88107 100644 --- a/src/widgets/modest-gtkhtml-msg-view.c +++ b/src/widgets/modest-gtkhtml-msg-view.c @@ -936,9 +936,14 @@ size_allocate (GtkWidget *widget, html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll)); html_allocation.x = 0; - html_allocation.y = headers_allocation.height; + html_allocation.y = MAX (0, headers_allocation.height - priv->vadj->value); html_allocation.width = view_allocation.width; - html_allocation.height = MAX ((gint) html_vadj->upper, (gint)(priv->vadj->upper - headers_allocation.height)); + if (html_vadj->upper < allocation->height) { + html_allocation.height = MAX (html_vadj->upper, allocation->height - headers_allocation.height); + } else { + html_allocation.height = allocation->height; + } + /* html_allocation.height = MAX ((gint) html_vadj->upper, (gint)(priv->vadj->upper - headers_allocation.height)); */ if (GTK_WIDGET_REALIZED (widget)) { gdk_window_move_resize (widget->window, @@ -959,7 +964,7 @@ size_allocate (GtkWidget *widget, headers_allocation.height); gdk_window_move_resize (priv->html_window, (gint) (- priv->hadj->value), - (gint) (html_allocation.y - priv->vadj->value), + (gint) html_allocation.y, (gint) priv->hadj->upper, html_allocation.height); } @@ -971,8 +976,11 @@ size_allocate (GtkWidget *widget, html_allocation.x = 0; html_allocation.y = 0; html_allocation.width = (gint) priv->hadj->upper; - html_allocation.height = (gint) priv->vadj->upper - headers_allocation.height; gtk_widget_size_allocate (priv->html_scroll, &html_allocation); + if (html_vadj->page_size != html_allocation.height) { + html_vadj->page_size = html_allocation.height; + gtk_adjustment_changed (html_vadj); + } } gtk_adjustment_changed (priv->hadj); gtk_adjustment_changed (priv->vadj); @@ -1021,9 +1029,15 @@ adjustment_value_changed (GtkAdjustment *adj, gpointer data) if (priv->html_scroll && GTK_WIDGET_VISIBLE (priv->html_scroll)) { gint old_x, old_y; gint new_x, new_y; + gint new_internal_vvalue; gdk_window_get_position (priv->html_window, &old_x, &old_y); new_x = -hadj->value; - new_y = headers_offset - vadj->value; + + new_internal_vvalue = MAX (0, vadj->value - headers_offset); + gtk_adjustment_set_value (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll)), + new_internal_vvalue); + + new_y = MAX (0, headers_offset - vadj->value); if (new_x != old_x || new_y != old_y) { gdk_window_move (priv->html_window, new_x, new_y); @@ -1059,13 +1073,18 @@ html_adjustment_changed (GtkAdjustment *adj, g_signal_stop_emission_by_name (G_OBJECT (adj), "changed"); priv->html_scroll->requisition.height = html_vadj->upper; - if (html_vadj->upper == priv->html_scroll->allocation.height) + if ((priv->vadj != NULL && (html_vadj->upper == (priv->vadj->upper - GTK_WIDGET (priv->headers_box)->allocation.height))) + && html_vadj->page_size == priv->html_scroll->allocation.height) return; - priv->html_scroll->allocation.height = html_vadj->upper; set_vadjustment_values (self, &vadj_changed); - new_height = MAX ((gint) html_vadj->upper, (gint) (priv->vadj->upper - priv->headers_box->allocation.height)); + if (html_vadj->upper < GTK_WIDGET (self)->allocation.height) { + new_height = MAX (html_vadj->upper, + GTK_WIDGET (self)->allocation.height - GTK_WIDGET(priv->headers_box)->allocation.height); + } else { + new_height = GTK_WIDGET (self)->allocation.height; + } gtk_adjustment_changed (priv->vadj); if (GTK_WIDGET_DRAWABLE (priv->html_scroll)) {