From cb71d49dc6040e5de8d581d8aca4654406f9014d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 19 Sep 2017 18:38:40 -0400 Subject: [PATCH] fix GTK+ warnings when trying to determine maximum screen size without a Gdk::Window --- gtk2_ardour/generic_pluginui.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 0e9935b291..979cd4405a 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -224,12 +224,16 @@ GenericPluginUI::~GenericPluginUI () void GenericPluginUI::scroller_size_request (Gtk::Requisition* a) { - Glib::RefPtr screen = get_screen(); - if (!screen) - screen = Gdk::Screen::get_default(); + Glib::RefPtr window (get_window()); + Glib::RefPtr screen; - int maximum_width; - { + if (window) { + screen = get_screen(); + } + + int maximum_width = -1; + + if (screen) { Gdk::Rectangle monitor; const int monitor_num = screen->get_monitor_at_window (get_window ()); screen->get_monitor_geometry (