From 4c4fb2570f43371666746dde1eb4b6d97608b264 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Nov 2015 15:27:04 -0500 Subject: Fix initial size of resizable X11 UIs in Gtk --- NEWS | 3 ++- src/x11_in_gtk2.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index dca1e72..88a0988 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ suil (0.8.3) unstable; * Add Cocoa in Gtk wrapper (patch from Robin Gareus) * Various Windows fixes (patches from Robin Gareus) * Center X11 UIs in Gtk (patch from Robin Gareus) + * Fix initial size of resizable X11 UIs in Gtk (patch from Robin Gareus) * Add Gtk2 and X11 in Qt5 wrappers (patch from Rui Nuno Capela) * Fix compilation with -Wl,--no-undefined * Fix a few minor/unlikely memory errors @@ -11,7 +12,7 @@ suil (0.8.3) unstable; * Only report suil_ui_supported() if necessary wrapper is compiled in * Upgrade to waf 1.8.14 - -- David Robillard Sat, 28 Nov 2015 15:22:29 -0500 + -- David Robillard Sat, 28 Nov 2015 15:26:47 -0500 suil (0.8.2) stable; diff --git a/src/x11_in_gtk2.c b/src/x11_in_gtk2.c index e46fe8d..6cd8677 100644 --- a/src/x11_in_gtk2.c +++ b/src/x11_in_gtk2.c @@ -157,6 +157,14 @@ forward_key_event(SuilX11Wrapper* socket, (XEvent*)&xev); } +static gboolean +idle_size_request(gpointer user_data) +{ + GtkWidget* w = GTK_WIDGET(user_data); + gtk_widget_queue_resize(w); + return FALSE; +} + static void forward_size_request(SuilX11Wrapper* socket, GtkAllocation* allocation) @@ -201,6 +209,10 @@ forward_size_request(SuilX11Wrapper* socket, XMoveWindow(GDK_WINDOW_XDISPLAY(window), (Window)socket->instance->ui_widget, wx, wy); + } else { + /* Child has not been realized, so unable to resize now. + Queue an idle resize. */ + g_idle_add(idle_size_request, socket->plug); } } -- cgit v1.2.1