give WindowProxy its own map/unmap signals so that other things can track map/unmap...
[ardour.git] / libs / gtkmm2ext / window_proxy.cc
index 28ec4fb28d37b7d5a4eddb1cacf2b3fa251ce1bd..d0303c972bf26a44d992c9eb1a390982fc83e9d2 100644 (file)
@@ -228,6 +228,10 @@ void
 WindowProxy::drop_window ()
 {
        if (_window) {
+               delete_connection.disconnect ();
+               configure_connection.disconnect ();
+               map_connection.disconnect ();
+               unmap_connection.disconnect ();
                _window->hide ();
                delete _window;
                _window = 0;
@@ -250,11 +254,43 @@ WindowProxy::setup ()
        assert (_window);
 
        vistracker = new Gtkmm2ext::VisibilityTracker (*_window);
-       _window->signal_delete_event().connect (sigc::mem_fun (*this, &WindowProxy::delete_event_handler));
+
+       delete_connection = _window->signal_delete_event().connect (sigc::mem_fun (*this, &WindowProxy::delete_event_handler));
+       configure_connection = _window->signal_configure_event().connect (sigc::mem_fun (*this, &WindowProxy::configure_handler), false);
+       map_connection = _window->signal_map().connect (sigc::mem_fun (*this, &WindowProxy::map_handler), false);
+       unmap_connection = _window->signal_unmap().connect (sigc::mem_fun (*this, &WindowProxy::unmap_handler), false);
 
        set_pos_and_size ();
 }
 
+void
+WindowProxy::map_handler ()
+{
+       /* emit our own signal */
+       signal_map ();
+}
+
+void
+WindowProxy::unmap_handler ()
+{
+       /* emit out own signal */
+       signal_unmap ();
+}
+
+bool
+WindowProxy::configure_handler (GdkEventConfigure* ev)
+{
+       /* stupidly, the geometry data in the event isn't the same as we get
+          from the window geometry APIs.so we have to actively interrogate
+          them to get the new information.
+
+          the difference is generally down to window manager framing.
+       */
+       save_pos_and_size ();
+       return false;
+}
+
+
 bool
 WindowProxy::visible() const
 {