From 4f7482e2f6c4263e0d0fd2116a2e2fa05a61f5e9 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Wed, 19 Oct 2016 22:37:14 +0200 Subject: [PATCH] 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? --- src/main.c | 5 +++++ 1 file changed, 5 insertions(+) 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", -- 2.20.1