From d9c33340c7954c424f98df8b71daa39323134710 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 2 Jul 2012 19:33:13 +0000 Subject: Correctly handle resizing for Gtk2 in Qt4. git-svn-id: http://svn.drobilla.net/lad/trunk/suil@4507 a436a847-0d15-0410-975c-d299462d15a1 --- src/gtk2_in_qt4.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src') diff --git a/src/gtk2_in_qt4.cpp b/src/gtk2_in_qt4.cpp index 7629989..dcec12a 100644 --- a/src/gtk2_in_qt4.cpp +++ b/src/gtk2_in_qt4.cpp @@ -25,6 +25,24 @@ extern "C" { +static void +on_size_request(GtkWidget* widget, + GtkRequisition* requisition, + gpointer user_data) +{ + QX11EmbedContainer* const wrap = (QX11EmbedContainer*)user_data; + wrap->setMinimumSize(requisition->width, requisition->height); +} + +static void +on_size_allocate(GtkWidget* widget, + GdkRectangle* allocation, + gpointer user_data) +{ + QX11EmbedContainer* const wrap = (QX11EmbedContainer*)user_data; + wrap->resize(allocation->width, allocation->height); +} + static int wrapper_wrap(SuilWrapper* wrapper, SuilInstance* instance) @@ -44,6 +62,12 @@ wrapper_wrap(SuilWrapper* wrapper, wrap->resize(alloc.width, alloc.height); #endif + g_signal_connect( + G_OBJECT(plug), "size-request", G_CALLBACK(on_size_request), wrap); + + g_signal_connect( + G_OBJECT(plug), "size-allocate", G_CALLBACK(on_size_allocate), wrap); + instance->host_widget = wrap; return 0; -- cgit v1.2.1