Use height of the viewport, not the scrolled window when telling Litehtml size of...
authorAndrej Kacian <ticho@claws-mail.org>
Mon, 11 Feb 2019 23:32:44 +0000 (00:32 +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
src/plugins/litehtml_viewer/lh_widget.h

index df6ee99..bf047cf 100644 (file)
@@ -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)
 {
index f4060d5..5e2a872 100644 (file)
@@ -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);