From c675942fb3fb33363deff62b907df39aec93f43e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 9 Jul 2013 19:48:15 +0200 Subject: [PATCH] fix meterbridge window pos+size state save ...even if window is not open when session is closed. --- gtk2_ardour/meterbridge.cc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/meterbridge.cc b/gtk2_ardour/meterbridge.cc index d6f1fee0ad..15e98a5d4d 100644 --- a/gtk2_ardour/meterbridge.cc +++ b/gtk2_ardour/meterbridge.cc @@ -471,26 +471,24 @@ Meterbridge::set_state (const XMLNode& node) XMLNode& Meterbridge::get_state (void) { + char buf[32]; XMLNode* node = new XMLNode ("Meterbridge"); - if (is_realized()) { - Glib::RefPtr win = get_window(); - + if (is_realized() && _visible) { get_window_pos_and_size (); - - XMLNode* geometry = new XMLNode ("geometry"); - char buf[32]; - snprintf(buf, sizeof(buf), "%d", m_width); - geometry->add_property(X_("x_size"), string(buf)); - snprintf(buf, sizeof(buf), "%d", m_height); - geometry->add_property(X_("y_size"), string(buf)); - snprintf(buf, sizeof(buf), "%d", m_root_x); - geometry->add_property(X_("x_pos"), string(buf)); - snprintf(buf, sizeof(buf), "%d", m_root_y); - geometry->add_property(X_("y_pos"), string(buf)); - node->add_child_nocopy (*geometry); } + XMLNode* geometry = new XMLNode ("geometry"); + snprintf(buf, sizeof(buf), "%d", m_width); + geometry->add_property(X_("x_size"), string(buf)); + snprintf(buf, sizeof(buf), "%d", m_height); + geometry->add_property(X_("y_size"), string(buf)); + snprintf(buf, sizeof(buf), "%d", m_root_x); + geometry->add_property(X_("x_pos"), string(buf)); + snprintf(buf, sizeof(buf), "%d", m_root_y); + geometry->add_property(X_("y_pos"), string(buf)); + node->add_child_nocopy (*geometry); + node->add_property ("show-meterbridge", _visible ? "yes" : "no"); return *node; }