From 9b3fd34b6b90e16157b8709ca0914b169a7235da Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 15 Nov 2018 23:05:07 +0100 Subject: [PATCH] Properly limit generic-UI window size Initially screen() is not unset, the window only exists after the scroller has been realized. Also prevent initially over-sized window. --- gtk2_ardour/generic_pluginui.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 055129b704..7b5820cd27 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -209,6 +209,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol scroller.set_name ("PluginEditor"); } else { scroller.signal_size_request().connect (sigc::mem_fun(*this, &GenericPluginUI::scroller_size_request)); + scroller.signal_realize().connect (sigc::mem_fun(scroller, &Widget::queue_resize)); scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_NEVER); } @@ -228,15 +229,15 @@ GenericPluginUI::scroller_size_request (Gtk::Requisition* a) { GtkRequisition request = hpacker.size_request(); - Glib::RefPtr window (get_window()); + Glib::RefPtr window (scroller.get_window()); Glib::RefPtr screen; if (window) { - screen = get_screen(); + screen = window->get_screen(); } if (!screen) { - a->width = request.width; + a->width = min(1024, request.width); return; }