commit 3d209145f3b91fec635b5d956d56a79ab8059f90
parent f0dc8213f7d907be763c70bd8189f998ca914117
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Tue, 12 Feb 2019 00:32:44 +0100
Use height of the viewport, not the scrolled window when telling Litehtml size of the area it has available for rendering
Diffstat:
2 files changed, 3 insertions(+), 20 deletions(-)
diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp
@@ -50,8 +50,6 @@ char master_css[] = {
static gboolean expose_event_cb(GtkWidget *widget, GdkEvent *event,
gpointer user_data);
-static void size_allocate_cb(GtkWidget *widget, GdkRectangle *allocation,
- gpointer user_data);
static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event,
gpointer user_data);
static gboolean motion_notify_event(GtkWidget *widget, GdkEventButton *event,
@@ -69,8 +67,6 @@ lh_widget::lh_widget()
m_scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(m_scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- g_signal_connect(m_scrolled_window, "size-allocate",
- G_CALLBACK(size_allocate_cb), this);
/* viewport */
GtkScrolledWindow *scw = GTK_SCROLLED_WINDOW(m_scrolled_window);
@@ -263,7 +259,7 @@ void lh_widget::draw(cairo_t *cr)
void lh_widget::redraw()
{
GtkAllocation rect;
- gint width, height;
+ gint width;
GdkWindow *gdkwin;
cairo_t *cr;
@@ -274,7 +270,8 @@ void lh_widget::redraw()
/* Get width of the viewport. */
gdkwin = gtk_viewport_get_view_window(GTK_VIEWPORT(m_viewport));
- gdk_drawable_get_size(gdkwin, &width, NULL);
+ width = gdk_window_get_width(gdkwin);
+ m_height = gdk_window_get_height(gdkwin);
/* If the available width has changed, rerender the HTML content. */
if (m_rendered_width != width) {
@@ -432,18 +429,6 @@ static gboolean expose_event_cb(GtkWidget *widget, GdkEvent *event,
return FALSE;
}
-static void size_allocate_cb(GtkWidget *widget, GdkRectangle *allocation,
- gpointer user_data)
-{
- lh_widget *w = (lh_widget *)user_data;
-
- debug_print("size_allocate_cb: %dx%d\n",
- allocation->width, allocation->height);
-
- w->setHeight(allocation->height);
- w->redraw();
-}
-
static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event,
gpointer user_data)
{
diff --git a/src/plugins/litehtml_viewer/lh_widget.h b/src/plugins/litehtml_viewer/lh_widget.h
@@ -20,8 +20,6 @@ class lh_widget : public container_linux
void get_client_rect(litehtml::position& client) const;
GdkPixbuf *get_image(const litehtml::tchar_t* url, bool redraw_on_ready);
- gint height() const { return m_height; };
- void setHeight(gint height) { m_height = height; };
void draw(cairo_t *cr);
void redraw();
void open_html(const gchar *contents);