make it possible to disable VisibilityTracker's use of WM visibility
[ardour.git] / libs / gtkmm2ext / tabbable.cc
index 928e501751c7be3e2b59a08743b88ded013cef48..9aa1c3fe5f5d7d8954f3b901d4addff3d5f1588f 100644 (file)
@@ -140,7 +140,6 @@ Tabbable::show_own_window (bool and_pack_it)
 
        tab_requested_by_state = false;
 
-       _window->show_all ();
        _window->present ();
 }
 
@@ -170,10 +169,34 @@ Tabbable::show_window ()
        }
 }
 
+/** If this Tabbable is currently parented by a tab, ensure that the tab is the
+ * current one. If it is parented by a window, then toggle the visibility of
+ * that window.
+ */
+void
+Tabbable::change_visibility ()
+{
+       if (tabbed()) {
+               _parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
+               return;
+       }
+
+       if (tab_requested_by_state) {
+               /* should be tabbed, but currently isn't parented by a notebook */
+               return;
+       }
+
+       if (_window && (current_toplevel() == _window)) {
+               /* Use WindowProxy method which will rotate then hide */
+               toggle();
+       }
+}
+
 void
 Tabbable::make_visible ()
 {
        if (_window && (current_toplevel() == _window)) {
+               set_pos ();
                _window->present ();
        } else {
 
@@ -281,6 +304,7 @@ Tabbable::show_tab ()
                        add_to_notebook (*_parent_notebook, _tab_title);
                }
                _parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
+               current_toplevel()->present ();
        }
 }
 
@@ -329,7 +353,7 @@ Tabbable::set_state (const XMLNode& node, int version)
        XMLNode* window_node = node.child ("Window");
 
        if (window_node) {
-               const XMLProperty* prop = window_node->property (X_("tabbed"));
+               XMLProperty const * prop = window_node->property (X_("tabbed"));
                if (prop) {
                        tab_requested_by_state = PBD::string_is_affirmative (prop->value());
                }
@@ -358,4 +382,3 @@ Tabbable::window_unmapped ()
 {
        StateChange (*this);
 }
-