Reset Litehtml scrolledwindow to top-left when displaying new content
authorAndrej Kacian <ticho@claws-mail.org>
Mon, 11 Feb 2019 22:10:45 +0000 (23:10 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Tue, 12 Feb 2019 18:38:10 +0000 (19:38 +0100)
src/plugins/litehtml_viewer/lh_widget.cpp

index 61abf61..df6ee99 100644 (file)
@@ -218,6 +218,7 @@ statusbar_pop:
 void lh_widget::open_html(const gchar *contents)
 {
        gint num = clear_images(lh_prefs_get()->image_cache_size * 1024 * 1000);
+       GtkAdjustment *adj;
 
        debug_print("LH: cleared %d images from image cache\n", num);
 
@@ -226,6 +227,12 @@ void lh_widget::open_html(const gchar *contents)
        m_rendered_width = 0;
        if (m_html != NULL) {
                debug_print("lh_widget::open_html created document\n");
+               adj = gtk_scrolled_window_get_hadjustment(
+                               GTK_SCROLLED_WINDOW(m_scrolled_window));
+               gtk_adjustment_set_value(adj, 0.0);
+               adj = gtk_scrolled_window_get_vadjustment(
+                               GTK_SCROLLED_WINDOW(m_scrolled_window));
+               gtk_adjustment_set_value(adj, 0.0);
                redraw();
        }
        lh_widget_statusbar_pop();