commit 5495234ca6656315d535dbbfee9d8afcd39d686e
parent 4d8314d853000b542f3f08d50ad64f6c29b14f95
Author: Jonathan Boeing <jonathan.n.boeing@gmail.com>
Date: Mon, 19 Jul 2021 14:21:07 -0700
Fix flickering when opening with LiteHTML viewer
Restrict painting to the allocation size of the drawing area, otherwise
we draw over other parts of the interface.
Calling paint_white from redraw isn't needed and causes flickering.
Calling redraw from open_html causes the old message to be redisplayed
after clearing it, before drawing the new message.
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp
@@ -195,7 +195,6 @@ void lh_widget::open_html(const gchar *contents)
adj = gtk_scrolled_window_get_vadjustment(
GTK_SCROLLED_WINDOW(m_scrolled_window));
gtk_adjustment_set_value(adj, 0.0);
- redraw(false);
}
lh_widget_statusbar_pop();
}
@@ -229,15 +228,13 @@ void lh_widget::redraw(gboolean force_render)
GdkWindow *gdkwin;
cairo_t *cr;
- paint_white();
-
if (m_html == NULL)
return;
/* Get width of the viewport. */
- gdkwin = gtk_viewport_get_view_window(GTK_VIEWPORT(m_viewport));
- width = gdk_window_get_width(gdkwin);
- m_height = gdk_window_get_height(gdkwin);
+ gtk_widget_get_allocation(GTK_WIDGET(m_viewport), &rect);
+ width = rect.width;
+ m_height = rect.height;
/* If the available width has changed, rerender the HTML content. */
if (m_rendered_width != width || force_render) {