From: Daniel Carl <danielcarl@gmx.de>
Date: Wed, 19 Oct 2016 20:37:14 +0000 (+0200)
Subject: Shut up GTK warning on realize widget.
X-Git-Url: https://git.owens.tech/assets/editable-focus.html/assets/editable-focus.html/git?a=commitdiff_plain;h=4f7482e2f6c4263e0d0fd2116a2e2fa05a61f5e9;p=vimb.git

Shut up GTK warning on realize widget.

We have to call gtk_widget_get_preferred_size to avoid warning like this
when the window widget is realized.

> Allocating size to WebKitWebViewBase 0x280c380 without calling
> gtk_widget_get_preferred_width/height(). How does the code know the size
> to allocate?
---

diff --git a/src/main.c b/src/main.c
index e8c97da..d3588d7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -514,8 +514,13 @@ static Client *client_new(WebKitWebView *webview)
         c->window = gtk_plug_new(vb.embed);
         xid       = g_strdup_printf("%d", (int)vb.embed);
     } else {
+        GtkRequisition req;
         c->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
         gtk_window_set_role(GTK_WINDOW(c->window), PROJECT_UCFIRST);
+        /* We have to call gtk_widget_get_preferred_size before
+         * gtk_widget_size_allocate otherwise a warning is thrown when the
+         * widget is realized. */
+        gtk_widget_get_preferred_size(GTK_WIDGET(c->window), &req, NULL);
         gtk_widget_realize(GTK_WIDGET(c->window));
 
         xid = g_strdup_printf("%d",